Let's say I have a video_id
having 8487
comments.
This code returns only 4309
comments.
def get_comments(youtube, video_id, comments=[], token=''): video_response=youtube.commentThreads().list(part='snippet', videoId=video_id, pageToken=token).execute() for item in video_response['items']: comment = item['snippet']['topLevelComment'] text = comment['snippet']['textDisplay'] comments.append(text) if "nextPageToken" in video_response: return get_comments(youtube, video_id, comments, video_response['nextPageToken']) else: return commentsyoutube = build('youtube', 'v3',developerKey=api_key)comment_threads = get_comments(youtube,video_id)print(len(comment_threads))> 4309
How can I extract all the 8487
comments?