-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
i added limit on load comments
_getComments(videoId, allComments, nextPageToken = null, limit = 10) {
const params = {
key: this._key,
part: 'snippet,replies',
videoId: videoId,
maxResults: 10,
pageToken: nextPageToken
};
const restUri = uri(this._baseuri)
.filename('commentThreads')
.query(params);
return this._doRequest(restUri)
.then(function(result) {
if (result && result.items && result.items.length > 0 && allComments.length < limit ) {
for (const item of result.items) {
if( allComments.length < limit ){
allComments.push( item )
}else
return allComments
}
}
if( result.nextPageToken ) {
return this._getComments(videoId, allComments, result.nextPageToken);
}
else {
return allComments;
}
}.bind(this));
}
Metadata
Metadata
Assignees
Labels
No labels