爬取抖音app个人主页视频信息
本帖最后由 wcq15759797758 于 2021-7-21 15:24 编辑抖音app防抓包太严了
我随便抓了信息主页
要发起请求带的可变参数太多了,每个抖音主页要带的数据都不一样,没啥时间就没去深究了我在请求头里结尾加了 #的 就是会变的
代码具有时效性 仅供参考 抓到主页数据修改请求头信息即可得到数据
请求头图片里面我没有带上的数据可以不带
附上代码
import json
import requests
headers = {"Accept-Encoding":"gzip",
"activity_now_client":"1626850313098",#时间戳
"passport-sdk-version":"18",
"sdk-version":"2",
"X-SS-REQ-TICKET":"1626850311590",#时间戳
"x-vc-bdturing-sdk-version":"2.1.0.cn",
"X-Ladon":"FX43SViG1Wg5SSiYI6AYsdqeqi2SdHYKlHxSDBHY8MXGqeY8",#
"X-Khronos":"1626850311", #时间戳
"X-Gorgon":"0404a0f100050b8e5f7a99c9b14be3eb56494185ef14db8ba186",#
"X-Tyhon":"CUOcQGBQvit5cKQ7KFvqKCRaulVdT4RAehGM7Os=",#
"X-Argus":"Z7reD11OudnmspknTR9LCOEFF4VsMDbrqNvi7tcmrKp1/o0QCp7CWTEg64zyEUBOncrMMglVelHgeAJbbqkf91E5f7IX6vCJLG1H9Eub+4UAvaRWIcUvswWbaH/ypokc2Y/XkGWouY/A4DXhY5RzslwKM8I6T0jCjIWfAvVrRsoKSQIITg1Y1MAxdKJICBDvRoLLODBeHvqsrQkuwTYZhJ9we4/4QcHCdM+WuIFEksJ7SRXJvs6+SPoNu7NFxV/IG0azHu9oHnh2ixWI73YYhUrO",
"Host":"aweme.snssdk.com",#固定不变
"Connection":"Keep-Alive",#固定不变
"User-Agent":"okhttp/3.10.0.1",#UA型号
}
url = 'https://aweme.snssdk.com/aweme/v1/aweme/post/?publish_video_strategy_type=2&source=0&user_avatar_shrink=96_96&video_cover_shrink=248_330&max_cursor=0&sec_user_id=MS4wLjABAAAAUpIowEL3ygUAahQB47vy8sbYMB1eIr40qtlDwxhxFGw&count=20&show_live_replay_strategy=1&is_order_flow=0&page_from=2&longitude=103.563582&latitude=37.00125&location_permission=true&locate_item_id=6984990536016891136&os_api=22&device_type=SM-G977N&ssmix=a&manifest_version_code=160201&dpi=320&uuid=351564342922218&app_name=aweme&version_name=16.2.0&ts=1626850311&cpu_support64=false&app_type=normal&appTheme=light&ac=wifi&host_abi=armeabi-v7a&update_version_code=16209900&channel=tengxun_1128_0531&_rticket=1626850311551&device_platform=android&iid=3255031094063671&version_code=160200&cdid=f957b21b-a922-4785-a884-1bbbc1f587c3&is_android_pad=0&openudid=cc2d84227abb58b9&device_id=1689286912251320&resolution=900*1600&os_version=5.1.1&language=zh&device_brand=Android&aid=1128&minor_status=0&mcc_mnc=46007'
response = requests.get(url=url,headers=headers)
dict = json.loads(response.text)
for item in dict['aweme_list']:
items = {}
items['aweme_id'] = item['aweme_id']
items['desc'] = item['desc']
items['点赞量'] = item['statistics']['digg_count']
items['评论数'] = item['statistics']['comment_count']
items['视频链接'] = 'https://www.douyin.com/video/' + item['aweme_id']
print(items)
路过大佬有好的app抓包环境配置 可以推荐 谢谢大佬们 感谢分享! 感谢分享!
hornwong 发表于 2021-7-21 15:38
感谢分享!
不客气 感谢 学习学习 感谢分享 谢谢大佬分享 谢谢大佬分享 wow 小白惊呼妙啊! 谢谢分享! 感谢大佬 {:10_257:} 大牛啊 江湖散人 发表于 2021-7-23 01:12
大牛啊
菜鸡一枚{:10_254:} 中奖
感谢分享! 感谢大佬分享 {:10_266:} 谢谢大佬 {:10_275:}
页:
[1]
2