An open API service indexing awesome lists of open source software.

https://github.com/mubtasimf443/lib-tiktok-api-npm-package

lib-tiktok-api is a npm package what is use for handling tiktok apis from nodejs
https://github.com/mubtasimf443/lib-tiktok-api-npm-package

javascript-library nodejs tiktok tiktok-api tiktok-apis tiktok-tool tiktokbot

Last synced: 8 months ago
JSON representation

lib-tiktok-api is a npm package what is use for handling tiktok apis from nodejs

Awesome Lists containing this project

README

          

this is a npm package for handling tiktok api's

## Get Started

```
let tiktok=new Tiktok({
key :TIKTOK_KEY,
secret:TIKTOK_SECRET,
redirect_uri :TIKTOK_REDIRECT_URI,
scope :['user.info.basic','video.upload','video.publish']
})

```

## Auth with tiktok-api

#### First get a auth url for authentication
```
app.get('/auth',async function (req,res){
return res.redirect(tiktok.getAuthUrl());
});

```

#### get access token and refresh token

```
app.get('/callback',async function (req,res){
let {access_token,refresh_token}=await tiktok.getAccessToken(req.query.code);
})
```

### Tiktok video upload

#### init video upload to inbox
```
let Account=new tiktok.Account("" ,'');
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;

#### upload video directly

```
let Account=new tiktok.Account(access_token ,refresh_token);
let response =await Account.postTiktokFromUrl({
video_url :'',
privacy_level :'SELF_ONLY',
title :"',
video_cover_timestamp_ms : 1000 // optional
})

```

#### upload images to tiktok

```
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"
})

```

#### get user info

```
let Account=new tiktok.Account(access_token ,refresh_token);
let data=await Account.getUserInfo()

```

#### get new access token

```
let 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***


  1. Github Profile

  2. X twitter

  3. Facebook

  4. Upwork

  5. +8801750147694