Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GetComments(requestData, searchLimit, commentsData)
- {
- // Get 'commentThread' list and deal with its data.
- gapi.client.youtube.commentThreads.list(requestData).then(
- function(response)
- {
- // Decrease the limit of comments for search before getting a new page.
- searchLimit -= 100;
- // Add the gotten page of comments to the array.
- commentsData.push(response.result.items);
- // If we are not pass the limit of comments for the search &&
- // we are not run out of comments.
- if(searchLimit > 0 && response.result.nextPageToken != undefined)
- {
- requestData.pageToken = response.result.nextPageToken;
- // Call the method again with a new pointer.
- GetComments(requestData, searchLimit, commentsData);
- }
- else
- {
- // Start actual search when all required data are gathered.
- SearchInList(commentsData);
- }
- },
- SearchExceptionLog
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement