Class: Getvideo::Youku
Instance Attribute Summary
Attributes inherited from Video
#url
Instance Method Summary
collapse
Methods inherited from Video
#connection, get_api_uri, #initialize, #json, #play_media, #response, set_api_uri
Instance Method Details
#cover ⇒ Object
25
26
27
28
29
|
# File 'lib/getvideo/youku.rb', line 25
def cover
if data = response["data"]
data[0]["logo"]
end
end
|
#flash ⇒ Object
31
32
33
|
# File 'lib/getvideo/youku.rb', line 31
def flash
"http://player.youku.com/player.php/sid/#{id}/v.swf"
end
|
#html_url ⇒ Object
15
16
17
|
# File 'lib/getvideo/youku.rb', line 15
def html_url
"http://v.youku.com/v_show/id_#{id}.html"
end
|
#id ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/getvideo/youku.rb', line 7
def id
if url =~ /\.html/
url.scan(/id_([^.]+)/)[0][0]
elsif url =~ /\.swf/
url.scan(/sid\/([^\/]+)\/v.swf/)[0][0]
end
end
|
#m3u8 ⇒ Object
35
36
37
|
# File 'lib/getvideo/youku.rb', line 35
def m3u8
"http://v.youku.com/player/getM3U8/vid/#{videoid}/type/flv/ts/v.m3u8"
end
|
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/getvideo/youku.rb', line 39
def media(type = nil)
video_list = {}
if data = response["data"]
data[0]["streamfileids"].each_key do |type|
stream = parse_stream(type)
video_list[type] = []
segs(type).each do |s|
video_list[type] << "http://f.youku.com/player/getFlvPath/sid/" + sid + "/st/#{type}/fileid/#{stream[0..8]+s["no"].to_i.to_s(16)+stream[10..-1]}_0#{s["no"].to_i.to_s(16)}?K="+s["k"] if s["k"] != -1
end
end
end
return video_list
end
|
#title ⇒ Object
19
20
21
22
23
|
# File 'lib/getvideo/youku.rb', line 19
def title
if data = response["data"]
data[0]["title"]
end
end
|