mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 21:45:02 +03:00
Fixed miomio download of sina video
This commit is contained in:
parent
135c05f5ee
commit
48cdcde2c8
@ -4,7 +4,7 @@ __all__ = ['miomio_download']
|
||||
|
||||
from ..common import *
|
||||
|
||||
from .sina import sina_download_by_vid
|
||||
from .sina import sina_download_by_xml
|
||||
from .tudou import tudou_download_by_id
|
||||
from .youku import youku_download_by_vid
|
||||
|
||||
@ -21,7 +21,9 @@ def miomio_download(url, output_dir = '.', merge = True, info_only = False):
|
||||
elif t == 'tudou':
|
||||
tudou_download_by_id(id, title, output_dir=output_dir, merge=merge, info_only=info_only)
|
||||
elif t == 'sina':
|
||||
sina_download_by_vid(id, title, output_dir=output_dir, merge=merge, info_only=info_only)
|
||||
url = "http://www.miomio.tv/mioplayer/mioplayerconfigfiles/sina.php?vid=" + id
|
||||
xml = get_content (url, headers=fake_headers, decoded=True)
|
||||
sina_download_by_xml(xml, title, output_dir=output_dir, merge=merge, info_only=info_only)
|
||||
else:
|
||||
raise NotImplementedError(flashvars)
|
||||
|
||||
|
@ -12,11 +12,13 @@ def get_k(vid, rand):
|
||||
t = str(int('{0:b}'.format(int(time()))[:-6], 2))
|
||||
return md5((vid + 'Z6prk18aWxP278cVAH' + t + rand).encode('utf-8')).hexdigest()[:16] + t
|
||||
|
||||
def video_info(vid):
|
||||
def video_info_xml(vid):
|
||||
rand = "0.{0}{1}".format(randint(10000, 10000000), randint(10000, 10000000))
|
||||
url = 'http://v.iask.com/v_play.php?vid={0}&ran={1}&p=i&k={2}'.format(vid, rand, get_k(vid, rand))
|
||||
xml = get_content(url, headers=fake_headers, decoded=True)
|
||||
return xml
|
||||
|
||||
def video_info(xml):
|
||||
urls = re.findall(r'<url>(?:<!\[CDATA\[)?(.*?)(?:\]\]>)?</url>', xml)
|
||||
name = match1(xml, r'<vname>(?:<!\[CDATA\[)?(.+?)(?:\]\]>)?</vname>')
|
||||
vstr = match1(xml, r'<vstr>(?:<!\[CDATA\[)?(.+?)(?:\]\]>)?</vstr>')
|
||||
@ -27,11 +29,17 @@ def sina_download_by_vid(vid, title=None, output_dir='.', merge=True, info_only=
|
||||
http://video.sina.com.cn/
|
||||
"""
|
||||
|
||||
urls, name, vstr = video_info(vid)
|
||||
xml = video_info_xml(vid)
|
||||
sina_download_by_urls(xml, title, output_dir, merge, info_only)
|
||||
|
||||
|
||||
def sina_download_by_xml(xml, title, output_dir, merge, info_only):
|
||||
urls, name, vstr = video_info(xml)
|
||||
title = title or name
|
||||
assert title
|
||||
size = 0
|
||||
for url in urls:
|
||||
print (url)
|
||||
_, _, temp = url_info(url)
|
||||
size += temp
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user