fix(eroterest): 本文からのクリック数・相対表記除外と既存エントリ優先マージによる未読化防止対応

This commit is contained in:
armonica committed 2026-11-06 22:44:37 +09:00
1 parent 4302fee3fe
commit 0fe359cf17
2 files changed
+22 -10

No files matched your search

@@ -1,4 +1,4 @@
using AngleSharp.Dom; using AngleSharp.Dom;
using rss_generator.Class.Common; using rss_generator.Class.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -351,6 +351,8 @@ internal static class MovieEroterestFeedManager
/// <summary> /// <summary>
/// 新着アイテムと既存アイテムをマージし、重複を排除して公開日時順にソートします。 /// 新着アイテムと既存アイテムをマージし、重複を排除して公開日時順にソートします。
/// 既存アイテムが存在する場合は前回のPublishDateおよびSummaryHtmlを最優先で維持し、
/// FreshRSSで更新されていない記事が未読化するのを防ぎます。
/// </summary> /// </summary>
private static List<SyndicationItem> MergeFeedItems( private static List<SyndicationItem> MergeFeedItems(
IEnumerable<SyndicationItem> newItems, IEnumerable<SyndicationItem> newItems,
@@ -369,12 +371,27 @@ internal static class MovieEroterestFeedManager
} }
} }
// 2. 新着アイテムで上書き・追加(最新の詳細情報を優先) // 2. 新着アイテムを追加(既存アイテムが存在する場合は公開日時および本文HTMLを固定)
foreach (var item in newItems) foreach (var item in newItems)
{ {
var key = GetItemKey(item); var key = GetItemKey(item);
if (!string.IsNullOrWhiteSpace(key)) if (!string.IsNullOrWhiteSpace(key))
{ {
if (merged.TryGetValue(key, out var existing))
{
if (existing.PublishDate != DateTimeOffset.MinValue)
{
item.PublishDate = existing.PublishDate;
}
if (existing.LastUpdatedTime != DateTimeOffset.MinValue)
{
item.LastUpdatedTime = existing.LastUpdatedTime;
}
if (existing.Summary != null && !string.IsNullOrWhiteSpace(existing.Summary.Text))
{
item.Summary = new TextSyndicationContent(existing.Summary.Text, TextSyndicationContentKind.Html);
}
}
merged[key] = item; merged[key] = item;
} }
} }
@@ -1,4 +1,4 @@
using AngleSharp.Dom; using AngleSharp.Dom;
using rss_generator.Class.Common; using rss_generator.Class.Common;
using rss_generator.Class.Eroterest.Core; using rss_generator.Class.Eroterest.Core;
using System; using System;
@@ -322,12 +322,11 @@ internal static class MovieEroterestVideoParser
sb.Append("</div>"); sb.Append("</div>");
} }
// 4. メタ情報リスト // 4. メタ情報リスト(相対時間文字列や閲覧クリック数などの変動要素はハッシュ安定のため除外)
sb.Append("<ul style=\"font-size: 0.9em; color: #475569; list-style-type: none; padding-left: 0; margin: 8px 0; line-height: 1.6;\">"); sb.Append("<ul style=\"font-size: 0.9em; color: #475569; list-style-type: none; padding-left: 0; margin: 8px 0; line-height: 1.6;\">");
if (info.ArticlePublishDate.HasValue) if (info.ArticlePublishDate.HasValue)
{ {
var relSuffix = !string.IsNullOrWhiteSpace(info.RelativeTimeText) ? $" ({WebUtility.HtmlEncode(info.RelativeTimeText)})" : ""; sb.Append($"<li>📅 <strong>記事公開日:</strong> {info.ArticlePublishDate.Value:yyyy/MM/dd HH:mm}</li>");
sb.Append($"<li>📅 <strong>記事公開日:</strong> {info.ArticlePublishDate.Value:yyyy/MM/dd HH:mm}{relSuffix}</li>");
} }
if (info.VideoPublishDate.HasValue) if (info.VideoPublishDate.HasValue)
{ {
@@ -341,10 +340,6 @@ internal static class MovieEroterestVideoParser
{ {
sb.Append($"<li>⏱ <strong>再生時間:</strong> {WebUtility.HtmlEncode(info.Duration)}</li>"); sb.Append($"<li>⏱ <strong>再生時間:</strong> {WebUtility.HtmlEncode(info.Duration)}</li>");
} }
if (!string.IsNullOrWhiteSpace(info.ClickCount))
{
sb.Append($"<li>👁 <strong>人気度:</strong> {WebUtility.HtmlEncode(info.ClickCount)}</li>");
}
if (info.Actresses.Count > 0) if (info.Actresses.Count > 0)
{ {
var actressLinks = string.Join(" / ", info.Actresses.Select(a => $"<a href=\"https://movie.eroterest.net/?word={Uri.EscapeDataString(a)}\" target=\"_blank\" rel=\"noopener noreferrer\">{WebUtility.HtmlEncode(a)}</a>")); var actressLinks = string.Join(" / ", info.Actresses.Select(a => $"<a href=\"https://movie.eroterest.net/?word={Uri.EscapeDataString(a)}\" target=\"_blank\" rel=\"noopener noreferrer\">{WebUtility.HtmlEncode(a)}</a>"));