Exemplo n.º 1
0
        public override PhimInfo GetPhimOnPage(string url)
        {
            PhimInfo phim    = new PhimInfo();
            HtmlWeb  htmlWeb = new HtmlWeb()
            {
                AutoDetectEncoding = false,
                OverrideEncoding   = Encoding.UTF8
            };

            HtmlAgilityPack.HtmlDocument doc = htmlWeb.Load(url);
            phim.Link   = url;
            phim.GetUrl = doc.DocumentNode.QuerySelector("#video source").Attributes["src"].Value;
            var name = doc.DocumentNode.QuerySelector("#container h2.title").InnerText.ToUpper();

            phim.Name = Utils.ChuanHoaFileName(name).Trim().Replace(" ", "-");
            var script = doc.DocumentNode.SelectNodes("/html/body/script[4]").FirstOrDefault();

            if (script != null)
            {
                var matches = Regex.Matches(script.InnerText, @"\/Data\/.+\.vtt");
                if (matches.Count > 1)
                {
                    phim.Sub1 = Host + matches[0].Value;
                }
                if (matches.Count >= 2)
                {
                    phim.Sub2 = Host + matches[1].Value;
                }
            }
            return(phim);
        }
Exemplo n.º 2
0
        public virtual void DownloadWithIdm(PhimInfo phim, string localsave)
        {
            var local     = localsave.Trim();
            var linkvideo = phim.GetUrl;
            var filevideo = Path.GetFileName(phim.GetUrl)?.Replace(" ", "-").Replace(@"%20", "-");
            var sub1      = phim.Chap + "-" + Path.GetFileName(phim.Sub1);
            var sub2      = phim.Chap + "-" + Path.GetFileName(phim.Sub2);

            if (string.IsNullOrWhiteSpace(linkvideo) || string.IsNullOrWhiteSpace(local))
            {
                MessageBox.Show("Chưa đặt đường dẫn lưu hoặc không tồn tại link video");
                return;
            }
            var localChap = local;

            if (!Directory.Exists(localChap))
            {
                Directory.CreateDirectory(localChap);
            }
            IdmDownload(linkvideo.Trim().Replace(" ", "%20"), localChap, filevideo);
            if (!string.IsNullOrWhiteSpace(phim.Sub1))
            {
                IdmDownload(phim.Sub1, localChap, sub1);
            }

            if (!string.IsNullOrWhiteSpace(phim.Sub2))
            {
                IdmDownload(phim.Sub2, localChap, sub2);
            }
        }
Exemplo n.º 3
0
        public override PhimInfo GetPhimOnPage(string url)
        {
            PhimInfo phim    = new PhimInfo();
            HtmlWeb  htmlWeb = new HtmlWeb()
            {
                AutoDetectEncoding = false,
                OverrideEncoding   = Encoding.UTF8
            };

            HtmlAgilityPack.HtmlDocument doc = htmlWeb.Load(url);
            phim.Link = url;

            var enUrl  = doc.DocumentNode.QuerySelector("input#video").Attributes["value"].Value;
            var enSub1 = doc.DocumentNode.QuerySelector("input#en").Attributes["value"].Value;
            var enSub2 = doc.DocumentNode.QuerySelector("input#vi").Attributes["value"].Value;

            if (!string.IsNullOrWhiteSpace(enUrl))
            {
                phim.GetUrl = DeCompressJavascript(enUrl);
            }

            if (!string.IsNullOrWhiteSpace(enSub1))
            {
                phim.Sub1 = Host + DeCompressJavascript(enSub1);
            }

            if (!string.IsNullOrWhiteSpace(enSub2))
            {
                phim.Sub2 = Host + DeCompressJavascript(enSub2);
            }

            var chap = Regex.Match(url, @"(?:=)(\d+)").Groups[1].Value;

            chap = chap.Length == 1 ? "0" + chap : chap;
            var name = Utils.ChuanHoaFileName(doc.DocumentNode.QuerySelector("title").InnerText);

            phim.Name = (name.Split('-')[0].Trim().Replace(" ", "-") + "-" + chap).ToUpper();

            return(phim);
        }