Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

匹配Emby 4.7.1.0 修复javdb解析元数据问题 增加从jav321抓取剧情方法 #292

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Emby.Actress/Emby.Actress.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Costura.Fody" Version="4.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Costura.Fody" Version="5.7.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Condition="'$(TargetFramework)'=='net461'" Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>

Expand Down
30 changes: 30 additions & 0 deletions Emby.Actress/FodyWeavers.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
Expand All @@ -43,6 +53,16 @@
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeRuntimeReferences" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if runtime assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UseRuntimeReferencePaths" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls whether the runtime assemblies are embedded with their full path or only with their assembly name.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCompression" type="xs:boolean">
<xs:annotation>
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
Expand Down Expand Up @@ -73,6 +93,16 @@
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
Expand Down
6 changes: 3 additions & 3 deletions Emby.Plugins.JavScraper/Emby.Plugins.JavScraper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
<PackageReference Include="HttpToSocks5Proxy" Version="1.4.0" />
<PackageReference Include="ILRepack" Version="2.0.18" />
<PackageReference Include="LiteDB" Version="5.0.10" />
<PackageReference Include="MediaBrowser.Server.Core" Version="4.6.0.50-*" Condition="'$(Configuration)'=='Debug' or '$(Configuration)'=='Release'" />
<PackageReference Include="Jellyfin.Controller" Version="10.4-*" Condition="'$(Configuration)'=='Debug.Jellyfin' or '$(Configuration)'=='Release.Jellyfin'" />
<PackageReference Include="MediaBrowser.Server.Core" Version="4.7.1.0" Condition="'$(Configuration)'=='Debug' or '$(Configuration)'=='Release'" />
<PackageReference Include="Jellyfin.Controller" Version="10.7.7" Condition="'$(Configuration)'=='Debug.Jellyfin' or '$(Configuration)'=='Release.Jellyfin'" />
<PackageReference Include="SkiaSharp" Version="1.68-*" />
<PackageReference Include="System.Memory" Version="4.5.3" Condition="'$(Configuration)'=='Debug' or '$(Configuration)'=='Release'" />
</ItemGroup>
Expand Down Expand Up @@ -79,7 +79,7 @@
</Target>

<!--复制到 Jellyfin 的补丁目录-->
<Target Name="JellyfinPlugin" AfterTargets="ILRepack" Condition="'$(Configuration)'=='Debug.Jellyfin' or '$(Configuration)'=='Release.Jellyfin'" >
<Target Name="JellyfinPlugin" AfterTargets="ILRepack" Condition="'$(Configuration)'=='Debug.Jellyfin' or '$(Configuration)'=='Release.Jellyfin'">
<!--<Copy SourceFiles="$(TargetPath)" DestinationFolder="D:\jellyfin\Data\plugins" OverwriteReadOnlyFiles="true" />-->
</Target>
</Project>
6 changes: 5 additions & 1 deletion Emby.Plugins.JavScraper/Http/ProxyHttpClientHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ protected override Task<HttpResponseMessage> SendAsync(
request.Headers.TryAddWithoutValidation("X-FORWARDED-FOR", cfg.X_FORWARDED_FOR);

//mgstage.com 加入年龄认证Cookies
if (request.RequestUri.ToString().Contains("mgstage.com") && !(request.Headers.TryGetValues("Cookie", out var cookies) && cookies.Contains("abc=1")))
if (request.RequestUri.ToString().Contains("mgstage.com") && !(request.Headers.TryGetValues("Cookie", out var cookies) && cookies.Contains("adc=1")))
request.Headers.Add("Cookie", "adc=1");

//dmm.co.jp 加入年龄认证Cookies
if (request.RequestUri.ToString().Contains("dmm.co.jp") && !(request.Headers.TryGetValues("Cookie", out var cookies2) && cookies2.Contains("age_check_done=1")))
request.Headers.Add("Cookie", "age_check_done=1");

//javdb.com 加入年龄认证Cookies
if (request.RequestUri.ToString().Contains("javdb") && !(request.Headers.TryGetValues("Cookie", out var cookies3) && cookies3.Contains("over18=1")))
request.Headers.Add("Cookie", "over18=1");

// Add UserAgent
if (!(request.Headers.UserAgent?.Count() > 0))
Expand Down
1 change: 0 additions & 1 deletion Emby.Plugins.JavScraper/JavMovieProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ from p in ps.DefaultIfEmpty()
OriginalTitle = m.OriginalTitle,
Genres = m.Genres?.ToArray() ?? new string[] { },
SortName = m.Num,
ForcedSortName = m.Num,
ExternalId = m.Num
};

Expand Down
1 change: 0 additions & 1 deletion Emby.Plugins.JavScraper/JavPersonProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ public async Task<MetadataResult<Person>> GetMetadata(PersonLookupInfo info, Can
Overview = additionalName?.OuterHtml + node?.OuterHtml,
OriginalTitle = name,
SortName = name,
ForcedSortName = name,
ExternalId = name
};

Expand Down
2 changes: 1 addition & 1 deletion Emby.Plugins.JavScraper/Scrapers/AVSOX.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public override bool CheckKey(string key)
/// </summary>
/// <param name="key">关键字</param>
/// <returns></returns>
protected override async Task<List<JavVideoIndex>> DoQyery(List<JavVideoIndex> ls, string key)
protected override async Task<List<JavVideoIndex>> DoQuery(List<JavVideoIndex> ls, string key)
{
///https://javdb.com/search?q=ADN-106&f=all
var doc = await GetHtmlDocumentAsync($"/cn/search/{key}");
Expand Down
55 changes: 51 additions & 4 deletions Emby.Plugins.JavScraper/Scrapers/AbstractScraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public virtual async Task<List<JavVideoIndex>> Query(string key)
var keys = GetAllKeys(key);
foreach (var k in keys)
{
await DoQyery(ls, k);
await DoQuery(ls, k);
if (ls.Any())
{
var uri = new Uri(base_url);
Expand All @@ -182,7 +182,7 @@ public virtual async Task<List<JavVideoIndex>> Query(string key)
/// <param name="ls"></param>
/// <param name="doc"></param>
/// <returns></returns>
protected abstract Task<List<JavVideoIndex>> DoQyery(List<JavVideoIndex> ls, string key);
protected abstract Task<List<JavVideoIndex>> DoQuery(List<JavVideoIndex> ls, string key);

/// <summary>
/// 解析列表
Expand Down Expand Up @@ -264,6 +264,7 @@ public static async Task<HtmlDocument> GetHtmlDocumentAsync(HttpClientEx client,
{
try
{
log?.Info($"{nameof(GetHtmlDocumentAsync)} {requestUri}");
var html = await client.GetStringAsync(requestUri);
if (string.IsNullOrWhiteSpace(html) == false)
{
Expand All @@ -274,7 +275,7 @@ public static async Task<HtmlDocument> GetHtmlDocumentAsync(HttpClientEx client,
}
catch (Exception ex)
{
log?.Error($"{ex.Message}");
log?.Error($"{nameof(GetHtmlDocumentAsync)} {ex.Message}");
}

return null;
Expand All @@ -297,6 +298,7 @@ public virtual async Task<HtmlDocument> GetHtmlDocumentByPostAsync(string reques
{
try
{
log?.Info($"{nameof(GetHtmlDocumentByPostAsync)} {requestUri}");
var resp = await client.PostAsync(requestUri, content);
if (resp.IsSuccessStatusCode == false)
{
Expand All @@ -314,7 +316,7 @@ public virtual async Task<HtmlDocument> GetHtmlDocumentByPostAsync(string reques
}
catch (Exception ex)
{
log?.Error($"{ex.Message}");
log?.Error($"{nameof(GetHtmlDocumentByPostAsync)} {ex.Message}");
}

return null;
Expand Down Expand Up @@ -358,5 +360,50 @@ public virtual async Task<string> GetDmmPlot(string num)
return plot;
}
}

public virtual async Task<string> GetJav321Plot(string num)
{
const string dmm = "jav321";
if (string.IsNullOrWhiteSpace(num))
return null;

num = num.Replace("-", "").Replace("_", "").ToLower();
using (await locker.LockAsync(num))
{
var item = Plugin.Instance.db.Plots.Find(o => o.num == num && o.provider == dmm).FirstOrDefault();
if (item != null)
return item.plot;

var url = $"https://www.jav321.com/search";

var doc = await GetHtmlDocumentByPostAsync(url, new Dictionary<string, string>() { ["sn"] = num });
if (doc == null)
return null;

var node = doc.DocumentNode.SelectSingleNode("//div[@class='panel-heading']/h3/../..");
if (node == null)
return null;

var plot = node.SelectSingleNode("./div[@class='panel-body']/div[last()]")?.InnerText?.Trim();

if (string.IsNullOrWhiteSpace(plot) == false)
{
var dt = DateTime.Now;
item = new Data.Plot()
{
created = dt,
modified = dt,
num = num,
plot = plot,
provider = dmm,
url = url
};
Plugin.Instance.db.Plots.Insert(item);
}
return plot;

}

}
}
}
4 changes: 2 additions & 2 deletions Emby.Plugins.JavScraper/Scrapers/FC2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ public override Task<List<JavVideoIndex>> Query(string key)
if (m.Success == false)
return Task.FromResult(new List<JavVideoIndex>());
var id = m.Groups["id"].Value;
return DoQyery(new List<JavVideoIndex>(), id);
return DoQuery(new List<JavVideoIndex>(), id);
}

/// <summary>
/// 获取列表
/// </summary>
/// <param name="key">关键字</param>
/// <returns></returns>
protected override async Task<List<JavVideoIndex>> DoQyery(List<JavVideoIndex> ls, string key)
protected override async Task<List<JavVideoIndex>> DoQuery(List<JavVideoIndex> ls, string key)
{
var item = await GetById(key);
if (item != null)
Expand Down
Loading