抖音用户和视频数据爬虫

    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": "谢谢朋友们的关注有关必回谢谢!\n玩玩抖音纯属娱乐不喜勿喷谢谢!\nvx………………………………A13662209855",
		"signature_language": "zh",
		"youtube_refresh_token": "",
		"uid": "3663204117120136",
		"activity": {
			"use_music_count": 0,
			"digg_count": 0
		},
		"iso_country_code": "CN",
		"new_story_cover": null,
		"relative_users": null,
		"is_block": false,
		"is_verified": true,
		"location": "安康",
		"school_name": "安康职业技术学院",
		"prevent_download": false,
		"download_setting": 0,
		"college_name": "旅游管理",
		"latest_order_time": 0,
		"total_favorited": 1467848,
		"followers_detail": [{
			"apple_id": "1142110895",
			"download_url": "https://d.douyin.com/JsvN/",
			"package_name": "com.ss.android.ugc.aweme",
			"app_name": "aweme",
			"name": "抖音",
			"icon": "http://p3.pstatp.com/origin/50ec00079b64de2050dc",
			"fans_count": 47992,
			"open_url": "snssdk1128://user/profile/3663204117120136?"
		}, {
			"app_name": "news_article",
			"name": "头条",
			"icon": "http://p3.pstatp.com/origin/50ed00079a1b6b8d1fb1",
			"fans_count": 0,
			"open_url": "snssdk143://profile?uid=0",
			"apple_id": "529092160",
			"download_url": "https://d.toutiao.com/YjjY/",
			"package_name": "com.ss.android.article.news"
		}, {
			"package_name": "com.ss.android.ugc.live",
			"app_name": "live_stream",
			"name": "抖音火山版",
			"icon": "http://p3.pstatp.com/origin/2ea5c000abe106154adef",
			"fans_count": 0,
			"open_url": "snssdk1112://profile?id=0",
			"apple_id": "1086047750",
			"download_url": "http://d.huoshanzhibo.com/eFvB/"
		}],
		"with_fusion_shop_entry": true,
		"user_canceled": false,
		"duet_setting": 0,
		"reflow_page_gid": 0,
		"with_luban_entry": false,
		"with_commerce_enterprise_tab_entry": false,
		"commerce_user_info": {},
		"sec_uid": "MS4wLjABAAAA-E69dWBSzgPpSwi052k0rBl3UAdpsPAO_BWBCm7Vb0sJq8kcvvo-CXCt_VpROVKl",
		"video_cover": {},
		"account_region": "",
		"follower_status": 0,
		"country": "中国",
		"district": "",
		"special_lock": 1,
		"commerce_user_level": 0,
		"unique_id_modify_time": 1580737275,
		"youtube_channel_id": "",
		"city": "安康",
		"user_mode": 0,
		"hide_location": false,
		"unique_id": "A17520498395",
		"bind_phone": "#",
		"item_list": null,
		"wx_tag": 0,
		"need_points": null,
		"gender": 2,
		"share_info": {
			"share_image_url": {
				"uri": "tos-cn-p-0015/b96cfd55caa74b8581d555f70921cfaf_1580698710",
				"url_list": ["https://p9-dy.byteimg.com/img/tos-cn-p-0015/b96cfd55caa74b8581d555f70921cfaf_1580698710~noop.jpeg", "https://p26-dy.byteimg.com/img/tos-cn-p-0015/b96cfd55caa74b8581d555f70921cfaf_1580698710~noop.jpeg", "https://p3-dy.byteimg.com/img/tos-cn-p-0015/b96cfd55caa74b8581d555f70921cfaf_1580698710~noop.jpeg"]
			},
			"bool_persist": 1,
			"share_url": "www.iesdouyin.com/share/user/3663204117120136?sec_uid=MS4wLjABAAAA-E69dWBSzgPpSwi052k0rBl3UAdpsPAO_BWBCm7Vb0sJq8kcvvo-CXCt_VpROVKl",
			"share_weibo_desc": "在抖音,记录美好生活!",
			"share_desc": "在抖音,记录美好生活!",
			"share_title": "快来加入抖音,让你发现最有趣的我!",
			"share_qrcode_url": {
				"uri": "1e0ac0002e24de826674c",
				"url_list": ["https://p9-dy.byteimg.com/obj/1e0ac0002e24de826674c", "https://p26-dy.byteimg.com/obj/1e0ac0002e24de826674c", "https://p3-dy.byteimg.com/obj/1e0ac0002e24de826674c"]
			}
		},
		"ins_id": "",
		"weibo_schema": "",
		"birthday_hide_level": 0,
		"youtube_channel_title": "",
		"comment_setting": 0,
		"is_effect_artist": false,
		"with_stick_entry": false,
		"show_favorite_list": true,
		"constellation": 4,
		"cover_url": [{
			"uri": "c8510002be9a3a61aad2",
			"url_list": ["https://p1-dy.byteimg.com/obj/c8510002be9a3a61aad2", "https://p29-dy.byteimg.com/obj/c8510002be9a3a61aad2", "https://p9-dy.byteimg.com/obj/c8510002be9a3a61aad2"]
		}],
		"mplatform_followers_count": 47992,
		"sync_to_toutiao": 1,
		"show_image_bubble": false,
		"profile_tab_type": 0,
		"ad_cover_url": null,
		"douplus_old_user": false,
		"room_id": 0,
		"region": "CN",
		"is_pro_account": false,
		"video_icon": {
			"uri": "",
			"url_list": []
		},
		"avatar_uri": "2402400046fc5ab8b7c69",
		"avatar_168x168": {
			"uri": "2402400046fc5ab8b7c69",
			"url_list": ["http://p9-dy.byteimg.com/img/mosaic-legacy/2402400046fc5ab8b7c69~168x168.webp", "http://p3-dy.byteimg.com/img/mosaic-legacy/2402400046fc5ab8b7c69~168x168.webp", "http://p1-dy.byteimg.com/img/mosaic-legacy/2402400046fc5ab8b7c69~168x168.webp"]
		},
		"weibo_verify": "",
		"share_qrcode_uri": "1e0ac0002e24de826674c",
		"general_permission": {
			"following_follower_list_toast": 1
		},
		"urge_detail": {
			"user_urged": 0
		},
		"verify_info": "",
		"province": "陕西",
		"type_label": null,
		"avatar_thumb": {
			"uri": "2402400046fc5ab8b7c69",
			"url_list": ["https://p9-dy.byteimg.com/aweme/100x100/2402400046fc5ab8b7c69.jpeg", "https://p3-dy.byteimg.com/aweme/100x100/2402400046fc5ab8b7c69.jpeg", "https://p1-dy.byteimg.com/aweme/100x100/2402400046fc5ab8b7c69.jpeg"]
		},
		"original_musician": {
			"music_used_count": 0,
			"digg_count": 0,
			"music_count": 0
		},
		"secret": 0,
		"hide_following_follower_list": 0,
		"following_count": 4947,
		"story_open": false,
		"school_poi_id": "",
		"has_activity_medal": false,
		"twitter_name": "",
		"has_insights": false,
		"video_icon_virtual_URI": "",
		"dp_level": false,
		"is_activity_user": false,
		"follow_status": 0,
		"is_gov_media_vip": false,
		"download_prompt_ts": 0,
		"nickname": "A晏荣芳✔",
		"follower_count": 47992,
		"custom_verify": "",
		"verification_type": 0,
		"enterprise_verify_reason": "",
		"with_shop_entry": false,
		"react_setting": 0,
		"watch_status": false
	},
	"extra": {
		"now": 1580737275000
	},
	"log_pb": {
		"impr_id": "202002032141150100140490810ED80337"
	}
}

如果您需要的话,评论区留下邮箱吧,会给你发送调用代码和用来测试的key。

你可能感兴趣的:(带我哥们学逆向)