Looking to grab all the comments from a given video, rather than go one page at a time.
from gdata import youtube as yt
from gdata.youtube import service as yts
client = yts.YouTubeService()
client.ClientLogin(username, pwd) #the pwd might need to be application specific fyi
comments = client.GetYouTubeVideoComments(video_id='the_id')
a_comment = comments.entry[0]
The above code with let you grab a single comment, likely the most recent comment, but I’m looking for a way to grab all the comments at once. Is this possible with Python’s gdata module?
The Youtube API docs for comments, the comment feed docs and the Python API docs
The following achieves what you asked for using the Python YouTube API:
Unfortunately the API limits the number of entries that can be retrieved to 1000. This was the error I got when I tried a tweaked version with a hand crafted
GetYouTubeVideoCommentFeedURL parameter:Note that the same principle should apply to retrieve entries in other feeds of the API.
If you want to hand craft the
GetYouTubeVideoCommentFeedURL parameter, its format is:The following restrictions apply:
start-index <= 1000andmax-results <= 50.