Closed stolenvw closed 1 year ago
These errors should no longer appear in version 0.2.2. The first error was because I tried to iterate over something that could be None before checking if it is actually None. The second is a byproduct of not raising StopIteration at the correct time and the occasional credentials issue. This second one spits out a warning now in case it happens again, telling you to try again if you believe it should be able to continue iteration.
hmmm, this is the start of code i use. By my thinking it should not be trying to iterate over something when i am telling it to only get 1. But guessing it has to do some iterating to get to that one video.
warning should be fine (hoping it dont happen alot and flood logs)
async with AsyncTikTokAPI(navigation_retries=1) as api:
user = await api.user(i.username, video_limit=1)
async for video in user.videos:
The way it works is that it has to grab videos from TikTok's API, which it does in bulk. It throws out any videos you don't want (set by the video_limit). It does some extra stuff on these bulk videos, which includes some iteration. This was where the TypeError came up.
You can suppress warnings of a specific type, in the case for tiktokapipy, the warning type is TikTokAPIWarning.
It's worth noting that if you're only getting one video, it's possible that no video will actually get fetched if the erroneous situation comes up. This error is suppressed, so it won't break anything, but you'll see that the async for loop won't actually run on anything.
Im okay with the loop not running on things now and then, right now its checking every 10min for new videos from 2 users, first thing i do in the async for loop is to check the video.id against the stored video.id from the last video from that user i got.
TypeError: 'NoneType' object is not iterable
seems to be happening on video comments as well.
All of these issues should be fixed in 0.2.4. Closing as complete.
tiktokapipy==0.2.1 playwright==1.32.1 pydantic==2.0.2 pydantic_core==2.1.2
Error 1. Only seen this one happen 3 times in past 9 hours
Error 2. This one has happened 72 times in past 9 hours