dunkyl / SlyYTDAPI-Python

No-boilerplate, async YouTube Data API access. 😋
MIT License
3 stars 1 forks source link

Bug: using `after` param includes items with published date = value in `after` #1

Closed betterthanever2 closed 2 months ago

betterthanever2 commented 2 months ago

Hi, When I use search_videos method with after param, for example:

uploads = await YouTubeData.search_videos(channel_id=<some_channel_id>, limit=None, after=<date_of_the_latest_video_I_have>)

The list of video obects I get, includes , because, I would guess, the range is inclusive rather than exclusive. This is certainly not what I would expect from after param.

I haven't go all the way into the code yet, so not sure how to fix this exactly.

betterthanever2 commented 2 months ago

This can be circumvented by importing timedelta from datetime and then adding a second, like so:

uploads = await YouTubeData.search_videos(channel_id=<some_channel_id>, limit=None, after=<date_of_the_latest_video_I_have>+timedelta(seconds=1))
dunkyl commented 2 months ago

Thanks for submitting an issue! The parameter is also referred to in the same way on the YouTube side. I agree that it is unintuitive, so folding your solution implemented into search_videos may be appropriate. If you agree that it should be implemented, I will do that and publish the new version to pypi tomorrow. Either way, I will also add a callout for this in the documentation.

betterthanever2 commented 2 months ago

You can expect several more issues :) And maybe a PR. Thanks, this library seems like a good piece of work.