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

fix: tiktok returned invalid reponse caused by bot detection #1197

Merged

Conversation

arhen
Copy link
Contributor

@arhen arhen commented Sep 24, 2024

This PR to solve the issues #1187 #1193 #1179 by simulating user movement using scrolling after open the page.

@anarchopythonista
Copy link
Contributor

anarchopythonista commented Oct 18, 2024

Some thoughts:

Could we get away from time.sleep with something like this:

await page.wait_for_load_state("networkidle")

I don't know playwright well enough to know if this would work. Currently, I'm working on getting an environment up to reproduce.

I also think

page.mouse.move(0, 0)
page.mouse.move(0, 100)

would make it fairly easy for TikTok to distinguish scrapers from legitimate desktop users. What are your thoughts on importing random and doing something like this:

x, y = 0, random.randint(0, 50)
a, b = random.randint(1, 50), random.randint(100, 200)

page.mouse.move(x, y)
page.mouse.move(a, b)

@arhen
Copy link
Contributor Author

arhen commented Nov 21, 2024

Some thoughts:

Could we get away from time.sleep with something like this:

await page.wait_for_load_state("networkidle")

I don't know playwright well enough to know if this would work. Currently, I'm working on getting an environment up to reproduce.

I also think

page.mouse.move(0, 0)
page.mouse.move(0, 100)

would make it fairly easy for TikTok to distinguish scrapers from legitimate desktop users. What are your thoughts on importing random and doing something like this:

x, y = 0, random.randint(0, 50)
a, b = random.randint(1, 50), random.randint(100, 200)

page.mouse.move(x, y)
page.mouse.move(a, b)

Yeah, sure. I'll add later. Thanks

@davidteather davidteather changed the base branch from main to v6.6.0 January 21, 2025 04:14
@davidteather
Copy link
Owner

Thank you! I'll add the updated code by @anarchopythonista and I found an alternative way to get around it but this will be more robust

@davidteather davidteather merged commit ccb0b1a into davidteather:v6.6.0 Jan 21, 2025
davidteather added a commit that referenced this pull request Jan 21, 2025
…ing (#1215)

* fix: unable to find byted acrawler
* fix: playwright timeout sessions with provide opt-out params when creating sessions (#1196)
* timeout: 300s -> 30s
* fix: tiktok returned invalid reponse by bot detection (#1197)
* chore: move wait for load state between mouse moves
* Update docstring for create_session() (#1202)
* Add playlist class (#1207)
* feat: add playlist class
* bump version, fix tests

---------

Co-authored-by: Rahmat Slamet <[email protected]>
Co-authored-by: brandon <[email protected]>
Co-authored-by: Lukas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants