Class: VideoInfo::Providers::Youtube
Instance Attribute Summary
#data, #options, #url, #video_id
Class Method Summary
collapse
Instance Method Summary
collapse
#available?, #embed_code, #stats, #thumbnail
Constructor Details
#initialize(url, options = {}) ⇒ Youtube
Returns a new instance of Youtube.
Class Method Details
.usable?(url) ⇒ Boolean
18
19
20
|
# File 'lib/video_info/providers/youtube.rb', line 18
def self.usable?(url)
url.match?(/(youtube\.com\/(?!playlist|embed\/videoseries).*)|(youtu\.be)/)
end
|
Instance Method Details
#embed_url ⇒ Object
30
31
32
|
# File 'lib/video_info/providers/youtube.rb', line 30
def embed_url
"//www.youtube.com/embed/#{video_id}"
end
|
#provider ⇒ Object
22
23
24
|
# File 'lib/video_info/providers/youtube.rb', line 22
def provider
"YouTube"
end
|
#thumbnail_large ⇒ Object
42
43
44
|
# File 'lib/video_info/providers/youtube.rb', line 42
def thumbnail_large
"https://i.ytimg.com/vi/#{video_id}/hqdefault.jpg"
end
|
#thumbnail_large_2x ⇒ Object
46
47
48
|
# File 'lib/video_info/providers/youtube.rb', line 46
def thumbnail_large_2x
"https://i.ytimg.com/vi/#{video_id}/sddefault.jpg"
end
|
#thumbnail_maxres ⇒ Object
50
51
52
|
# File 'lib/video_info/providers/youtube.rb', line 50
def thumbnail_maxres
"https://i.ytimg.com/vi/#{video_id}/maxresdefault.jpg"
end
|
#thumbnail_medium ⇒ Object
38
39
40
|
# File 'lib/video_info/providers/youtube.rb', line 38
def thumbnail_medium
"https://i.ytimg.com/vi/#{video_id}/mqdefault.jpg"
end
|
#thumbnail_small ⇒ Object
34
35
36
|
# File 'lib/video_info/providers/youtube.rb', line 34
def thumbnail_small
"https://i.ytimg.com/vi/#{video_id}/default.jpg"
end
|