예제 #1
0
        public override void DownloadAndParseData()
        {
            //base.DownloadAndParseData();

            var html = streamDownloader.Download(BaseUrl);

            var titleMatch = Regex.Match(html, @"""title"":""(.+?)""");

            if (titleMatch.Success)
            {
                Title = UnEscapeString(titleMatch.Groups[1].Value);
            }

            var imageMatch = Regex.Match(html, @"""image"":""(.+?)""");

            if (imageMatch.Success)
            {
                PosterUrl   = UnEscapeString(imageMatch.Groups[1].Value);
                PosterUrl   = PosterUrl.StartsWith("//") ? "https:" + PosterUrl : PosterUrl;
                PosterImage = streamDownloader.DownloadImage(PosterUrl);
            }

            var hlsMatch = Regex.Match(html, @"""hls_file"":""(.+?)""");
            var playlist = string.Empty;

            if (hlsMatch.Success)
            {
                playlist = UnEscapeString(hlsMatch.Groups[1].Value);
            }

            var durationMatch = Regex.Match(html, @"""duration"":(\d+)");

            if (durationMatch.Success)
            {
                Duration = int.Parse(durationMatch.Groups[1].Value);
            }

            var streamHdMatch = Regex.Match(html, @"""file_http_hd"":""(.+?)""");

            if (streamHdMatch.Success)
            {
                var streamUrl = _urBaseurl + UnEscapeString(streamHdMatch.Groups[1].Value) + playlist;
                ParseStreams(streamDownloader.Download(streamUrl), UnEscapeString(streamHdMatch.Groups[1].Value), "");
            }

            var streamHdSubMatch = Regex.Match(html, @"""file_http_sub_hd"":""(.+?)""");

            if (streamHdSubMatch.Success)
            {
                var streamUrl = _urBaseurl + UnEscapeString(streamHdSubMatch.Groups[1].Value) + playlist;
                ParseStreams(streamDownloader.Download(streamUrl), UnEscapeString(streamHdSubMatch.Groups[1].Value), "TEXT");
            }
        }