我正在尝试从 Twitter 获取个人资料数据,但最近我注意到 Twitter 中的请求标头中有一个参数“x-client-transaction-id”,这就是我的脚本无法工作的原因,有人有吗想法如何获取参数“x-client-transaction-id”的值
我查看了源代码,似乎参数是在这里生成的:
function Nn(e) {
return async(n,t)=>{
if (!Bn.test(n.host))
return t(n);
const a = {
...n
};
if (e.isTrue("rweb_client_transaction_id_enabled")) {
const {method: e, path: t} = n;
try {
a.headers["X-Client-Transaction-Id"] = await async function(e, n) {
xn = xn || new Promise((e=>{
d.e("ondemand.s").then(d.bind(d, 71269)).then((n=>e(n.default())))
}
));
const t = await xn;
return await t(e, n)
}(function(e) {
return (e || "").split("?")[0].trim()
}(t), e)
} catch (e) {
a.headers["X-Client-Transaction-Id"] = btoa(`e:${e}`)
}
}
return t(a)
}
}
来自 https://abs.twimg.com/responsive-web/client-web/main.bfe3e92a.js.
也许你可以从那里继续。