This commit is contained in:
Mort Yao 2013-01-24 21:12:15 +01:00
parent efdc98b459
commit 898e1b63cf
3 changed files with 22 additions and 6 deletions

View File

@ -1,6 +1,14 @@
Changelog Changelog
========= =========
0.3dev-20130125
---------------
*Date: 2013-01-25*
* Dailymotion: downloading best quality available now.
* iQIYI: fix `#77 <https://github.com/soimort/you-get/issues/77>`_.
0.3dev-20130118 0.3dev-20130118
--------------- ---------------

View File

@ -14,6 +14,7 @@ def iqiyi_download(url, output_dir = '.', merge = True, info_only = False):
#info_url = 'http://cache.video.qiyi.com/v/%s/%s/%s/' % (videoId, pid, ptype) #info_url = 'http://cache.video.qiyi.com/v/%s/%s/%s/' % (videoId, pid, ptype)
videoId = r1(r'''["']videoId["'][:=]["']([^"']+)["']''', html) videoId = r1(r'''["']videoId["'][:=]["']([^"']+)["']''', html)
assert videoId assert videoId
info_url = 'http://cache.video.qiyi.com/v/%s' % videoId info_url = 'http://cache.video.qiyi.com/v/%s' % videoId
info_xml = get_html(info_url) info_xml = get_html(info_url)
@ -23,12 +24,19 @@ def iqiyi_download(url, output_dir = '.', merge = True, info_only = False):
size = int(doc.getElementsByTagName('totalBytes')[0].firstChild.nodeValue) size = int(doc.getElementsByTagName('totalBytes')[0].firstChild.nodeValue)
urls = [n.firstChild.nodeValue for n in doc.getElementsByTagName('file')] urls = [n.firstChild.nodeValue for n in doc.getElementsByTagName('file')]
assert urls[0].endswith('.f4v'), urls[0] assert urls[0].endswith('.f4v'), urls[0]
tss = ["http://61.155.192.31/videos2" + url[33:-4] + ".ts" for url in urls] # use MPEG-TS .ts files temporarily
# FIXME: find the key to access .f4v files
print_info(site_info, title, 'ts', size) for i in range(len(urls)):
temp_url = "http://data.video.qiyi.com/%s" % urls[i].split("/")[-1].split(".")[0] + ".ts"
try:
response = request.urlopen(temp_url)
except request.HTTPError as e:
key = r1(r'key=(.*)', e.geturl())
assert key
urls[i] += "?key=%s" % key
print_info(site_info, title, 'flv', size)
if not info_only: if not info_only:
download_urls_chunked(tss, title, 'ts', size, output_dir = output_dir, merge = merge) # use MPEG-TS .ts files temporarily download_urls(urls, title, 'flv', size, output_dir = output_dir, merge = merge)
site_info = "iQIYI.com" site_info = "iQIYI.com"
download = iqiyi_download download = iqiyi_download

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python
__version__ = '0.3dev-20130118' __version__ = '0.3dev-20130125'
__date__ = '2013-01-18' __date__ = '2013-01-25'