Unofficial API wrapper for TikTok
This project is no longer maintained.
A reverse-engineered implementation of the TikTok (previously musical.ly) app's API.
npm i tiktok-api…Authenticates you with the API and stores your session data in a cookie jar. Subsequent requests will include these cookies.
api.loginWithEmail('', '')
.then(res => console.log(res.data))
.catch(console.log)
// Outputs:
// { email: '', session_key: '123456', user_id: '123456', ... }
See the login types for the response data.
Authenticates you with the API and stores your session data in a cookie jar. Subsequent requests will include these cookies.
api.loginWithUsername('', '')
.then(res => console.log(res.data))
.catch(console.log)
// Outputs:
// { username: '', session_key: '123456', user_id: '123456', ... }
See the login types for the response data.
Gets a user's profile.
api.getUser('')
.then(res => console.log(res.data.user))
.catch(console.log);
// Outputs:
// { aweme_count: 1000, nickname: 'example', unique_id: 'musername', ... }
See the user types for the response data.
Searches for users.
api.searchUsers({
keyword: 'example',
count: 10,
cursor: 0,
})
.then(res => console.log(res.data.user_list))
.catch(console.log);
// Outputs:
// [{ user_info: {...}, position: [], uniqposition: [] }, ...]
See the search types for the complete request/response objects.
Gets the QR code for a user.
api.getQRCode('')
.then(res => console.log(res.data.qrcode_url.url_list[0]))
.catch(console.log);
// Outputs:
// 'http://p16.muscdn.com/img/musically-qrcode/1111111111111111111~c5_720x720.image'
See the QR code types for the complete request/response objects.
Gets a post.
api.getPost('')
.then(res => console.log(res.data.aweme_detail))
.catch(console.log);
// Outputs:
// { author: {...}, aweme_id: '999', desc: 'description', music: {...}, statistics: {...}, video: {...}, ... }
See the post types for the complete response object.
Lists a user's posts.
api.listPosts({
user_id: '',
max_cursor: 0,
})
.then(res => console.log(res.data.aweme_list))
.catch(console.log);
// Outputs:
// [{ author: {...}, aweme_id: '999', desc: 'description', music: {...}, statistics: {...}, video: {...} }, ...]
See the post types for the complete request/response objects.
Lists the users that follow the specified user.
api.listFollowers({
user_id: '',
max_time: Math.floor(new Date().getTime() / 1000),
})
.then(res => console.log(res.data.followers))
.catch(console.log);
// Outputs:
// [{ unique_id: 'follower1' }, { unique_id: 'follower2' }, ...]
See the follower types for the complete request/response objects.
Lists the users that the specified user follows.
api.listFollowing({
user_id: '',
max_time: Math.floor(new Date().getTime() / 1000),
})
.then(res => console.log(res.data.followings))
.catch(console.log);
// Outputs:
// [{ unique_id: 'following1' }, { unique_id: 'following2' }, ...]
See the following types for the complete request/response objects.
Follows a user.
api.follow('')
.then(res => console.log(res.data.follow_status))
.catch(console.log);
// Outputs:
// 1
See the follow types for the response data.
Stops following a user.
api.unfollow('')
.then(res => console.log(res.data.follow_status))
.catch(console.log);
// Outputs:
// 0
See the follow types for the response data.
Lists the users that have requested to follow the logged in user.
api.listReceivedFollowRequests({
max_time: Math.floor(new Date().getTime() / 1000),
count: 10,
})
.then(res => console.log(res.data.request_users))
.catch(console.log);
// Outputs:
// [{ unique_id: 'user1' }, { unique_id: 'user2' }, ...]
See the follow types for the complete request/response objects.
Approves a user's request to follow you.
api.approveFollowRequest('')
.then(res => console.log(res.data.approve_status))
.catch(console.log);
// Outputs:
// 0
See the follow types for the response data.
Rejects a user's request to follow you.
api.rejectFollowRequest('')
.then(res => console.log(res.data.reject_status))
.catch(console.log);
// Outputs:
// 0
See the follow types for the response data.
Likes a post.
api.likePost('')
.then(res => console.log(res.data.is_digg))
.catch(console.log);
// Outputs:
// 1
Unlikes a post.
api.unlikePost('')
.then(res => console.log(res.data.is_digg))
.catch(console.log);
// Outputs:
// 0
Lists comments for a post.
api.listComments({
aweme_id: '',
cursor: 0,
})
.then(res => console.log(res.data.comments))
.catch(console.log);
// Outputs:
// [{ text: 'first!', user: {...} }, { text: 'second!', user: {...} }, ...]
See the comment types for the response data.
Comments on a post.
api.postComment('', 'first!')
.then(res => console.log(res.data.comment))
.catch(console.log);
// Outputs:
// { cid: '', text: 'first!', user: {...}, ... }
See the comment types for the response data.
Lists popular categories/hashtags.
api.listCategories({
count: 10,
cursor: 0,
})
.then(res => console.log(res.data.category_list))
.catch(console.log);
// Outputs:
// [{ { challenge_info: { cha_name: 'posechallenge', cid: '123' }, desc: 'Trending Hashtag' }, ...]
See the category types for the complete request/response objects.
Searches for hashtags.
api.searchHashtags({
keyword: 'example',
count: 10,
cursor: 0,
})
.then(res => console.log(res.data.challenge_list))
.catch(console.log);
// Outputs:
// [{ challenge_info: {...}, position: [] }, ...]
See the search types for the complete request/response objects.
Lists posts in a hashtag.
api.listPostsInHashtag({
ch_id: '',
})
.then(res => console.log(res.data.aweme_list))
.catch(console.log);
// Outputs:
// [{ author: {...}, aweme_id: '999', desc: 'description', music: {...}, statistics: {...}, video: {...} }, ...]
See the hashtag types for the complete request/response objects.
Lists posts in the For You feed.
api.listForYouFeed()
.then(res => console.log(res.data.aweme_list))
.catch(console.log);
// Outputs:
// [{ author: {...}, aweme_id: '999', desc: 'description', music: {...}, statistics: {...}, video: {...} }, ...]
See the feed types for the complete request/response objects.
Lists posts in the Following feed.
api.listFollowingFeed()
.then(res => console.log(res.data.aweme_list))
.catch(console.log);
// Outputs:
// [{ author: {...}, aweme_id: '999', desc: 'description', music: {...}, statistics: {...}, video: {...} }, ...]
See the feed types for the complete request/response objects.
Gets information about a sticker/effect.
api.getSticker('')
.then(res => console.log(res.data.sticker_infos))
.catch(console.log);
// Outputs:
// [{ id: '100000', name: 'cloned', owner_nickname: 'Effect Assistant', ...}]
See the sticker types for the complete response object.
Gets information about many stickers/effects.
api.getStickers(['', ''])
.then(res => console.log(res.data.sticker_infos))
.catch(console.log);
// Outputs:
// [{ id: '100000', name: 'cloned', owner_nickname: 'Effect Assistant', ...}, ...]
See the sticker types for the complete response object.
Lists posts that use a sticker/effect.
api.listPostsBySticker({
count: 20,
cursor: 0,
sticker_id: '100000',
})
.then(res => console.log(res.data.aweme_list))
.catch(console.log);
// Outputs:
// [{ author: {...}, aweme_id: '999', desc: 'description', music: {...}, statistics: {...}, video: {...} }, ...]See the sticker types for the complete request/response object.
Joins a live stream.
The rtmp_pull_url value can be used with VLC's Open Network Stream option.
api.joinLiveStream('')
.then(res => console.log(res.data.room))
.catch(console.log);
// Outputs:
// { create_time: 1000000000, owner: {...}, stream_url: {...}, title: 'Example', user_count: 1000, ... }
See the live stream types for the response data.
Leaves a live stream.
api.leaveLiveStream('')
.then(res => console.log(res.data.status_code))
.catch(consoleNo open issues yet, or sync has not completed.