Class: VideoInfo::Providers::Dailymotion

Inherits:
VideoInfo::Provider show all
Defined in:
lib/video_info/providers/dailymotion.rb

Instance Attribute Summary

Attributes inherited from VideoInfo::Provider

#data, #iframe_attributes, #options, #url, #video_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from VideoInfo::Provider

#available?, #embed_code, #initialize, #thumbnail, #thumbnail_large_2x, #thumbnail_maxres

Constructor Details

This class inherits a constructor from VideoInfo::Provider

Class Method Details

.usable?(url) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/video_info/providers/dailymotion.rb', line 4

def self.usable?(url)
  url =~ /(dai(?:\.ly|lymotion\.com))/
end

Instance Method Details

#authorObject



20
21
22
# File 'lib/video_info/providers/dailymotion.rb', line 20

def author
  data['owner.screenname']
end

#author_thumbnailObject



28
29
30
# File 'lib/video_info/providers/dailymotion.rb', line 28

def author_thumbnail
  data['owner.avatar_60_url']
end

#author_urlObject



24
25
26
# File 'lib/video_info/providers/dailymotion.rb', line 24

def author_url
  data['owner.url']
end

#dateObject



40
41
42
# File 'lib/video_info/providers/dailymotion.rb', line 40

def date
  Time.at(data['created_time']).utc
end

#embed_urlObject



36
37
38
# File 'lib/video_info/providers/dailymotion.rb', line 36

def embed_url
  "//www.dailymotion.com/embed/video/#{video_id}"
end

#keywordsObject



32
33
34
# File 'lib/video_info/providers/dailymotion.rb', line 32

def keywords
  data['tags']
end

#providerObject



8
9
10
# File 'lib/video_info/providers/dailymotion.rb', line 8

def provider
  'Dailymotion'
end

#thumbnail_largeObject



52
53
54
# File 'lib/video_info/providers/dailymotion.rb', line 52

def thumbnail_large
  data['thumbnail_720_url']
end

#thumbnail_mediumObject



48
49
50
# File 'lib/video_info/providers/dailymotion.rb', line 48

def thumbnail_medium
  data['thumbnail_240_url']
end

#thumbnail_smallObject



44
45
46
# File 'lib/video_info/providers/dailymotion.rb', line 44

def thumbnail_small
  data['thumbnail_60_url']
end

#view_countObject



56
57
58
# File 'lib/video_info/providers/dailymotion.rb', line 56

def view_count
  data['views_total'].to_i
end