Class: Getvideo::Sina
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) ⇒ Sina
Returns a new instance of Sina.
15
16
17
18
|
# File 'lib/getvideo/sina.rb', line 15
def initialize(url)
super
parse_page if !(is_flash_url? || is_subject_url?)
end
|
Instance Method Details
#cover ⇒ Object
26
27
28
29
|
# File 'lib/getvideo/sina.rb', line 26
def cover
return "" if is_flash_url? || is_subject_url?
page.match(/pic[\s]*:[\s]*["|']?[\s]*([^'|"]+)?/).to_a[1]
end
|
#flash ⇒ Object
40
41
42
43
44
45
|
# File 'lib/getvideo/sina.rb', line 40
def flash
return url if is_flash_url?
return "" if is_subject_url?
return "" if !page
page.match(/swfOutsideUrl[\s]*:[\s]*["|']?[\s]*([^'|"]+)/).to_a[1]
end
|
#html_url ⇒ Object
31
32
33
34
|
# File 'lib/getvideo/sina.rb', line 31
def html_url
return "" if is_flash_url?
url
end
|
#id ⇒ Object
20
21
22
23
24
|
# File 'lib/getvideo/sina.rb', line 20
def id
return url.match(/vid=(\d+)/).to_a[1] if is_flash_url?
return url.match(/#(\d+)/).to_a[1] if is_subject_url?
page.match(/vid[\s]*:[\s]*["|']?[\s]*(\d+)[\s]*["|']?/).to_a[1]
end
|
#ipad_response ⇒ Object
11
12
13
|
# File 'lib/getvideo/sina.rb', line 11
def ipad_response
@ipad_response ||= ipad_connection
end
|
#m3u8 ⇒ Object
47
48
49
50
51
52
53
|
# File 'lib/getvideo/sina.rb', line 47
def m3u8
if !(is_flash_url? || is_subject_url?)
ipad_response["video"]["durl"]["url"]
else
""
end
end
|
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/getvideo/sina.rb', line 55
def media
video_list = {}
if !(is_flash_url? || is_subject_url?)
video_list["mp4"] = []
video_list["mp4"] << ipad_response["video"]["durl"]["url"]
end
video_list["hlv"] = []
video_list["hlv"] << response["video"]["durl"]["url"]
return video_list
end
|
#title ⇒ Object
36
37
38
|
# File 'lib/getvideo/sina.rb', line 36
def title
response["video"]["vname"]
end
|