Closed TSW1133 closed 2 years ago
Hi there,
To get video info you should access a different endpoint. This repo is used just for signing the endpoint. Check this one if you want to access TikTok data.
Here's a node example to access video info.
const Signer = require("../../tiktok-signature");
const rp = require("request-promise");
const VIDEO_ID = "7069560015434173739";
const USER_AGENT =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36";
async function main() {
const signer = new Signer(null, USER_AGENT);
await signer.init();
const url = `https://m.tiktok.com/api/item/detail?itemId=${VIDEO_ID}&lang=&shareUid=recType=`;
const signature = await signer.sign(url);
const navigator = await signer.navigator();
await signer.close();
// console.log(signature);
// console.log(navigator);
const { signed_url: signedURL, x_tt_params: xTtParams } = signature;
const { user_agent: userAgent } = navigator;
const res = await testSignedUrl({ userAgent, xTtParams, signedURL });
console.log(res);
debugger;
}
async function testSignedUrl({ userAgent, xTtParams, signedURL }) {
const options = {
method: "GET",
headers: {
"user-agent": userAgent,
"x-tt-params": xTtParams,
},
uri: signedURL,
json: true,
};
return rp(options);
}
main();
uri: signedURL,
@carcabot, are we supposed to use the signed_url
the .sign()
produces? Your other example requires more than that, SEC_UID
, msToken
, and X-Bogus
that you manually obtained, and uses some weird static URL instead of the signed_url
. Which is the latest, working method?
我如何部署这个算法,对我想要的视频进行采集信息