Class: VideoInfo::Providers::Dailymotion
Instance Attribute Summary
#data, #options, #url, #video_id
Class Method Summary
collapse
Instance Method Summary
collapse
#available?, #embed_code, #initialize, #thumbnail, #thumbnail_large_2x, #thumbnail_maxres
Class Method Details
.usable?(url) ⇒ Boolean
4
5
6
|
# File 'lib/video_info/providers/dailymotion.rb', line 4
def self.usable?(url)
url.match?(/(dai(?:\.ly|lymotion\.com))/)
end
|
Instance Method Details
#author ⇒ Object
20
21
22
|
# File 'lib/video_info/providers/dailymotion.rb', line 20
def author
data["owner.screenname"]
end
|
#author_thumbnail ⇒ Object
28
29
30
|
# File 'lib/video_info/providers/dailymotion.rb', line 28
def author_thumbnail
data["owner.avatar_60_url"]
end
|
#author_url ⇒ Object
24
25
26
|
# File 'lib/video_info/providers/dailymotion.rb', line 24
def author_url
data["owner.url"]
end
|
#date ⇒ Object
40
41
42
|
# File 'lib/video_info/providers/dailymotion.rb', line 40
def date
Time.at(data["created_time"]).utc
end
|
#embed_url ⇒ Object
36
37
38
|
# File 'lib/video_info/providers/dailymotion.rb', line 36
def embed_url
"//www.dailymotion.com/embed/video/#{video_id}"
end
|
#keywords ⇒ Object
32
33
34
|
# File 'lib/video_info/providers/dailymotion.rb', line 32
def keywords
data["tags"]
end
|
#provider ⇒ Object
8
9
10
|
# File 'lib/video_info/providers/dailymotion.rb', line 8
def provider
"Dailymotion"
end
|
#stats ⇒ Object
60
61
62
63
64
65
|
# File 'lib/video_info/providers/dailymotion.rb', line 60
def stats
{
"views_total" => view_count,
"likes_total" => data["likes_total"].to_i
}
end
|
#thumbnail_large ⇒ Object
52
53
54
|
# File 'lib/video_info/providers/dailymotion.rb', line 52
def thumbnail_large
data["thumbnail_720_url"]
end
|
#thumbnail_medium ⇒ Object
48
49
50
|
# File 'lib/video_info/providers/dailymotion.rb', line 48
def thumbnail_medium
data["thumbnail_240_url"]
end
|
#thumbnail_small ⇒ Object
44
45
46
|
# File 'lib/video_info/providers/dailymotion.rb', line 44
def thumbnail_small
data["thumbnail_60_url"]
end
|
#view_count ⇒ Object
56
57
58
|
# File 'lib/video_info/providers/dailymotion.rb', line 56
def view_count
data["views_total"].to_i
end
|