In a particular video_id
there are 133 comments. But the code below only returns 20. I want all 133 comments to be stored in the list comments
video_id = ""api_key = ""comments=[]youtube = build('youtube', 'v3',developerKey=api_key)video_response=youtube.commentThreads().list(part='snippet,replies', videoId=video_id).execute()for comment_count in video_response['items']: comments.append(comment_count['snippet']['topLevelComment']['snippet']['textDisplay']) print(len(comments))
There is a key named nextPageToken
in the JSON response, that can be used but I couldn't find a proper way to make use of it.