追加: 85PO(85po.com / 85ro.com / 85po.net)の動画閲覧・埋め込みプレイヤー再生対応
- DomainClassifierに85po.comおよび関連ドメインを登録し動画メディアとして自動認識 - VideoEmbedExtractorにResolve85PoAsyncを実装し公式埋め込みプレイヤー(embed)の自動抽出・解決に対応 - UnifiedHtmlRendererのトップページに85POのサンプルカードおよび対応ドメインチップを追加 - Windows環境でのWinHttpHandler適用によるCloudflare TLSフィンガープリント耐性の向上 - レガシーVideoUrlResolverへの85POホスト判定の追加による後方互換性担保
This commit is contained in:
1 parent
cd202a1719
commit
bec51879c7
5 files changed
+206
-7
No files matched your search
@@ -1,4 +1,4 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text.RegularExpressions;
|
||||
using HtmlAgilityPack;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using WebImageViewer.Class.Legacy.Common;
|
||||
@@ -155,6 +155,24 @@ public class VideoUrlResolver
|
||||
};
|
||||
}
|
||||
|
||||
// 85PO
|
||||
if (url.Contains("85po.com", StringComparison.OrdinalIgnoreCase) ||
|
||||
url.Contains("85ro.com", StringComparison.OrdinalIgnoreCase) ||
|
||||
url.Contains("85po.net", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var match = Regex.Match(url, @"(?:/v/|/embed/|/videos/|^)(?<id>[0-9]+)", RegexOptions.IgnoreCase);
|
||||
var id = match.Success ? match.Groups["id"].Value : "video";
|
||||
return new ResolvedVideoResult
|
||||
{
|
||||
Site = "85po",
|
||||
VideoId = id,
|
||||
PlayerUrl = $"https://www.85po.com/embed/{id}",
|
||||
OriginalUrl = url,
|
||||
Title = title ?? $"85PO 動画 ({id})",
|
||||
IsSuccess = true
|
||||
};
|
||||
}
|
||||
|
||||
// HDZog
|
||||
if (url.Contains("hdzog.com", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -514,4 +532,3 @@ public class VideoUrlResolver
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -667,6 +667,13 @@ public static class UnifiedHtmlRenderer
|
||||
<span class="sample-url">https://missav.ai/ja/fc2-ppv-4968519</span>
|
||||
</a>
|
||||
|
||||
<!-- 85PO -->
|
||||
<a href="/?url=https://www.85po.com/v/37405.html" class="sample-card">
|
||||
<span class="sample-badge badge-video">動画 (埋め込みプレイヤー)</span>
|
||||
<span class="sample-title">85PO - Mana KODV-0035</span>
|
||||
<span class="sample-url">https://www.85po.com/v/37405.html</span>
|
||||
</a>
|
||||
|
||||
<!-- 2. Hitomi.la -->
|
||||
<a href="/?url=https://hitomi.la/cg/%E3%80%90full%E3%80%91%E5%87%B6%E6%82%AA%E8%A7%A6%E6%89%8B%E7%94%9F%E7%89%A9%E3%81%AB%E6%8D%95%E3%81%BE%E3%81%A3%E3%81%A6%E9%98%B2%E6%88%A6%E4%B8%80%E6%96%B9%E3%81%AA%E8%AB%9C%E5%A0%B1%E5%93%A1%E3%82%8B%E3%81%AA-%E6%97%A5%E6%9C%AC%E8%AA%9E-4223100.html" class="sample-card">
|
||||
<span class="sample-badge badge-gallery">画像ギャラリー (gg.js対応)</span>
|
||||
@@ -711,6 +718,7 @@ public static class UnifiedHtmlRenderer
|
||||
</div>
|
||||
<div class="sites-grid">
|
||||
<div class="site-chip"><span class="site-name">MissAV</span><span class="site-type">動画 (HLS)</span></div>
|
||||
<div class="site-chip"><span class="site-name">85PO</span><span class="site-type">動画 (Embed)</span></div>
|
||||
<div class="site-chip"><span class="site-name">Hitomi.la</span><span class="site-type">画像ギャラリー</span></div>
|
||||
<div class="site-chip"><span class="site-name">E-Hentai</span><span class="site-type">画像ギャラリー</span></div>
|
||||
<div class="site-chip"><span class="site-name">HentaiPaw (エロモフ)</span><span class="site-type">画像ギャラリー</span></div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using WebImageViewer.Class.Unified.Models;
|
||||
using WebImageViewer.Class.Unified.Models;
|
||||
|
||||
namespace WebImageViewer.Class.Unified.Services;
|
||||
|
||||
@@ -39,6 +39,12 @@ public static class DomainClassifier
|
||||
{ "missav.com", ("missav", "MissAV") },
|
||||
{ "missav.ws", ("missav", "MissAV") },
|
||||
{ "missav.net", ("missav", "MissAV") },
|
||||
{ "85po.com", ("85po", "85PO") },
|
||||
{ "www.85po.com", ("85po", "85PO") },
|
||||
{ "85ro.com", ("85po", "85RO") },
|
||||
{ "www.85ro.com", ("85po", "85RO") },
|
||||
{ "85po.net", ("85po", "85PO") },
|
||||
{ "www.85po.net", ("85po", "85PO") },
|
||||
{ "spankbang.com", ("spankbang", "SpankBang") },
|
||||
{ "jp.spankbang.com", ("spankbang", "SpankBang") },
|
||||
{ "spankbang.party", ("spankbang", "SpankBang") },
|
||||
@@ -118,6 +124,10 @@ public static class DomainClassifier
|
||||
{
|
||||
return new DomainClassificationResult(MediaType.Video, "123av", "123av", host);
|
||||
}
|
||||
if (string.Equals(host, "85po", StringComparison.OrdinalIgnoreCase) || host.Contains("85po") || host.Contains("85ro"))
|
||||
{
|
||||
return new DomainClassificationResult(MediaType.Video, "85po", "85PO", host);
|
||||
}
|
||||
if (string.Equals(host, "missav", StringComparison.OrdinalIgnoreCase) || host.Contains("missav"))
|
||||
{
|
||||
return new DomainClassificationResult(MediaType.Video, "missav", "MissAV", host);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using HtmlAgilityPack;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using WebImageViewer.Class.Unified.Common;
|
||||
@@ -68,6 +69,10 @@ public class VideoEmbedExtractor
|
||||
resolvedItem = await ResolveMissAvAsync(trimmedUrl, ct);
|
||||
break;
|
||||
|
||||
case "85po":
|
||||
resolvedItem = await this.Resolve85PoAsync(trimmedUrl, ct);
|
||||
break;
|
||||
|
||||
case "spankbang":
|
||||
resolvedItem = ResolveSpankBang(trimmedUrl);
|
||||
break;
|
||||
@@ -192,6 +197,138 @@ public class VideoEmbedExtractor
|
||||
|
||||
#region 各サイト別リゾルバー
|
||||
|
||||
/// <summary>
|
||||
/// 85PO (85po.com / 85ro.com / 85po.net) の動画および埋め込みプレイヤー情報を解決します。
|
||||
/// </summary>
|
||||
/// <param name="url">入力されたURLまたはID文字列</param>
|
||||
/// <param name="ct">キャンセレーショントークン</param>
|
||||
/// <returns>解決された統一動画情報</returns>
|
||||
private async Task<UnifiedVideoItem> Resolve85PoAsync(string url, CancellationToken ct)
|
||||
{
|
||||
// 1. URLから動画IDを抽出(例: /v/37405.html, /embed/37405, 37405 等)
|
||||
var matchId = Regex.Match(url, @"(?:/v/|/embed/|/videos/|^)(?<id>\d+)(?:\.html)?", RegexOptions.IgnoreCase);
|
||||
string videoId = matchId.Success ? matchId.Groups["id"].Value : "";
|
||||
|
||||
// ホスト名の取得(85po.com / 85ro.com / 85po.net)
|
||||
string host = "www.85po.com";
|
||||
if (Uri.TryCreate(url, UriKind.Absolute, out var parsedUri) && !string.IsNullOrWhiteSpace(parsedUri.Host))
|
||||
{
|
||||
host = parsedUri.Host.ToLowerInvariant();
|
||||
}
|
||||
|
||||
// メタデータ取得用URLの決定
|
||||
// 85POは embed ページ(または /ja/v/)からタイトルおよびサムネイルを安定して取得可能
|
||||
string targetFetchUrl = !string.IsNullOrEmpty(videoId)
|
||||
? $"https://{host}/embed/{videoId}"
|
||||
: (url.StartsWith("http", StringComparison.OrdinalIgnoreCase) ? url : $"https://{host}/");
|
||||
string originalPageUrl = !string.IsNullOrEmpty(videoId)
|
||||
? $"https://{host}/v/{videoId}.html"
|
||||
: url;
|
||||
string? title = null;
|
||||
string? posterUrl = null;
|
||||
|
||||
// 2. ページHTMLを取得してタイトル・サムネイルを抽出
|
||||
// もし動画IDが抽出できていない場合、トップページ等と判定して先頭動画リンクを探索
|
||||
try
|
||||
{
|
||||
var html = await this._httpHelper.GetHtmlAsync(targetFetchUrl, useFlareSolverr: false, referer: $"https://{host}/", ct: ct);
|
||||
if (!string.IsNullOrWhiteSpace(html))
|
||||
{
|
||||
var doc = new HtmlDocument();
|
||||
doc.LoadHtml(html);
|
||||
|
||||
// ID未取得の場合、ページ内の動画リンクを探す
|
||||
if (string.IsNullOrEmpty(videoId))
|
||||
{
|
||||
var linkNode = doc.DocumentNode.SelectSingleNode("//a[contains(@href, '/v/') and contains(@href, '.html')]");
|
||||
if (linkNode != null)
|
||||
{
|
||||
var href = linkNode.GetAttributeValue("href", "");
|
||||
var m = Regex.Match(href, @"/v/(?<id>\d+)\.html", RegexOptions.IgnoreCase);
|
||||
if (m.Success)
|
||||
{
|
||||
videoId = m.Groups["id"].Value;
|
||||
originalPageUrl = $"https://{host}/v/{videoId}.html";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// タイトル抽出
|
||||
var ogTitle = doc.DocumentNode.SelectSingleNode("//meta[@property='og:title']")?.GetAttributeValue("content", null);
|
||||
if (!string.IsNullOrWhiteSpace(ogTitle))
|
||||
{
|
||||
title = WebUtility.HtmlDecode(ogTitle).Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
var titleNode = doc.DocumentNode.SelectSingleNode("//title");
|
||||
if (titleNode != null)
|
||||
{
|
||||
var rawTitle = WebUtility.HtmlDecode(titleNode.InnerText).Trim();
|
||||
title = Regex.Replace(rawTitle, @"\s*[-|–]\s*85PO.*$", "", RegexOptions.IgnoreCase).Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
var mTitle = Regex.Match(html, @"video_title:\s*['""]([^'""]+)['""]", RegexOptions.IgnoreCase);
|
||||
if (mTitle.Success)
|
||||
{
|
||||
title = WebUtility.HtmlDecode(mTitle.Groups[1].Value).Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// サムネイル抽出
|
||||
var ogImage = doc.DocumentNode.SelectSingleNode("//meta[@property='og:image']")?.GetAttributeValue("content", null);
|
||||
if (!string.IsNullOrWhiteSpace(ogImage))
|
||||
{
|
||||
posterUrl = ogImage.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
var mPreview = Regex.Match(html, @"preview_url:\s*['""]([^'""]+)['""]", RegexOptions.IgnoreCase);
|
||||
if (mPreview.Success)
|
||||
{
|
||||
posterUrl = mPreview.Groups[1].Value.Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this._logger.LogWarning(ex, "85PO HTMLの取得に失敗しました。フォールバックで構築します: {Url}", url);
|
||||
}
|
||||
|
||||
// フォールバックIDの確定
|
||||
if (string.IsNullOrEmpty(videoId))
|
||||
{
|
||||
videoId = "video";
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(title))
|
||||
{
|
||||
title = $"85PO ({videoId})";
|
||||
}
|
||||
|
||||
// サムネイルのフォールバック
|
||||
if (string.IsNullOrWhiteSpace(posterUrl) && int.TryParse(videoId, out var numId))
|
||||
{
|
||||
int folderId = (numId / 1000) * 1000;
|
||||
posterUrl = $"https://{host}/contents/videos_screenshots/{folderId}/{videoId}/preview.jpg";
|
||||
}
|
||||
|
||||
var embedUrl = $"https://{host}/embed/{videoId}";
|
||||
|
||||
return new UnifiedVideoItem
|
||||
{
|
||||
Site = "85po",
|
||||
VideoId = videoId,
|
||||
Title = title,
|
||||
OriginalUrl = originalPageUrl,
|
||||
EmbedUrl = embedUrl,
|
||||
PosterUrl = posterUrl
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MissAV の埋め込み・HLSストリームを解決します。
|
||||
/// Cloudflare保護を通過し、surrit.comのm3u8を安全な内部プロキシ経由(CORS・Referer解決)で設定することで、
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Net;
|
||||
using System.Runtime.Versioning;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using WebImageViewer.Class.Unified.Common;
|
||||
using WebImageViewer.Class.Unified.Scrapers;
|
||||
using WebImageViewer.Class.Unified.Services;
|
||||
@@ -19,8 +21,16 @@ public static class UnifiedServiceExtensions
|
||||
/// <returns>登録後のサービスコレクション</returns>
|
||||
public static IServiceCollection AddUnifiedServices(this IServiceCollection services)
|
||||
{
|
||||
// HTTP通信ヘルパー
|
||||
services.AddHttpClient<UnifiedHttpHelper>();
|
||||
// HTTP通信ヘルパー(Cloudflare TLSフィンガープリント対策としてWindows環境ではWinHttpHandlerを適用)
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
services.AddHttpClient<UnifiedHttpHelper>()
|
||||
.ConfigurePrimaryHttpMessageHandler(CreateWinHttpHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
services.AddHttpClient<UnifiedHttpHelper>();
|
||||
}
|
||||
|
||||
// 画像スクレイパー群
|
||||
services.AddScoped<IUnifiedScraper, UnifiedHitomiScraper>();
|
||||
@@ -43,4 +53,21 @@ public static class UnifiedServiceExtensions
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region □メソッド(Private)
|
||||
|
||||
/// <summary>
|
||||
/// Windows環境専用のWinHttpHandlerインスタンスを生成・構成します。
|
||||
/// </summary>
|
||||
/// <returns>構成済みのHttpMessageHandler</returns>
|
||||
[SupportedOSPlatform("windows")]
|
||||
private static HttpMessageHandler CreateWinHttpHandler()
|
||||
{
|
||||
return new WinHttpHandler
|
||||
{
|
||||
AutomaticDecompression = DecompressionMethods.All
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in new issue
Block a user