diff --git a/.gitignore b/.gitignore index dd87710..b68fc30 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ -################################################################################ +################################################################################ # この .gitignore ファイルは Microsoft(R) Visual Studio によって自動的に作成されました。 ################################################################################ /.vs /rss-generator/bin /rss-generator/obj +/app diff --git a/rss-generator/Class/Eroterest/MovieEroterestVideoParser.cs b/rss-generator/Class/Eroterest/MovieEroterestVideoParser.cs index 374e7c8..94c6013 100644 --- a/rss-generator/Class/Eroterest/MovieEroterestVideoParser.cs +++ b/rss-generator/Class/Eroterest/MovieEroterestVideoParser.cs @@ -337,12 +337,76 @@ internal static class MovieEroterestVideoParser return; } - // 7. 実動画URLが存在する場合 (LAXD, Xvideos, その他) + // VJAV + if (info.VideoSiteName == "vjav" && !string.IsNullOrWhiteSpace(info.VideoSiteId)) + { + var play = $"https://vjav.com/embed/{info.VideoSiteId}/"; + info.ViewerUrl = $"{baseViewer}/video?site=vjav&id={Uri.EscapeDataString(info.VideoSiteId)}&play={Uri.EscapeDataString(play)}&url={Uri.EscapeDataString(info.ActualVideoUrl ?? "")}&title={Uri.EscapeDataString(info.Title)}"; + return; + } + + // FC2動画 + if ((info.VideoSiteName == "fc2" || info.VideoSiteName == "fc2video") && !string.IsNullOrWhiteSpace(info.VideoSiteId)) + { + var play = $"https://video.fc2.com/a/embed/player/{info.VideoSiteId}/"; + info.ViewerUrl = $"{baseViewer}/video?site=fc2&id={Uri.EscapeDataString(info.VideoSiteId)}&play={Uri.EscapeDataString(play)}&url={Uri.EscapeDataString(info.ActualVideoUrl ?? "")}&title={Uri.EscapeDataString(info.Title)}"; + return; + } + + // LAXD + if (info.VideoSiteName == "laxd" && !string.IsNullOrWhiteSpace(info.VideoSiteId)) + { + var play = $"https://video.laxd.com/a/embed/player/{info.VideoSiteId}/"; + info.ViewerUrl = $"{baseViewer}/video?site=laxd&id={Uri.EscapeDataString(info.VideoSiteId)}&play={Uri.EscapeDataString(play)}&url={Uri.EscapeDataString(info.ActualVideoUrl ?? "")}&title={Uri.EscapeDataString(info.Title)}"; + return; + } + + // XVIDEOS + if (info.VideoSiteName == "xvideos" && !string.IsNullOrWhiteSpace(info.VideoSiteId)) + { + var play = $"https://www.xvideos.com/embedframe/{info.VideoSiteId}"; + info.ViewerUrl = $"{baseViewer}/video?site=xvideos&id={Uri.EscapeDataString(info.VideoSiteId)}&play={Uri.EscapeDataString(play)}&url={Uri.EscapeDataString(info.ActualVideoUrl ?? "")}&title={Uri.EscapeDataString(info.Title)}"; + return; + } + + // 7. 実動画URLが存在する場合 (上記以外の動画サイトまたは未知サイト) if (!string.IsNullOrWhiteSpace(info.ActualVideoUrl)) { - var siteParam = !string.IsNullOrWhiteSpace(info.VideoSiteName) ? $"&site={Uri.EscapeDataString(info.VideoSiteName)}" : ""; - var idParam = !string.IsNullOrWhiteSpace(info.VideoSiteId) ? $"&id={Uri.EscapeDataString(info.VideoSiteId)}" : ""; - info.ViewerUrl = $"{baseViewer}/video?url={Uri.EscapeDataString(info.ActualVideoUrl)}{siteParam}{idParam}&title={Uri.EscapeDataString(info.Title)}"; + // URLから既知の動画サイト判定を試行し、埋め込み可能な場合はplayパラメータを付与 + string? fallbackPlay = null; + string? detectedSite = info.VideoSiteName; + string? detectedId = info.VideoSiteId; + + if (info.ActualVideoUrl.Contains("vjav.com", StringComparison.OrdinalIgnoreCase)) + { + detectedSite = "vjav"; + detectedId ??= System.Text.RegularExpressions.Regex.Match(info.ActualVideoUrl, @"/videos/([0-9]+)").Groups[1].Value; + if (!string.IsNullOrWhiteSpace(detectedId)) fallbackPlay = $"https://vjav.com/embed/{detectedId}/"; + } + else if (info.ActualVideoUrl.Contains("video.laxd.com", StringComparison.OrdinalIgnoreCase) || info.ActualVideoUrl.Contains("laxd.com", StringComparison.OrdinalIgnoreCase)) + { + detectedSite = "laxd"; + detectedId ??= System.Text.RegularExpressions.Regex.Match(info.ActualVideoUrl, @"laxd\.com/(?:content/|embed/)?([0-9a-zA-Z_\-]+)").Groups[1].Value; + if (!string.IsNullOrWhiteSpace(detectedId)) fallbackPlay = $"https://video.laxd.com/a/embed/player/{detectedId}/"; + } + else if (info.ActualVideoUrl.Contains("fc2.com", StringComparison.OrdinalIgnoreCase)) + { + detectedSite = "fc2"; + detectedId ??= System.Text.RegularExpressions.Regex.Match(info.ActualVideoUrl, @"(?:article/|aid=|content/)([0-9a-zA-Z_\-]+)").Groups[1].Value; + if (!string.IsNullOrWhiteSpace(detectedId)) fallbackPlay = $"https://video.fc2.com/a/embed/player/{detectedId}/"; + } + else if (info.ActualVideoUrl.Contains("xvideos.com", StringComparison.OrdinalIgnoreCase)) + { + detectedSite = "xvideos"; + detectedId ??= System.Text.RegularExpressions.Regex.Match(info.ActualVideoUrl, @"(?:video\.|video)([0-9]+)").Groups[1].Value; + if (!string.IsNullOrWhiteSpace(detectedId)) fallbackPlay = $"https://www.xvideos.com/embedframe/{detectedId}"; + } + + var siteParam = !string.IsNullOrWhiteSpace(detectedSite) ? $"&site={Uri.EscapeDataString(detectedSite)}" : ""; + var idParam = !string.IsNullOrWhiteSpace(detectedId) ? $"&id={Uri.EscapeDataString(detectedId)}" : ""; + var playParam = !string.IsNullOrWhiteSpace(fallbackPlay) ? $"&play={Uri.EscapeDataString(fallbackPlay)}" : ""; + + info.ViewerUrl = $"{baseViewer}/video?url={Uri.EscapeDataString(info.ActualVideoUrl)}{siteParam}{idParam}{playParam}&title={Uri.EscapeDataString(info.Title)}"; return; }