Esempio n. 1
0
        public static YoutubeComments RequestId(this YoutubeComments comments, params string[] ids)
        {
            var settings = comments.Settings.Clone();

            settings.Id = settings.Id.AddItems(ids);
            return(Comments(settings));
        }
Esempio n. 2
0
        public static YoutubeComments TextFormat(this YoutubeComments comments, TextFormat f)
        {
            var settings = comments.Settings.Clone();

            settings.TextFormat = f;
            return(Comments(settings));
        }
Esempio n. 3
0
        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"];
    }
Esempio n. 6
0
 public static IEnumerable <YoutubeComment> TakePages(this YoutubeComments comments, int pageCount)
 {
     return(comments.Take(comments.ResultsPerPage.GetValueOrDefault(ResultsPerPage) * pageCount));
 }
Esempio n. 7
0
 public static YoutubeComments FormatPlainText(this YoutubeComments comments)
 {
     return(comments.TextFormat(Enums.TextFormat.PlainText));
 }
Esempio n. 8
0
 public static YoutubeComments FormatHtml(this YoutubeComments comments)
 {
     return(comments.TextFormat(Enums.TextFormat.Html));
 }
Esempio n. 9
0
 public static IEnumerable <YoutubeComment> TakePage(this YoutubeComments comments)
 {
     return(comments.TakePages(1));
 }