Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excessive number of API requests #68

Open
leveled opened this issue Jul 12, 2019 · 2 comments · May be fixed by #89
Open

Excessive number of API requests #68

leveled opened this issue Jul 12, 2019 · 2 comments · May be fixed by #89
Labels
bug Something isn't working high priority High priority bug/task

Comments

@leveled
Copy link

leveled commented Jul 12, 2019

YTSM seems to be generating an excessive number of API requests for me, to the point where I cannot add any additional subscriptions as my 10000 request/day limit is quickly reached. I have my synchronization schedule set as such

0 0 * * *

Which if I understand correctly should just be triggering once a day. I only have around 30-40 subscriptions, which doesn't seem like a lot. I'm not sure what is causing the high number of requests.

@chibicitiberiu
Copy link
Owner

I think I found the source of the bug in the synchronization code. During synchronization, one of the steps is to update the statistics of the videos (play count, ratings). The bug is at this exact line, which makes it reiterate videos more than once.

The line for video in itertools.chain(work_vids, self.__new_vids): should actually read
for video in batch:.

I will submit a fix soon. If you don't care at all about these video statistics, you can modify this file manually and set _ENABLE_UPDATE_STATS = False.

@chibicitiberiu
Copy link
Owner

Thinking about it, I think that may not be the problem. In that for loop, there is no YtAPI call. The problem may simply be that it tries to update the statistics for a few thousand videos every day, which is the reason why you are reaching the limit.

Disabling that 'update stats' field will probably fix the issue, but you won't get any video statistics any more.

I think the solution would be to be more conservative about updating video statistics. For big channels, the general trend is that videos generate the most views in the first couple of days, after which views slow down. So I think updating statistics less frequently for older videos is probably the best approach.

@chibicitiberiu chibicitiberiu added bug Something isn't working high priority High priority bug/task labels Aug 19, 2019
@girlpunk girlpunk linked a pull request Feb 10, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority High priority bug/task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants