Class: Getvideo::Tudou
Instance Attribute Summary
Attributes inherited from Video
#url
Instance Method Summary
collapse
Methods inherited from Video
#connection, get_api_uri, #json, #play_media, #response, set_api_uri
Constructor Details
#initialize(url) ⇒ Tudou
Returns a new instance of Tudou.
14
15
16
17
18
19
20
21
|
# File 'lib/getvideo/tudou.rb', line 14
def initialize(url)
@url = url
parse_page
get_type
if !swf_iid && url_type != "views"
get_item_info(page_get_iid)
end
end
|
Instance Method Details
#cover ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/getvideo/tudou.rb', line 46
def cover
if url_type == "albumplay" || url_type == "oplay"
if data = response["data"]
data[0]["logo"]
else
page_get_pic
end
else
page_get_pic
end
end
|
#flash ⇒ Object
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/getvideo/tudou.rb', line 58
def flash
case url_type
when "views"
"http://www.tudou.com/v/#{page_get_icode}/v.swf"
when "albumplay", "oplay"
"http://www.tudou.com/a/#{page_get_lcode}/&iid=#{page_get_iid}/v.swf"
when "listplay"
"http://www.tudou.com/l/#{page_get_lcode}/&iid=#{page_get_iid}/v.swf"
end
end
|
#html_url ⇒ Object
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/getvideo/tudou.rb', line 27
def html_url
case url_type
when "views"
"http://www.tudou.com/programs/view/#{page_get_icode}/"
when "albumplay", "oplay"
"http://www.tudou.com/albumplay/#{page_get_lcode}/#{page_get_icode}.html"
when "listplay"
"http://www.tudou.com/listplay/#{page_get_lcode}/#{page_get_icode}.html"
end
end
|
#id ⇒ Object
23
24
25
|
# File 'lib/getvideo/tudou.rb', line 23
def id
page_get_iid
end
|
#m3u8 ⇒ Object
69
70
71
|
# File 'lib/getvideo/tudou.rb', line 69
def m3u8
"http://vr.tudou.com/v2proxy/v2.m3u8?it=#{page_get_iid}&st=2&pw="
end
|
73
74
75
76
77
78
79
|
# File 'lib/getvideo/tudou.rb', line 73
def media(type = nil)
if url_type == "albumplay" || url_type == "oplay"
albumplay_media(type)
else
view_media(type)
end
end
|
#title ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/getvideo/tudou.rb', line 38
def title
if page_get_title.encoding != 'UTF-8'
CGI.unescapeHTML(page_get_title)
else
page_get_title
end
end
|