前言
嗨喽~大家好呀,这里是魔王呐 ❤ ~!
python更多源码/资料/解答/教程等 点击此处跳转文末名片免费获取
知识点:
-
动态数据抓包
-
requests发送请求
-
X-Bogus 参数逆向
开发环境:
-
python 3.8 运行代码
-
pycharm 2022.3 辅助敲代码
-
requests pip install requests
import requests
import execjs
ctx = execjs.compile(open('xb.js', mode='r', encoding='utf-8').read())
headers = {
'referer': 'https://***/user/MS4wLjABAAAAqsOmrExIsJbZ2b0QLzytzAhAFbJUROH72_yVYM7Zq8E?vid=7273024102460362047',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36',
}
arg1 = 'device_platform=webapp&aid=6383&channel=channel_pc_web&sec_user_id=MS4wLjABAAAAqsOmrExIsJbZ2b0QLzytzAhAFbJUROH72_yVYM7Zq8E&max_cursor=1690869936000&locate_item_id=7273024102460362047&locate_query=false&show_live_replay_strategy=1&need_time_list=1&time_list_query=0&count=18&publish_video_strategy_type=2&pc_client_type=1&version_code=170400&version_name=17.4.0&cookie_enabled=true&screen_width=1920&screen_height=1080&browser_language=zh-CN&browser_platform=Win32&browser_name=Chrome&browser_version=116.0.0.0&browser_online=true&engine_name=Blink&engine_version=116.0.0.0&os_name=Windows&os_version=10&cpu_core_num=6&device_memory=8&platform=PC&downlink=10&effective_type=4g&round_trip_time=0&webid=7206570248416773684&msToken=kuJ7VXEum5t8MRJsb-EWiKneHuMabLt_Xmvzqjv7Tl92qzTPYaHkfIMCn9ndAkA39d7QfcI57AU353tQuNpAnxbsgxSEXN6KR4Du5bRKUrivq2hBvPiEPaFyW0xyaMc='
url = 'https://****/aweme/v1/web/aweme/post/?'
xb = arg1 + '&X-Bogus=' + ctx.call('window.siyue111', arg1)
url += xb
print(url)
response = requests.get(url, headers=headers)
json_data = response.json()
aweme_list = json_data['aweme_list']
for aweme in aweme_list:
desc = aweme['desc']
video_url = aweme['video']['play_addr']['url_list'][0]
print(desc, video_url)
具体讲解请看这:
抖音X-Bongus 参数逆向 python爬虫实战
尾语
最后感谢你观看我的文章呐~本次航班到这里就结束啦 🛬
希望本篇文章有对你带来帮助 🎉,有学习到一点知识~
躲起来的星星🍥也在努力发光,你也要努力加油(让我们一起努力叭)。