RobertGrubb / tiktok-php

TikTok scraper in PHP
MIT License
63 stars 21 forks source link

Your API not working getting these errors all the time #15

Closed sarabhi92git closed 4 years ago

sarabhi92git commented 4 years ago

Array ( [error] => 1 [message] => Status code 0 was returned ) Array ( [error] => 1 [message] => Unable to retrieve NEXT_DATA from DOM )

Please check :)

RobertGrubb commented 4 years ago

May I please have a few more specifics? On what methods is this happening, etc.

Thank you!

sarabhi92git commented 4 years ago

None of the methods is working in the API. For your reference, I have checked this again but unfortunately not working. Please check below:

$scraper->user->search('tiktok', 30); $scraper->user->details('tiktok'); $scraper->user->videos('tiktok', 10); $scraper->user->allVideos('tiktok'); $scraper->trending->videos(25);

I have checked on both condition 'signMethod' => 'node' // Or datafetch In each method, I am getting the same error. Please check at your end! Thank you!

RobertGrubb commented 4 years ago

Very interesting,

I've checked again on my end, and all methods are working as intended. Do you have the option of trying a proxy? You can set it by the following (This is a real public proxy you can use for this test):

[
  'proxy' => [
    'address' => '69.162.88.174:5836'
  ]
]

Let me know what it returns. I'm simply trying to figure out if the issue is where the request is coming from, or from the signing layer.

Thanks!

sarabhi92git commented 4 years ago

Okay, I am just checking it on my end and update you soon.

I have one question, how can I add local proxy on each request.

sarabhi92git commented 4 years ago

I got the same error after using your proxy. This was the code executed:

`<?php

require '../../../../vendor/autoload.php'; require_once DIR . '/../src/TikTok.php';

use TikTok\Scraper;

$scraper = new Scraper([ 'proxy' => [ 'protocol' => 'http', 'address' => '69.162.88.174:5836', 'auth' => 'username:password' ], 'timeout' => 20 ]);

try { $data = $scraper->user->details('tiktok'); if ($scraper->error) print_r($scraper->error);

print_r($data); } catch (Exception $e) { echo $e->getMessage() . PHP_EOL; }`

sarabhi92git commented 4 years ago

Using your Proxy and signmethod as datafetch, it is working but taking too much time to get response. But it working only in getting user information and not working on fetching user's videos.

Using signmethod as node doesn't work anymore.

RobertGrubb commented 4 years ago

I will check up on all of this later today and see what I can find. May I ask just a generalized location from where you're sending your requests from? (If it's from your machine, what country, if it's from a server, what country is it hosted in?)

Knowing that information would allow me to find a proxy in the same area, and debug it thoroughly.

Thanks again.

sarabhi92git commented 4 years ago

The request was sent from India and server is AWS cloud India Location

RobertGrubb commented 4 years ago

Okay, I'll be looking into this a little more. It is VERY possible that TikTok is blocking the requests somehow from their end depending on where it's coming from. I'm going to close this for now, but you can watch the repo for any upcoming changes.