|
| 1 | + |
| 2 | +# Unofficial TikTok API Wrapper in Python |
| 3 | + |
| 4 | +This is an unofficial TikTok Api python wrapper. I have an App using this API, and thus will constantly keep updating this wrapper |
| 5 | +This implementation is inspired by [TikTokApi](https://github.com/davidteather/TikTok-Api/), but runs faster. |
| 6 | + |
| 7 | + |
| 8 | +## Table of Contents |
| 9 | +- [Getting Started](#getting-started) |
| 10 | + - [Installing](#installing) |
| 11 | +- [Quick Start Guide](#quick-start-guide) |
| 12 | +- [Detailed Documentation](#detailed-documentation) |
| 13 | + - [Methods](#methods) |
| 14 | + - [TikTok Class](#tiktok-class) |
| 15 | + - [Get Trending Videos](#get-trending) |
| 16 | + - [Get User](#get-user) |
| 17 | + - [Get Videos By UserName](#get-videos-by-username) |
| 18 | + - [Get Likes By UserName](#get-likes-by-username) |
| 19 | + - [Get HashTag](#get-hashtag) |
| 20 | + - [Get Videos By HashTag](#get-videos-by-hashtag) |
| 21 | + - [Get Music](#get-music) |
| 22 | + - [Get Music By UserName](#get-videos-by-music) |
| 23 | + - [Get Video By Id](#get-video-by-id) |
| 24 | +- [Built With](#built-with) |
| 25 | +- [Authors](#authors) |
| 26 | +- [License](#license) |
| 27 | + |
| 28 | +## Getting Started |
| 29 | + |
| 30 | +To get started using this API, follow the instructions below. |
| 31 | + |
| 32 | +### Installing |
| 33 | +``` |
| 34 | +git clone https://github.com/avilash/TikTokAPI-Python.git |
| 35 | +python setup.py install |
| 36 | +``` |
| 37 | + |
| 38 | +## Quick Start Guide |
| 39 | +Get the most trending Videos on TikTok |
| 40 | +``` |
| 41 | +api = TikTokAPI() |
| 42 | +retval = api.getTrending(count=5) |
| 43 | +``` |
| 44 | +Get a user by name |
| 45 | +``` |
| 46 | +api = TikTokAPI() |
| 47 | +user_obj = api.getUserByName("fcbarcelona") |
| 48 | +``` |
| 49 | +Get videos of a user |
| 50 | +``` |
| 51 | +api = TikTokAPI() |
| 52 | +user_videos = api.getVideosByUserName("fcbarcelona") |
| 53 | +``` |
| 54 | +Get likes of a user |
| 55 | +``` |
| 56 | +api = TikTokAPI() |
| 57 | +user_videos = api.getLikesByUserName("fcbarcelona") |
| 58 | +``` |
| 59 | + |
| 60 | +## Detailed Documentation |
| 61 | +This section contains details about the parameters of each function and what it returns |
| 62 | + |
| 63 | +### Methods |
| 64 | + |
| 65 | +#### Tiktok Class |
| 66 | +Inputs |
| 67 | +* language - Self explanatory |
| 68 | +* region - Self explanatory |
| 69 | +* cookie - The TikTok Cookie containing the parameter <em>s_v_web_id</em>. If not provided, the parameter will be generated. |
| 70 | + |
| 71 | +```buildoutcfg |
| 72 | +__init__(self, language='en', region='IN', cookie=None) |
| 73 | +``` |
| 74 | + |
| 75 | +#### Get Trending |
| 76 | +Inputs |
| 77 | +* count - Number of videos to fetch |
| 78 | + |
| 79 | +```buildoutcfg |
| 80 | +getTrending(self, count=30) |
| 81 | +``` |
| 82 | + |
| 83 | +#### Get User |
| 84 | +Inputs |
| 85 | +* user_name - Username, eg - <em>fcbarcelona</em> |
| 86 | + |
| 87 | +```buildoutcfg |
| 88 | +getUserByName(self, user_name) |
| 89 | +``` |
| 90 | + |
| 91 | +#### Get Videos By Username |
| 92 | +Inputs |
| 93 | +* user_name - Username, eg - <em>fcbarcelona</em> |
| 94 | +* count - Number of videos to fetch |
| 95 | + |
| 96 | +```buildoutcfg |
| 97 | +getVideosByUserName(self, user_name, count=30) |
| 98 | +``` |
| 99 | + |
| 100 | +#### Get Likes By Username |
| 101 | +Inputs |
| 102 | +* user_name - Username, eg - <em>fcbarcelona</em> |
| 103 | +* count - Number of videos to fetch |
| 104 | + |
| 105 | +```buildoutcfg |
| 106 | +getLikesByUserName(self, user_name, count=30) |
| 107 | +``` |
| 108 | + |
| 109 | +#### Get Hashtag |
| 110 | +Inputs |
| 111 | +* hashTag - HashTag, eg - <em>#fcbarcelona</em> |
| 112 | + |
| 113 | +```buildoutcfg |
| 114 | +getHashTag(self, hashTag) |
| 115 | +``` |
| 116 | + |
| 117 | +#### Get Videos By Hashtag |
| 118 | +Inputs |
| 119 | +* hashTag - HashTag, eg - <em>#fcbarcelona</em> |
| 120 | +* count - Number of videos to fetch |
| 121 | + |
| 122 | +```buildoutcfg |
| 123 | +getVideosByHashTag(self, hashTag, count=30) |
| 124 | +``` |
| 125 | + |
| 126 | +#### Get Music |
| 127 | +Inputs |
| 128 | +* music_id - Music Id, eg - <em>6704854531001289474</em> |
| 129 | + |
| 130 | +```buildoutcfg |
| 131 | +getMusic(self, music_id) |
| 132 | +``` |
| 133 | + |
| 134 | +#### Get Videos By Music |
| 135 | +Inputs |
| 136 | +* music_id - Music Id, eg - <em>6704854531001289474</em> |
| 137 | +* count - Number of videos to fetch |
| 138 | + |
| 139 | +```buildoutcfg |
| 140 | +getVideosByMusic(self, music_id, count=30) |
| 141 | +``` |
| 142 | + |
| 143 | +#### Get Video By Id |
| 144 | +Inputs |
| 145 | +* video_id - VIdeo Id, eg - <em>6843481669886954757</em> |
| 146 | + |
| 147 | +```buildoutcfg |
| 148 | +getVideoById(self, video_id) |
| 149 | +``` |
| 150 | + |
| 151 | +## Built With |
| 152 | + |
| 153 | +* [Python 3.7](https://www.python.org/) |
| 154 | + |
| 155 | +## Authors |
| 156 | + |
| 157 | +* **Avilash Kumar** - [avilash](https://github.com/avilash) |
| 158 | + |
| 159 | +## License |
| 160 | + |
| 161 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details |
| 162 | + |
0 commit comments