public static YoutubeComments RequestId(this YoutubeComments comments, params string[] ids) { var settings = comments.Settings.Clone(); settings.Id = settings.Id.AddItems(ids); return(Comments(settings)); }
public static YoutubeComments TextFormat(this YoutubeComments comments, TextFormat f) { var settings = comments.Settings.Clone(); settings.TextFormat = f; return(Comments(settings)); }
public static YoutubeComments ForParentId(this YoutubeComments comments, string id) { var settings = comments.Settings.Clone(); settings.ParentId = id; return(Comments(settings)); }
IEnumerator YoutubeCallComments(string videoId, Action <YoutubeComments[]> callback) { WWW call = new WWW("https://www.googleapis.com/youtube/v3/commentThreads/?videoId=" + videoId + "&part=snippet%2Creplies&key=" + APIKey); yield return(call); Debug.Log(call.url); JSONNode result = JSON.Parse(call.text); comments = new YoutubeComments[result["items"].Count]; for (int itemsCounter = 0; itemsCounter < comments.Length; itemsCounter++) { comments[itemsCounter] = new YoutubeComments(); SetComment(result["items"][itemsCounter]["snippet"], out comments[itemsCounter]); } callback.Invoke(comments); }
private void SetComment(JSONNode commentsData, out YoutubeComments data) { data = new YoutubeComments(); data.videoId = commentsData["videoId"]; JSONNode commentDetail = commentsData["topLevelComment"]["snippet"]; data.authorDisplayName = commentDetail["authorDisplayName"]; data.authorProfileImageUrl = commentDetail["authorProfileImageUrl"]; data.authorChannelUrl = commentDetail["authorChannelUrl"]; data.authorChannelId = commentDetail["authorChannelId"]["value"]; data.textDisplay = commentDetail["textDisplay"]; data.textOriginal = commentDetail["textOriginal"]; data.canRate = commentDetail["canRate"].AsBool; data.viewerRating = commentDetail["viewerRating"]; data.likeCount = commentDetail["likeCount"].AsInt; data.publishedAt = commentDetail["publishedAt"]; data.updatedAt = commentDetail["updatedAt"]; }
public static IEnumerable <YoutubeComment> TakePages(this YoutubeComments comments, int pageCount) { return(comments.Take(comments.ResultsPerPage.GetValueOrDefault(ResultsPerPage) * pageCount)); }
public static YoutubeComments FormatPlainText(this YoutubeComments comments) { return(comments.TextFormat(Enums.TextFormat.PlainText)); }
public static YoutubeComments FormatHtml(this YoutubeComments comments) { return(comments.TextFormat(Enums.TextFormat.Html)); }
public static IEnumerable <YoutubeComment> TakePage(this YoutubeComments comments) { return(comments.TakePages(1)); }