public CommentsResource.ListRequest GetCommentListRequest(string part, string parentId, CommentsResource.ListRequest.TextFormatEnum textFormat, string pageToken) { var commentListReq = _youTubeService.Comments.List("snippet"); commentListReq.ParentId = parentId; commentListReq.TextFormat = textFormat; commentListReq.PageToken = pageToken; return(commentListReq); }
public IEnumerable <Comment> GetComments(string part, string parentId, CommentsResource.ListRequest.TextFormatEnum textFormat) { do { var commentListReq = _youTubeDataApi.GetCommentListRequest(part, parentId, textFormat, nextCommentsBatchToken); commentListReq.MaxResults = 100; var comments = commentListReq.ExecuteAsync().GetAwaiter().GetResult(); nextCommentsBatchToken = comments.NextPageToken != nextCommentsBatchToken ? comments.NextPageToken : null; foreach (var comment in comments.Items) { yield return(comment); } } while (nextCommentsBatchToken != null); }
public IEnumerable <Comment> GetComments(string part, string parentId, CommentsResource.ListRequest.TextFormatEnum textFormat) { do { var comments = _restApi.GetCommentsFromThread(parentId, part, textFormat.ToString(), nextCommentsBatchToken).GetAwaiter().GetResult(); if (comments == null) { nextCommentsBatchToken = null; yield break; } nextCommentsBatchToken = comments.NextPageToken != nextCommentsBatchToken ? comments.NextPageToken : null; foreach (var comment in comments.Items) { yield return(comment); } } while (nextCommentsBatchToken != null); }