networkdynamics / pytok

A web scraper for TikTok using Playwright
59 stars 6 forks source link

Errors in comment.py and user_example #5

Open ketanmalempati opened 8 months ago

ketanmalempati commented 8 months ago

I am getting the following error while running comment example.py

AssertionError: Locator expected to be visible
Actual value: None
Call log:
LocatorAssertions.to_be_visible with timeout 30000ms
waiting for locator("[data-e2e=comment-level-1]").first.or_(locator("Rotate the shapes").or_(get_by_text("Verify to continue:", exact=True)).or_(get_by_text("Click on the shapes with the same size", exact=True)).or_(get_by_text("Drag the slider to fit the puzzle", exact=True))).or_(get_by_text("Be the first to comment!", exact=True))

User example.py is giving this error

json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 2 column 5 (char 6)

bendavidsteel commented 8 months ago

Both of these examples are currently working for me! Unfortunately due to the nature of this library, errors will heavily vary by location and network conditions. I would encourage you to try debugging it yourself and see if you find a fix! As hints though: The comment example error is likely because the page didn't load in time, and the HTML you're getting from TikTok is different from the HTML I'm getting. And for the JSONDecodeErrror, it looks like the library received some kind of JSON that the default decoder couldn't decode. Try figuring out why that is!