Class: Getvideo::Wole
Instance Attribute Summary
Attributes inherited from Video
#url
Instance Method Summary
collapse
Methods inherited from Video
#connection, get_api_uri, #initialize, #json, #response, set_api_uri
Instance Method Details
#cover ⇒ Object
26
27
28
|
# File 'lib/getvideo/56.rb', line 26
def cover
response["info"]["bimg"] if response
end
|
#flash ⇒ Object
34
35
36
|
# File 'lib/getvideo/56.rb', line 34
def flash
"http://player.56.com/v_#{id}.swf"
end
|
#html_url ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/getvideo/56.rb', line 7
def html_url
if url =~ /v_([^.]+).html/
url
else
"http://www.56.com/u/v_#{id}.html"
end
end
|
#id ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/getvideo/56.rb', line 15
def id
if url =~ /v_([^.]+).[html|swf]/
url.scan(/v_([^.]+)\.[html|swf]/)[0][0]
elsif url =~ /w.+\/play_album.+_vid-([^.]+)\.html/
ids = url.scan /w.+\/play_album.+_vid-([^.]+)\.html/
ids[0][0]
else
url
end
end
|
#m3u8 ⇒ Object
38
39
40
|
# File 'lib/getvideo/56.rb', line 38
def m3u8
"http://vxml.56.com/m3u8/#{response["info"]["vid"]}/" if response
end
|
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/getvideo/56.rb', line 42
def media
video_list = {}
response["info"]["rfiles"].each do |f|
f_type = f["url"].scan(/\.(flv|mp4|m3u8)\?/)[0][0]
if video_list[f_type].nil?
video_list[f_type] = []
video_list[f_type] << f["url"]
else
video_list[f_type] << f["url"]
end
end
return video_list
end
|
56
57
58
|
# File 'lib/getvideo/56.rb', line 56
def play_media
media["mp4"][0] if media["mp4"]
end
|
#title ⇒ Object
30
31
32
|
# File 'lib/getvideo/56.rb', line 30
def title
response["info"]["Subject"] if response
end
|