This is an unofficial TikTok Api python wrapper. I have an App using this API, and thus will constantly keep updating this wrapper
This implementation is inspired by TikTokApi, but runs faster.
To get started using this API, follow the instructions below.
Pip
pip install PyTikTokAPI
Install from source
git clone https://github.com/avilash/TikTokAPI-Python.git
python setup.py install
Import
from TikTokAPI import TikTokAPI
Get your keys from Cookie. You can get them from the Applications tab in Chrome developer console.
By default it used hardcoded values which may not work after some time.
The keys to extract are s_v_web_id
and tt_webid
cookie = {
"s_v_web_id": "<your_key>",
"tt_webid": "<your_key>"
}
Get the most trending Videos on TikTok
api = TikTokAPI(cookie=cookie)
retval = api.getTrending(count=5)
Get a user by name
api = TikTokAPI(cookie=cookie)
user_obj = api.getUserByName("fcbarcelona")
Get videos of a user
api = TikTokAPI(cookie=cookie)
user_videos = api.getVideosByUserName("fcbarcelona")
Get likes of a user
api = TikTokAPI(cookie=cookie)
user_videos = api.getLikesByUserName("fcbarcelona")
This section contains details about the parameters of each function and what it returns
Inputs
__init__(self, language='en', region='IN', cookie=None)
Inputs
getTrending(self, count=30)
Inputs
getUserByName(self, user_name)
Inputs
getVideosByUserName(self, user_name, count=30)
Inputs
getLikesByUserName(self, user_name, count=30)
Inputs
getHashTag(self, hashTag)
Inputs
getVideosByHashTag(self, hashTag, count=30)
Inputs
getMusic(self, music_id)
Inputs
getVideosByMusic(self, music_id, count=30)
Inputs
getVideoById(self, video_id)
Inputs
downloadVideoById(self, video_id, save_path)
Inputs
downloadVideoByIdNoWatermark(self, video_id, save_path)
This project is licensed under the MIT License - see the LICENSE file for details