修复射手无法查询无字幕问题

This commit is contained in:
Meiam
2023-02-09 22:38:20 +08:00
parent 0c5a3656c8
commit 8bebe5ba5b
8 changed files with 36 additions and 37 deletions

View File

@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyVersion>1.0.8.0</AssemblyVersion>
<FileVersion>1.0.8.0</FileVersion>
<Version>1.0.8</Version>
<AssemblyVersion>1.0.9.0</AssemblyVersion>
<FileVersion>1.0.9.0</FileVersion>
<Version>1.0.9</Version>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

View File

@@ -90,9 +90,11 @@ namespace Emby.MeiamSub.Shooter
var hash = ComputeFileHash(fileInfo);
_logger.Info($"{Name} Search | FileHash -> { hash }");
HttpRequestOptions options = new HttpRequestOptions
{
Url = $"http://www.shooter.cn/api/subapi.php",
Url = $"https://www.shooter.cn/api/subapi.php",
UserAgent = $"{Name}",
TimeoutMs = 30000,
AcceptHeader = "*/*",
@@ -185,8 +187,6 @@ namespace Emby.MeiamSub.Shooter
return new SubtitleResponse();
}
downloadSub.Url = downloadSub.Url.Replace("https://www.shooter.cn", "http://www.shooter.cn");
_logger.Info($"{Name} DownloadSub | Url -> { downloadSub.Url } | Format -> { downloadSub.Format } | Language -> { downloadSub.Language } ");
var response = await _httpClient.GetResponse(new HttpRequestOptions

View File

@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyVersion>1.0.8.0</AssemblyVersion>
<FileVersion>1.0.8.0</FileVersion>
<Version>1.0.8</Version>
<AssemblyVersion>1.0.9.0</AssemblyVersion>
<FileVersion>1.0.9.0</FileVersion>
<Version>1.0.9</Version>
</PropertyGroup>
<PropertyGroup>

View File

@@ -85,6 +85,8 @@ namespace Emby.MeiamSub.Thunder
var cid = GetCidByFile(request.MediaPath);
_logger.Info($"{Name} Search | FileHash -> { cid }");
var response = await _httpClient.GetResponse(new HttpRequestOptions
{
//Url = $"http://sub.xmp.sandai.net:8000/subxl/{cid}.json",

View File

@@ -2,9 +2,9 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Version>1.0.8</Version>
<AssemblyVersion>1.0.8.0</AssemblyVersion>
<FileVersion>1.0.8.0</FileVersion>
<Version>1.0.9</Version>
<AssemblyVersion>1.0.9.0</AssemblyVersion>
<FileVersion>1.0.9.0</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

View File

@@ -83,42 +83,38 @@ namespace Jellyfin.MeiamSub.Shooter
var hash = ComputeFileHash(fileInfo);
var content = new StringContent(JsonSerializer.Serialize(new
{
filehash = HttpUtility.UrlEncode(hash),
pathinfo = HttpUtility.UrlEncode(request.MediaPath),
format = "json",
lang = request.Language == "chi" ? "chn" : "eng"
}), Encoding.UTF8, "application/json");
_logger.LogInformation($"{Name} Search | FileHash -> { hash }");
var options = new HttpRequestMessage
var content = new Dictionary<string, string>
{
Method = HttpMethod.Post,
RequestUri = new Uri($"http://www.shooter.cn/api/subapi.php"),
Content = content,
Headers =
{
UserAgent = { new ProductInfoHeaderValue(new ProductHeaderValue($"{Name}")) },
Accept = { new MediaTypeWithQualityHeaderValue("*/*") }
}
{ "filehash", hash},
{ "pathinfo", request.MediaPath},
{ "format", "json"},
{ "lang", request.Language == "chi" ? "chn" : "eng"}
};
_logger.LogInformation($"{Name} Search | Request -> { JsonSerializer.Serialize(options) }");
HttpRequestMessage requestMessage = new HttpRequestMessage();
var response = await _httpClient.SendAsync(options);
requestMessage.Method = HttpMethod.Post;
requestMessage.RequestUri = new Uri($"https://www.shooter.cn/api/subapi.php");
requestMessage.Content = new FormUrlEncodedContent(content);
requestMessage.Headers.Add("User-Agent", $"{Name}");
requestMessage.Headers.Add("Accept-Encoding", $"gzip, deflate, br");
requestMessage.Headers.Add("Accept", $"*/*");
var response = await _httpClient.SendAsync(requestMessage);
_logger.LogInformation($"{Name} Search | Response -> { JsonSerializer.Serialize(response) }");
if (response.StatusCode == HttpStatusCode.OK && response.Headers.Any(m => m.Value.Contains("application/json")))
if (response.StatusCode == HttpStatusCode.OK && response.Content.Headers.Any(m => m.Value.Contains("application/json; charset=utf-8")))
{
var subtitleResponse = JsonSerializer.Deserialize<List<SubtitleResponseRoot>>(await response.Content.ReadAsStringAsync());
_logger.LogInformation($"{Name} Search | Response -> { JsonSerializer.Serialize(subtitleResponse) }");
if (subtitleResponse != null)
{
_logger.LogInformation($"{Name} Search | Response -> { JsonSerializer.Serialize(subtitleResponse) }");
var remoteSubtitleInfos = new List<RemoteSubtitleInfo>();
foreach (var subFileInfo in subtitleResponse)
@@ -185,8 +181,6 @@ namespace Jellyfin.MeiamSub.Shooter
return new SubtitleResponse();
}
downloadSub.Url = downloadSub.Url.Replace("https://www.shooter.cn", "http://www.shooter.cn");
_logger.LogInformation($"{Name} DownloadSub | Url -> { downloadSub.Url } | Format -> { downloadSub.Format } | Language -> { downloadSub.Language } ");
using var options = new HttpRequestMessage

View File

@@ -5,7 +5,8 @@
<TargetFramework>net5.0</TargetFramework>
<ApplicationIcon />
<StartupObject />
<Version>1.0.8</Version>
<Version>1.0.9</Version>
<AssemblyVersion>1.0.9.0</AssemblyVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

View File

@@ -80,6 +80,8 @@ namespace Jellyfin.MeiamSub.Thunder
var cid = GetCidByFile(request.MediaPath);
_logger.LogInformation($"{Name} Search | FileHash -> { cid }");
using var options = new HttpRequestMessage
{
Method = HttpMethod.Get,