Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3637

How to extract all YouTube comments from YouTube API (python)

$
0
0

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.


Viewing all articles
Browse latest Browse all 3637

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>