Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

You Tube Comments API

 
Ranch Hand
Posts: 54
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does getReplies() in CommentThread return only a limited number of replies? At first i didn't really understand, but having tested it, it doesn't return all the replies, and I guess that what it meant. Is there anyway to get all the replies?
 
Marshal
Posts: 65851
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know. Please give us some more details about the code in question.
 
Sheriff
Posts: 21805
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A lot of APIs return long lists in pages, and you will need to call separate pages yourself.

Assuming you're talking about this call, you can:
  • Send in a higher maxResults parameter. The default is 20, but it can go up to 100. Disallowing higher values is probably meant to keep responses small (so no 10MB responses if there are many replies).
  • Use the pageToken to call a next page. The value is returned in the previous response's nextPageToken field. That means that, to get all replies, you will need to loop until there is no more nextPageToken.
  • You can use the response's pageInfo.totalResults and pageInfo.resultsPerPage to determine how many pages are needed.
  •  
    William Ng
    Ranch Hand
    Posts: 54
    1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Campbell Ritchie wrote:Don't know. Please give us some more details about the code in question.



    Here I seek to provide you more information about my problem.

    This is a link to the method in question
    https://developers.google.com/resources/api-libraries/documentation/youtube/v3/java/latest/com/google/api/services/youtube/model/CommentThread.html#getReplies()
    link

    I tested it on this video: https://www.youtube.com/watch?v=m4Jtj2lCMAA

    Initially, I could not get all the comments, but as, Rob Spoor, stated it returned them in pages, and I soon figured that out. However, on one of the top level comments who replies were copious, it become apparent what the term "limited", stated by the documentation meant. No easy solution as revealed itself to me. I'm wondering what reason they have to limit the replies. Maybe its storage, but then again they are Google, so should have no problem with that!
     
    Do you pee on your compost? Does this tiny ad?
    Java file APIs (DOC, XLS, PDF, and many more)
    https://products.aspose.com/total/java
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!