Sha256: 1c1050a24164aece8d93905481ee1b8767d4c4f03eee26987b70166a11f05c85
Contents?: true
Size: 486 Bytes
Versions: 1
Compression:
Stored size: 486 Bytes
Contents
require "youtube_id/version" module YoutubeID FORMATS = [ %r((?:https?://)?youtu\.be/(.+)), %r((?:https?://)?(?:www\.)?youtube\.com/watch\?v=(.*?)(&|#|$)), %r((?:https?://)?(?:www\.)?youtube\.com/embed/(.*?)(\?|$)), %r((?:https?://)?(?:www\.)?youtube\.com/v/(.*?)(#|\?|$)), %r((?:https?://)?(?:www\.)?youtube\.com/user/.*?#\w/\w/\w/\w/(.+)\b) ] def self.from(video_url) video_url.strip! FORMATS.find { |format| video_url =~ format } and $1 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
youtube_id-0.1.0 | lib/youtube_id.rb |