mirror of
https://github.com/soimort/you-get.git
synced 2025-02-02 16:24:00 +03:00
Sohu: fix #53
This commit is contained in:
parent
da25d8a2fa
commit
bc5b704e0e
@ -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
|
||||
---------------
|
||||
|
||||
|
@ -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
|
||||
|
@ -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,24 +13,38 @@ 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
|
||||
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]
|
||||
if hqvid != 0 and hqvid != vid :
|
||||
data = json.loads(get_decoded_html('http://hot.vrs.sohu.com/vrs_flash.action?vid=%s' % hqvid))
|
||||
break
|
||||
host = data['allot']
|
||||
prot = data['prot']
|
||||
urls = []
|
||||
data = data['data']
|
||||
title = data['tvName']
|
||||
size = sum(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')
|
||||
|
||||
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]
|
||||
if hqvid != 0 and hqvid != vid :
|
||||
data = json.loads(get_decoded_html('http://hot.vrs.sohu.com/vrs_flash.action?vid=%s' % hqvid))
|
||||
break
|
||||
host = data['allot']
|
||||
prot = data['prot']
|
||||
urls = []
|
||||
data = data['data']
|
||||
title = data['tvName']
|
||||
size = sum(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')
|
||||
|
||||
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:
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__version__ = '0.3dev-20121228'
|
||||
__date__ = '2012-12-28'
|
||||
__version__ = '0.3dev-20130104'
|
||||
__date__ = '2013-01-04'
|
||||
|
Loading…
Reference in New Issue
Block a user