This commit is contained in:
Mort Yao 2013-01-03 16:04:33 +01:00
parent da25d8a2fa
commit bc5b704e0e
4 changed files with 46 additions and 21 deletions

View File

@ -1,6 +1,15 @@
Changelog
=========
0.3dev-20130104
---------------
*Date: 2013-01-04*
* Sohu:
- fix `#53 <https://github.com/soimort/you-get/issues/53>`_.
- merge pull request `#54 <https://github.com/soimort/you-get/pull/54>`_; downloading the highest available quality now.
0.3dev-20121228
---------------

View File

@ -1,7 +1,7 @@
==============================================
This is a copy of the MIT license.
==============================================
Copyright (C) 2012 Mort Yao <mort.yao@gmail.com>
Copyright (C) 2012, 2013 Mort Yao <mort.yao@gmail.com>
Copyright (C) 2012 Boyu Guo <iambus@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of

View File

@ -4,6 +4,8 @@ __all__ = ['sohu_download']
from ..common import *
import json
def real_url(host, prot, file, new):
url = 'http://%s/?prot=%s&file=%s&new=%s' % (host, prot, file, new)
start, _, host, key, _, _ = get_html(url).split('|')
@ -11,8 +13,8 @@ def real_url(host, prot, file, new):
def sohu_download(url, output_dir = '.', merge = True, info_only = False):
vid = r1('vid="(\d+)"', get_html(url))
assert vid
import json
if vid:
data = json.loads(get_decoded_html('http://hot.vrs.sohu.com/vrs_flash.action?vid=%s' % vid))
for qtyp in ["oriVid","superVid","highVid" ,"norVid","relativeId"]:
hqvid = data['data'][qtyp]
@ -30,6 +32,20 @@ def sohu_download(url, output_dir = '.', merge = True, info_only = False):
urls.append(real_url(host, prot, file, new))
assert data['clipsURL'][0].endswith('.mp4')
else:
vid = r1('vid=\'(\d+)\'', get_html(url))
data = json.loads(get_decoded_html('http://my.tv.sohu.com/videinfo.jhtml?m=viewnew&vid=%s' % vid))
host = data['allot']
prot = data['prot']
urls = []
data = data['data']
title = data['tvName']
size = sum([int(clipsBytes) for clipsBytes in data['clipsBytes']])
assert len(data['clipsURL']) == len(data['clipsBytes']) == len(data['su'])
for file, new in zip(data['clipsURL'], data['su']):
urls.append(real_url(host, prot, file, new))
assert data['clipsURL'][0].endswith('.mp4')
print_info(site_info, title, 'mp4', size)
if not info_only:
download_urls(urls, title, 'mp4', size, output_dir, refer = url, merge = merge)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
__version__ = '0.3dev-20121228'
__date__ = '2012-12-28'
__version__ = '0.3dev-20130104'
__date__ = '2013-01-04'