diff --git a/Emby.Plugins.JavScraper/JavMovieProvider.cs b/Emby.Plugins.JavScraper/JavMovieProvider.cs index 3a61af8..e263ffe 100644 --- a/Emby.Plugins.JavScraper/JavMovieProvider.cs +++ b/Emby.Plugins.JavScraper/JavMovieProvider.cs @@ -214,6 +214,10 @@ from p in ps.DefaultIfEmpty() ForcedSortName = m.Num, ExternalId = m.Num }; + + if (m.CommunityRating >= 0 && m.CommunityRating <= 10) + metadataResult.Item.CommunityRating = m.CommunityRating; + #if !__JELLYFIN__ if (!string.IsNullOrWhiteSpace(m.Set)) metadataResult.Item.AddCollection(m.Set); diff --git a/Emby.Plugins.JavScraper/Scrapers/FC2.cs b/Emby.Plugins.JavScraper/Scrapers/FC2.cs index ebbc24e..eb81b38 100644 --- a/Emby.Plugins.JavScraper/Scrapers/FC2.cs +++ b/Emby.Plugins.JavScraper/Scrapers/FC2.cs @@ -137,7 +137,7 @@ private async Task GetById(string id) //尝试获取 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; + : n.InnerText?.Split(':').Last(); if (string.IsNullOrWhiteSpace(value) == false) dic[name] = value; @@ -161,6 +161,19 @@ string getDate() return dm.Groups["date"].Value.Replace('/', '-'); } + float? GetCommunityRating() + { + var value = GetValue("影片评分"); + if (string.IsNullOrWhiteSpace(value)) + return null; + var m = Regex.Match(value, @"(?[\d.]+)"); + if (m.Success == false) + return null; + if (float.TryParse(m.Groups["rating"].Value, out var rating)) + return rating / 10.0f; + return null; + } + 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() @@ -180,6 +193,7 @@ string getDate() Genres = genres, Actors = actors, Samples = samples, + CommunityRating = GetCommunityRating(), }; //去除标题中的番号 if (string.IsNullOrWhiteSpace(m.Num) == false && m.Title?.StartsWith(m.Num, StringComparison.OrdinalIgnoreCase) == true) diff --git a/Emby.Plugins.JavScraper/Scrapers/JavDB.cs b/Emby.Plugins.JavScraper/Scrapers/JavDB.cs index 5647aa7..419af5c 100644 --- a/Emby.Plugins.JavScraper/Scrapers/JavDB.cs +++ b/Emby.Plugins.JavScraper/Scrapers/JavDB.cs @@ -220,6 +220,19 @@ List GetActors() return ac; } + float? GetCommunityRating() + { + var value = GetValue("評分"); + if (string.IsNullOrWhiteSpace(value)) + return null; + var m = Regex.Match(value, @"(?[\d.]+)分"); + if (m.Success == false) + return null; + if (float.TryParse(m.Groups["rating"].Value, out var rating)) + return rating / 5.0f * 10f; + return null; + } + List GetSamples() { return doc.DocumentNode.SelectNodes("//div[@class='tile-images preview-images']/a") @@ -243,6 +256,7 @@ List GetSamples() Genres = GetGenres(), Actors = GetActors(), Samples = GetSamples(), + CommunityRating = GetCommunityRating(), }; m.Plot = await GetDmmPlot(m.Num); diff --git a/Emby.Plugins.JavScraper/Scrapers/JavVideo.cs b/Emby.Plugins.JavScraper/Scrapers/JavVideo.cs index fa81b67..16bb282 100644 --- a/Emby.Plugins.JavScraper/Scrapers/JavVideo.cs +++ b/Emby.Plugins.JavScraper/Scrapers/JavVideo.cs @@ -66,6 +66,11 @@ public class JavVideo : JavVideoIndex /// public List Samples { get; set; } + /// + /// 公众评分 0-10之间。 + /// + public float? CommunityRating { get; set; } + /// /// %genre:中文字幕?中文:% ///