新版a_bogus算法的过程,仅学习参考,如有涉及侵权联系本人删除
最近看到这个参数花了点时间研究了一下 流程和X-Bogus差不多,通过对这段字符串概是对数据、ua、时间戳、浏览器的几个指纹进行计算,长度168位
下面是实现效果以及测试方法:
具体调用方法:
import requests
headers = {
"accept": "application/json, text/plain, */*",
"accept-language": "zh-CN,zh;q=0.9",
"priority": "u=1, i",
"referer": "https://www.douyin.com/user/MS4wLjABAAAAEpmH344CkCw2M58T33Q8TuFpdvJsOyaZcbWxAMc6H03wOVFf1Ow4mPP94TDUS4Us",
"sec-ch-ua": "\"Chromium\";v=\"124\", \"Google Chrome\";v=\"124\", \"Not-A.Brand\";v=\"99\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
}
cookies = {
"ttwid": "1%7Cmad1f-1QOMRDrZL7FeBuk4X701QZZmU13X-LreVPZ_4%7C1713410299%7C8571e30cd5676e1d7f6aa2837d20ded6aeba89edc04aca2de29d30147c8b3ccb",
}
# 用户作品列表接口
douyin_url = "https://www.douyin.com/aweme/v1/web/aweme/post/"
# params为请求某音的参数
params = {
"device_platform": "webapp",
"aid": "6383",
"channel": "channel_pc_web",
"sec_user_id": "MS4wLjABAAAAEpmH344CkCw2M58T33Q8TuFpdvJsOyaZcbWxAMc6H03wOVFf1Ow4mPP94TDUS4Us",
"max_cursor": "0",
"locate_query": "false",
"show_live_replay_strategy": "1",
"need_time_list": "1",
"time_list_query": "0",
"whale_cut_token": "",
"cut_version": "1",
"count": "18",
"publish_video_strategy_type": "2",
"pc_client_type": "1",
"version_code": "290100",
"version_name": "29.1.0",
"cookie_enabled": "true",
"screen_width": "1536",
"screen_height": "864",
"browser_language": "zh-CN",
"browser_platform": "Win32",
"browser_name": "Chrome",
"browser_version": "124.0.0.0",
"browser_online": "true",
"engine_name": "Blink",
"engine_version": "124.0.0.0",
"os_name": "Windows",
"os_version": "10",
"cpu_core_num": "16",
"device_memory": "8",
"platform": "PC",
"downlink": "1.4",
"effective_type": "3g",
"round_trip_time": "600",
"webid": "7359041139830294068",
"msToken": "GRQrh9I42TzLMrowI1XorMyQl-eZ8PQEwRRspobtVRB5hH79C9WAFpgd_QvDF31Fi5c5gmN9Eelg_3LUfUavFkd7RPjCmGhxwlSiNRZTFimzLVeX_hcYyccy18CtRQ==",
# "a_bogus": "OjRhQD06di6sDD6h5IKLfY3q65q3Y07Q0trE/D2fYdfPGg39HMPP9exLA2svB2YjLT/AIeLjy4heO3aMiOInA3v6HSRKl2Ck-g00t-Pg5o4j5Hv9uyR0rtRF4kt4FeeM5iQ3xOssy7ccKSRZAIqe-wHvPjojx2f39gcK"
}
data = {
'params': params,
'ua': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
"user_token": 'test'
}
# 请求生成a_bogus的接口
ab_url = "http://82.156.83.156:5000/douyin_monitor/get_douyin_ab/" # 请求生产a_bogus的接口
response = requests.post(ab_url, json=data).json()
#
# 把生成的a_bogus加入到params中
print("生成参数成功a_bogus:", response['data'])
params["a_bogus"] = response['data']
# 请求抖音用户列表接口
response_douyin = requests.get(douyin_url, headers=headers, cookies=cookies, params=params)
# 解析请求出来的数据
data_list = response_douyin.json()
for douyin_data in data_list.get("aweme_list"):
product_id = douyin_data.get("aweme_id")
desc = douyin_data.get("desc")
print(product_id, desc)