Merge branch 'Justsoos-develop' into develop

This commit is contained in:
Mort Yao 2019-08-19 13:40:56 +02:00
commit 20d6e6f646
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251
2 changed files with 32 additions and 29 deletions

View File

@ -108,7 +108,7 @@ def kg_qq_download_by_shareid(shareid, output_dir='.', info_only=False, caption=
def qq_download(url, output_dir='.', merge=True, info_only=False, **kwargs): def qq_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
"""""" """"""
if re.match(r'https?://egame.qq.com/live\?anchorid=(\d+)', url): if re.match(r'https?://(m\.)?egame.qq.com/', url):
from . import qq_egame from . import qq_egame
qq_egame.qq_egame_download(url, output_dir=output_dir, merge=merge, info_only=info_only, **kwargs) qq_egame.qq_egame_download(url, output_dir=output_dir, merge=merge, info_only=info_only, **kwargs)
return return

View File

@ -1,7 +1,7 @@
import re import re
import json import json
from ..common import get_content from ..common import *
from ..extractors import VideoExtractor from ..extractors import VideoExtractor
from ..util import log from ..util import log
from ..util.strings import unescape_html from ..util.strings import unescape_html
@ -9,33 +9,36 @@ from ..util.strings import unescape_html
__all__ = ['qq_egame_download'] __all__ = ['qq_egame_download']
class QQEgame(VideoExtractor): def qq_egame_download(url,
stream_types = [ output_dir='.',
{'id': 'original', 'video_profile': '0', 'container': 'flv'}, merge=True,
{'id': '900', 'video_profile': '900kb/s', 'container': 'flv'}, info_only=False,
{'id': '550', 'video_profile': '550kb/s', 'container': 'flv'} **kwargs):
] uid = re.search('\d\d\d+', url)
name = 'QQEgame' an_url = "https://m.egame.qq.com/live?anchorid={}&".format(uid.group(0))
page = get_content(an_url)
server_data = re.search(r'window\.serverData\s*=\s*({.+?});', page)
if server_data is None:
log.wtf('Can not find window.server_data')
json_data = json.loads(server_data.group(1))
if json_data['anchorInfo']['data']['isLive'] == 0:
log.wtf('Offline...')
live_info = json_data['liveInfo']['data']
title = '{}_{}'.format(live_info['profileInfo']['nickName'],
live_info['videoInfo']['title'])
real_url = live_info['videoInfo']['streamInfos'][0]['playUrl']
def prepare(self, **kwargs): print_info(site_info, title, 'flv', float('inf'))
page = get_content(self.url) if not info_only:
server_data = re.search(r'serverData\s*=\s*({.+?});', page) download_url_ffmpeg(
if server_data is None: real_url,
log.wtf('cannot find server_data') title,
json_data = json.loads(server_data.group(1)) 'flv',
live_info = json_data['liveInfo']['data'] params={},
self.title = '{}_{}'.format(live_info['profileInfo']['nickName'], live_info['videoInfo']['title']) output_dir=output_dir,
for exsited_stream in live_info['videoInfo']['streamInfos']: merge=merge)
for s in self.__class__.stream_types:
if re.search(r'(\d+)', s['video_profile']).group(1) == exsited_stream['bitrate']:
current_stream_id = s['id']
stream_info = dict(src=[unescape_html(exsited_stream['playUrl'])])
stream_info['video_profile'] = exsited_stream['desc']
stream_info['container'] = s['container']
stream_info['size'] = float('inf')
self.streams[current_stream_id] = stream_info
def qq_egame_download(url, **kwargs): site_info = "egame.qq.com"
QQEgame().download_by_url(url, **kwargs) download = qq_egame_download
# url dispatching has been done in qq.py download_playlist = playlist_not_supported('qq_egame')