Skip to content

Commit d508afd

Browse files
authored
Merge pull request Jack-Cherish#25 from steven7851/patch-2
share_desc change and replace invalid characters
2 parents e89ae67 + 9c2ebd9 commit d508afd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

douyin_pro_2.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,14 @@ 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+
if os.name == 'nt':
47+
for c in r'\/:*?"<>|':
48+
share_desc = share_desc.replace(c, '')
4649
unix_timestamp = each['create_time']
4750
utc_time = datetime.fromtimestamp(unix_timestamp, timezone.utc)
4851
local_time = utc_time.astimezone()
4952
tc = local_time.strftime('%Y-%m-%d-%H-%M-%S')
50-
if '抖音-原创音乐短视频社区' == share_desc:
53+
if share_desc in ['抖音-原创音乐短视频社区', 'TikTok']:
5154
video_names.append(tc + '.mp4')
5255
else:
5356
video_names.append(tc + '-' + share_desc + '.mp4')

0 commit comments

Comments
 (0)