46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using AngleSharp.Dom;
|
|
using rss_generator.Class.Eroterest.Core;
|
|
using System;
|
|
using System.Text.RegularExpressions;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace rss_generator.Class.Eroterest.Upornia;
|
|
|
|
/// <summary>
|
|
/// Upornia (upornia.com) の動画解析リゾルバー
|
|
/// </summary>
|
|
internal class UporniaSiteResolver : IEroterestSiteResolver
|
|
{
|
|
public string SiteName => "upornia";
|
|
public int Priority => 90;
|
|
|
|
public bool CanHandle(string url, IDocument? doc = null)
|
|
{
|
|
return !string.IsNullOrWhiteSpace(url) && url.Contains("upornia.com", StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
|
|
public Task<SiteResolveResult> ResolveAsync(
|
|
HttpClient client,
|
|
string url,
|
|
IDocument? preloadedDoc,
|
|
SiteResolveContext context,
|
|
CancellationToken ct)
|
|
{
|
|
var result = new SiteResolveResult
|
|
{
|
|
VideoPageUrl = url,
|
|
VideoSiteName = "upornia"
|
|
};
|
|
|
|
// 動画ID抽出 (例: /videos/6167135/...)
|
|
var match = Regex.Match(url, @"/videos/([0-9]+)");
|
|
if (match.Success)
|
|
{
|
|
result.VideoSiteId = match.Groups[1].Value;
|
|
}
|
|
|
|
return Task.FromResult(result);
|
|
}
|
|
}
|