[acfun] fix #745

This commit is contained in:
Mort Yao 2015-11-11 01:41:16 +01:00
parent babbd22368
commit 4d8e6e5c99

View File

@ -24,7 +24,7 @@ def get_srt_lock_json(id):
def acfun_download_by_vid(vid, title=None, output_dir='.', merge=True, info_only=False, **kwargs): def acfun_download_by_vid(vid, title=None, output_dir='.', merge=True, info_only=False, **kwargs):
info = json.loads(get_html('http://www.acfun.tv/video/getVideo.aspx?id=' + vid)) info = json.loads(get_html('http://www.acfun.tv/video/getVideo.aspx?id=' + vid))
sourceType = info['sourceType'] sourceType = info['sourceType']
sourceId = info['sourceId'] if 'sourceId' in info: sourceId = info['sourceId']
# danmakuId = info['danmakuId'] # danmakuId = info['danmakuId']
if sourceType == 'sina': if sourceType == 'sina':
sina_download_by_vid(sourceId, title, output_dir=output_dir, merge=merge, info_only=info_only) sina_download_by_vid(sourceId, title, output_dir=output_dir, merge=merge, info_only=info_only)
@ -36,6 +36,13 @@ def acfun_download_by_vid(vid, title=None, output_dir='.', merge=True, info_only
qq_download_by_vid(sourceId, title, output_dir=output_dir, merge=merge, info_only=info_only) qq_download_by_vid(sourceId, title, output_dir=output_dir, merge=merge, info_only=info_only)
elif sourceType == 'letv': elif sourceType == 'letv':
letvcloud_download_by_vu(sourceId, '2d8c027396', title, output_dir=output_dir, merge=merge, info_only=info_only) letvcloud_download_by_vu(sourceId, '2d8c027396', title, output_dir=output_dir, merge=merge, info_only=info_only)
elif sourceType == 'zhuzhan':
videoList = info['videoList']
playUrl = videoList[-1]['playUrl']
mime, ext, size = url_info(playUrl)
print_info(site_info, title, mime, size)
if not info_only:
download_urls([playUrl], title, ext, size, output_dir, merge=merge)
else: else:
raise NotImplementedError(sourceType) raise NotImplementedError(sourceType)
@ -122,7 +129,7 @@ def acfun_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
if videos is not None: if videos is not None:
for video in videos: for video in videos:
p_vid = video[0] p_vid = video[0]
p_title = title + " - " + video[1] p_title = title + " - " + video[1] if video[1] != '删除标签' else title
acfun_download_by_vid(p_vid, p_title, output_dir=output_dir, merge=merge, info_only=info_only ,**kwargs) acfun_download_by_vid(p_vid, p_title, output_dir=output_dir, merge=merge, info_only=info_only ,**kwargs)
else: else:
# Useless - to be removed? # Useless - to be removed?