前言
x_bogus或a_bogus算法大概是对数据、ua、时间戳、浏览器的几个指纹进行计算,拿到一个110位大数组,然后转字符,在头部再添加十二位随机字符,再进行魔改的base64加密。
问:抖音的x_bogus、a_bogus值有什么用?
1.抖音所有数据的校验都离不开x_bogus、a_bogus。
2.抖音作为最大的短视频平台他的数据是十分多且有用的。
3.获取批量抖音的数据,例如评论、无水印视频、弹幕监听、直播间抢货等。
在浏览器按f12可找到搜索接口地址。
一、接口地址:
api_url=`https://www.douyin.com/aweme/v1/web/search/item/?device_platform=webapp&aid=6383&channel=channel_pc_web&search_channel=aweme_video_web&sort_type=${sort_type}&publish_time=${publish_time}&keyword=${keyword}&search_source=switch_tab&query_correct_type=1&is_filter_search=${is_filter_search}&from_group_id=&offset=${offset}&count=10&pc_client_type=1&version_code=170400&version_name=17.4.0&cookie_enabled=true&screen_width=1536&screen_height=864&browser_language=zh-CN&browser_platform=Win32&browser_name=Chrome&browser_version=114.0.0.0&browser_online=true&engine_name=Blink&engine_version=114.0.0.0&os_name=Windows&os_version=10&cpu_core_num=8&device_memory=8&platform=PC&downlink=0.3&effective_type=2g&round_trip_time=1600&webid=7119735414450456103&msToken=${msToken}`;
二、参数说明
0、搜索结果按页返回,每页有10个视频
1、offset
搜索分页的偏移;0为第一页,10为二页,20第三页。
2、search_id
第二页还需要带上search_id参数;search_id由上一页返回。
3、sort_type
搜索结果排序
排序说明:
综合排序
sort_type=0
最新发布
sort_type=2
最多点赞
sort_type=1
4、publish_time
按发布时间过滤条件
不限
publish_time=0
一天内
publish_time=1
一周内
publish_time=7
半年内
publish_time=182
三、完整源代码
//----------------------------------------------模块初始化----------------------------------------------------
const User_Agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
const fs = require("fs");
const cookie= fs.readFileSync("./cookie.txt").toString('utf8');
//console.log(cookie);
let msToken="";
const https = require('node:https');
exports.get_search_data=get_search_data;
//----------------------------------------------调用模块初始化----------------------------------------------------
//技术支持:byc6