Ejemplo n.º 1
0
        public static YoutubeComment TextFormat(this YoutubeComment comment, TextFormat f)
        {
            var settings = comment.Settings.Clone();

            settings.TextFormat = f;
            return(Comment(settings));
        }
Ejemplo n.º 2
0
 public static YoutubeChannel AuthorChannel(this YoutubeComment comment)
 {
     if (comment.AuthorChannelId == null)
     {
         return(null);
     }
     return(Channel(comment.AuthorChannelId));
 }
Ejemplo n.º 3
0
 public static YoutubeVideo Video(this YoutubeComment comment)
 {
     if (comment.VideoId == null)
     {
         return(null);
     }
     return(Video(comment.VideoId));
 }
Ejemplo n.º 4
0
        public static YoutubeComment Parent(this YoutubeComment comment)
        {
            if (comment.ParentId != null)
            {
                return(Comment(comment.ParentId));
            }

            return(null);
        }
Ejemplo n.º 5
0
        private AverageSentiment ParseCommentThreadListResponse(CommentThreadListResponse commentThreadListResponse)
        {
            // Construct the empty parsed comment threads list
            AverageSentiment averageScore = new AverageSentiment();

            // Iterate over the comment thread list response and add each comment text
            foreach (CommentThread commentThread in commentThreadListResponse.Items)
            {
                var comment = new YoutubeComment();
                comment.AuthorName     = commentThread.Snippet.TopLevelComment.Snippet.AuthorDisplayName;
                comment.Content        = commentThread.Snippet.TopLevelComment.Snippet.TextDisplay;
                comment.SentimentScore = SentimentAnalysis.SelectComments(comment.Content);

                averageScore.CommentList.Add(comment);
            }

            // Set the average sentiment score
            averageScore.AverageSentimentScore = averageScore.CommentList.Average(c => c.SentimentScore);
            averageScore.VideoURL     = commentThreadListResponse.Items[0].Snippet.VideoId;
            averageScore.AnalysisDate = DateTime.Now;

            // Return the parsed comment threads list
            return(averageScore);
        }
Ejemplo n.º 6
0
 public static YoutubeComments Replies(this YoutubeComment comment)
 {
     return(Comments().ForParentId(comment.Id));
 }
Ejemplo n.º 7
0
 public static YoutubeComment FormatPlainText(this YoutubeComment comment)
 {
     return(comment.TextFormat(Enums.TextFormat.PlainText));
 }
Ejemplo n.º 8
0
 public static YoutubeComment FormatHtml(this YoutubeComment comment)
 {
     return(comment.TextFormat(Enums.TextFormat.Html));
 }
Ejemplo n.º 9
0
 public static YoutubeCommentThread CommentThread(this YoutubeComment comment)
 {
     return(CommentThread(comment.Id.Split('.')[0]));
 }