diff --git a/README.md b/README.md
index 86c5e4e958..f6f8efdcac 100644
--- a/README.md
+++ b/README.md
@@ -416,6 +416,7 @@ Use `--url`/`-u` to get a list of downloadable resource URLs extracted from the
| 西瓜视频 | |✓| | |
| 快手 | |✓|✓| |
| 抖音 | |✓| | |
+| 中国体育(TV) | |✓| | |
For all other sites not on the list, the universal extractor will take care of finding and downloading interesting resources from the page.
diff --git a/src/you_get/common.py b/src/you_get/common.py
index e30008549c..30e533f1a4 100755
--- a/src/you_get/common.py
+++ b/src/you_get/common.py
@@ -24,6 +24,7 @@
SITES = {
'163' : 'netease',
'56' : 'w56',
+ '365yg' : 'toutiao',
'acfun' : 'acfun',
'archive' : 'archive',
'baidu' : 'baidu',
@@ -64,6 +65,7 @@
'iqiyi' : 'iqiyi',
'ixigua' : 'ixigua',
'isuntv' : 'suntv',
+ 'iwara' : 'iwara',
'joy' : 'joy',
'kankanews' : 'bilibili',
'khanacademy' : 'khan',
@@ -82,6 +84,7 @@
'mixcloud' : 'mixcloud',
'mtv81' : 'mtv81',
'musicplayon' : 'musicplayon',
+ 'miaopai' : 'yixia',
'naver' : 'naver',
'7gogo' : 'nanagogo',
'nicovideo' : 'nicovideo',
@@ -118,14 +121,12 @@
'xiaojiadianvideo' : 'fc2video',
'ximalaya' : 'ximalaya',
'yinyuetai' : 'yinyuetai',
- 'miaopai' : 'yixia',
'yizhibo' : 'yizhibo',
'youku' : 'youku',
- 'iwara' : 'iwara',
'youtu' : 'youtube',
'youtube' : 'youtube',
'zhanqi' : 'zhanqi',
- '365yg' : 'toutiao',
+ 'zhibo' : 'zhibo',
}
dry_run = False
diff --git a/src/you_get/extractors/__init__.py b/src/you_get/extractors/__init__.py
index ec9e86ae42..649a911f36 100755
--- a/src/you_get/extractors/__init__.py
+++ b/src/you_get/extractors/__init__.py
@@ -88,3 +88,4 @@
from .khan import *
from .zhanqi import *
from .kuaishou import *
+from .zhibo import *
\ No newline at end of file
diff --git a/src/you_get/extractors/acfun.py b/src/you_get/extractors/acfun.py
index c521422f60..4b45c5e962 100644
--- a/src/you_get/extractors/acfun.py
+++ b/src/you_get/extractors/acfun.py
@@ -65,7 +65,7 @@ def acfun_download_by_vid(vid, title, output_dir='.', merge=True, info_only=Fals
elif sourceType == 'tudou':
tudou_download_by_iid(sourceId, title, output_dir=output_dir, merge=merge, info_only=info_only)
elif sourceType == 'qq':
- qq_download_by_vid(sourceId, title, output_dir=output_dir, merge=merge, info_only=info_only)
+ qq_download_by_vid(sourceId, title, True, output_dir=output_dir, merge=merge, info_only=info_only)
elif sourceType == 'letv':
letvcloud_download_by_vu(sourceId, '2d8c027396', title, output_dir=output_dir, merge=merge, info_only=info_only)
elif sourceType == 'zhuzhan':
diff --git a/src/you_get/extractors/bilibili.py b/src/you_get/extractors/bilibili.py
index 916782af92..9e2b8bc068 100644
--- a/src/you_get/extractors/bilibili.py
+++ b/src/you_get/extractors/bilibili.py
@@ -169,7 +169,7 @@ def entry(self, **kwargs):
tc_flashvars = tc_flashvars.group(1)
if tc_flashvars is not None:
self.out = True
- qq_download_by_vid(tc_flashvars, self.title, output_dir=kwargs['output_dir'], merge=kwargs['merge'], info_only=kwargs['info_only'])
+ qq_download_by_vid(tc_flashvars, self.title, True, output_dir=kwargs['output_dir'], merge=kwargs['merge'], info_only=kwargs['info_only'])
return
has_plist = re.search(r'"page":2', self.page)
diff --git a/src/you_get/extractors/qq.py b/src/you_get/extractors/qq.py
index 4a67c57c44..7f2f4acc22 100644
--- a/src/you_get/extractors/qq.py
+++ b/src/you_get/extractors/qq.py
@@ -8,7 +8,14 @@
from .qie_video import download_by_url as qie_video_download
from urllib.parse import urlparse,parse_qs
-def qq_download_by_vid(vid, title, output_dir='.', merge=True, info_only=False):
+def qq_download_by_vid(vid, title, default_from, output_dir='.', merge=True, info_only=False):
+
+ if default_from:
+ platform = 11
+ else:
+ # fix return {,"msg":"cannot play outside"}
+ platform = 4100201
+
info_api = 'http://vv.video.qq.com/getinfo?otype=json&appver=3.2.19.333&platform=11&defnpayver=1&defn=shd&vid={}'.format(vid)
info = get_content(info_api)
video_json = json.loads(match1(info, r'QZOutputJson=(.*)')[:-1])
@@ -17,7 +24,8 @@ def qq_download_by_vid(vid, title, output_dir='.', merge=True, info_only=False):
title = video_json['vl']['vi'][0]['ti']
host = video_json['vl']['vi'][0]['ul']['ui'][0]['url']
streams = video_json['fl']['fi']
- seg_cnt = video_json['vl']['vi'][0]['cl']['fc']
+ seg_cnt = fc_cnt = video_json['vl']['vi'][0]['cl']['fc']
+
filename = video_json['vl']['vi'][0]['fn']
if seg_cnt == 0:
seg_cnt = 1
@@ -25,21 +33,13 @@ def qq_download_by_vid(vid, title, output_dir='.', merge=True, info_only=False):
fn_pre, magic_str, video_type = filename.split('.')
best_quality = streams[-1]['name']
- #part_format_id = streams[-1]['id']
part_urls= []
total_size = 0
for part in range(1, seg_cnt+1):
- #if seg_cnt == 1 and video_json['vl']['vi'][0]['vh'] <= 480:
- # filename = fn_pre + '.mp4'
- #else:
- # filename = fn_pre + '.p' + str(part_format_id % 10000) + '.' + str(part) + '.mp4'
- #filename = fn_pre + '.p' + str(part_format_id % 10000) + '.' + str(part) + '.mp4'
-
- # fix some error cases("check vid&filename failed" and "format invalid")
- # https://v.qq.com/x/page/q06058th9ll.html
- # https://v.qq.com/x/page/t060789a21e.html
- if seg_cnt == 1:
+ if fc_cnt == 0:
+ # fix json parsing error
+ # example:https://v.qq.com/x/page/w0674l9yrrh.html
part_format_id = video_json['vl']['vi'][0]['cl']['keyid'].split('.')[-1]
else:
part_format_id = video_json['vl']['vi'][0]['cl']['ci'][part - 1]['keyid'].split('.')[1]
@@ -112,6 +112,8 @@ 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):
""""""
+ default_from = True
+
if re.match(r'https?://egame.qq.com/live\?anchorid=(\d+)', url):
from . import qq_egame
qq_egame.qq_egame_download(url, output_dir=output_dir, merge=merge, info_only=info_only, **kwargs)
@@ -134,7 +136,7 @@ def qq_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
content = get_content(url)
vids = matchall(content, [r'\?vid=(\w+)'])
for vid in vids:
- qq_download_by_vid(vid, vid, output_dir, merge, info_only)
+ qq_download_by_vid(vid, vid, default_from, output_dir, merge, info_only)
return
if 'kuaibao.qq.com' in url or re.match(r'http://daxue.qq.com/content/content/id/\d+', url):
@@ -165,7 +167,12 @@ def qq_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
title = match1(content, r'"title":"([^"]+)"') if not title else title
title = vid if not title else title #general fallback
- qq_download_by_vid(vid, title, output_dir, merge, info_only)
+ if 'v.sports.qq.com' in url:
+ # fix url forbidden
+ # example:http://v.sports.qq.com/#/cover/t0fqsm1y83r8v5j/a0026nvw5jr
+ default_from = False
+
+ qq_download_by_vid(vid, title, default_from, output_dir, merge, info_only)
site_info = "QQ.com"
download = qq_download
diff --git a/src/you_get/extractors/zhibo.py b/src/you_get/extractors/zhibo.py
new file mode 100644
index 0000000000..4aaa293e7d
--- /dev/null
+++ b/src/you_get/extractors/zhibo.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+
+__all__ = ['zhibo_download']
+
+from ..common import *
+
+def zhibo_vedio_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
+ # http://video.zhibo.tv/video/details/d103057f-663e-11e8-9d83-525400ccac43.html
+
+ html = get_html(url)
+ title = r1(r'
([\s\S]*)', html)
+ total_size = 0
+ part_urls= []
+
+ video_html = r1(r'', html)
+
+ # video_guessulike = r1(r"window.xgData =([s\S'\s\.]*)\'\;[\s\S]*window.vouchData", video_html)
+ video_url = r1(r"window.vurl = \'([s\S'\s\.]*)\'\;[\s\S]*window.imgurl", video_html)
+ part_urls.append(video_url)
+ ext = video_url.split('.')[-1]
+
+ print_info(site_info, title, ext, total_size)
+ if not info_only:
+ download_urls(part_urls, title, ext, total_size, output_dir=output_dir, merge=merge)
+
+
+def zhibo_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
+ if 'video.zhibo.tv' in url:
+ zhibo_vedio_download(url, output_dir=output_dir, merge=merge, info_only=info_only, **kwargs)
+ return
+
+ # if 'v.zhibo.tv' in url:
+ # http://v.zhibo.tv/31609372
+ html = get_html(url)
+ title = r1(r'([\s\S]*)', html)
+ is_live = r1(r"window.videoIsLive=\'([s\S'\s\.]*)\'\;[\s\S]*window.resDomain", html)
+ if is_live is not "1":
+ raise ValueError("The live stream is not online! (Errno:%s)" % is_live)
+
+ ourStreamName = r1(r"window.ourStreamName=\'([s\S'\s\.]*)\'\;[\s\S]*window.rtmpDefaultSource", html)
+ rtmpPollUrl = r1(r"window.rtmpPollUrl=\'([s\S'\s\.]*)\'\;[\s\S]*window.hlsDefaultSource", html)
+
+ #real_url = 'rtmp://220.194.213.56/live.zhibo.tv/8live/' + ourStreamName
+ real_url = rtmpPollUrl + ourStreamName
+
+ print_info(site_info, title, 'flv', float('inf'))
+ if not info_only:
+ download_url_ffmpeg(real_url, title, 'flv', params={}, output_dir=output_dir, merge=merge)
+
+site_info = "zhibo.tv"
+download = zhibo_download
+download_playlist = playlist_not_supported('zhibo')