Class: Getvideo::Iqiyi
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
29
30
31
|
# File 'lib/getvideo/iqiyi.rb', line 29
def cover
response_info["albumImage"]
end
|
#flash ⇒ Object
37
38
39
40
41
42
|
# File 'lib/getvideo/iqiyi.rb', line 37
def flash
position = response_info["logoPosition"]
duration = response_info["totalDuration"]
video_url = response_info["videoUrl"].gsub("http://www.iqiyi.com/","")
"http://player.video.qiyi.com/#{id}/#{position}/#{duration}/#{video_url}"[0..-5]+"swf"
end
|
#html_url ⇒ Object
11
12
13
|
# File 'lib/getvideo/iqiyi.rb', line 11
def html_url
response_info["videoUrl"]
end
|
#id ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/getvideo/iqiyi.rb', line 15
def id
if url =~ /\.html/
parse_vid[1]
elsif url =~ /swf/
url.scan(/com\/([^\/]+)/)[0][0]
else
url
end
end
|
#ipad_response ⇒ Object
7
8
9
|
# File 'lib/getvideo/iqiyi.rb', line 7
def ipad_response
@ipad_response ||= ipad_connection
end
|
#m3u8 ⇒ Object
33
34
35
|
# File 'lib/getvideo/iqiyi.rb', line 33
def m3u8
ipad_response["data"]["mtl"][1]["m3u"]
end
|
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/getvideo/iqiyi.rb', line 44
def media
video_list = {}
video_list["mp4"] = []
video_list["f4v"] = []
mp4_file = ipad_response["data"]["mp4Url"]
res = Faraday.get "http://data.video.qiyi.com/#{mp4_file.split("/")[-1].split(".")[0]}.ts"
video_list["mp4"] << "#{mp4_file}?#{URI.parse(res["location"]).query}"
file = response_info["fileUrl"]["file"]
size = response_info["fileBytes"]["size"]
file.each_with_index do |f, i|
res = Faraday.get "http://data.video.qiyi.com/#{file[i].split("/")[-1].split(".")[0]}.ts"
video_list["f4v"] << "#{f}?#{URI.parse(res["location"]).query}"
end
return video_list
end
|
#title ⇒ Object
25
26
27
|
# File 'lib/getvideo/iqiyi.rb', line 25
def title
response_info["title"]
end
|