mirror of
https://github.com/soimort/you-get.git
synced 2025-02-02 16:24:00 +03:00
add support for PPTV (download not supported)
This commit is contained in:
parent
ba9b14752f
commit
ab378f24ce
@ -106,7 +106,6 @@ def url_info(url):
|
|||||||
'video/webm': 'webm',
|
'video/webm': 'webm',
|
||||||
'video/x-flv': 'flv'
|
'video/x-flv': 'flv'
|
||||||
}
|
}
|
||||||
#assert type in mapping, type
|
|
||||||
if type in mapping:
|
if type in mapping:
|
||||||
ext = mapping[type]
|
ext = mapping[type]
|
||||||
else:
|
else:
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from .cntv import *
|
from .cntv import *
|
||||||
from .ku6 import *
|
from .ku6 import *
|
||||||
|
from .pptv import *
|
||||||
from .sohu import *
|
from .sohu import *
|
||||||
from .tudou import *
|
from .tudou import *
|
||||||
from .w56 import *
|
from .w56 import *
|
||||||
|
40
you_get/downloader/pptv.py
Normal file
40
you_get/downloader/pptv.py
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
__all__ = ['pptv_download', 'pptv_download_by_id']
|
||||||
|
|
||||||
|
from ..common import *
|
||||||
|
|
||||||
|
import re
|
||||||
|
import urllib
|
||||||
|
import hashlib
|
||||||
|
|
||||||
|
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)
|
||||||
|
host = r1(r'<sh>([^<>]+)</sh>', xml)
|
||||||
|
port = 8080
|
||||||
|
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)
|
||||||
|
title = r1(r'nm="([^"]+)"', xml)
|
||||||
|
pieces = re.findall('<sgm no="(\d+)".*fs="(\d+)"', xml)
|
||||||
|
numbers, fs = zip(*pieces)
|
||||||
|
urls = ['http://%s:%s/%s/%s?key=%s' % (host, port, 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))
|
||||||
|
assert rid.endswith('.mp4')
|
||||||
|
|
||||||
|
print_info(site_info, title, 'mp4', total_size)
|
||||||
|
if not info_only:
|
||||||
|
download_urls(urls, title, 'mp4', total_size, output_dir = output_dir, merge = merge)
|
||||||
|
|
||||||
|
def pptv_download(url, output_dir = '.', merge = True, info_only = False):
|
||||||
|
assert re.match(r'http://v.pptv.com/show/(\w+)\.html$', url)
|
||||||
|
html = get_html(url)
|
||||||
|
id = r1(r'webcfg\s*=\s*{"id":\s*(\d+)', html)
|
||||||
|
assert id
|
||||||
|
pptv_download_by_id(id, output_dir = output_dir, merge = merge, info_only = info_only)
|
||||||
|
|
||||||
|
site_info = "PPTV.com"
|
||||||
|
download = pptv_download
|
||||||
|
download_playlist = playlist_not_supported('pptv')
|
@ -7,7 +7,7 @@ from ..common import *
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
def w56_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False):
|
def w56_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False):
|
||||||
info = json.loads(get_html('http://vxml.56.com/json/%s/?src=site'%id))['info']
|
info = json.loads(get_html('http://vxml.56.com/json/%s/?src=site' % id))['info']
|
||||||
title = title or info['Subject']
|
title = title or info['Subject']
|
||||||
assert title
|
assert title
|
||||||
hd = info['hd']
|
hd = info['hd']
|
||||||
|
@ -19,6 +19,7 @@ def url_to_module(url):
|
|||||||
'56': w56,
|
'56': w56,
|
||||||
'cntv': cntv,
|
'cntv': cntv,
|
||||||
'ku6': ku6,
|
'ku6': ku6,
|
||||||
|
'pptv': pptv,
|
||||||
'sohu': sohu,
|
'sohu': sohu,
|
||||||
'tudou': tudou,
|
'tudou': tudou,
|
||||||
'yinyuetai': yinyuetai,
|
'yinyuetai': yinyuetai,
|
||||||
@ -30,7 +31,6 @@ def url_to_module(url):
|
|||||||
# 'kankanews': bilibili,
|
# 'kankanews': bilibili,
|
||||||
# 'iask': iask,
|
# 'iask': iask,
|
||||||
# 'sina': iask,
|
# 'sina': iask,
|
||||||
# 'pptv': pptv,
|
|
||||||
# 'iqiyi': iqiyi,
|
# 'iqiyi': iqiyi,
|
||||||
}
|
}
|
||||||
if k in downloads:
|
if k in downloads:
|
||||||
|
Loading…
Reference in New Issue
Block a user