Advertisement
Guest User

Untitled

a guest
Mar 13th, 2021
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function GetComments(requestData, searchLimit, commentsData)
  2. {
  3.     // Get 'commentThread' list and deal with its data.
  4.     gapi.client.youtube.commentThreads.list(requestData).then(
  5.         function(response)
  6.         {
  7.             // Decrease the limit of comments for search before getting a new page.
  8.             searchLimit -= 100;
  9.             // Add the gotten page of comments to the array.
  10.             commentsData.push(response.result.items);
  11.  
  12.             // If we are not pass the limit of comments for the search &&
  13.             // we are not run out of comments.
  14.             if(searchLimit > 0 && response.result.nextPageToken != undefined)
  15.             {
  16.                 requestData.pageToken = response.result.nextPageToken;
  17.  
  18.                 // Call the method again with a new pointer.
  19.                 GetComments(requestData, searchLimit, commentsData);
  20.             }
  21.             else
  22.             {
  23.                 // Start actual search when all required data are gathered.
  24.                 SearchInList(commentsData);
  25.             }
  26.         },
  27.         SearchExceptionLog
  28.     );
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement