SMAPPNYU / youtube-data-api

A Python Client for collect and parse public data from the Youtube Data API
https://youtube-data-api.readthedocs.io/en/latest/index.html
MIT License
79 stars 31 forks source link

Potential bug: quota explodes #22

Closed cschwem2er closed 5 years ago

cschwem2er commented 5 years ago

Hi! First of all thank you so much for creating this awesome package. I am using the most recent version available via pip and via attempts to get recommended videos, I hit my quota limit for YouTube within one minute.

I have used the YouTube API before and before was able to collect that much data within the quota limit, which is why I think that this might be bug. Here's my code:

def get_related(seed_id, max_results = 25):
    all_rels = []
    seed =  yt.get_recommended_videos(seed_id, max_results = max_results)
    for rank, i in enumerate(seed):
        i['rank'] = rank + 1
        i['seed'] = seed_id
        seed_id = i['video_id']
        all_rels.append(i)
        seed = yt.get_recommended_videos(seed_id, max_results = max_results)
        for rank1, i1 in enumerate(seed):
            i1['rank'] = rank1 + 1
            i1['seed'] = seed_id
            seed_id = i1['video_id']
            all_rels.append(i1)
    return all_rels

res = get_related('4Y1lZQsyuSQ')

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "dailyLimitExceeded",
    "message": "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console."  }
  ],
  "code": 403,
  "message": "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: "
 }
}
yinleon commented 5 years ago

I am not sure this is a bug with the software. The problem could be how you authorized the API key in the cloud console? Are you using the same key here as your previous (unlimited query?)

yinleon commented 5 years ago

I am closing this issue because it is related to an API key.

cschwem2er commented 5 years ago

Hi , sorry I didn't get notified for your first response for some reason. Yes, I was using the same key. I'll monitor the number of calls and do some checks if I find the time. I'll get back to you in case I still experience these strange quota issues.