Api
in package
TikTok API Class
Table of Contents
- API_BASE = "https://www.tiktok.com/node/"
- API Base url
- $_config : array<string|int, mixed>
- Config
- $cacheEnabled : bool
- If Cache is enabled
- $cacheEngine : object
- Cache Engine
- $defaults : array<string|int, mixed>
- Default config
- __construct() : void
- Class Constructor
- getChallenge() : object
- Challenge detail
- getChallengeFeed() : object
- Challenge Feed
- getMusic() : object
- Music detail
- getMusicFeed() : object
- Music feed
- getNoWatermark() : object
- Non watermarked video
- getNoWatermarkLegacy() : object
- Non watermarked video
- getTrendingFeed() : object
- Trending/ForYou Feed
- getUser() : object
- User detail
- getUserFeed() : object
- User Feed
- getVideoByID() : void
- Video by video id
- getVideoByUrl() : object
- Video by video url
- verify_fp() : void
- Verify Fingerprint Token
- failure() : void
- Failure? Huh?
- remote_call() : object
- Remote request
Constants
API_BASE
API Base url
public
string
API_BASE
= "https://www.tiktok.com/node/"
Properties
$_config
Config
private
array<string|int, mixed>
$_config
= []
$cacheEnabled
If Cache is enabled
private
bool
$cacheEnabled
= false
$cacheEngine
Cache Engine
private
object
$cacheEngine
$defaults
Default config
private
array<string|int, mixed>
$defaults
= ["user-agent" => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36', "proxy-host" => false, "proxy-port" => false, "proxy-username" => false, "proxy-password" => false, "cache-timeout" => 3600, "nwm_endpoint" => false, "api_key" => false]
Methods
__construct()
Class Constructor
public
__construct([array<string|int, mixed> $config = array() ][, bool $cacheEngine = false ]) : void
Parameters
- $config : array<string|int, mixed> = array()
-
API Config
- $cacheEngine : bool = false
Return values
void —getChallenge()
Challenge detail
public
getChallenge([string $challenge = "" ]) : object
Accepts challenge name and returns challenge detail object or false on failure
Parameters
- $challenge : string = ""
Return values
object —getChallengeFeed()
Challenge Feed
public
getChallengeFeed([string $challenge_name = "" ], int $maxCursor) : object
Accepts challenge name and returns challenge feed object or false on faliure
Parameters
- $challenge_name : string = ""
- $maxCursor : int
Return values
object —getMusic()
Music detail
public
getMusic([string $music_id = "" ]) : object
Accepts music ID and returns music detail object or false on failure
Parameters
- $music_id : string = ""
Return values
object —getMusicFeed()
Music feed
public
getMusicFeed([string $music_id = "" ], int $maxCursor) : object
Accepts music id and returns music feed object or false on failure
Parameters
- $music_id : string = ""
- $maxCursor : int
Return values
object —getNoWatermark()
Non watermarked video
public
getNoWatermark(string $url) : object
- Accepts video post url and returns non-watermarked video object or false on failure
- Uses musical.ly endpoint but may not last for long
Parameters
- $url : string
Return values
object —getNoWatermarkLegacy()
Non watermarked video
public
getNoWatermarkLegacy([string $url = "" ]) : object
Accepts video post url and returns non-watermarked video object or false on failure
Uses private API method as fallback
Parameters
- $url : string = ""
Return values
object —getTrendingFeed()
Trending/ForYou Feed
public
getTrendingFeed(int $maxCursor) : object
Accepts $maxCursor offset and returns trending video feed object or false on failure
Parameters
- $maxCursor : int
Return values
object —getUser()
User detail
public
getUser([string $username = "" ]) : object
Accepts tiktok username and returns user detail object or false on failure
Parameters
- $username : string = ""
Return values
object —getUserFeed()
User Feed
public
getUserFeed([string $username = "" ], int $maxCursor) : object
Accepts username and $maxCursor pagination offset and returns user video feed object or false on failure
Parameters
- $username : string = ""
- $maxCursor : int
Return values
object —getVideoByID()
Video by video id
public
getVideoByID([string $video_id = "" ]) : void
Accept video ID and returns video detail object or false on failure
Parameters
- $video_id : string = ""
Return values
void —getVideoByUrl()
Video by video url
public
getVideoByUrl([string $url = "" ]) : object
Accepts tiktok video url and returns video detail object or false on failure
Parameters
- $url : string = ""
Return values
object —verify_fp()
Verify Fingerprint Token
public
verify_fp() : void
Fingerprint structure has changed, will update this soon.
Or Never
Return values
void —failure()
Failure? Huh?
private
failure() : void
Be a man and accept the failure
Return values
void —remote_call()
Remote request
private
remote_call([string $url = "" ][, bool $isJson = true ][, mixed $headers = ['Referer: https://www.tiktok.com/foryou?lang=en'] ]) : object
Parameters
- $url : string = ""
- $isJson : bool = true
- $headers : mixed = ['Referer: https://www.tiktok.com/foryou?lang=en']