如何将 maxresults 的限制设置为 python 中 youtube 数据允许的限制 api?

how to set the limit of maxresults upto permissible limit of youtube data api in python?

我创建此脚本是为了从 python 中的一个 youtube 频道中提取所有播放列表视频信息,但由于配额限制,我无法提取超过 10k 的视频信息。如何将限制设置为小于 10k 或任何其他方法来提取信息?

这是我的代码:

while 1:
    res = youtube.playlistItems().list(playlistId=playlist_id,\
            part='id,snippet',maxResults=50,pageToken=next_page_token).execute()
    next_page_token = res.get('nextPageToken')
    if next_page_token is None:
        break

One can use the counter to come out of the loop. Always keep in mind that calculate the quota for any kind of search. Yes its a bad thing to having 10K limit but anyhow one can extract atleast till 10k. Ex: a youtube.search.list with will incur cost as 5 per page.

count =1
...loop starts
then code
if count and next page response is not none
increment count
else 
break
...