Skip to content

Commit df91e6d

Browse files
authored
结束重复回圈避免搜索 API 多次访问
1 parent c7525c3 commit df91e6d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

douyin_pro_2.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ def get_video_urls(self, user_id):
4646
uid = html['user_list'][0]['user_info']['uid']
4747
nickname = html['user_list'][0]['user_info']['nickname']
4848
unique_id = html['user_list'][0]['user_info']['unique_id']
49+
if unique_id != user_id:
50+
unique_id = html['user_list'][0]['user_info']['short_id']
51+
else:
52+
print('用户ID可能输入错误或无法搜索到此用户ID')
53+
sys.exit()
4954
share_user_url = 'https://www.amemv.com/share/user/%s' % uid
5055
share_user = requests.get(share_user_url, headers=self.headers)
5156
_dytk_re = re.compile(r"dytk: '(.+)'")

0 commit comments

Comments
 (0)