mirror of
https://github.com/soimort/you-get.git
synced 2025-01-24 05:55:02 +03:00
Merge branch 'Justsoos-develop' into develop
This commit is contained in:
commit
20d6e6f646
@ -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
|
||||||
|
@ -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)
|
||||||
def prepare(self, **kwargs):
|
server_data = re.search(r'window\.serverData\s*=\s*({.+?});', page)
|
||||||
page = get_content(self.url)
|
|
||||||
server_data = re.search(r'serverData\s*=\s*({.+?});', page)
|
|
||||||
if server_data is None:
|
if server_data is None:
|
||||||
log.wtf('cannot find server_data')
|
log.wtf('Can not find window.server_data')
|
||||||
json_data = json.loads(server_data.group(1))
|
json_data = json.loads(server_data.group(1))
|
||||||
|
if json_data['anchorInfo']['data']['isLive'] == 0:
|
||||||
|
log.wtf('Offline...')
|
||||||
live_info = json_data['liveInfo']['data']
|
live_info = json_data['liveInfo']['data']
|
||||||
self.title = '{}_{}'.format(live_info['profileInfo']['nickName'], live_info['videoInfo']['title'])
|
title = '{}_{}'.format(live_info['profileInfo']['nickName'],
|
||||||
for exsited_stream in live_info['videoInfo']['streamInfos']:
|
live_info['videoInfo']['title'])
|
||||||
for s in self.__class__.stream_types:
|
real_url = live_info['videoInfo']['streamInfos'][0]['playUrl']
|
||||||
if re.search(r'(\d+)', s['video_profile']).group(1) == exsited_stream['bitrate']:
|
|
||||||
current_stream_id = s['id']
|
print_info(site_info, title, 'flv', float('inf'))
|
||||||
stream_info = dict(src=[unescape_html(exsited_stream['playUrl'])])
|
if not info_only:
|
||||||
stream_info['video_profile'] = exsited_stream['desc']
|
download_url_ffmpeg(
|
||||||
stream_info['container'] = s['container']
|
real_url,
|
||||||
stream_info['size'] = float('inf')
|
title,
|
||||||
self.streams[current_stream_id] = stream_info
|
'flv',
|
||||||
|
params={},
|
||||||
|
output_dir=output_dir,
|
||||||
|
merge=merge)
|
||||||
|
|
||||||
|
|
||||||
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')
|
||||||
|
Loading…
Reference in New Issue
Block a user