Skip to content

Commit 2053929

Browse files
authored
share_desc change and replace invalid characters
1 parent d76f9b7 commit 2053929

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

douyin_pro_2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ def get_video_urls(self, user_id):
4343
html = json.loads(req.text)
4444
for each in html['aweme_list']:
4545
share_desc = each['share_info']['share_desc']
46+
for c in r'\/:*?"<>|':
47+
share_desc = share_desc.replace(c, '')
4648
unix_timestamp = each['create_time']
4749
utc_time = datetime.fromtimestamp(unix_timestamp, timezone.utc)
4850
local_time = utc_time.astimezone()
4951
tc = local_time.strftime('%Y-%m-%d-%H-%M-%S')
50-
if '抖音-原创音乐短视频社区' == share_desc:
52+
if share_desc in ['抖音-原创音乐短视频社区', 'TikTok']:
5153
video_names.append(tc + '.mp4')
5254
else:
5355
video_names.append(tc + '-' + share_desc + '.mp4')

0 commit comments

Comments
 (0)