Win a copy of Terraform in Action this week in the Cloud 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

You Tube Comments API

 
Ranch Hand
Posts: 54
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 74388
334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't know. Please give us some more details about the code in question.
 
Sheriff
Posts: 22510
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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!
     
    reply
      Bookmark Topic Watch Topic
    • New Topic