/// <summary> /// 获取详情 /// </summary> /// <param name="url">地址</param> /// <returns></returns> public override async Task <JavVideo> Get(string url) { //https://www.javbus.cloud/ABP-933 var doc = await GetHtmlDocumentAsync(url); if (doc == null) { return(null); } var node = doc.DocumentNode.SelectSingleNode("//div[@class='container']/h3/.."); if (node == null) { return(null); } var dic = new Dictionary <string, string>(); var nodes = node.SelectNodes(".//*[@class='header']"); foreach (var n in nodes) { var next = n.NextSibling; while (next != null && string.IsNullOrWhiteSpace(next.InnerText)) { next = next.NextSibling; } if (next != null) { dic[n.InnerText.Trim()] = next.InnerText.Trim(); } } string GetValue(string _key) => dic.Where(o => o.Key.Contains(_key)).Select(o => o.Value).FirstOrDefault(); var genres = node.SelectNodes(".//span[@class='genre']")? .Select(o => o.InnerText.Trim()).ToList(); var actors = node.SelectNodes(".//*[@class='avatar-box']")? .Select(o => o.InnerText.Trim()).ToList(); var samples = node.SelectNodes(".//a[@class='sample-box']")? .Select(o => o.GetAttributeValue("href", null)).Where(o => o != null).ToList(); var m = new JavVideo() { Provider = Name, Url = url, Title = node.SelectSingleNode("./h3")?.InnerText?.Trim(), Cover = node.SelectSingleNode(".//a[@class='bigImage']")?.GetAttributeValue("href", null), Num = GetValue("识别码"), Date = GetValue("发行时间"), Runtime = GetValue("长度"), Maker = GetValue("发行商"), Studio = GetValue("制作商"), Set = GetValue("系列"), Director = GetValue("导演"), //Plot = node.SelectSingleNode("./h3")?.InnerText, Genres = genres, Actors = actors, Samples = samples, }; m.Plot = await GetDmmPlot(m.Num); //去除标题中的番号 if (string.IsNullOrWhiteSpace(m.Num) == false && m.Title?.StartsWith(m.Num, StringComparison.OrdinalIgnoreCase) == true) { m.Title = m.Title.Substring(m.Num.Length).Trim(); } return(m); }
/// <summary> /// 获取详情 /// </summary> /// <param name="url">地址</param> /// <returns></returns> public override async Task <JavVideo> Get(string url) { //https://www.r18.com/videos/vod/movies/detail/-/id=ssni00879/?dmmref=video.movies.popular&i3_ref=list&i3_ord=4 var doc = await GetHtmlDocumentAsync(url); if (doc == null) { return(null); } var node = doc.DocumentNode.SelectSingleNode("//div[@class='product-details-page']"); if (node == null) { return(null); } var product_details = node.SelectSingleNode(".//div[@class='product-details']"); string GetValueByItemprop(string name) => product_details.SelectSingleNode($".//dd[@itemprop='{name}']")?.InnerText.Trim().Trim('-'); string GetDuration() { var _d = GetValueByItemprop("duration"); if (string.IsNullOrWhiteSpace(_d)) { return(null); } var _m = Regex.Match(_d, @"[\d]+"); if (_m.Success) { return(_m.Value); } return(null); } var dic = new Dictionary <string, string>(); var nodes = product_details.SelectNodes(".//dt"); foreach (var n in nodes) { var name = n.InnerText.Trim(); if (string.IsNullOrWhiteSpace(name)) { continue; } //获取下一个标签 var nx = n; do { nx = nx.NextSibling; if (nx == null || nx.Name == "dt") { nx = null; break; } if (nx.Name == "dd") { break; } } while (true); if (nx == null) { continue; } var aa = nx.SelectNodes(".//a"); var value = aa?.Any() == true?string.Join(", ", aa.Select(o => o.InnerText.Trim()?.Trim('-')).Where(o => string.IsNullOrWhiteSpace(o) == false)) : nx?.InnerText?.Trim()?.Trim('-'); if (string.IsNullOrWhiteSpace(value) == false) { dic[name] = value; } } string GetValue(string _key) => dic.Where(o => o.Key.Contains(_key)).Select(o => o.Value).FirstOrDefault(); var genres = product_details.SelectNodes(".//*[@itemprop='genre']") .Select(o => o.InnerText.Trim()?.Trim('-')).Where(o => string.IsNullOrWhiteSpace(o) == false).ToList(); var actors = product_details.SelectNodes(".//div[@itemprop='actors']//*[@itemprop='name']") .Select(o => o.InnerText.Trim()?.Trim('-')).Where(o => string.IsNullOrWhiteSpace(o) == false).ToList(); var product_gallery = doc.GetElementbyId("product-gallery"); var samples = product_gallery.SelectNodes(".//img")? .Select(o => o.GetAttributeValue("data-src", null) ?? o.GetAttributeValue("src", null)).Where(o => o != null).ToList(); var m = new JavVideo() { Provider = Name, Url = url, Title = HttpUtility.HtmlDecode(node.SelectSingleNode(".//cite")?.InnerText?.Trim() ?? string.Empty), Cover = node.SelectSingleNode(".//img[@itemprop='image']")?.GetAttributeValue("src", null)?.Replace("ps.", "pl."), Num = GetValue("DVD ID:"), Date = GetValueByItemprop("dateCreated")?.Replace('/', '-'), Runtime = GetDuration(), Maker = GetValue("片商:"), Studio = GetValue("廠牌:"), Set = GetValue("系列:"), Director = GetValueByItemprop("director"), //Plot = node.SelectSingleNode("//p[@class='txt introduction']")?.InnerText, Genres = genres, Actors = actors, Samples = samples, }; if (string.IsNullOrWhiteSpace(m.Title)) { m.Title = m.Num; } if (string.IsNullOrWhiteSpace(m.Plot)) { m.Plot = await GetDmmPlot(m.Num); } //去除标题中的番号 if (string.IsNullOrWhiteSpace(m.Num) == false && m.Title?.StartsWith(m.Num, StringComparison.OrdinalIgnoreCase) == true) { m.Title = m.Title.Substring(m.Num.Length).Trim(); } return(m); }
private async Task <JavVideo> ParseVideo(string url, HtmlDocument doc) { var node = doc.DocumentNode.SelectSingleNode("//div[@class='panel-heading']/h3/../.."); if (node == null) { return(null); } var nodes = node.SelectNodes(".//b"); if (nodes?.Any() != true) { return(null); } if (string.IsNullOrWhiteSpace(url)) { url = doc.DocumentNode.SelectSingleNode("//li/a[contains(text(),'简体中文')]")?.GetAttributeValue("href", null); if (url?.StartsWith("//") == true) { url = $"https:{url}"; } } var dic = new Dictionary <string, string>(); foreach (var n in nodes) { var name = n.InnerText.Trim(); if (string.IsNullOrWhiteSpace(name)) { continue; } var arr = new List <string>(); var next = n.NextSibling; while (next != null && next.Name != "b") { arr.Add(next.InnerText); next = next.NextSibling; } if (arr.Count == 0) { continue; } var value = string.Join(", ", arr.Select(o => o.Replace(" ", " ").Trim(": ".ToArray())).Where(o => string.IsNullOrWhiteSpace(o) == false)); if (string.IsNullOrWhiteSpace(value)) { continue; } dic[name] = value; } string GetValue(string _key) => dic.Where(o => o.Key.Contains(_key)).Select(o => o.Value).FirstOrDefault(); string GetCover() { var img = node.SelectSingleNode(".//*[@id='vjs_sample_player']")?.GetAttributeValue("poster", null); if (string.IsNullOrWhiteSpace(img) == false) { return(img); } img = doc.DocumentNode.SelectSingleNode("//img[@class='img-responsive']")?.GetAttributeValue("src", null); if (string.IsNullOrWhiteSpace(img) == false) { return(img); } return(img); } List <string> GetGenres() { var v = GetValue("标签"); if (string.IsNullOrWhiteSpace(v)) { return(null); } return(v.Split(',').Select(o => o.Trim()).Distinct().ToList()); } List <string> GetActors() { var v = GetValue("女优"); if (string.IsNullOrWhiteSpace(v)) { return(null); } var ac = v.Split(',').Select(o => o.Trim()).Distinct().ToList(); return(ac); } List <string> GetSamples() { return(doc.DocumentNode.SelectNodes("//a[contains(@href,'snapshot')]/img") ?.Select(o => o.GetAttributeValue("src", null)) .Where(o => string.IsNullOrWhiteSpace(o) == false).ToList()); } var m = new JavVideo() { Provider = Name, Url = url, Title = node.SelectSingleNode(".//h3/text()")?.InnerText?.Trim(), Cover = GetCover(), Num = GetValue("番号")?.ToUpper(), Date = GetValue("发行日期"), Runtime = GetValue("播放时长"), Maker = GetValue("片商"), Studio = GetValue("片商"), Set = GetValue("系列"), Director = GetValue("导演"), Genres = GetGenres(), Actors = GetActors(), Samples = GetSamples(), Plot = node.SelectSingleNode("./div[@class='panel-body']/div[last()]")?.InnerText?.Trim(), }; if (string.IsNullOrWhiteSpace(m.Plot)) { m.Plot = await GetDmmPlot(m.Num); } ////去除标题中的番号 if (string.IsNullOrWhiteSpace(m.Num) == false && m.Title?.StartsWith(m.Num, StringComparison.OrdinalIgnoreCase) == true) { m.Title = m.Title.Substring(m.Num.Length).Trim(); } return(m); }
/// <summary> /// 获取详情 /// </summary> /// <param name="url">地址</param> /// <returns></returns> public override async Task <JavVideo> Get(string url) { //https://www.mgstage.com/product/product_detail/320MMGH-242/ var doc = await GetHtmlDocumentAsync(url); if (doc == null) { return(null); } var node = doc.DocumentNode.SelectSingleNode("//div[@class='common_detail_cover']"); if (node == null) { return(null); } var dic = new Dictionary <string, string>(); var nodes = node.SelectNodes(".//table/tr/th/.."); foreach (var n in nodes) { var name = n.SelectSingleNode("./th")?.InnerText?.Trim(); if (string.IsNullOrWhiteSpace(name)) { continue; } //尝试获取 a 标签的内容 var aa = n.SelectNodes("./td/a"); var value = aa?.Any() == true?string.Join(", ", aa.Select(o => o.InnerText.Trim()).Where(o => string.IsNullOrWhiteSpace(o) == false)) : n.SelectSingleNode("./td")?.InnerText?.Trim(); if (string.IsNullOrWhiteSpace(value) == false) { dic[name] = value; } } string GetValue(string _key) => dic.Where(o => o.Key.Contains(_key)).Select(o => o.Value).FirstOrDefault(); var genres = GetValue("ジャンル")?.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); var actors = GetValue("出演")?.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); var samples = node.SelectNodes("//a[@class='sample_image']")? .Select(o => o.GetAttributeValue("href", null)).Where(o => o != null).ToList(); var m = new JavVideo() { Provider = Name, Url = url, Title = node.SelectSingleNode("./h1")?.InnerText?.Trim(), Cover = node.SelectSingleNode(".//img[@class='enlarge_image']")?.GetAttributeValue("src", null), Num = GetValue("品番"), Date = GetValue("配信開始日")?.Replace('/', '-'), Runtime = GetValue("収録時間"), Maker = GetValue("發行商"), Studio = GetValue("メーカー"), Set = GetValue("シリーズ"), Director = GetValue("シリーズ"), Plot = node.SelectSingleNode("//p[@class='txt introduction']")?.InnerText, Genres = genres, Actors = actors, Samples = samples, }; //去除标题中的番号 if (string.IsNullOrWhiteSpace(m.Num) == false && m.Title?.StartsWith(m.Num, StringComparison.OrdinalIgnoreCase) == true) { m.Title = m.Title.Substring(m.Num.Length).Trim(); } return(m); }
/// <summary> /// 获取详情 /// </summary> /// <param name="url">地址</param> /// <returns></returns> private async Task <JavVideo> GetById(string id) { //https://adult.contents.fc2.com/article/1252526/ //https://fc2club.com/html/FC2-1252526.html var url = $"https://fc2club.com/html/FC2-{id}.html"; var doc = await GetHtmlDocumentAsync(url); if (doc == null) { return(null); } var node = doc.DocumentNode.SelectSingleNode("//div[@class='show-top-grids']"); if (node == null) { return(null); } var doc2 = GetHtmlDocumentAsync($"https://adult.contents.fc2.com/article/{id}/"); var dic = new Dictionary <string, string>(); var nodes = node.SelectNodes(".//h5/strong/.."); foreach (var n in nodes) { var name = n.SelectSingleNode("./strong")?.InnerText?.Trim(); if (string.IsNullOrWhiteSpace(name)) { continue; } //尝试获取 a 标签的内容 var aa = n.SelectNodes("./a"); var value = aa?.Any() == true?string.Join(", ", aa.Select(o => o.InnerText.Trim()).Where(o => string.IsNullOrWhiteSpace(o) == false && !o.Contains("本资源"))) : null; if (string.IsNullOrWhiteSpace(value) == false) { dic[name] = value; } } string GetValue(string _key) => dic.Where(o => o.Key.Contains(_key)).Select(o => o.Value).FirstOrDefault(); var genres = GetValue("影片标签")?.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); var actors = GetValue("女优名字")?.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); string getDate() { var t = doc2.GetAwaiter().GetResult()?.DocumentNode.SelectSingleNode("//div[@class='items_article_Releasedate']")?.InnerText; if (string.IsNullOrWhiteSpace(t)) { return(null); } var dm = regexDate.Match(t); if (dm.Success == false) { return(null); } return(dm.Groups["date"].Value.Replace('/', '-')); } var samples = node.SelectNodes("//ul[@class='slides']/li/img")? .Select(o => o.GetAttributeValue("src", null)).Where(o => o != null).Select(o => new Uri(client.BaseAddress, o).ToString()).ToList(); var m = new JavVideo() { Provider = Name, Url = url, Title = node.SelectSingleNode(".//h3")?.InnerText?.Trim(), Cover = samples?.FirstOrDefault(), Num = $"FC2-{id}", Date = getDate(), //Runtime = GetValue("収録時間"), Maker = GetValue("卖家信息"), Studio = GetValue("卖家信息"), Set = Name, //Director = GetValue("シリーズ"), //Plot = node.SelectSingleNode("//p[@class='txt introduction']")?.InnerText, Genres = genres, Actors = actors, Samples = samples, }; //去除标题中的番号 if (string.IsNullOrWhiteSpace(m.Num) == false && m.Title?.StartsWith(m.Num, StringComparison.OrdinalIgnoreCase) == true) { m.Title = m.Title.Substring(m.Num.Length).Trim(); } return(m); }
/// <summary> /// 获取详情 /// </summary> /// <param name="url">地址</param> /// <returns></returns> public override async Task <JavVideo> Get(string url) { //https://javdb.com/v/BzbA6 var doc = await GetHtmlDocumentAsync(url); if (doc == null) { return(null); } var nodes = doc.DocumentNode.SelectNodes("//div[contains(@class,'panel-block')]"); if (nodes?.Any() != true) { return(null); } var dic = new Dictionary <string, string>(); foreach (var n in nodes) { var k = n.SelectSingleNode("./strong")?.InnerText?.Trim(); string v = null; if (k?.Contains("演員") == true) { var ac = n.SelectNodes("./*[@class='value']/a"); if (ac?.Any() == true) { v = string.Join(",", ac.Select(o => o.InnerText?.Trim())); } } if (v == null) { v = n.SelectSingleNode("./*[@class='value']")?.InnerText?.Trim().Replace(" ", " "); } if (string.IsNullOrWhiteSpace(k) == false && string.IsNullOrWhiteSpace(v) == false) { dic[k] = v; } } string GetValue(string _key) => dic.Where(o => o.Key.Contains(_key)).Select(o => o.Value).FirstOrDefault(); string GetCover() { var img = doc.DocumentNode.SelectSingleNode("//img[@class='box video-cover']")?.GetAttributeValue("src", null); if (string.IsNullOrWhiteSpace(img) == false) { return(img); } img = doc.DocumentNode.SelectSingleNode("//meta[@property='og:image']")?.GetAttributeValue("content", null); if (string.IsNullOrWhiteSpace(img) == false) { return(img); } img = doc.DocumentNode.SelectSingleNode("//meta[@class='fancybox-video']")?.GetAttributeValue("poster", null); return(img); } List <string> GetGenres() { var v = GetValue("类别"); if (string.IsNullOrWhiteSpace(v)) { return(null); } return(v.Split(',').Select(o => o.Trim()).Distinct().ToList()); } List <string> GetActors() { var v = GetValue("演員"); if (string.IsNullOrWhiteSpace(v)) { return(null); } var ac = v.Split(',').Select(o => o.Trim()).Distinct().ToList(); for (int i = 0; i < ac.Count; i++) { var a = ac[i]; if (a.Contains("(") == false) { continue; } var arr = a.Split("()".ToArray(), StringSplitOptions.RemoveEmptyEntries).Distinct().ToArray(); if (arr.Length == 2) { ac[i] = arr[1]; } } return(ac); } List <string> GetSamples() { return(doc.DocumentNode.SelectNodes("//div[@class='tile-images preview-images']/a") ?.Select(o => o.GetAttributeValue("href", null)) .Where(o => string.IsNullOrWhiteSpace(o) == false).ToList()); } var m = new JavVideo() { Provider = Name, Url = url, Title = doc.DocumentNode.SelectSingleNode("//*[contains(@class,'title')]/strong")?.InnerText?.Trim(), Cover = GetCover(), Num = GetValue("番號"), Date = GetValue("時間"), Runtime = GetValue("時長"), Maker = GetValue("片商"), Studio = GetValue("發行"), Set = GetValue("系列"), Director = GetValue("導演"), Genres = GetGenres(), Actors = GetActors(), Samples = GetSamples(), }; m.Plot = await GetDmmPlot(m.Num); ////去除标题中的番号 if (string.IsNullOrWhiteSpace(m.Num) == false && m.Title?.StartsWith(m.Num, StringComparison.OrdinalIgnoreCase) == true) { m.Title = m.Title.Substring(m.Num.Length).Trim(); } return(m); }