Closed ahm750 closed 1 year ago
This is probably happening because the page doesn't load correctly. The easiest way to fix this is to increase the navigation_retries
parameter in the TikTokAPI constructor.
Specifically, TikTok inserts into every page a script element that contains all the preloaded data that's used to set the initial state of any page. TikToPy grabs this tag, which is what the wait_for_selector
is for. It just makes sure that the element is there.
Reasons the element may not be present:
In my experience, navigation retries bypass these issues after one or two.
As a side note, you'll probably need to make sure the second parameter in api.user
is an int not a string.
When I use the library I normally set retries to 1 or 2.
Please let me know if this helps!
Thanks! I tried passing the navigation_retries
parameter and changing the video count parameter to an int, but the same problem exists.
Is there any way to use a proxy with it? If so, how can I pass the proxy credentials? Couldn't find it anywhere in the docs.
Issue #11 asked about adding a proxy. I answered there as well as added an example in the docs for it. Check it out, and if it still isn't working, try running the API with headless=False. There may be some indicator on the page as to what's going on.
Update from #29 - proxy settings should actually work now
I'm trying to use this package to scrape user profiles and it returns the error below. Any reason why it's happening and how to fix it?
Here's my code: