pablouser1/tikscraper

Get data from TikTok API


README

A Wrapper for the TikTok API made with PHP

How to Use

$api = new \TikScraper\Api([
    'user_agent' => 'YOUR_CUSTOM_USER_AGENT_HERE',
    'cookie_path' => '/your/custom/path/here/tiktok.json', // Path to store TikTok's cookies, defaults to /tmp/tiktok.json
    'proxy' => 'http://user:password@hostname:port',
    'ms_token' => 'YOUR_CUSTOM_MS_TOKEN_HERE', // Custom msToken, sometimes useful when having issues getting data from TikTok
    // More info about signing below
    'signer' => [
        'method' => 'remote',
        'url' => 'http://localhost:8080/signature',
        'close_when_done' => true // ONLY FOR BROWSER SIGNING, set to true if you want to quit the browser after making the request (default true)
    ]
], $cacheEngine);

$hashtag = $api->hashtag('funny');
$hashtag->feed();

if ($hastag->ok()) {
    echo $hashtag->getFull()->toJson(true);
} else {
    print_r($hashtag->error());
}

Signing

For using TikScrapperPHP you need to use a signing service. There are multiple available:

Remote signing

This method involves using an external signer.

  • Set 'method' to remote
  • Set 'url' to the signing endpoint

Currently supported:

Browser

This method involves using a chromedriver instance.

You can also generate the documentation available using PHPDoc

Caching

TikScrapperPHP supports caching requests, to use it you need to implement CacheInterface.php

TODO

  • Search
  • Comments

Credits

  • @Sharqo78: Working TikTok downloader without watermark

HUGE thanks to the following projects, this wouldn't be possible without their help