mirror of
https://github.com/soimort/you-get.git
synced 2025-03-13 11:24:02 +03:00
修正pptv视频地址解析
This commit is contained in:
parent
82532aa504
commit
e4eb92d264
@ -9,18 +9,14 @@ import urllib
|
|||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
def pptv_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False):
|
def pptv_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False):
|
||||||
xml = get_html('http://web-play.pptv.com/webplay3-151-%s.xml' % id)
|
xml = get_html('http://web-play.pptv.com/webplay3-0-%s.xml?type=web.fpp' % id)
|
||||||
host = r1(r'<sh>([^<>]+)</sh>', xml)
|
host = r1(r'<sh>([^<>]+)</sh>', xml)
|
||||||
port = 8080
|
key = r1(r'<key expire=[^<>]+>([^<>]+)</key>', xml)
|
||||||
st = r1(r'<st>([^<>]+)</st>', xml).encode('utf-8')
|
|
||||||
key = hashlib.md5(st).hexdigest() # FIXME: incorrect key
|
|
||||||
rids = re.findall(r'rid="([^"]+)"', xml)
|
|
||||||
rid = r1(r'rid="([^"]+)"', xml)
|
rid = r1(r'rid="([^"]+)"', xml)
|
||||||
title = r1(r'nm="([^"]+)"', xml)
|
title = r1(r'nm="([^"]+)"', xml)
|
||||||
pieces = re.findall('<sgm no="(\d+)".*fs="(\d+)"', xml)
|
pieces = re.findall('<sgm no="(\d+)".*fs="(\d+)"', xml)
|
||||||
numbers, fs = zip(*pieces)
|
numbers, fs = zip(*pieces)
|
||||||
urls = ['http://%s:%s/%s/%s?key=%s' % (host, port, i, rid, key) for i in numbers]
|
urls = ['http://%s/%s/%s?k=%s' % (host, i, rid, key) for i in numbers]
|
||||||
urls = ['http://pptv.vod.lxdns.com/%s/%s?key=%s' % (i, rid, key) for i in numbers]
|
|
||||||
total_size = sum(map(int, fs))
|
total_size = sum(map(int, fs))
|
||||||
assert rid.endswith('.mp4')
|
assert rid.endswith('.mp4')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user