This is a PHP implementation for scraping Tiktok (or Musically) through API.
PHP 7.3 is required
getUser($uid)Returns user profile data.$uidis a user's Tiktok unique id.getUserVideos($uid)Returns a list of user videos.$uidis a user's Tiktok unique id.searchUser($keyword)Returns user search results.getVideo($uid)Returns a video datails.$uidis a video Tiktok unique id.searchHashtags($keyword)Returns a list of found hashtags.getHashtagMedia($uid)Returns a list of videos for a certain hashtag.$uidis a hashtag Tiktok unique id.
Your contribution is welcome!
In order to use and make requests to Tiktok API, some extra device parameters are needed. These parameters should be extracted from your mobile phone by using a man in the middle proxy. I used PacketCapture for Android, you may use any proxy application you like. Grab the following parameters: device_id, iid, openudid.
- Install commposer packages in the root of the project.
composer install - Run
php demo.phpto see the results
- Before runing tests you should modify and set correct environment variables
tests/bootstrap.php. - Do not commit
tests/bootstrap.phpafter your changes.