mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 00:33:58 +03:00
fix bug #353
also may fix bug #456 Now the -y proxy can be used for tv.sohu.com such as http://tv.sohu.com/20140629/n401523369.shtml?txid=8254069965286abe9ee523a73c256ea7
This commit is contained in:
parent
cb375b6cfb
commit
1763986ca4
@ -11,7 +11,7 @@ def real_url(host, prot, file, new):
|
|||||||
start, _, host, key = get_html(url).split('|')[:4]
|
start, _, host, key = get_html(url).split('|')[:4]
|
||||||
return '%s%s?key=%s' % (start[:-1], new, key)
|
return '%s%s?key=%s' % (start[:-1], new, key)
|
||||||
|
|
||||||
def sohu_download(url, output_dir = '.', merge = True, info_only = False):
|
def sohu_download(url, output_dir = '.', merge = True, info_only = False, extractor_proxy=None):
|
||||||
if re.match(r'http://share.vrs.sohu.com', url):
|
if re.match(r'http://share.vrs.sohu.com', url):
|
||||||
vid = r1('id=(\d+)', url)
|
vid = r1('id=(\d+)', url)
|
||||||
else:
|
else:
|
||||||
@ -20,12 +20,16 @@ def sohu_download(url, output_dir = '.', merge = True, info_only = False):
|
|||||||
assert vid
|
assert vid
|
||||||
|
|
||||||
if re.match(r'http://tv.sohu.com/', url):
|
if re.match(r'http://tv.sohu.com/', url):
|
||||||
|
if extractor_proxy:
|
||||||
|
set_proxy(tuple(extractor_proxy.split(":")))
|
||||||
data = json.loads(get_decoded_html('http://hot.vrs.sohu.com/vrs_flash.action?vid=%s' % 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"]:
|
for qtyp in ["oriVid","superVid","highVid" ,"norVid","relativeId"]:
|
||||||
hqvid = data['data'][qtyp]
|
hqvid = data['data'][qtyp]
|
||||||
if hqvid != 0 and hqvid != vid :
|
if hqvid != 0 and hqvid != vid :
|
||||||
data = json.loads(get_decoded_html('http://hot.vrs.sohu.com/vrs_flash.action?vid=%s' % hqvid))
|
data = json.loads(get_decoded_html('http://hot.vrs.sohu.com/vrs_flash.action?vid=%s' % hqvid))
|
||||||
break
|
break
|
||||||
|
if extractor_proxy:
|
||||||
|
unset_proxy()
|
||||||
host = data['allot']
|
host = data['allot']
|
||||||
prot = data['prot']
|
prot = data['prot']
|
||||||
urls = []
|
urls = []
|
||||||
|
Loading…
Reference in New Issue
Block a user