this is a npm package for handling tiktok api's
let tiktok=new Tiktok({
key :TIKTOK_KEY,
secret:TIKTOK_SECRET,
redirect_uri :TIKTOK_REDIRECT_URI,
scope :['user.info.basic','video.upload','video.publish']
})
app.get('/auth',async function (req,res){
return res.redirect(tiktok.getAuthUrl());
});
app.get('/callback',async function (req,res){
let {access_token,refresh_token}=await tiktok.getAccessToken(req.query.code);
})
let Account=new tiktok.Account("<access_token>" ,'<refresh_token>');
let data=await Account.initVideoOnInbox('https://gojushinryu.com/video-for-download');
access_token is required in the new tiktok.Account and refresh_token is not requied ,
refresh_token is only required when using Account.updateTokens api;
let Account=new tiktok.Account(access_token ,refresh_token);
let response =await Account.postTiktokFromUrl({
video_url :'<VIDEO_URL>',
privacy_level :'SELF_ONLY',
title :"<VIDEO_CAPTION>',
video_cover_timestamp_ms : 1000 // optional
})
let Account=new tiktok.Account(access_token ,refresh_token);
let post_id= await Account.uploadImages({
images:["https://tiktokcdn.com/obj/example-image-01.webp","https://tiktokcdn.com/obj/example-image-02.webp"],
caption :"this will be a #funny photomode on your @tiktok #fyp"
})
let Account=new tiktok.Account(access_token ,refresh_token);
let data=await Account.getUserInfo()
let TIKTOK_KEY="<TIKTOK_KEY>";
let Account=new tiktok.Account(access_token ,refresh_token);
let data=await Account.updateTokens({app_key});
Follow ME I will be very happy if you support me by following me or offering me a job
- Github Profile
- X twitter
- Upwork
- +8801750147694