def get_user_info(self, user_id):
"""获取用户信息
:param user_id: 用户ID
:return:
"""
params = {
'user_id': user_id
}
douyin_url = 'https://aweme-eagle.snssdk.com/aweme/v1/user/?'
return self.__http_get(douyin_url, params)
使用如下代码片段:
if __name__ == '__main__':
douApi = DouYinApi("xxx")
result = douApi.register_device()
print(result)
douApi.init_device_ids(result['device_id'],result['iid'],result['uuid'],result['openudid'])
#douApi.init_device_ids("70634181730","101843848716","869699393751772","fa23c8f6e021e1ef")
result = douApi.get_user_info(3663204117120136)
print(result)
获取抖音用户的信息数据如下
{
"status_code": 0,
"user": {
"favoriting_count": 21695,
"is_blocked": false,
"homepage_bottom_toast": null,
"reflow_page_uid": 0,
"r_fans_group_info": {},
"content_language_already_popup": 0,
"geofencing": null,
"twitter_id": "",
"with_new_goods": false,
"avatar_300x300": {
"uri": "2402400046fc5ab8b7c69",
"url_list": ["http://p9-dy.byteimg.com/img/mosaic-legacy/2402400046fc5ab8b7c69~300x300.webp", "http://p3-dy.byteimg.com/img/mosaic-legacy/2402400046fc5ab8b7c69~300x300.webp", "http://p1-dy.byteimg.com/img/mosaic-legacy/2402400046fc5ab8b7c69~300x300.webp"]
},
"aweme_count": 350,
"with_commerce_entry": true,
"platform_sync_info": null,
"apple_account": 0,
"cha_list": null,
"birthday": "1983-01-01",
"weibo_url": "",
"user_period": 0,
"avatar_larger": {
"uri": "2402400046fc5ab8b7c69",
"url_list": ["https://p9-dy.byteimg.com/aweme/1080x1080/2402400046fc5ab8b7c69.jpeg", "https://p3-dy.byteimg.com/aweme/1080x1080/2402400046fc5ab8b7c69.jpeg", "https://p1-dy.byteimg.com/aweme/1080x1080/2402400046fc5ab8b7c69.jpeg"]
},
"avatar_medium": {
"uri": "2402400046fc5ab8b7c69",
"url_list": ["https://p9-dy.byteimg.com/aweme/720x720/2402400046fc5ab8b7c69.jpeg", "https://p3-dy.byteimg.com/aweme/720x720/2402400046fc5ab8b7c69.jpeg", "https://p1-dy.byteimg.com/aweme/720x720/2402400046fc5ab8b7c69.jpeg"]
},
"dongtai_count": 385,
"is_star": false,
"youtube_last_refresh_time": 0,
"star_use_new_download": true,
"live_commerce": true,
"recommend_reason_relation": "",
"short_id": "0",
"signature": "