Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TikTokApi response breaks tool #28

Closed
GalenReich opened this issue Feb 19, 2024 · 7 comments · Fixed by #30
Closed

TikTokApi response breaks tool #28

GalenReich opened this issue Feb 19, 2024 · 7 comments · Fixed by #30
Labels
bug Something isn't working

Comments

@GalenReich
Copy link
Contributor

GalenReich commented Feb 19, 2024

The TikTok API initially returns a Warning, and then Errors with an unexpected status code 10201, resulting in no posts found:

2024-02-19 11:22:02 WARNING | Encountered error None -> TikTok returned an empty response when fetching data, retrying in headed mode

2024-02-19 11:22:12,695 - TikTokApi.tiktok - ERROR - Got an unexpected status code: {'log_pb': {'impr_id': '###'}, 'statusCode': 10201, 'statusMsg': '', 'status_code': 10201, 'status_msg': ''}

2024-02-19 11:22:12,695 - TikTokApi.tiktok - ERROR - Got an unexpected status code: {'log_pb': {'impr_id': '###'}, 'statusCode': 10201, 'statusMsg': '', 'status_code': 10201, 'status_msg': ''}

2024-02-19 11:22:12 ERROR | Got an unexpected status code: {'log_pb': {'impr_id': '###'}, 'statusCode': 10201, 'statusMsg': '', 'status_code': 10201, 'status_msg': ''}

2024-02-19 11:22:12 WARNING | No posts were found for the hashtag: winter

2024-02-19 11:22:12 INFO | Scraped 0 new posts containing the hashtag 'winter', with 0 posts previously scraped

The None -> TikTok returned an empty response error is discussed variously here: davidteather/TikTok-Api#1090 davidteather/TikTok-Api#1097 davidteather/TikTok-Api#1104

Error 10201 is discussed here and may be "invalid entity or invalid parameter". Another post suggests it is related to CAPTCHA.

This is probably the same error as davidteather/TikTok-Api#1069 but running in headed mode (which happens automatically in this tool) does not seem to solve the issue.

@GalenReich GalenReich added the bug Something isn't working label Feb 19, 2024
@GalenReich GalenReich changed the title Call to TikTokApi returns unexpected status code TikTokApi response breaks tool Feb 19, 2024
@andre-santos1
Copy link

Same here. Any solutions?

@PwccaCode
Copy link

Any updates to this?

@GalenReich
Copy link
Contributor Author

Judging from the content of the other issues it looks like it may be a result of running in headless mode (i.e. no browser opens up while the tool is running).

Adding the --headed flag may cause it to work, I would be interested to know if it works for you both?

@PwccaCode
Copy link

problem is count = 1000

tiktok new limit to count is 35 change and it works

@GalenReich
Copy link
Contributor Author

Interesting! Does passing --limit 35 as a command line argument fix it for you?

@GalenReich
Copy link
Contributor Author

It fixes it for me, I'm going to suggest changing the default to limit=35 for now.

We should look to add pagination of results, or some date-based bifurcation once #29 is addressed.

trislee added a commit to trislee/TikTok-Api that referenced this issue Mar 11, 2024
TikTok appears to have limited the number of posts that can be returned for a single hashtag search to 35 (e.g. bellingcat/tiktok-hashtag-analysis#28).

Similar to how the `User.liked` method works, I set the batch size to 35 videos per request.
@trislee
Copy link
Contributor

trislee commented Mar 11, 2024

This PR (davidteather/TikTok-Api#1126) for the TikTokApi scraper should fix this issue, but in the meantime I'll approve Galen's fix.

davidteather pushed a commit to davidteather/TikTok-Api that referenced this issue Apr 12, 2024
TikTok appears to have limited the number of posts that can be returned for a single hashtag search to 35 (e.g. bellingcat/tiktok-hashtag-analysis#28).

Similar to how the `User.liked` method works, I set the batch size to 35 videos per request.
davidteather added a commit to davidteather/TikTok-Api that referenced this issue Apr 12, 2024
* Add 'executable_path' field to the 'api.create_sessions()' method (#1136)
* Fixed retries loop (#1133)
* Add option to select which browser playwright uses (#1129)
* add browser selection option to create_sessions method
* fix spelling typo

---------

Co-authored-by: David Teather <[email protected]>

* Update hashtag.py (#1126)

TikTok appears to have limited the number of posts that can be returned for a single hashtag search to 35 (e.g. bellingcat/tiktok-hashtag-analysis#28).

Similar to how the `User.liked` method works, I set the batch size to 35 videos per request.

* add executable path to str

* bump ver

---------

Co-authored-by: kkordik <[email protected]>
Co-authored-by: ekorian <[email protected]>
Co-authored-by: Will Howes <[email protected]>
Co-authored-by: Tristan Lee <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants