mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 08:43:58 +03:00
[douyin] fix if there is not title, you-get cannot works well
https://www.douyin.com/share/video/6553248251821165832
This commit is contained in:
parent
50bba5527b
commit
daf630e9d7
@ -21,7 +21,13 @@ def douyin_download_by_url(url, **kwargs):
|
|||||||
match_rule = re.compile(r'var data = \[(.*?)\];')
|
match_rule = re.compile(r'var data = \[(.*?)\];')
|
||||||
video_info = json.loads(match_rule.findall(page_content)[0])
|
video_info = json.loads(match_rule.findall(page_content)[0])
|
||||||
video_url = video_info['video']['play_addr']['url_list'][0]
|
video_url = video_info['video']['play_addr']['url_list'][0]
|
||||||
title = video_info['cha_list'][0]['cha_name']
|
# fix: https://www.douyin.com/share/video/6553248251821165832
|
||||||
|
# if there is no title, use desc
|
||||||
|
cha_list = video_info['cha_list']
|
||||||
|
if cha_list:
|
||||||
|
title = cha_list[0]['cha_name']
|
||||||
|
else:
|
||||||
|
title = video_info['desc']
|
||||||
video_format = 'mp4'
|
video_format = 'mp4'
|
||||||
size = url_size(video_url, faker=True)
|
size = url_size(video_url, faker=True)
|
||||||
print_info(
|
print_info(
|
||||||
|
Loading…
Reference in New Issue
Block a user