From 01a63763285c0512df4fa85b24cbfe489ab12017 Mon Sep 17 00:00:00 2001 From: uduki Date: Thu, 10 Sep 2026 18:23:53 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8B=95=E7=94=BB=E3=83=97=E3=83=AC?= =?UTF-8?q?=E3=82=A4=E3=83=A4=E3=83=BC=E4=B8=8B=E9=83=A8=E3=83=86=E3=82=AD?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=83=9C=E3=83=83=E3=82=AF=E3=82=B9=E3=81=AE?= =?UTF-8?q?=E3=83=95=E3=83=ABURL=E3=82=A8=E3=83=A9=E3=83=BC=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E3=80=81=E7=94=BB=E5=83=8F=E3=83=BB=E5=8B=95=E7=94=BB?= =?UTF-8?q?=E4=B8=A1=E5=AF=BE=E5=BF=9C=E3=81=AE=E8=87=AA=E5=8B=95=E5=88=A4?= =?UTF-8?q?=E5=88=A5=E3=83=8A=E3=83=93=E3=82=B2=E3=83=BC=E3=82=B7=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E3=81=8A=E3=82=88=E3=81=B3=E7=9B=B8=E4=BA=92=E3=83=AA?= =?UTF-8?q?=E3=83=80=E3=82=A4=E3=83=AC=E3=82=AF=E3=83=88=E3=81=AE=E5=AE=9F?= =?UTF-8?q?=E8=A3=85=E3=80=81=E6=8E=A2=E7=B4=A2=E9=9A=8E=E5=B1=A410?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Class/Renderers/HtmlRenderer.cs | 440 ++++++++++++------ .../Class/Services/VideoUrlResolver.cs | 4 +- WebImageViewer/Program.cs | 100 +++- 3 files changed, 378 insertions(+), 166 deletions(-) diff --git a/WebImageViewer/Class/Renderers/HtmlRenderer.cs b/WebImageViewer/Class/Renderers/HtmlRenderer.cs index 20c25cb..41b881a 100644 --- a/WebImageViewer/Class/Renderers/HtmlRenderer.cs +++ b/WebImageViewer/Class/Renderers/HtmlRenderer.cs @@ -1523,43 +1523,176 @@ public static class HtmlRenderer } } - // 動画URL/IDの判定と遷移 - function navigateVideoInput(input) { + // 汎用URL/IDナビゲーション処理(画像ギャラリー・動画の両対応判定) + function navigateUniversalInput(input) { if (!input) return; input = input.trim(); - // 123av判定 + // 1. フルURL(http:// または https://)の場合 + if (input.startsWith('http://') || input.startsWith('https://')) { + try { + const urlObj = new URL(input); + const host = urlObj.hostname.toLowerCase(); + const path = urlObj.pathname.replace(/^\/+|\/+$/g, ''); + + // 画像ギャラリーサイト判定 + if (host.includes('e-hentai.org') || host.includes('exhentai.org')) { + const gm = path.match(/g\/(\d+)\/([a-z0-9]+)/i); + if (gm) { + window.location.href = '/ehentai/' + gm[1] + '/' + gm[2] + '/'; + return; + } + window.location.href = '/view?url=' + encodeURIComponent(input); + return; + } + if (host.includes('hitomi.la')) { + const hm = path.match(/(?:doujinshi|manga|gamecg|artistcg|anime)\/[^\/]+-(\d+)\.html/i) || path.match(/(\d+)\.html/i) || path.match(/(\d+)$/i); + if (hm) { + window.location.href = '/hitomi/' + hm[1] + '/'; + return; + } + window.location.href = '/view?url=' + encodeURIComponent(input); + return; + } + if (host.includes('aurahentai.com')) { + const am = path.match(/gallery\/([0-9a-zA-Z_\-]+)/i); + if (am) { + window.location.href = '/aurahentai/' + am[1] + '/'; + return; + } + window.location.href = '/view?url=' + encodeURIComponent(input); + return; + } + if (host.includes('momon-ga.com') || host.includes('momonga')) { + const mm = path.match(/(?:fanzine|magazine|comic)\/([0-9a-zA-Z_\-]+)/i) || path.match(/(mo\d+)/i); + if (mm) { + window.location.href = '/momonga/' + mm[1] + '/'; + return; + } + window.location.href = '/view?url=' + encodeURIComponent(input); + return; + } + if (host.includes('mangalear.com') || host.includes('mangalear.blog')) { + const p = urlObj.searchParams.get('p'); + if (p) { + window.location.href = '/mangalear/' + p + '/'; + return; + } + const ml = path.match(/(?:manga|series|detail)\/([0-9a-zA-Z_\-]+)/i) || path.match(/(\d+)/i); + if (ml) { + window.location.href = '/mangalear/' + ml[1] + '/'; + return; + } + window.location.href = '/view?url=' + encodeURIComponent(input); + return; + } + if (host.includes('hentaipaw.com')) { + const hp = path.match(/doujinshi\/([0-9a-zA-Z_\-]+)/i) || path.match(/(\d+)/i); + if (hp) { + window.location.href = '/hentaipaw/' + hp[1] + '/'; + return; + } + window.location.href = '/view?url=' + encodeURIComponent(input); + return; + } + + // 主要動画サイト判定 + if (host.includes('123av')) { + const match = path.match(/(?:video\/|^)([a-zA-Z0-9_-]+)/i); + if (match) { + window.location.href = '/123av/' + encodeURIComponent(match[1]); + return; + } + } + if (host.includes('missav')) { + const match = path.match(/(?:[a-z]{2}\/)?([a-zA-Z0-9_-]+)$/i); + if (match) { + window.location.href = '/missav/' + encodeURIComponent(match[1]); + return; + } + } + if (host.includes('spankbang')) { + const sbMatch = path.match(/([a-z0-9]+)(?:\/(?:video|play|embed)|\/|$)/i); + if (sbMatch) { + window.location.href = '/spankbang/' + encodeURIComponent(sbMatch[1]); + return; + } + } + + // 動画ホストまたはまとめブログ等は /video?url= + const videoHosts = ['do-ga.eroterest.net', 'movie.eroterest.net', 'vjav.com', 'laxd.com', 'fc2.com', 'inporn.com', 'bdsmx.tube', 'senzuri.tube', 'txxx.com', 'hclips.com', 'hdzog.com', 'upornia.com', 'youjizz.com', 'xvideos.com', 'blogterest.net', 'blog.2nt.com']; + if (videoHosts.some(vh => host.includes(vh))) { + window.location.href = '/video?url=' + encodeURIComponent(input); + return; + } + + // デフォルト画像ビューアー + window.location.href = '/view?url=' + encodeURIComponent(input); + return; + } catch (e) { + window.location.href = '/view?url=' + encodeURIComponent(input); + return; + } + } + + // 2. プレフィックス付きサイト指定 (/site/id や site/id) + const slashMatch = input.match(/^([a-z0-9_-]+)\/([a-z0-9_\-\/]+)$/i); + if (slashMatch) { + const s = slashMatch[1].toLowerCase(); + const v = slashMatch[2].replace(/^\/+|\/+$/g, ''); + const gallerySites = ['ehentai', 'hitomi', 'aurahentai', 'momonga', 'mangalear', 'hentaipaw']; + const videoSites = ['123av', 'missav', 'spankbang', 'doga', 'vjav', 'laxd', 'fc2', 'xvideos', 'inporn', 'bdsmx', 'senzuri', 'txxx', 'hclips', 'hdzog', 'upornia', 'youjizz']; + if (gallerySites.includes(s)) { + window.location.href = '/' + s + '/' + v + '/'; + return; + } + if (videoSites.includes(s)) { + window.location.href = '/' + s + '/' + encodeURIComponent(v); + return; + } + } + + // 3. 123av / missav / spankbang のキーワード判定 if (input.toLowerCase().includes('123av')) { - const match = input.match(/(?:123av\.com\/[a-z]{2}\/(?:video\/)?|^123av\/)([^/?#]+)/i); - const id = match ? match[1] : input.replace(/^123av\//i, '').replace(/^\/+|\/+$/g, ''); + const id = input.replace(/^123av\//i, '').replace(/^\/+|\/+$/g, ''); window.location.href = '/123av/' + encodeURIComponent(id); return; } - - // missav判定 if (input.toLowerCase().includes('missav')) { - const match = input.match(/(?:missav\.[a-z]+\/[a-z]{2}\/|^missav\/)([^/?#]+)/i); - const id = match ? match[1] : input.replace(/^missav\//i, '').replace(/^\/+|\/+$/g, ''); + const id = input.replace(/^missav\//i, '').replace(/^\/+|\/+$/g, ''); window.location.href = '/missav/' + encodeURIComponent(id); return; } - - // SpankBang判定 - const sbMatch = input.match(/spankbang\.(?:com|party)\/([a-z0-9]+)(?:\/(?:video|play|embed)|\/|$)/i) || input.match(/^spankbang\/([a-z0-9]+)/i); - if (sbMatch) { - window.location.href = '/spankbang/' + encodeURIComponent(sbMatch[1]); + if (input.toLowerCase().includes('spankbang')) { + const id = input.replace(/^spankbang\//i, '').replace(/^\/+|\/+$/g, ''); + window.location.href = '/spankbang/' + encodeURIComponent(id); return; } - // デフォルト: 汎用 /video - window.location.href = '/video?url=' + encodeURIComponent(input); + // 4. E-Hentai の gid/token 形式 (例: 4159771/95d2fa13bd または 4159771_95d2fa13bd) + const ehPair = input.match(/^(\d+)[/_ -]([a-z0-9]{10})$/i); + if (ehPair) { + window.location.href = '/ehentai/' + ehPair[1] + '/' + ehPair[2] + '/'; + return; + } + + // 5. 自動判定 + if (/^\d{7,}$/.test(input)) { + window.location.href = '/hitomi/' + input + '/'; + } else if (/^\d+$/.test(input)) { + window.location.href = '/aurahentai/' + input + '/'; + } else if (input.startsWith('mo') || input.startsWith('MO')) { + window.location.href = '/momonga/' + input + '/'; + } else { + window.location.href = '/view?url=' + encodeURIComponent(input); + } } // 動画用フォーム送信イベント document.getElementById('videoForm').addEventListener('submit', function(e) { e.preventDefault(); const input = document.getElementById('videoUrlInput').value.trim(); - navigateVideoInput(input); + navigateUniversalInput(input); }); // 画像用フォーム送信イベント @@ -1569,116 +1702,19 @@ public static class HtmlRenderer const siteSelect = document.getElementById('siteSelect').value; if (!input) return; - // 動画サイト選択または動画URLの判定 - if (siteSelect === 'spankbang' || siteSelect === '123av' || siteSelect === 'missav' || - input.toLowerCase().includes('spankbang') || input.toLowerCase().includes('123av') || input.toLowerCase().includes('missav')) { - if (siteSelect === '123av' && !input.toLowerCase().includes('123av')) { - window.location.href = '/123av/' + encodeURIComponent(input); - return; - } - if (siteSelect === 'missav' && !input.toLowerCase().includes('missav')) { - window.location.href = '/missav/' + encodeURIComponent(input); - return; - } - if (siteSelect === 'spankbang' && !input.toLowerCase().includes('spankbang')) { - window.location.href = '/spankbang/' + encodeURIComponent(input); - return; - } - navigateVideoInput(input); - return; - } - - // 完全URLの場合 - if (input.startsWith('http://') || input.startsWith('https://')) { - try { - const url = new URL(input); - const host = url.hostname.toLowerCase(); - const path = url.pathname.replace(/^\/+|\/+$/g, ''); - - if (host.includes('e-hentai.org') || host.includes('exhentai.org')) { - const gm = path.match(/g\/(\d+)\/([a-z0-9]+)/i); - if (gm) { - window.location.href = '/ehentai/' + gm[1] + '/' + gm[2] + '/'; - return; - } - const sm = path.match(/s\/([a-z0-9]+)\/(\d+)-/i); - if (sm) { - window.location.href = '/view?url=' + encodeURIComponent(input); - return; - } - } - if (host.includes('hitomi.la')) { - const m = path.match(/(?:-|\/)(\d{5,8})(?:\.html)?$/) || path.match(/\d{5,8}/); - const id = m ? m[1] || m[0] : path; - window.location.href = '/hitomi/' + id + '/'; - return; - } - if (host.includes('aurahentai.com')) { - const segs = path.split('/'); - const id = segs.length >= 2 ? segs[1] : segs[0]; - window.location.href = '/aurahentai/' + id + '/'; - return; - } - if (host.includes('momon-ga.com')) { - const segs = path.split('/'); - const id = segs.length >= 2 ? segs[1] : segs[0]; - window.location.href = '/momonga/' + id + '/'; - return; - } - if (host.includes('mangalear.blog')) { - const p = url.searchParams.get('p'); - if (p) { - window.location.href = '/mangalear/' + p + '/'; - return; - } - const segs = path.split('/'); - const id = segs.length >= 2 ? segs[1] : segs[0]; - window.location.href = '/mangalear/' + id + '/'; - return; - } - - // 汎用ビューアーへ - window.location.href = '/view?url=' + encodeURIComponent(input); - return; - } catch(err) { - window.location.href = '/view?url=' + encodeURIComponent(input); - return; - } - } - // サイト選択が明示されている場合 if (siteSelect !== 'auto') { const cleanId = input.replace(/^\/+|\/+$/g, ''); + const videoSites = ['123av', 'missav', 'spankbang']; + if (videoSites.includes(siteSelect)) { + window.location.href = '/' + siteSelect + '/' + encodeURIComponent(cleanId); + return; + } window.location.href = '/' + siteSelect + '/' + cleanId + '/'; return; } - // E-Hentai の gid/token 形式 (例: 4159771/95d2fa13bd または 4159771_95d2fa13bd) - const ehPair = input.match(/^(\d+)[/_ -]([a-z0-9]{10})$/i); - if (ehPair) { - window.location.href = '/ehentai/' + ehPair[1] + '/' + ehPair[2] + '/'; - return; - } - - // スラッシュが含まれる場合 (例: ehentai/4159771/95d2fa13bd や hitomi/4159707 や momonga/mo3469109) - if (input.includes('/')) { - window.location.href = '/' + input.replace(/^\/+|\/+$/g, '') + '/'; - return; - } - - // 自動判定 - if (/^\d{7,}$/.test(input)) { - // 7桁以上の数字 -> hitomi - window.location.href = '/hitomi/' + input + '/'; - } else if (/^\d+$/.test(input)) { - // 6桁以下の数字 -> aurahentai - window.location.href = '/aurahentai/' + input + '/'; - } else if (input.startsWith('mo') || input.startsWith('MO')) { - // moで始まる -> momonga - window.location.href = '/momonga/' + input + '/'; - } else { - window.location.href = '/view?id=' + encodeURIComponent(input); - } + // URLまたはIDを画像・動画両対応でスマートに判定・遷移 }); @@ -2414,10 +2450,10 @@ public static class HtmlRenderer
- +
- - + +
@@ -2492,37 +2528,159 @@ public static class HtmlRenderer } } - // 動画切り替えフォーム - document.getElementById('switchForm').addEventListener('submit', (e) => { - e.preventDefault(); - const input = document.getElementById('switchInput').value.trim(); + // 汎用URL・IDナビゲーション処理(画像ギャラリー・動画の両対応判定) + function navigateUniversalInput(input) { if (!input) return; + input = input.trim(); - // 123av判定 + // 1. フルURL(http:// または https://)の場合 + if (input.startsWith('http://') || input.startsWith('https://')) { + try { + const urlObj = new URL(input); + const host = urlObj.hostname.toLowerCase(); + const path = urlObj.pathname.replace(/^\/+|\/+$/g, ''); + + // 画像ギャラリーサイト判定 + if (host.includes('e-hentai.org') || host.includes('exhentai.org')) { + const gm = path.match(/g\/(\d+)\/([a-z0-9]+)/i); + if (gm) { + window.location.href = '/ehentai/' + gm[1] + '/' + gm[2] + '/'; + return; + } + window.location.href = '/view?url=' + encodeURIComponent(input); + return; + } + if (host.includes('hitomi.la')) { + const hm = path.match(/(?:doujinshi|manga|gamecg|artistcg|anime)\/[^\/]+-(\d+)\.html/i) || path.match(/(\d+)\.html/i) || path.match(/(\d+)$/i); + if (hm) { + window.location.href = '/hitomi/' + hm[1] + '/'; + return; + } + window.location.href = '/view?url=' + encodeURIComponent(input); + return; + } + if (host.includes('aurahentai.com')) { + const am = path.match(/gallery\/([0-9a-zA-Z_\-]+)/i); + if (am) { + window.location.href = '/aurahentai/' + am[1] + '/'; + return; + } + window.location.href = '/view?url=' + encodeURIComponent(input); + return; + } + if (host.includes('momon-ga.com') || host.includes('momonga')) { + const mm = path.match(/(?:fanzine|magazine|comic)\/([0-9a-zA-Z_\-]+)/i) || path.match(/(mo\d+)/i); + if (mm) { + window.location.href = '/momonga/' + mm[1] + '/'; + return; + } + window.location.href = '/view?url=' + encodeURIComponent(input); + return; + } + if (host.includes('mangalear.com')) { + const ml = path.match(/(?:manga|series|detail)\/([0-9a-zA-Z_\-]+)/i) || path.match(/(\d+)/i); + if (ml) { + window.location.href = '/mangalear/' + ml[1] + '/'; + return; + } + window.location.href = '/view?url=' + encodeURIComponent(input); + return; + } + if (host.includes('hentaipaw.com')) { + const hp = path.match(/doujinshi\/([0-9a-zA-Z_\-]+)/i) || path.match(/(\d+)/i); + if (hp) { + window.location.href = '/hentaipaw/' + hp[1] + '/'; + return; + } + window.location.href = '/view?url=' + encodeURIComponent(input); + return; + } + + // 主要動画サイト判定 + if (host.includes('123av')) { + const match = path.match(/(?:video\/|^)([a-zA-Z0-9_-]+)/i); + if (match) { + window.location.href = '/123av/' + encodeURIComponent(match[1]); + return; + } + } + if (host.includes('missav')) { + const match = path.match(/(?:[a-z]{2}\/)?([a-zA-Z0-9_-]+)$/i); + if (match) { + window.location.href = '/missav/' + encodeURIComponent(match[1]); + return; + } + } + if (host.includes('spankbang')) { + const sbMatch = path.match(/([a-z0-9]+)(?:\/(?:video|play|embed)|\/|$)/i); + if (sbMatch) { + window.location.href = '/spankbang/' + encodeURIComponent(sbMatch[1]); + return; + } + } + + // その他の動画ホストまたはまとめブログ等は /video?url= でサーバー自動解決 + window.location.href = '/video?url=' + encodeURIComponent(input); + return; + } catch (e) { + window.location.href = '/video?url=' + encodeURIComponent(input); + return; + } + } + + // 2. プレフィックス付きサイト指定 (/site/id や site/id) + const slashMatch = input.match(/^([a-z0-9_-]+)\/([a-z0-9_\-\/]+)$/i); + if (slashMatch) { + const s = slashMatch[1].toLowerCase(); + const v = slashMatch[2].replace(/^\/+|\/+$/g, ''); + const gallerySites = ['ehentai', 'hitomi', 'aurahentai', 'momonga', 'mangalear', 'hentaipaw']; + const videoSites = ['123av', 'missav', 'spankbang', 'doga', 'vjav', 'laxd', 'fc2', 'xvideos', 'inporn', 'bdsmx', 'senzuri', 'txxx', 'hclips', 'hdzog', 'upornia', 'youjizz']; + if (gallerySites.includes(s)) { + window.location.href = '/' + s + '/' + v + '/'; + return; + } + if (videoSites.includes(s)) { + window.location.href = '/' + s + '/' + encodeURIComponent(v); + return; + } + } + + // 3. 123av / missav / spankbang のキーワード判定 if (input.toLowerCase().includes('123av')) { - const match = input.match(/(?:123av\.com\/[a-z]{2}\/(?:video\/)?|^123av\/)([^/?#]+)/i); - const id = match ? match[1] : input.replace(/^123av\//i, '').replace(/^\/+|\/+$/g, ''); + const id = input.replace(/^123av\//i, '').replace(/^\/+|\/+$/g, ''); window.location.href = '/123av/' + encodeURIComponent(id); return; } - - // missav判定 if (input.toLowerCase().includes('missav')) { - const match = input.match(/(?:missav\.[a-z]+\/[a-z]{2}\/|^missav\/)([^/?#]+)/i); - const id = match ? match[1] : input.replace(/^missav\//i, '').replace(/^\/+|\/+$/g, ''); + const id = input.replace(/^missav\//i, '').replace(/^\/+|\/+$/g, ''); window.location.href = '/missav/' + encodeURIComponent(id); return; } - - // SpankBang判定 - const sbMatch = input.match(/spankbang\.(?:com|party)\/([a-z0-9]+)(?:\/(?:video|play|embed)|\/|$)/i); - if (sbMatch) { - window.location.href = '/spankbang/' + encodeURIComponent(sbMatch[1]); + if (input.toLowerCase().includes('spankbang')) { + const id = input.replace(/^spankbang\//i, '').replace(/^\/+|\/+$/g, ''); + window.location.href = '/spankbang/' + encodeURIComponent(id); return; } - // 現在のサイトとして遷移 - window.location.href = '/' + currentSite + '/' + encodeURIComponent(input); + // 4. E-Hentai の {gid}/{token} 形式判定 + if (/^\d+\/[a-z0-9]+$/i.test(input)) { + window.location.href = '/ehentai/' + input + '/'; + return; + } + + // 5. 現在のサイトが動画プレイヤーの場合のフォールバック + if (currentSite && currentSite !== 'video') { + window.location.href = '/' + currentSite + '/' + encodeURIComponent(input); + } else { + window.location.href = '/video?id=' + encodeURIComponent(input); + } + } + + // 切り替えフォーム送信イベント + document.getElementById('switchForm').addEventListener('submit', (e) => { + e.preventDefault(); + const input = document.getElementById('switchInput').value.trim(); + navigateUniversalInput(input); }); diff --git a/WebImageViewer/Class/Services/VideoUrlResolver.cs b/WebImageViewer/Class/Services/VideoUrlResolver.cs index e8e350c..0cf22f0 100644 --- a/WebImageViewer/Class/Services/VideoUrlResolver.cs +++ b/WebImageViewer/Class/Services/VideoUrlResolver.cs @@ -341,13 +341,13 @@ public class VideoUrlResolver int currentDepth, CancellationToken ct) { - if (currentDepth > 3) + if (currentDepth > 10) { return new ResolvedVideoResult { IsSuccess = false, OriginalUrl = pageUrl, - ErrorMessage = "探索階層の深さ上限(3階層)に達しました。" + ErrorMessage = "探索階層の深さ上限(10階層)に達しました。" }; } diff --git a/WebImageViewer/Program.cs b/WebImageViewer/Program.cs index 1e93f3f..f166264 100644 --- a/WebImageViewer/Program.cs +++ b/WebImageViewer/Program.cs @@ -84,30 +84,10 @@ app.MapGet("/view", async (string? url, string? site, string? id, string? catego return Results.Redirect("/"); } - // 動画サイト判定(SpankBang, 123av, missav) - if (string.Equals(site, "spankbang", StringComparison.OrdinalIgnoreCase) || target.Contains("spankbang", StringComparison.OrdinalIgnoreCase)) + // 動画サイト・動画URL判定(各種動画サイトまたはまとめブログのURLであれば /video へ自動リダイレクト) + if (IsVideoUrlOrSite(site, target)) { - var sbId = ExtractSpankBangId(target); - if (!string.IsNullOrWhiteSpace(sbId)) - { - return Results.Redirect($"/spankbang/{sbId}"); - } - } - if (string.Equals(site, "123av", StringComparison.OrdinalIgnoreCase) || target.Contains("123av", StringComparison.OrdinalIgnoreCase)) - { - var vId = Extract123AvId(target); - if (!string.IsNullOrWhiteSpace(vId)) - { - return Results.Redirect($"/123av/{vId}"); - } - } - if (string.Equals(site, "missav", StringComparison.OrdinalIgnoreCase) || target.Contains("missav", StringComparison.OrdinalIgnoreCase)) - { - var vId = ExtractMissAvId(target); - if (!string.IsNullOrWhiteSpace(vId)) - { - return Results.Redirect($"/missav/{vId}"); - } + return Results.Redirect($"/video?url={Uri.EscapeDataString(target)}"); } return await RenderGalleryResponseAsync(site, target, category, galleryService, ct); @@ -130,6 +110,12 @@ app.MapGet("/video", async ( return Results.Redirect("/"); } + // 画像ギャラリーURL判定(画像サイトのURLであれば /view へ自動リダイレクト) + if (IsGalleryUrlOrSite(site, target)) + { + return Results.Redirect($"/view?url={Uri.EscapeDataString(target!)}"); + } + // 1. target が URL かつ play/stream が渡されていない場合、記事URL(galgaldoga等)または未解決動画URLを自動探索 if (target != null && target.StartsWith("http", StringComparison.OrdinalIgnoreCase) && string.IsNullOrWhiteSpace(play) && string.IsNullOrWhiteSpace(stream)) { @@ -577,4 +563,72 @@ static string? ExtractMissAvId(string input) return input; } +static bool IsGalleryUrlOrSite(string? site, string? urlOrId) +{ + if (string.IsNullOrWhiteSpace(urlOrId)) return false; + var lower = urlOrId.ToLowerInvariant(); + if (string.Equals(site, "ehentai", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "hitomi", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "aurahentai", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "momonga", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "mangalear", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "hentaipaw", StringComparison.OrdinalIgnoreCase)) + { + return true; + } + return lower.Contains("e-hentai.org") || + lower.Contains("exhentai.org") || + lower.Contains("hitomi.la") || + lower.Contains("aurahentai.com") || + lower.Contains("momon-ga.com") || + lower.Contains("mangalear.com") || + lower.Contains("hentaipaw.com"); +} + +static bool IsVideoUrlOrSite(string? site, string? urlOrId) +{ + if (string.IsNullOrWhiteSpace(urlOrId)) return false; + var lower = urlOrId.ToLowerInvariant(); + if (string.Equals(site, "spankbang", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "123av", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "missav", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "doga", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "eroterest_doga", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "vjav", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "laxd", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "fc2", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "inporn", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "bdsmx", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "senzuri", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "txxx", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "hclips", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "hdzog", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "upornia", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "youjizz", StringComparison.OrdinalIgnoreCase) || + string.Equals(site, "xvideos", StringComparison.OrdinalIgnoreCase)) + { + return true; + } + + return lower.Contains("spankbang") || + lower.Contains("123av") || + lower.Contains("missav") || + lower.Contains("do-ga.eroterest.net") || + lower.Contains("movie.eroterest.net") || + lower.Contains("vjav.com") || + lower.Contains("laxd.com") || + lower.Contains("fc2.com") || + lower.Contains("inporn.com") || + lower.Contains("bdsmx.tube") || + lower.Contains("senzuri.tube") || + lower.Contains("txxx.com") || + lower.Contains("hclips.com") || + lower.Contains("hdzog.com") || + lower.Contains("upornia.com") || + lower.Contains("youjizz.com") || + lower.Contains("xvideos.com") || + lower.Contains("blogterest.net") || + lower.Contains("blog.2nt.com"); +} + app.Run(); \ No newline at end of file