追加: 123av埋め込みプレイヤーの透明広告リンク除去サービスとプロキシAPIを追加

123av埋め込みプレイヤー(sadie-shop.site等)で定期的に出現する透明リンクエリア(__pu2)および外部サイト遷移を除去するUnifiedEmbedSanitizerを追加し、Plyrプレイヤー操作やHLSストリーム(.m3u8/セグメント/VTT)を維持したまま配信する /api/clean-embed と /api/proxy-embed-req エンドポイントを登録
This commit is contained in:
armonica committed 2026-10-24 16:31:04 +09:00
1 parent 211da2a9d4
commit 373169d697
3 files changed
+1341 -2

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -1,15 +1,22 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using WebImageViewer.Class.Unified.Common; using WebImageViewer.Class.Unified.Common;
using WebImageViewer.Class.Unified.Scrapers; using WebImageViewer.Class.Unified.Scrapers;
using WebImageViewer.Class.Unified.Services; using WebImageViewer.Class.Unified.Services;
namespace WebImageViewer.Class.Unified; namespace WebImageViewer.Class.Unified;
/// <summary>
/// 新アーキテクチャ(Unified)用のDIサービス登録拡張クラス
/// </summary>
public static class UnifiedServiceExtensions public static class UnifiedServiceExtensions
{ {
#region □メソッド(Public)
/// <summary> /// <summary>
/// 新アーキテクチャ(Unified)のサービス群をDIコンテナに登録します。 /// 新アーキテクチャ(Unified)のサービス群をDIコンテナに登録します。
/// </summary> /// </summary>
/// <param name="services">サービスコレクション</param>
/// <returns>登録後のサービスコレクション</returns>
public static IServiceCollection AddUnifiedServices(this IServiceCollection services) public static IServiceCollection AddUnifiedServices(this IServiceCollection services)
{ {
// HTTP通信ヘルパー // HTTP通信ヘルパー
@@ -23,6 +30,9 @@ public static class UnifiedServiceExtensions
services.AddScoped<IUnifiedScraper, UnifiedAuraHentaiScraper>(); services.AddScoped<IUnifiedScraper, UnifiedAuraHentaiScraper>();
services.AddScoped<IUnifiedScraper, UnifiedMangalearScraper>(); services.AddScoped<IUnifiedScraper, UnifiedMangalearScraper>();
// 123av等の透明リンクエリア・外部広告除去サニタイザー
services.AddScoped<UnifiedEmbedSanitizer>();
// 動画埋め込み抽出エンジン // 動画埋め込み抽出エンジン
services.AddScoped<VideoEmbedExtractor>(); services.AddScoped<VideoEmbedExtractor>();
@@ -31,4 +41,6 @@ public static class UnifiedServiceExtensions
return services; return services;
} }
#endregion
} }
+20 -1
View File
@@ -1,4 +1,4 @@
using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.HttpOverrides;
using WebImageViewer.Class.Legacy; using WebImageViewer.Class.Legacy;
using WebImageViewer.Class.Unified; using WebImageViewer.Class.Unified;
using WebImageViewer.Class.Unified.Common; using WebImageViewer.Class.Unified.Common;
@@ -114,6 +114,25 @@ app.MapGet("/api/proxy-image", async (string url, string? referer, HttpContext h
} }
}); });
// ==========================================
// 123av等の動画プレイヤー透明リンクエリア・外部リンク除去プロキシAPI
// ==========================================
app.MapGet("/api/clean-embed", async (string? url, string? referer, UnifiedEmbedSanitizer embedSanitizer, CancellationToken ct) =>
{
if (string.IsNullOrWhiteSpace(url))
{
return Results.BadRequest("url is required");
}
var sanitizedHtml = await embedSanitizer.GetSanitizedEmbedHtmlAsync(url, referer, ct);
return Results.Content(sanitizedHtml, "text/html; charset=utf-8");
});
app.MapMethods("/api/proxy-embed-req", new[] { "GET", "POST", "HEAD" }, async (string? url, string? referer, HttpContext httpContext, UnifiedEmbedSanitizer embedSanitizer, CancellationToken ct) =>
{
return await embedSanitizer.ProxyEmbedRequestAsync(httpContext, url, referer, ct);
});
// ========================================== // ==========================================
// 旧バージョン(Legacy)のエンドポイント登録 // 旧バージョン(Legacy)のエンドポイント登録
// (/view, /video, /{site}/{id}, /spankbang/{id}, 旧API等を過去互換用として保持) // (/view, /video, /{site}/{id}, /spankbang/{id}, 旧API等を過去互換用として保持)