@@ -38,17 +38,16 @@ def get_video_urls(self, user_id):
38
38
share_urls = []
39
39
unique_id = ''
40
40
device_id = str (random .randint (3 , 5 )) + '' .join (map (str , (random .randint (0 , 9 ) for _ in range (10 ))))
41
- while unique_id != user_id :
42
- search_url = 'https://api.amemv.com/aweme/v1/discover/search/?cursor=0&keyword={0}&count=10&type=1&retry_type=no_retry&device_id={1}&ac=wifi&channel=xiaomi&aid=1128&app_name=aweme&version_code=162&version_name=1.6.2&device_platform=android&ssmix=a&device_type=MI+5&device_brand=Xiaomi&os_api=24&os_version=7.0&manifest_version_code=162&resolution=1080*1920&dpi=480&update_version_code=1622' .format (user_id , device_id )
43
- req = requests .get (search_url , headers = self .headers )
44
- html = json .loads (req .text )
45
- aweme_count = 32767 # html['user_list'][0]['user_info']['aweme_count']
46
- uid = html ['user_list' ][0 ]['user_info' ]['uid' ]
47
- nickname = html ['user_list' ][0 ]['user_info' ]['nickname' ]
48
- unique_id = html ['user_list' ][0 ]['user_info' ]['unique_id' ]
41
+ search_url = 'https://api.amemv.com/aweme/v1/discover/search/?cursor=0&keyword={0}&count=10&type=1&retry_type=no_retry&device_id={1}&ac=wifi&channel=xiaomi&aid=1128&app_name=aweme&version_code=162&version_name=1.6.2&device_platform=android&ssmix=a&device_type=MI+5&device_brand=Xiaomi&os_api=24&os_version=7.0&manifest_version_code=162&resolution=1080*1920&dpi=480&update_version_code=1622' .format (user_id , device_id )
42
+ req = requests .get (search_url , headers = self .headers )
43
+ html = json .loads (req .text )
44
+ aweme_count = 32767 # html['user_list'][0]['user_info']['aweme_count']
45
+ uid = html ['user_list' ][0 ]['user_info' ]['uid' ]
46
+ nickname = html ['user_list' ][0 ]['user_info' ]['nickname' ]
47
+ unique_id = html ['user_list' ][0 ]['user_info' ]['unique_id' ]
48
+ if unique_id != user_id :
49
+ unique_id = html ['user_list' ][0 ]['user_info' ]['short_id' ]
49
50
if unique_id != user_id :
50
- unique_id = html ['user_list' ][0 ]['user_info' ]['short_id' ]
51
- else :
52
51
print ('用户ID可能输入错误或无法搜索到此用户ID' )
53
52
sys .exit ()
54
53
share_user_url = 'https://www.amemv.com/share/user/%s' % uid
0 commit comments