-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[BUG] seeing 2 different errors in log using version 0.2.1 #59
Comments
* #58, #61 - Resolved status code 10201 appearing when extracting videos from mobile app share links * #59 - Suppressed two errors during user video iteration: * TypeError: `DeferredItemListIterator` no longer attempts to iterate over a None item_list * JSONDecodeError: `DeferredItemListIterator` cuts iteration short if an API request returns null JSON
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. If you would prefer that the iterator raise a TikTokAPIError instead of just issuing a warning, let me know. |
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. |
|
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
The text was updated successfully, but these errors were encountered: