Exemple #1
0
        private static VideoInfo ExtractDataFromPlayerArgs(JObject JsonData, VideoInfo Info)
        {
            JToken VideoMetaDataRenderer = JsonData["contents"]["twoColumnWatchNextResults"]["results"]["results"]["contents"][0]["itemSectionRenderer"]["contents"][0]["videoMetadataRenderer"];

            Info.Like        = Convert.ToUInt32(VideoMetaDataRenderer["likeButton"]["likeButtonRenderer"]["likeCount"]);
            Info.DisLike     = Convert.ToUInt32(VideoMetaDataRenderer["likeButton"]["likeButtonRenderer"]["dislikeCount"]);
            Info.ChannelLogo = LogoExtractor.ExtractThumbnail(VideoMetaDataRenderer["owner"]["videoOwnerRenderer"]["thumbnail"]["thumbnails"]);
            Info.Subscribers = Convert.ToString(VideoMetaDataRenderer["owner"]["videoOwnerRenderer"]["subscribeButton"]["subscribeButtonRenderer"]["subscriberCountText"]["simpleText"]);

            return(Info);
        }
Exemple #2
0
        private static VideoInfo ExtractDataFromPlayerResponse(string HtmlCode, VideoInfo Info)
        {
            JObject JsonData = DataExtractor.ExtractJsonData(HtmlCode);
            JObject ExtractedPlayerResponseJson = DataExtractor.ExtractPlayerResponse(JsonData);
            JToken  VideoDetails = ExtractedPlayerResponseJson["videoDetails"];

            Info.Title       = Convert.ToString(VideoDetails["title"]);
            Info.Description = Convert.ToString(VideoDetails["shortDescription"]);
            Info.Channel     = Convert.ToString(VideoDetails["author"]);
            Info.Thumbnail   = LogoExtractor.ExtractThumbnail(VideoDetails["thumbnail"]["thumbnails"]);
            Info.View        = Convert.ToInt32(VideoDetails["viewCount"]);
            Info.Duration    = TimeSpan.FromSeconds(Convert.ToDouble(VideoDetails["lengthSeconds"]));

            return(Info);
        }