Beispiel #1
0
        /// <summary>
        /// 获取详情
        /// </summary>
        /// <param name="index">地址</param>
        /// <returns></returns>
        public virtual async Task <JavVideo> Get(JavVideoIndex index)
        {
            var r = await Get(index?.Url);

            if (r != null)
            {
                r.OriginalTitle = r.Title;
            }
            return(r);
        }
        /// <summary>
        /// 解析列表
        /// </summary>
        /// <param name="ls"></param>
        /// <param name="doc"></param>
        /// <returns></returns>
        protected override List <JavVideoIndex> ParseIndex(List <JavVideoIndex> ls, HtmlDocument doc)
        {
            if (doc == null)
            {
                return(ls);
            }
            var nodes = doc.DocumentNode.SelectNodes("//div[@class='rank_list']/ul/li");

            if (nodes?.Any() != true)
            {
                return(ls);
            }

            foreach (var node in nodes)
            {
                var title_node = node.SelectSingleNode("./h5/a");
                if (title_node == null)
                {
                    continue;
                }
                var url = title_node.GetAttributeValue("href", null);
                if (string.IsNullOrWhiteSpace(url))
                {
                    continue;
                }

                var m = new JavVideoIndex()
                {
                    Provider = Name,
                    Url      = new Uri(client.BaseAddress, url).ToString(),
                    Num      = url.Split("/".ToArray(), StringSplitOptions.RemoveEmptyEntries).Last(),
                    Title    = title_node.InnerText.Trim()
                };
                ls.Add(m);

                var img = node.SelectSingleNode("./h6/a/img");
                if (img != null)
                {
                    m.Cover = img.GetAttributeValue("src", null);
                }
                var date = node.SelectSingleNode(".//p[@class='data']");
                if (date != null)
                {
                    var d  = date.InnerText.Trim();
                    var me = regexDate.Match(d);
                    if (me.Success)
                    {
                        m.Date = me.Groups["date"].Value.Replace('/', '-');
                    }
                }
            }

            return(ls);
        }
        /// <summary>
        /// 解析列表
        /// </summary>
        /// <param name="ls"></param>
        /// <param name="doc"></param>
        /// <returns></returns>
        protected override List <JavVideoIndex> ParseIndex(List <JavVideoIndex> ls, HtmlDocument doc)
        {
            if (doc == null)
            {
                return(ls);
            }
            var nodes = doc.DocumentNode.SelectNodes("//a[@class='movie-box']");

            if (nodes?.Any() != true)
            {
                return(ls);
            }

            foreach (var node in nodes)
            {
                var url = node.GetAttributeValue("href", null);
                if (string.IsNullOrWhiteSpace(url))
                {
                    continue;
                }
                var m = new JavVideoIndex()
                {
                    Provider = Name, Url = url
                };

                var img = node.SelectSingleNode(".//div[@class='photo-frame']//img");
                if (img != null)
                {
                    m.Cover = img.GetAttributeValue("src", null);
                    m.Title = img.GetAttributeValue("title", null);
                }
                var dates = node.SelectNodes(".//date");
                if (dates?.Count >= 1)
                {
                    m.Num = dates[0].InnerText.Trim();
                }
                if (dates?.Count >= 2)
                {
                    m.Date = dates[1].InnerText.Trim();
                }

                if (string.IsNullOrWhiteSpace(m.Num))
                {
                    continue;
                }
                ls.Add(m);
            }

            return(ls);
        }
Beispiel #4
0
        /// <summary>
        /// 解析列表
        /// </summary>
        /// <param name="ls"></param>
        /// <param name="doc"></param>
        /// <returns></returns>
        protected override List <JavVideoIndex> ParseIndex(List <JavVideoIndex> ls, HtmlDocument doc)
        {
            if (doc == null)
            {
                return(ls);
            }
            var nodes = doc.DocumentNode.SelectNodes("//li[@class='item-list']");

            if (nodes?.Any() != true)
            {
                return(ls);
            }

            foreach (var node in nodes)
            {
                var title_node = node.SelectSingleNode("./a");
                if (title_node == null)
                {
                    continue;
                }
                var url = title_node.GetAttributeValue("href", null);
                if (string.IsNullOrWhiteSpace(url))
                {
                    continue;
                }
                var img = title_node.SelectSingleNode(".//img");
                if (img == null)
                {
                    continue;
                }
                var t2 = title_node.SelectSingleNode(".//dt");
                var m  = new JavVideoIndex()
                {
                    Provider = Name,
                    Url      = url + "&lg=zh",
                    Num      = img.GetAttributeValue("alt", null),
                    Title    = t2?.InnerText.Trim(),
                    Cover    = img.GetAttributeValue("src", null),
                };
                if (string.IsNullOrWhiteSpace(m.Title))
                {
                    m.Title = m.Num;
                }

                ls.Add(m);
            }

            return(ls);
        }
        /// <summary>
        /// 解析列表
        /// </summary>
        /// <param name="ls"></param>
        /// <param name="doc"></param>
        /// <returns></returns>
        protected override List <JavVideoIndex> ParseIndex(List <JavVideoIndex> ls, HtmlDocument doc)
        {
            if (doc == null)
            {
                return(ls);
            }
            var nodes = doc.DocumentNode.SelectNodes("//*[@id='videos']/div/div/a");

            if (nodes?.Any() != true)
            {
                return(ls);
            }

            foreach (var node in nodes)
            {
                var url = node.GetAttributeValue("href", null);
                if (string.IsNullOrWhiteSpace(url))
                {
                    continue;
                }
                var m = new JavVideoIndex()
                {
                    Provider = Name, Url = new Uri(client.BaseAddress, url).ToString()
                };
                ls.Add(m);
                var img = node.SelectSingleNode("./div/img");
                if (img != null)
                {
                    m.Cover = img.GetAttributeValue("src", null);
                    if (m.Cover?.StartsWith("//") == true)
                    {
                        m.Cover = $"https:{m.Cover}";
                    }
                }

                m.Num   = node.SelectSingleNode("./div[@class='uid']")?.InnerText.Trim();
                m.Title = node.SelectSingleNode("./div[@class='video-title']")?.InnerText.Trim();
                m.Date  = node.SelectSingleNode("./div[@class='meta']")?.InnerText.Trim();

                if (string.IsNullOrWhiteSpace(m.Num) == false && m.Title?.StartsWith(m.Num, StringComparison.OrdinalIgnoreCase) == true)
                {
                    m.Title = m.Title.Substring(m.Num.Length).Trim();
                }
            }

            return(ls);
        }
 /// <summary>
 /// 获取详情
 /// </summary>
 /// <param name="index">地址</param>
 /// <returns></returns>
 public virtual Task <JavVideo> Get(JavVideoIndex index)
 => Get(index?.Url);