diff --git a/Emby.MeiamSub.Shooter/Emby.MeiamSub.Shooter.csproj b/Emby.MeiamSub.Shooter/Emby.MeiamSub.Shooter.csproj index b21d539..acd7a57 100644 --- a/Emby.MeiamSub.Shooter/Emby.MeiamSub.Shooter.csproj +++ b/Emby.MeiamSub.Shooter/Emby.MeiamSub.Shooter.csproj @@ -1,8 +1,8 @@  - 1.0.8.0 - 1.0.8.0 - 1.0.8 + 1.0.9.0 + 1.0.9.0 + 1.0.9 netcoreapp3.1 diff --git a/Emby.MeiamSub.Shooter/ShooterProvider.cs b/Emby.MeiamSub.Shooter/ShooterProvider.cs index f0df1c6..b7c1939 100644 --- a/Emby.MeiamSub.Shooter/ShooterProvider.cs +++ b/Emby.MeiamSub.Shooter/ShooterProvider.cs @@ -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 diff --git a/Emby.MeiamSub.Thunder/Emby.MeiamSub.Thunder.csproj b/Emby.MeiamSub.Thunder/Emby.MeiamSub.Thunder.csproj index 16ea8f8..dc75f47 100644 --- a/Emby.MeiamSub.Thunder/Emby.MeiamSub.Thunder.csproj +++ b/Emby.MeiamSub.Thunder/Emby.MeiamSub.Thunder.csproj @@ -1,9 +1,9 @@  - 1.0.8.0 - 1.0.8.0 - 1.0.8 + 1.0.9.0 + 1.0.9.0 + 1.0.9 diff --git a/Emby.MeiamSub.Thunder/ThunderProvider.cs b/Emby.MeiamSub.Thunder/ThunderProvider.cs index 8ac7d51..f1d4903 100644 --- a/Emby.MeiamSub.Thunder/ThunderProvider.cs +++ b/Emby.MeiamSub.Thunder/ThunderProvider.cs @@ -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", diff --git a/Jellyfin.MeiamSub.Shooter/Jellyfin.MeiamSub.Shooter.csproj b/Jellyfin.MeiamSub.Shooter/Jellyfin.MeiamSub.Shooter.csproj index cca5e37..1ec5285 100644 --- a/Jellyfin.MeiamSub.Shooter/Jellyfin.MeiamSub.Shooter.csproj +++ b/Jellyfin.MeiamSub.Shooter/Jellyfin.MeiamSub.Shooter.csproj @@ -2,9 +2,9 @@ net5.0 - 1.0.8 - 1.0.8.0 - 1.0.8.0 + 1.0.9 + 1.0.9.0 + 1.0.9.0 diff --git a/Jellyfin.MeiamSub.Shooter/ShooterProvider.cs b/Jellyfin.MeiamSub.Shooter/ShooterProvider.cs index 589a52f..7d10071 100644 --- a/Jellyfin.MeiamSub.Shooter/ShooterProvider.cs +++ b/Jellyfin.MeiamSub.Shooter/ShooterProvider.cs @@ -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 { - 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>(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(); 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 diff --git a/Jellyfin.MeiamSub.Thunder/Jellyfin.MeiamSub.Thunder.csproj b/Jellyfin.MeiamSub.Thunder/Jellyfin.MeiamSub.Thunder.csproj index 6b3180a..3500041 100644 --- a/Jellyfin.MeiamSub.Thunder/Jellyfin.MeiamSub.Thunder.csproj +++ b/Jellyfin.MeiamSub.Thunder/Jellyfin.MeiamSub.Thunder.csproj @@ -5,7 +5,8 @@ net5.0 - 1.0.8 + 1.0.9 + 1.0.9.0 diff --git a/Jellyfin.MeiamSub.Thunder/ThunderProvider.cs b/Jellyfin.MeiamSub.Thunder/ThunderProvider.cs index 91fdc9e..8588636 100644 --- a/Jellyfin.MeiamSub.Thunder/ThunderProvider.cs +++ b/Jellyfin.MeiamSub.Thunder/ThunderProvider.cs @@ -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,