I’d like to have all comments of a specific video, replies of a comment included.
It doesn’t work if a comment have more than 100 replies.
Indeed, to have all the replies of a comment I have to specify the parentId
. Max results’ length is 100. If it’s bigger we have a nextPageToken
attribute as usual. However, the request with the given nextPageToken return the same output as before.
Here is an example in python :
q = https://www.googleapis.com/youtube/v3/comments?part=snippet&part=id&parentId=UgyRYe5L38xhQoviSrF4AaABAg&key=xx&textFormat=plainText&maxResults=100
res = request.get(q, auth=auth)
res = res.json()
# building url for next page
url = f"{q}&pageToken={res.json().get('nextPageToken')}"
res2 = request.get(url, auth=auth)
res2.json() == res
# >>> True
In this example, the parent comment has more than 500 replies. I can only have top 100.
Maybe I’m doing something wrong…
Matthieu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.