ssovit / tiktok-private-api
This package is abandoned and no longer maintained.
No replacement package was suggested.
Unofficial TikTok Private API for PHP
1.0.7
2022-08-10 09:55 UTC
Requires
- guzzlehttp/guzzle: ^6.5 || ^7.0
README
API Wrapper for private API access
Installation
Via composer composer require ssovit/tiktok-private-api
How does this work?
Monthly subscription of my private API server is required for this to function. See below.
Documentation
https://ssovit.github.io/TikTok-Private-API-PHP/
Usage
Follow examples in /example
directory
$api=new \Sovit\TikTokPrivate\Api(array(/* config array*/)); $trendingFeed=$api->getForYou($maxCursor=0); $userData=$api->getUser("USERNAME"); $userFeed=$api->getUserFeed("USER_ID",$maxCursor=0); $challenge=$api->getChallenge("CHALLENGE_ID"); $challengeFeed=$api->getChallengeFeed("CHALLENGE_ID",$maxCursor=0); $musc=$api->getMusic("6798898508385585925"); $musicFeed=$api->getMusicFeed("6798898508385585925",$maxCursor=0); $videoData=$api->getVideoByID("6829540826570296577"); $videoData=$api->getVideoByUrl("https://www.tiktok.com/@zachking/video/6829303572832750853"); // More to come
Available Options
$api=new \Sovit\TikTokPrivate\Api(array( "proxy" => '', // proxy in url format like http://username:password@host:port "cache_timeout" => 3600 // 1 hours cache timeout "transform_result" => true, // false if you want to get json without transforming it to more readable JSON structure "api_key" => "API_KEY" // see below on how to get API key ), $cache_engine=false);
Cache Engine
You can build your own engine that will store and fetch cache from your local storage to prevent frequent requests to TikTok server. This can help being banned from TikTok server for too frequent requests.
Cache engine should have callable get
and set
methods that the API class uses
// Example using WordPress transient as cache engine Class MyCacheEngine{ function get($cache_key){ return get_transient($cache_key); } function set($cache_key,$data,$timeout=3600){ return set_transient($cache_key,$data,$timeout); } }
Usage
$cache_engine=new MyCacheEngine(); $api=new \Sovit\TikTokPrivate\Api(array(/* config array*/),$cache_engine);
Available methods
getForYou
- Get trending feedgetForYou($maxCursor)
getUser
- Get profile data for TikTok UsergetUser($username)
getUserFeed
- Get user feed by IDgetUserFeed($user_id,$maxCursor)
getChallenge
- Get challenge/hashtag infogetChallenge($challenge)
getChallengeFeed
- Get challenge feed by IDgetChallengeFeed($challenge_id, $maxCursor)
getMusic
- Get music infogetMusic($music_id)
getMusicFeed
- Get music feedgetMusicFeed($music_id,$maxCursor)
getVideoByID
- Get video by IDgetVideoByID($video_id)
getVideoByUrl
- Get video by URLgetVideoByUrl($video_url)
- not all methods are documented, will update when I am free
$maxCursor
defaults to0
, and is offset for results page.maxCursor
for next page is exposed on current page call feed data.
Pirvate API server subscription pricing
No Longer Available