feat(momonga): フィード著者にアーティスト(作者)およびサークルの値を追加しFreshRSSでの個別検索に対応
- momonga_fanzine.cs, momonga_magazine.cs において本文メタデータから「サークル」「作者」を抽出し、著者の箇所(Authors)にそれぞれ追加 - 複数作者や複数サークルがある場合はカンマ区切りで個別登録し、重複を排除 - FreshRSS上でサークル名・アーティスト名のそれぞれで絞り込み検索が可能になるよう改善 - リファクタリングおよびログ出力プレフィックスの統一
This commit is contained in:
1 parent
a5d796e099
commit
c788acaeca
29 files changed
+373
-375
No files matched your search
@@ -63,7 +63,7 @@ internal static class anige_sokuhouvip
|
|||||||
var root = xdoc.Root;
|
var root = xdoc.Root;
|
||||||
if (root == null)
|
if (root == null)
|
||||||
{
|
{
|
||||||
LogManager.AddLog("[警告] [anige_sokuhouvip] XMLルート要素が存在しません。");
|
LogManager.AddLog("[警告] 【anige_sokuhouvip】 XMLルート要素が存在しません。");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ internal static class anige_sokuhouvip
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] [anige_sokuhouvip] フィード生成失敗: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【anige_sokuhouvip】 フィード生成失敗: {ex.Message}");
|
||||||
CmnUtil.PrintCallStackToEvent(ex);
|
CmnUtil.PrintCallStackToEvent(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp.Dom;
|
using AngleSharp.Dom;
|
||||||
using AngleSharp.Html.Dom;
|
using AngleSharp.Html.Dom;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -46,33 +46,18 @@ internal class aurahentai
|
|||||||
// 既存の aurahentai.xml から過去に出力した各記事の内容(タイトル・本文・日時)を読み込む
|
// 既存の aurahentai.xml から過去に出力した各記事の内容(タイトル・本文・日時)を読み込む
|
||||||
var existingEntries = LoadExistingEntries("aurahentai.xml");
|
var existingEntries = LoadExistingEntries("aurahentai.xml");
|
||||||
|
|
||||||
// 外部からセッションが渡されなかった場合は自前で作成
|
sessionId ??= CmnUtil.SharedFlareSolverrSessionId;
|
||||||
bool ownSession = sessionId == null;
|
for (int pageId = 1; pageId <= 5; pageId++)
|
||||||
if (ownSession)
|
|
||||||
{
|
{
|
||||||
sessionId = await CmnUtil.CreateFlareSolverrSession(client);
|
var pageURL = $"{baseURL}?page={pageId}";
|
||||||
}
|
var document = await CmnUtil.GetDocumentFlareSolverr(client, pageURL, session: sessionId);
|
||||||
try
|
if (document == null)
|
||||||
{
|
|
||||||
for (int pageId = 1; pageId <= 5; pageId++)
|
|
||||||
{
|
{
|
||||||
var pageURL = $"{baseURL}?page={pageId}";
|
continue;
|
||||||
var document = await CmnUtil.GetDocumentFlareSolverr(client, pageURL, session: sessionId);
|
}
|
||||||
if (document == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var newItems = await CreateFeedItemsFromListPageAsync(client, sessionId, document, pageId, existingEntries);
|
var newItems = await CreateFeedItemsFromListPageAsync(client, sessionId, document, pageId, existingEntries);
|
||||||
items.AddRange(newItems);
|
items.AddRange(newItems);
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (ownSession && sessionId != null)
|
|
||||||
{
|
|
||||||
await CmnUtil.DestroyFlareSolverrSession(client, sessionId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID 重複排除
|
// ID 重複排除
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ internal class ci_en
|
|||||||
var responseUri = response.RequestMessage?.RequestUri?.ToString() ?? string.Empty;
|
var responseUri = response.RequestMessage?.RequestUri?.ToString() ?? string.Empty;
|
||||||
if (responseUri.Contains("maintenance", StringComparison.OrdinalIgnoreCase))
|
if (responseUri.Contains("maintenance", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
AddLog($"[情報] [ci_en] Ci-enは現在システムメンテナンス中です ({responseUri})。メンテナンス完了後に自動再開されます。");
|
AddLog($"[情報] 【ci_en】 Ci-enは現在システムメンテナンス中です ({responseUri})。メンテナンス完了後に自動再開されます。");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,11 +76,11 @@ internal class ci_en
|
|||||||
{
|
{
|
||||||
if (trimmedContent.Contains("メンテナンス") || trimmedContent.Contains("maintenance", StringComparison.OrdinalIgnoreCase))
|
if (trimmedContent.Contains("メンテナンス") || trimmedContent.Contains("maintenance", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
AddLog("[情報] [ci_en] Ci-enは現在システムメンテナンス中です。サービスの再開後に自動取得されます。");
|
AddLog("[情報] 【ci_en】 Ci-enは現在システムメンテナンス中です。サービスの再開後に自動取得されます。");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddLog("[警告] [ci_en] APIからJSONではなくHTMLが返却されました。セッションCookieの有効期限切れ、またはリダイレクトの可能性があります。");
|
AddLog("[警告] 【ci_en】 APIからJSONではなくHTMLが返却されました。セッションCookieの有効期限切れ、またはリダイレクトの可能性があります。");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ internal class ci_en
|
|||||||
if (!jsonDoc.RootElement.TryGetProperty("items", out var itemsElem) ||
|
if (!jsonDoc.RootElement.TryGetProperty("items", out var itemsElem) ||
|
||||||
!itemsElem.TryGetProperty("data", out var dataElem))
|
!itemsElem.TryGetProperty("data", out var dataElem))
|
||||||
{
|
{
|
||||||
AddLog("[警告] [ci_en] items.data プロパティが存在しません。");
|
AddLog("[警告] 【ci_en】 items.data プロパティが存在しません。");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ internal class ci_en
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
AddLog($"[エラー] [ci_en]:{ex.Message}");
|
AddLog($"[エラー] 【ci_en】 {ex.Message}");
|
||||||
CmnUtil.PrintCallStackToEvent(ex);
|
CmnUtil.PrintCallStackToEvent(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp;
|
using AngleSharp;
|
||||||
using AngleSharp.Dom;
|
using AngleSharp.Dom;
|
||||||
using AngleSharp.Html.Parser;
|
using AngleSharp.Html.Parser;
|
||||||
using PuppeteerSharp;
|
using PuppeteerSharp;
|
||||||
@@ -427,7 +427,7 @@ public class CmnUtil
|
|||||||
|
|
||||||
int count = feed.Items?.Count() ?? 0;
|
int count = feed.Items?.Count() ?? 0;
|
||||||
string displayFileName = System.IO.Path.GetFileName(filePath);
|
string displayFileName = System.IO.Path.GetFileName(filePath);
|
||||||
LogManager.AddLog($"[情報] {displayFileName} を正常に出力しました (記事数: {count})");
|
LogManager.AddLog($"[情報] 【CmnUtil】 {displayFileName} を正常に出力しました (記事数: {count})");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -459,7 +459,7 @@ public class CmnUtil
|
|||||||
|
|
||||||
int count = feed.Items?.Count() ?? 0;
|
int count = feed.Items?.Count() ?? 0;
|
||||||
string displayFileName = System.IO.Path.GetFileName(filePath);
|
string displayFileName = System.IO.Path.GetFileName(filePath);
|
||||||
LogManager.AddLog($"[情報] {displayFileName} を正常に出力しました (記事数: {count})");
|
LogManager.AddLog($"[情報] 【CmnUtil】 {displayFileName} を正常に出力しました (記事数: {count})");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -482,7 +482,7 @@ public class CmnUtil
|
|||||||
{
|
{
|
||||||
// 404の場合などのログをここに書くことも可能
|
// 404の場合などのログをここに書くことも可能
|
||||||
//AddLog($"[HTTP Error] Status Code: {response.StatusCode} for {url}");
|
//AddLog($"[HTTP Error] Status Code: {response.StatusCode} for {url}");
|
||||||
LogManager.AddLog($"[HTTP Error] Status Code: {response.StatusCode} for {url}");
|
LogManager.AddLog($"[エラー] 【CmnUtil】 HTTP Error Status Code: {response.StatusCode} for {url}");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -492,7 +492,7 @@ public class CmnUtil
|
|||||||
catch (HttpRequestException ex)
|
catch (HttpRequestException ex)
|
||||||
{
|
{
|
||||||
// ネットワーク不通やタイムアウトなどの例外処理
|
// ネットワーク不通やタイムアウトなどの例外処理
|
||||||
LogManager.AddLog($"[Network Error] {ex.Message}");
|
LogManager.AddLog($"[エラー] 【CmnUtil】 Network Error {ex.Message}");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
@@ -600,6 +600,11 @@ public class CmnUtil
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly SemaphoreSlim FlareSolverrSemaphore = new(1, 1);
|
private static readonly SemaphoreSlim FlareSolverrSemaphore = new(1, 1);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// アプリケーション全体で共有・使い回す FlareSolverr セッションID
|
||||||
|
/// </summary>
|
||||||
|
public static string? SharedFlareSolverrSessionId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// FlareSolverr 経由で対象 URL の HTML を取得し、AngleSharp の IDocument を生成して返します。
|
/// FlareSolverr 経由で対象 URL の HTML を取得し、AngleSharp の IDocument を生成して返します。
|
||||||
/// 排他制御および最大3回の自動リトライ(セッション無効化フォールバック・待機付き)を備えています。
|
/// 排他制御および最大3回の自動リトライ(セッション無効化フォールバック・待機付き)を備えています。
|
||||||
@@ -621,7 +626,7 @@ public class CmnUtil
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
const int maxRetries = 3;
|
const int maxRetries = 3;
|
||||||
string? currentSession = session;
|
string? currentSession = session ?? SharedFlareSolverrSessionId;
|
||||||
|
|
||||||
for (int attempt = 1; attempt <= maxRetries; attempt++)
|
for (int attempt = 1; attempt <= maxRetries; attempt++)
|
||||||
{
|
{
|
||||||
@@ -652,7 +657,7 @@ public class CmnUtil
|
|||||||
// セッション不整合による500の可能性があるため、次回はセッションなしでリトライ
|
// セッション不整合による500の可能性があるため、次回はセッションなしでリトライ
|
||||||
if (currentSession != null)
|
if (currentSession != null)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[情報] セッション {currentSession} を解除して次回セッションなしで再試行します。");
|
LogManager.AddLog($"[情報] 【CmnUtil】 セッション {currentSession} を解除して次回セッションなしで再試行します。");
|
||||||
currentSession = null;
|
currentSession = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -674,7 +679,7 @@ public class CmnUtil
|
|||||||
if (!string.Equals(flareResponse.Status, "ok", StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(flareResponse.Status, "ok", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
string errorMsg = $"FlareSolverr エラー (Status: {flareResponse.Status}, Message: {flareResponse.Message}): {pageURL}";
|
string errorMsg = $"FlareSolverr エラー (Status: {flareResponse.Status}, Message: {flareResponse.Message}): {pageURL}";
|
||||||
LogManager.AddLog($"[警告] {errorMsg}");
|
LogManager.AddLog($"[警告] 【CmnUtil】 {errorMsg}");
|
||||||
|
|
||||||
if (attempt < maxRetries)
|
if (attempt < maxRetries)
|
||||||
{
|
{
|
||||||
@@ -699,7 +704,7 @@ public class CmnUtil
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (attempt < maxRetries && ex is not OperationCanceledException)
|
catch (Exception ex) when (attempt < maxRetries && ex is not OperationCanceledException)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[警告] FlareSolverr リクエスト再試行 (試行 {attempt}/{maxRetries}, URL: {pageURL}): {ex.Message}");
|
LogManager.AddLog($"[警告] 【CmnUtil】 FlareSolverr リクエスト再試行 (試行 {attempt}/{maxRetries}, URL: {pageURL}): {ex.Message}");
|
||||||
currentSession = null;
|
currentSession = null;
|
||||||
await Task.Delay(attempt * 2500);
|
await Task.Delay(attempt * 2500);
|
||||||
}
|
}
|
||||||
@@ -734,7 +739,7 @@ public class CmnUtil
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
const int maxRetries = 3;
|
const int maxRetries = 3;
|
||||||
string? currentSession = session;
|
string? currentSession = session ?? SharedFlareSolverrSessionId;
|
||||||
|
|
||||||
for (int attempt = 1; attempt <= maxRetries; attempt++)
|
for (int attempt = 1; attempt <= maxRetries; attempt++)
|
||||||
{
|
{
|
||||||
@@ -764,7 +769,7 @@ public class CmnUtil
|
|||||||
|
|
||||||
if (currentSession != null)
|
if (currentSession != null)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[情報] セッション {currentSession} を解除して次回セッションなしで再試行します。");
|
LogManager.AddLog($"[情報] 【CmnUtil】 セッション {currentSession} を解除して次回セッションなしで再試行します。");
|
||||||
currentSession = null;
|
currentSession = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -786,7 +791,7 @@ public class CmnUtil
|
|||||||
if (!string.Equals(flareResponse.Status, "ok", StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(flareResponse.Status, "ok", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
string errorMsg = $"FlareSolverr エラー (Status: {flareResponse.Status}, Message: {flareResponse.Message}): {url}";
|
string errorMsg = $"FlareSolverr エラー (Status: {flareResponse.Status}, Message: {flareResponse.Message}): {url}";
|
||||||
LogManager.AddLog($"[警告] {errorMsg}");
|
LogManager.AddLog($"[警告] 【CmnUtil】 {errorMsg}");
|
||||||
|
|
||||||
if (attempt < maxRetries)
|
if (attempt < maxRetries)
|
||||||
{
|
{
|
||||||
@@ -811,7 +816,7 @@ public class CmnUtil
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (attempt < maxRetries && ex is not OperationCanceledException)
|
catch (Exception ex) when (attempt < maxRetries && ex is not OperationCanceledException)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[警告] FlareSolverr リクエスト再試行 (試行 {attempt}/{maxRetries}, URL: {url}): {ex.Message}");
|
LogManager.AddLog($"[警告] 【CmnUtil】 FlareSolverr リクエスト再試行 (試行 {attempt}/{maxRetries}, URL: {url}): {ex.Message}");
|
||||||
currentSession = null;
|
currentSession = null;
|
||||||
await Task.Delay(attempt * 2500);
|
await Task.Delay(attempt * 2500);
|
||||||
}
|
}
|
||||||
@@ -849,7 +854,7 @@ public class CmnUtil
|
|||||||
Cmd = "request.get",
|
Cmd = "request.get",
|
||||||
Url = url,
|
Url = url,
|
||||||
MaxTimeout = maxTimeout,
|
MaxTimeout = maxTimeout,
|
||||||
Session = session
|
Session = session ?? SharedFlareSolverrSessionId
|
||||||
};
|
};
|
||||||
|
|
||||||
using var request = new HttpRequestMessage(HttpMethod.Post, flareSolverrEndpoint)
|
using var request = new HttpRequestMessage(HttpMethod.Post, flareSolverrEndpoint)
|
||||||
@@ -874,7 +879,7 @@ public class CmnUtil
|
|||||||
if (!string.Equals(flareResponse.Status, "ok", StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(flareResponse.Status, "ok", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
string errorMsg = $"FlareSolverr エラー (Status: {flareResponse.Status}, Message: {flareResponse.Message}): {url}";
|
string errorMsg = $"FlareSolverr エラー (Status: {flareResponse.Status}, Message: {flareResponse.Message}): {url}";
|
||||||
LogManager.AddLog($"[エラー] {errorMsg}");
|
LogManager.AddLog($"[エラー] 【CmnUtil】 {errorMsg}");
|
||||||
throw new InvalidOperationException(errorMsg);
|
throw new InvalidOperationException(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -906,7 +911,7 @@ public class CmnUtil
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] FlareSolverr フィード {url} の取得に失敗: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【CmnUtil】 FlareSolverr フィード {url} の取得に失敗: {ex.Message}");
|
||||||
PrintCallStackToEvent(ex);
|
PrintCallStackToEvent(ex);
|
||||||
return Enumerable.Empty<SyndicationItem>();
|
return Enumerable.Empty<SyndicationItem>();
|
||||||
}
|
}
|
||||||
@@ -1118,7 +1123,7 @@ public class CmnUtil
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] {url} の取得に失敗: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【CmnUtil】 {url} の取得に失敗: {ex.Message}");
|
||||||
return Enumerable.Empty<SyndicationItem>();
|
return Enumerable.Empty<SyndicationItem>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1371,7 +1376,7 @@ public class CmnUtil
|
|||||||
if (process.ExitCode != 0)
|
if (process.ExitCode != 0)
|
||||||
{
|
{
|
||||||
// エラー時は StandardError と StandardOutput の両方をログに出力する
|
// エラー時は StandardError と StandardOutput の両方をログに出力する
|
||||||
LogManager.AddLog($"[エラー] コマンド実行失敗 (ExitCode: {process.ExitCode}, Cmd: {command} {arguments})\n" +
|
LogManager.AddLog($"[エラー] 【CmnUtil】 コマンド実行失敗 (ExitCode: {process.ExitCode}, Cmd: {command} {arguments})\n" +
|
||||||
$"STDERR: {(string.IsNullOrEmpty(error) ? "(なし)" : error)}\n" +
|
$"STDERR: {(string.IsNullOrEmpty(error) ? "(なし)" : error)}\n" +
|
||||||
$"STDOUT: {(string.IsNullOrEmpty(output) ? "(なし)" : output)}");
|
$"STDOUT: {(string.IsNullOrEmpty(output) ? "(なし)" : output)}");
|
||||||
}
|
}
|
||||||
@@ -1385,7 +1390,7 @@ public class CmnUtil
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] プロセスの起動に失敗しました: {command}");
|
LogManager.AddLog($"[エラー] 【CmnUtil】 プロセスの起動に失敗しました: {command}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -91,11 +91,11 @@ public class ExternalConfigWatcher : IDisposable
|
|||||||
_watcher.Created += OnFileEvent;
|
_watcher.Created += OnFileEvent;
|
||||||
_watcher.Renamed += (s, e) => OnFileEvent(s, new FileSystemEventArgs(WatcherChangeTypes.Changed, watchDir, e.Name));
|
_watcher.Renamed += (s, e) => OnFileEvent(s, new FileSystemEventArgs(WatcherChangeTypes.Changed, watchDir, e.Name));
|
||||||
|
|
||||||
LogManager.AddLog($"[情報] FileSystemWatcher による設定ファイル監視を開始しました: {watchDir}");
|
LogManager.AddLog($"[情報] 【ExternalConfigWatcher】 FileSystemWatcher による設定ファイル監視を開始しました: {watchDir}");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[警告] FileSystemWatcher の初期化に失敗(ポーリングのみで監視を継続します): {ex.Message}");
|
LogManager.AddLog($"[警告] 【ExternalConfigWatcher】 FileSystemWatcher の初期化に失敗(ポーリングのみで監視を継続します): {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. バックグラウンドポーリングタスク(Dockerバインドマウント環境でも確実に検知するため2.5秒間隔で更新日時を走査)
|
// 2. バックグラウンドポーリングタスク(Dockerバインドマウント環境でも確実に検知するため2.5秒間隔で更新日時を走査)
|
||||||
@@ -216,7 +216,7 @@ public class ExternalConfigWatcher : IDisposable
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] 外部設定ファイル監視ループ例外: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【ExternalConfigWatcher】 外部設定ファイル監視ループ例外: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -231,7 +231,7 @@ public class ExternalConfigWatcher : IDisposable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogManager.AddLog($"[情報] 外部設定ファイルの変更を検知しました: {fileName} -> 【{handler.DisplayName}】のRSS生成を開始します");
|
LogManager.AddLog($"[情報] 【ExternalConfigWatcher】 外部設定ファイルの変更を検知しました: {fileName} -> 【{handler.DisplayName}】のRSS生成を開始します");
|
||||||
|
|
||||||
// 定期実行または他トリガーとの排他ロックを取得
|
// 定期実行または他トリガーとの排他ロックを取得
|
||||||
await _executionLock.WaitAsync();
|
await _executionLock.WaitAsync();
|
||||||
@@ -247,7 +247,7 @@ public class ExternalConfigWatcher : IDisposable
|
|||||||
await handler.Action(client);
|
await handler.Action(client);
|
||||||
|
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
LogManager.AddLog($"[情報] 【{handler.DisplayName}】 外部設定変更に伴うRSS生成完了 ({sw.Elapsed.TotalSeconds:0.##}秒)");
|
LogManager.AddLog($"[情報] 【ExternalConfigWatcher】 【{handler.DisplayName}】 外部設定変更に伴うRSS生成完了 ({sw.Elapsed.TotalSeconds:0.##}秒)");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -112,13 +112,13 @@ public static class ExternalFeedConfigManager
|
|||||||
{
|
{
|
||||||
if (defaultTargets != null && defaultTargets.Any())
|
if (defaultTargets != null && defaultTargets.Any())
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[情報] 設定ファイルが存在しないため、デフォルト設定を書き出します: {filePath}");
|
LogManager.AddLog($"[情報] 【ExternalFeedConfigManager】 設定ファイルが存在しないため、デフォルト設定を書き出します: {filePath}");
|
||||||
await SaveTargetsAsync(fileName, defaultTargets);
|
await SaveTargetsAsync(fileName, defaultTargets);
|
||||||
var defaults = defaultTargets.ToList();
|
var defaults = defaultTargets.ToList();
|
||||||
return onlyEnabled ? defaults.Where(t => t.Enabled).ToList() : defaults;
|
return onlyEnabled ? defaults.Where(t => t.Enabled).ToList() : defaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogManager.AddLog($"[警告] 設定ファイルが見つかりません: {filePath}");
|
LogManager.AddLog($"[警告] 【ExternalFeedConfigManager】 設定ファイルが見つかりません: {filePath}");
|
||||||
return new List<T>();
|
return new List<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,22 +127,22 @@ public static class ExternalFeedConfigManager
|
|||||||
|
|
||||||
if (items == null)
|
if (items == null)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[警告] 設定ファイルの内容が空または不正です: {filePath}");
|
LogManager.AddLog($"[警告] 【ExternalFeedConfigManager】 設定ファイルの内容が空または不正です: {filePath}");
|
||||||
return new List<T>();
|
return new List<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
LogManager.AddLog($"[情報] 外部設定ファイル読み込み完了: {fileName} ({items.Count}件)");
|
LogManager.AddLog($"[情報] 【ExternalFeedConfigManager】 外部設定ファイル読み込み完了: {fileName} ({items.Count}件)");
|
||||||
return onlyEnabled ? items.Where(t => t.Enabled).ToList() : items;
|
return onlyEnabled ? items.Where(t => t.Enabled).ToList() : items;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] 外部設定ファイル読み込み失敗 ({filePath}): {ex.Message}");
|
LogManager.AddLog($"[エラー] 【ExternalFeedConfigManager】 外部設定ファイル読み込み失敗 ({filePath}): {ex.Message}");
|
||||||
CmnUtil.PrintCallStackToEvent(ex);
|
CmnUtil.PrintCallStackToEvent(ex);
|
||||||
|
|
||||||
// 読み込みに失敗した場合、デフォルトが指定されていればフォールバック
|
// 読み込みに失敗した場合、デフォルトが指定されていればフォールバック
|
||||||
if (defaultTargets != null && defaultTargets.Any())
|
if (defaultTargets != null && defaultTargets.Any())
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[情報] デフォルト設定をフォールバックとして使用します: {fileName}");
|
LogManager.AddLog($"[情報] 【ExternalFeedConfigManager】 デフォルト設定をフォールバックとして使用します: {fileName}");
|
||||||
var defaults = defaultTargets.ToList();
|
var defaults = defaultTargets.ToList();
|
||||||
return onlyEnabled ? defaults.Where(t => t.Enabled).ToList() : defaults;
|
return onlyEnabled ? defaults.Where(t => t.Enabled).ToList() : defaults;
|
||||||
}
|
}
|
||||||
@@ -168,6 +168,6 @@ public static class ExternalFeedConfigManager
|
|||||||
string filePath = Path.Combine(dir, fileName);
|
string filePath = Path.Combine(dir, fileName);
|
||||||
using var stream = File.Create(filePath);
|
using var stream = File.Create(filePath);
|
||||||
await JsonSerializer.SerializeAsync(stream, targets, JsonOptions);
|
await JsonSerializer.SerializeAsync(stream, targets, JsonOptions);
|
||||||
LogManager.AddLog($"[情報] 設定ファイルを保存しました: {filePath}");
|
LogManager.AddLog($"[情報] 【ExternalFeedConfigManager】 設定ファイルを保存しました: {filePath}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -8,6 +8,7 @@ using rss_generator.Class.HentaiPaw;
|
|||||||
using rss_generator.Class.HitomiLa;
|
using rss_generator.Class.HitomiLa;
|
||||||
using rss_generator.Class.MissAV;
|
using rss_generator.Class.MissAV;
|
||||||
using rss_generator.Class.MissAV123;
|
using rss_generator.Class.MissAV123;
|
||||||
|
using rss_generator.Class.Skebetter;
|
||||||
using rss_generator.Class.SpankBang;
|
using rss_generator.Class.SpankBang;
|
||||||
using rss_generator.Class.YahooBaseball;
|
using rss_generator.Class.YahooBaseball;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ internal static class FlareSolverrFeedManager
|
|||||||
/// <param name="client">HttpClient インスタンス</param>
|
/// <param name="client">HttpClient インスタンス</param>
|
||||||
public static async Task CreateAllRSSAsync(HttpClient client)
|
public static async Task CreateAllRSSAsync(HttpClient client)
|
||||||
{
|
{
|
||||||
LogManager.AddLog("[情報] FlareSolverr フィード生成(単一セッション順次実行)を開始します");
|
LogManager.AddLog("[情報] 【FlareSolverrFeedManager】 FlareSolverr フィード生成(単一セッション順次実行)を開始します");
|
||||||
var sw = Stopwatch.StartNew();
|
var sw = Stopwatch.StartNew();
|
||||||
string? sessionId = null;
|
string? sessionId = null;
|
||||||
|
|
||||||
@@ -37,7 +38,8 @@ internal static class FlareSolverrFeedManager
|
|||||||
|
|
||||||
// 1. 全タスク共通の単一 FlareSolverr セッションを作成(Chromium 1インスタンスのみ起動)
|
// 1. 全タスク共通の単一 FlareSolverr セッションを作成(Chromium 1インスタンスのみ起動)
|
||||||
sessionId = await CmnUtil.CreateFlareSolverrSession(client);
|
sessionId = await CmnUtil.CreateFlareSolverrSession(client);
|
||||||
LogManager.AddLog($"[情報] 共通 FlareSolverr セッションを作成しました (Session: {sessionId ?? "none"})");
|
CmnUtil.SharedFlareSolverrSessionId = sessionId;
|
||||||
|
LogManager.AddLog($"[情報] 【FlareSolverrFeedManager】 共通 FlareSolverr セッションを作成しました (Session: {sessionId ?? "none"})");
|
||||||
|
|
||||||
// 2. メモリ節約のため、1つのセッションを使い回して直列(同期)で順番に実行
|
// 2. メモリ節約のため、1つのセッションを使い回して直列(同期)で順番に実行
|
||||||
// 個別のエラーで全体が止まらないよう各タスクを保護
|
// 個別のエラーで全体が止まらないよう各タスクを保護
|
||||||
@@ -49,7 +51,7 @@ internal static class FlareSolverrFeedManager
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] [FlareSolverrFeedManager] npb_6 実行失敗: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【FlareSolverrFeedManager】 npb_6 実行失敗: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// aurahentai
|
// aurahentai
|
||||||
@@ -59,7 +61,7 @@ internal static class FlareSolverrFeedManager
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] [FlareSolverrFeedManager] aurahentai 実行失敗: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【FlareSolverrFeedManager】 aurahentai 実行失敗: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Danbooru rank
|
// Danbooru rank
|
||||||
@@ -69,7 +71,7 @@ internal static class FlareSolverrFeedManager
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] [FlareSolverrFeedManager] Danbooru.rank 実行失敗: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【FlareSolverrFeedManager】 Danbooru.rank 実行失敗: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// missav
|
// missav
|
||||||
@@ -79,7 +81,7 @@ internal static class FlareSolverrFeedManager
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] [FlareSolverrFeedManager] missav 実行失敗: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【FlareSolverrFeedManager】 missav 実行失敗: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// missav123
|
// missav123
|
||||||
@@ -89,7 +91,7 @@ internal static class FlareSolverrFeedManager
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] [FlareSolverrFeedManager] missav123 実行失敗: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【FlareSolverrFeedManager】 missav123 実行失敗: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// hitomi.la
|
// hitomi.la
|
||||||
@@ -99,7 +101,7 @@ internal static class FlareSolverrFeedManager
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] [FlareSolverrFeedManager] hitomi.la 実行失敗: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【FlareSolverrFeedManager】 hitomi.la 実行失敗: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// spankbang
|
// spankbang
|
||||||
@@ -109,7 +111,7 @@ internal static class FlareSolverrFeedManager
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] [FlareSolverrFeedManager] spankbang 実行失敗: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【FlareSolverrFeedManager】 spankbang 実行失敗: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// hentaipaw (エロモフ)
|
// hentaipaw (エロモフ)
|
||||||
@@ -119,30 +121,41 @@ internal static class FlareSolverrFeedManager
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] [FlareSolverrFeedManager] hentaipaw 実行失敗: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【FlareSolverrFeedManager】 hentaipaw 実行失敗: {ex.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// skebetter
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await skebetter.CreateRSSAsync(client, sessionId);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogManager.AddLog($"[エラー] 【FlareSolverrFeedManager】 skebetter 実行失敗: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] [FlareSolverrFeedManager] 共通セッション処理中に例外発生: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【FlareSolverrFeedManager】 共通セッション処理中に例外発生: {ex.Message}");
|
||||||
CmnUtil.PrintCallStackToEvent(ex);
|
CmnUtil.PrintCallStackToEvent(ex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
// 3. すべて取得完了後にセッション(Chromiumインスタンス)を確実に破棄してメモリ・CPUを完全解放
|
// 3. すべて取得完了後にセッション(Chromiumインスタンス)を確実に破棄してメモリ・CPUを完全解放
|
||||||
|
CmnUtil.SharedFlareSolverrSessionId = null;
|
||||||
// 個別の sessionId 破棄に加え、万が一の残留セッションも一括破棄
|
// 個別の sessionId 破棄に加え、万が一の残留セッションも一括破棄
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await CmnUtil.DestroyAllFlareSolverrSessions(client);
|
await CmnUtil.DestroyAllFlareSolverrSessions(client);
|
||||||
LogManager.AddLog($"[情報] [FlareSolverrFeedManager] FlareSolverr セッションクリーンアップ完了");
|
LogManager.AddLog($"[情報] 【FlareSolverrFeedManager】 FlareSolverr セッションクリーンアップ完了");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[警告] [FlareSolverrFeedManager] セッションクリーンアップ中にエラー: {ex.Message}");
|
LogManager.AddLog($"[警告] 【FlareSolverrFeedManager】 セッションクリーンアップ中にエラー: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
LogManager.AddLog($"[情報] FlareSolverr フィード生成完了 実行時間:{sw.Elapsed.TotalSeconds:0.##}秒");
|
LogManager.AddLog($"[情報] 【FlareSolverrFeedManager】 FlareSolverr フィード生成完了 実行時間:{sw.Elapsed.TotalSeconds:0.##}秒");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp.Dom;
|
using AngleSharp.Dom;
|
||||||
using AngleSharp.Html.Dom;
|
using AngleSharp.Html.Dom;
|
||||||
using AngleSharp.Html.Parser;
|
using AngleSharp.Html.Parser;
|
||||||
using System;
|
using System;
|
||||||
@@ -24,55 +24,40 @@ internal class rank
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 外部からセッションが渡されなかった場合は自前で作成
|
sessionId ??= CmnUtil.SharedFlareSolverrSessionId;
|
||||||
bool ownSession = sessionId == null;
|
// FlareSolverr 経由で Atom フィードアイテムを取得
|
||||||
if (ownSession)
|
var items = await CmnUtil.GetFeedItemsFlareSolverr(client, pageMaster, session: sessionId);
|
||||||
{
|
var simplifiedItems = new List<SyndicationItem>();
|
||||||
sessionId = await CmnUtil.CreateFlareSolverrSession(client);
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// FlareSolverr 経由で Atom フィードアイテムを取得
|
|
||||||
var items = await CmnUtil.GetFeedItemsFlareSolverr(client, pageMaster, session: sessionId);
|
|
||||||
var simplifiedItems = new List<SyndicationItem>();
|
|
||||||
|
|
||||||
var cutoff = DateTimeOffset.Now.AddHours(-24);
|
var cutoff = DateTimeOffset.Now.AddHours(-24);
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
|
{
|
||||||
|
// 24時間以上前の記事は詳細スクレイピングをスキップ
|
||||||
|
if (!CmnUtil.IsItemWithinCutoff(item, cutoff))
|
||||||
{
|
{
|
||||||
// 24時間以上前の記事は詳細スクレイピングをスキップ
|
continue;
|
||||||
if (!CmnUtil.IsItemWithinCutoff(item, cutoff))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var simplified = await Simplified(client, item, sessionId);
|
|
||||||
if (simplified != null)
|
|
||||||
{
|
|
||||||
simplifiedItems.Add(simplified);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新しい統合フィードを作成
|
var simplified = await Simplified(client, item, sessionId);
|
||||||
var mergedFeed = new SyndicationFeed(
|
if (simplified != null)
|
||||||
"Danbooru",
|
|
||||||
"Danbooru Rank Posts",
|
|
||||||
new Uri("https://danbooru.donmai.us/posts?tags=order%3Arank"),
|
|
||||||
simplifiedItems
|
|
||||||
);
|
|
||||||
|
|
||||||
await CmnUtil.ExportXMLFileAsync("rank.xml", mergedFeed, client, "danbooru");
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (ownSession && sessionId != null)
|
|
||||||
{
|
{
|
||||||
await CmnUtil.DestroyFlareSolverrSession(client, sessionId);
|
simplifiedItems.Add(simplified);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新しい統合フィードを作成
|
||||||
|
var mergedFeed = new SyndicationFeed(
|
||||||
|
"Danbooru",
|
||||||
|
"Danbooru Rank Posts",
|
||||||
|
new Uri("https://danbooru.donmai.us/posts?tags=order%3Arank"),
|
||||||
|
simplifiedItems
|
||||||
|
);
|
||||||
|
|
||||||
|
await CmnUtil.ExportXMLFileAsync("rank.xml", mergedFeed, client, "danbooru");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] danbooru:{ex.Message}");
|
LogManager.AddLog($"[エラー] 【Danbooru】 {ex.Message}");
|
||||||
CmnUtil.PrintCallStackToEvent(ex);
|
CmnUtil.PrintCallStackToEvent(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
@@ -35,7 +35,7 @@ internal class e_hentai_ai
|
|||||||
);
|
);
|
||||||
|
|
||||||
// XML ファイルとして出力
|
// XML ファイルとして出力
|
||||||
await CmnUtil.ExportXMLFileAsync("e_hentai_ai.xml", feed, client);
|
await CmnUtil.ExportXMLFileAsync("e_hentai_ai.xml", feed, client, addDir: "e-hentai.org");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp.Dom;
|
using AngleSharp.Dom;
|
||||||
using AngleSharp.Html.Dom;
|
using AngleSharp.Html.Dom;
|
||||||
using AngleSharp.Html.Parser;
|
using AngleSharp.Html.Parser;
|
||||||
using System;
|
using System;
|
||||||
@@ -65,7 +65,7 @@ internal static class e_hentai_common
|
|||||||
using var response = await client.SendAsync(request);
|
using var response = await client.SendAsync(request);
|
||||||
if (!response.IsSuccessStatusCode)
|
if (!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[警告] E-Hentai 一覧取得失敗 (URL={currentUrl}, Status={response.StatusCode})");
|
LogManager.AddLog($"[警告] 【EHentai】 E-Hentai 一覧取得失敗 (URL={currentUrl}, Status={response.StatusCode})");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,7 +247,7 @@ internal static class e_hentai_common
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[警告] ギャラリー詳細取得エラー ({gallery.Url}): {ex.Message}");
|
LogManager.AddLog($"[警告] 【EHentai】 ギャラリー詳細取得エラー ({gallery.Url}): {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new List<string>();
|
return new List<string>();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
@@ -35,7 +35,7 @@ internal class e_hentai_non_ai
|
|||||||
);
|
);
|
||||||
|
|
||||||
// XML ファイルとして出力
|
// XML ファイルとして出力
|
||||||
await CmnUtil.ExportXMLFileAsync("e_hentai_non_ai.xml", feed, client);
|
await CmnUtil.ExportXMLFileAsync("e_hentai_non_ai.xml", feed, client, addDir: "e-hentai.org");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp.Dom;
|
using AngleSharp.Dom;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -53,19 +53,11 @@ internal static class hentaipaw
|
|||||||
// 既存の hentaipaw.xml から各記事(タイトル・本文・日時・カテゴリ)を読み込んでキャッシュ化
|
// 既存の hentaipaw.xml から各記事(タイトル・本文・日時・カテゴリ)を読み込んでキャッシュ化
|
||||||
var existingEntries = LoadExistingEntries("hentaipaw.xml");
|
var existingEntries = LoadExistingEntries("hentaipaw.xml");
|
||||||
|
|
||||||
// 外部からセッションが渡されなかった場合は自前で作成
|
sessionId ??= CmnUtil.SharedFlareSolverrSessionId;
|
||||||
bool ownSession = sessionId == null;
|
|
||||||
if (ownSession)
|
|
||||||
{
|
|
||||||
sessionId = await CmnUtil.CreateFlareSolverrSession(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var document = await CmnUtil.GetDocumentFlareSolverr(client, TargetUrl, session: sessionId);
|
var document = await CmnUtil.GetDocumentFlareSolverr(client, TargetUrl, session: sessionId);
|
||||||
if (document == null)
|
if (document == null)
|
||||||
{
|
{
|
||||||
LogManager.AddLog("[警告] [hentaipaw] トップページの取得に失敗しました。");
|
LogManager.AddLog("[警告] 【hentaipaw】 トップページの取得に失敗しました。");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,18 +400,10 @@ internal static class hentaipaw
|
|||||||
|
|
||||||
feed.Items = items;
|
feed.Items = items;
|
||||||
await CmnUtil.ExportXMLFileAsync("hentaipaw.xml", feed, client, filter24Hours: false);
|
await CmnUtil.ExportXMLFileAsync("hentaipaw.xml", feed, client, filter24Hours: false);
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (ownSession && sessionId != null)
|
|
||||||
{
|
|
||||||
await CmnUtil.DestroyFlareSolverrSession(client, sessionId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] hentaipaw: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【hentaipaw】 {ex.Message}");
|
||||||
CmnUtil.PrintCallStackToEvent(ex);
|
CmnUtil.PrintCallStackToEvent(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp.Dom;
|
using AngleSharp.Dom;
|
||||||
using AngleSharp.Html.Dom;
|
using AngleSharp.Html.Dom;
|
||||||
using AngleSharp.Html.Parser;
|
using AngleSharp.Html.Parser;
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp.Dom;
|
using AngleSharp.Dom;
|
||||||
using AngleSharp.Html.Dom;
|
using AngleSharp.Html.Dom;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -120,7 +120,7 @@ internal class javtwi
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] javtwi:{ex.Message}");
|
LogManager.AddLog($"[エラー] 【javtwi】 {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp.Dom;
|
using AngleSharp.Dom;
|
||||||
using AngleSharp.Html.Dom;
|
using AngleSharp.Html.Dom;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -132,7 +132,7 @@ internal class kimochiinfo
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] kimochiinfo:{ex.Message}");
|
LogManager.AddLog($"[エラー] 【kimochiinfo】 {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp.Dom;
|
using AngleSharp.Dom;
|
||||||
using AngleSharp.Html.Dom;
|
using AngleSharp.Html.Dom;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -185,7 +185,7 @@ internal class mangalear
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
AddLog($"[エラー] [mangalear]: {ex.Message}");
|
AddLog($"[エラー] 【mangalear】 {ex.Message}");
|
||||||
CmnUtil.PrintCallStackToEvent(ex);
|
CmnUtil.PrintCallStackToEvent(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp.Dom;
|
using AngleSharp.Dom;
|
||||||
using AngleSharp.Html.Dom;
|
using AngleSharp.Html.Dom;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -25,15 +25,7 @@ internal static class missav
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 外部からセッションが渡されなかった場合は自前で作成
|
sessionId ??= CmnUtil.SharedFlareSolverrSessionId;
|
||||||
bool ownSession = sessionId == null;
|
|
||||||
if (ownSession)
|
|
||||||
{
|
|
||||||
sessionId = await CmnUtil.CreateFlareSolverrSession(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var docList = new List<IDocument>();
|
var docList = new List<IDocument>();
|
||||||
for (int pageId = 1; pageId <= 2; pageId++)
|
for (int pageId = 1; pageId <= 2; pageId++)
|
||||||
{
|
{
|
||||||
@@ -247,18 +239,10 @@ internal static class missav
|
|||||||
|
|
||||||
feed.Items = items;
|
feed.Items = items;
|
||||||
await CmnUtil.ExportXMLFileAsync("missav.xml", feed, client);
|
await CmnUtil.ExportXMLFileAsync("missav.xml", feed, client);
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (ownSession && sessionId != null)
|
|
||||||
{
|
|
||||||
await CmnUtil.DestroyFlareSolverrSession(client, sessionId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] missav:{ex.Message}");
|
LogManager.AddLog($"[エラー] 【missav】 {ex.Message}");
|
||||||
CmnUtil.PrintCallStackToEvent(ex);
|
CmnUtil.PrintCallStackToEvent(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp.Dom;
|
using AngleSharp.Dom;
|
||||||
using AngleSharp.Html.Dom;
|
using AngleSharp.Html.Dom;
|
||||||
using AngleSharp.Html.Parser;
|
using AngleSharp.Html.Parser;
|
||||||
using System;
|
using System;
|
||||||
@@ -27,14 +27,7 @@ internal class missav123
|
|||||||
var items = new List<SyndicationItem>();
|
var items = new List<SyndicationItem>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 外部からセッションが渡されなかった場合は自前で作成
|
sessionId ??= CmnUtil.SharedFlareSolverrSessionId;
|
||||||
bool ownSession = sessionId == null;
|
|
||||||
if (ownSession)
|
|
||||||
{
|
|
||||||
sessionId = await CmnUtil.CreateFlareSolverrSession(client);
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var docList = new List<IDocument>();
|
var docList = new List<IDocument>();
|
||||||
for (int pageId = 1; pageId <= 2; pageId++)
|
for (int pageId = 1; pageId <= 2; pageId++)
|
||||||
{
|
{
|
||||||
@@ -350,18 +343,10 @@ internal class missav123
|
|||||||
feed.Items = items;
|
feed.Items = items;
|
||||||
|
|
||||||
await CmnUtil.ExportXMLFileAsync("123av.xml", feed, client);
|
await CmnUtil.ExportXMLFileAsync("123av.xml", feed, client);
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (ownSession && sessionId != null)
|
|
||||||
{
|
|
||||||
await CmnUtil.DestroyFlareSolverrSession(client, sessionId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] 123av:{ex.Message}");
|
LogManager.AddLog($"[エラー] 【missav123】 {ex.Message}");
|
||||||
CmnUtil.PrintCallStackToEvent(ex);
|
CmnUtil.PrintCallStackToEvent(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp.Html.Parser;
|
using AngleSharp.Html.Parser;
|
||||||
using System.ServiceModel.Syndication;
|
using System.ServiceModel.Syndication;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -12,7 +12,7 @@ internal class momonga_fanzine
|
|||||||
{
|
{
|
||||||
var pageMaster = "https://momon-ga.com/fanzine";
|
var pageMaster = "https://momon-ga.com/fanzine";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var linkList = new List<string>();
|
var linkList = new List<string>();
|
||||||
for (int pageId = 1; pageId <= 50; pageId++)
|
for (int pageId = 1; pageId <= 50; pageId++)
|
||||||
@@ -31,9 +31,11 @@ internal class momonga_fanzine
|
|||||||
// 簡潔なRSSに非同期で整形
|
// 簡潔なRSSに非同期で整形
|
||||||
var itemTasks = validItems.OrderByDescending(x => x.PublishDate).Select(async originalItem =>
|
var itemTasks = validItems.OrderByDescending(x => x.PublishDate).Select(async originalItem =>
|
||||||
{
|
{
|
||||||
List<SyndicationCategory> getAddCategory()
|
// 本文内のメタデータからカテゴリおよび著者(サークル・作者)を抽出
|
||||||
|
(List<SyndicationCategory> categories, List<string> authors) parseMetadata()
|
||||||
{
|
{
|
||||||
List<SyndicationCategory> result = new List<SyndicationCategory>();
|
var resultCategories = new List<SyndicationCategory>();
|
||||||
|
var resultAuthors = new List<string>();
|
||||||
|
|
||||||
string orgText = originalItem.Summary.Text;
|
string orgText = originalItem.Summary.Text;
|
||||||
var parser = new HtmlParser();
|
var parser = new HtmlParser();
|
||||||
@@ -50,14 +52,15 @@ internal class momonga_fanzine
|
|||||||
targetText = targetText.Substring(0, tagIndex);
|
targetText = targetText.Substring(0, tagIndex);
|
||||||
}
|
}
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
// 正規表現で各項目の値を抽出する
|
// 正規表現で各項目のラベルと値を抽出する
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
string pattern = @"【[^】]+】([^【]*)";
|
string pattern = @"【(?<key>[^】]+)】(?<val>[^【]*)";
|
||||||
var matches = Regex.Matches(targetText, pattern);
|
var matches = Regex.Matches(targetText, pattern);
|
||||||
|
|
||||||
foreach (Match match in matches)
|
foreach (Match match in matches)
|
||||||
{
|
{
|
||||||
string valuesStr = match.Groups[1].Value;
|
string key = match.Groups["key"].Value.Trim();
|
||||||
|
string valuesStr = match.Groups["val"].Value;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(valuesStr))
|
if (string.IsNullOrWhiteSpace(valuesStr))
|
||||||
{
|
{
|
||||||
@@ -68,16 +71,27 @@ internal class momonga_fanzine
|
|||||||
|
|
||||||
foreach (var val in splitValues)
|
foreach (var val in splitValues)
|
||||||
{
|
{
|
||||||
string categoryName = val.Trim();
|
string cleanName = val.Trim();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(categoryName))
|
if (!string.IsNullOrEmpty(cleanName))
|
||||||
{
|
{
|
||||||
result.Add(new SyndicationCategory(categoryName));
|
resultCategories.Add(new SyndicationCategory(cleanName));
|
||||||
|
|
||||||
|
// サークルまたは作者(アーティスト)の場合は著者一覧にも追加
|
||||||
|
if (key == "サークル" || key == "作者" ||
|
||||||
|
key.Equals("circle", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
key.Equals("artist", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
if (!resultAuthors.Contains(cleanName, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
resultAuthors.Add(cleanName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return (resultCategories, resultAuthors);
|
||||||
}
|
}
|
||||||
|
|
||||||
var newItem = new SyndicationItem()
|
var newItem = new SyndicationItem()
|
||||||
@@ -93,8 +107,11 @@ internal class momonga_fanzine
|
|||||||
{
|
{
|
||||||
newItem.Links.Add(new SyndicationLink(link));
|
newItem.Links.Add(new SyndicationLink(link));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (addCategories, addAuthors) = parseMetadata();
|
||||||
|
|
||||||
// カテゴリに本文内の作者などの情報を追加する
|
// カテゴリに本文内の作者などの情報を追加する
|
||||||
foreach (var category in getAddCategory())
|
foreach (var category in addCategories)
|
||||||
{
|
{
|
||||||
newItem.Categories.Add(category);
|
newItem.Categories.Add(category);
|
||||||
}
|
}
|
||||||
@@ -104,9 +121,21 @@ internal class momonga_fanzine
|
|||||||
category.Scheme = null;
|
category.Scheme = null;
|
||||||
newItem.Categories.Add(category);
|
newItem.Categories.Add(category);
|
||||||
}
|
}
|
||||||
foreach (var author in originalItem.Authors)
|
|
||||||
|
// 著者の設定:アーティストやサークルの値をすべて追加してFreshRSSで検索可能にする
|
||||||
|
if (addAuthors.Count > 0)
|
||||||
{
|
{
|
||||||
newItem.Authors.Add(author);
|
foreach (var authorName in addAuthors)
|
||||||
|
{
|
||||||
|
newItem.Authors.Add(new SyndicationPerson { Name = authorName });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var author in originalItem.Authors)
|
||||||
|
{
|
||||||
|
newItem.Authors.Add(author);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID
|
// ID
|
||||||
@@ -165,14 +194,14 @@ internal class momonga_fanzine
|
|||||||
simplifiedItems
|
simplifiedItems
|
||||||
);
|
);
|
||||||
|
|
||||||
await CmnUtil.ExportXMLFileAsync("momonga-fanzine.xml", mergedFeed, client);
|
await CmnUtil.ExportXMLFileAsync("momonga-fanzine.xml", mergedFeed, client, addDir: "momon-ga.com");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] momonga-fanzine:{ex.Message}");
|
LogManager.AddLog($"[エラー] 【Momonga】 fanzine: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 文字列をURLセーフなBase64(Base64URL)に変換します (RFC 4648 準拠)
|
/// 文字列をURLセーフなBase64(Base64URL)に変換します (RFC 4648 準拠)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -184,5 +213,5 @@ internal class momonga_fanzine
|
|||||||
.Replace('/', '_') // '/' を '_' に置換
|
.Replace('/', '_') // '/' を '_' に置換
|
||||||
.TrimEnd('='); // 末尾のパディング '=' を削除
|
.TrimEnd('='); // 末尾のパディング '=' を削除
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp.Html.Parser;
|
using AngleSharp.Html.Parser;
|
||||||
using System.ServiceModel.Syndication;
|
using System.ServiceModel.Syndication;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -31,9 +31,11 @@ internal class momonga_magazine
|
|||||||
// 簡潔なRSSに非同期で整形
|
// 簡潔なRSSに非同期で整形
|
||||||
var itemTasks = validItems.OrderByDescending(x => x.PublishDate).Select(async originalItem =>
|
var itemTasks = validItems.OrderByDescending(x => x.PublishDate).Select(async originalItem =>
|
||||||
{
|
{
|
||||||
List<SyndicationCategory> getAddCategory()
|
// 本文内のメタデータからカテゴリおよび著者(サークル・作者)を抽出
|
||||||
|
(List<SyndicationCategory> categories, List<string> authors) parseMetadata()
|
||||||
{
|
{
|
||||||
List<SyndicationCategory> result = new List<SyndicationCategory>();
|
var resultCategories = new List<SyndicationCategory>();
|
||||||
|
var resultAuthors = new List<string>();
|
||||||
|
|
||||||
string orgText = originalItem.Summary.Text;
|
string orgText = originalItem.Summary.Text;
|
||||||
var parser = new HtmlParser();
|
var parser = new HtmlParser();
|
||||||
@@ -50,14 +52,15 @@ internal class momonga_magazine
|
|||||||
targetText = targetText.Substring(0, tagIndex);
|
targetText = targetText.Substring(0, tagIndex);
|
||||||
}
|
}
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
// 正規表現で各項目の値を抽出する
|
// 正規表現で各項目のラベルと値を抽出する
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
string pattern = @"【[^】]+】([^【]*)";
|
string pattern = @"【(?<key>[^】]+)】(?<val>[^【]*)";
|
||||||
var matches = Regex.Matches(targetText, pattern);
|
var matches = Regex.Matches(targetText, pattern);
|
||||||
|
|
||||||
foreach (Match match in matches)
|
foreach (Match match in matches)
|
||||||
{
|
{
|
||||||
string valuesStr = match.Groups[1].Value;
|
string key = match.Groups["key"].Value.Trim();
|
||||||
|
string valuesStr = match.Groups["val"].Value;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(valuesStr))
|
if (string.IsNullOrWhiteSpace(valuesStr))
|
||||||
{
|
{
|
||||||
@@ -68,16 +71,27 @@ internal class momonga_magazine
|
|||||||
|
|
||||||
foreach (var val in splitValues)
|
foreach (var val in splitValues)
|
||||||
{
|
{
|
||||||
string categoryName = val.Trim();
|
string cleanName = val.Trim();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(categoryName))
|
if (!string.IsNullOrEmpty(cleanName))
|
||||||
{
|
{
|
||||||
result.Add(new SyndicationCategory(categoryName));
|
resultCategories.Add(new SyndicationCategory(cleanName));
|
||||||
|
|
||||||
|
// サークルまたは作者(アーティスト)の場合は著者一覧にも追加
|
||||||
|
if (key == "サークル" || key == "作者" ||
|
||||||
|
key.Equals("circle", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
key.Equals("artist", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
if (!resultAuthors.Contains(cleanName, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
resultAuthors.Add(cleanName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return (resultCategories, resultAuthors);
|
||||||
}
|
}
|
||||||
|
|
||||||
var newItem = new SyndicationItem()
|
var newItem = new SyndicationItem()
|
||||||
@@ -93,8 +107,11 @@ internal class momonga_magazine
|
|||||||
{
|
{
|
||||||
newItem.Links.Add(new SyndicationLink(link));
|
newItem.Links.Add(new SyndicationLink(link));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (addCategories, addAuthors) = parseMetadata();
|
||||||
|
|
||||||
// カテゴリに本文内の作者などの情報を追加する
|
// カテゴリに本文内の作者などの情報を追加する
|
||||||
foreach (var category in getAddCategory())
|
foreach (var category in addCategories)
|
||||||
{
|
{
|
||||||
newItem.Categories.Add(category);
|
newItem.Categories.Add(category);
|
||||||
}
|
}
|
||||||
@@ -104,9 +121,21 @@ internal class momonga_magazine
|
|||||||
category.Scheme = null;
|
category.Scheme = null;
|
||||||
newItem.Categories.Add(category);
|
newItem.Categories.Add(category);
|
||||||
}
|
}
|
||||||
foreach (var author in originalItem.Authors)
|
|
||||||
|
// 著者の設定:アーティストやサークルの値をすべて追加してFreshRSSで検索可能にする
|
||||||
|
if (addAuthors.Count > 0)
|
||||||
{
|
{
|
||||||
newItem.Authors.Add(author);
|
foreach (var authorName in addAuthors)
|
||||||
|
{
|
||||||
|
newItem.Authors.Add(new SyndicationPerson { Name = authorName });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var author in originalItem.Authors)
|
||||||
|
{
|
||||||
|
newItem.Authors.Add(author);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID
|
// ID
|
||||||
@@ -165,11 +194,11 @@ internal class momonga_magazine
|
|||||||
simplifiedItems
|
simplifiedItems
|
||||||
);
|
);
|
||||||
|
|
||||||
await CmnUtil.ExportXMLFileAsync("momonga-magazine.xml", mergedFeed, client);
|
await CmnUtil.ExportXMLFileAsync("momonga-magazine.xml", mergedFeed, client, addDir: "momon-ga.com");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] momonga-magazine:{ex.Message}");
|
LogManager.AddLog($"[エラー] 【Momonga】 magazine: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,5 +213,5 @@ internal class momonga_magazine
|
|||||||
.Replace('/', '_') // '/' を '_' に置換
|
.Replace('/', '_') // '/' を '_' に置換
|
||||||
.TrimEnd('='); // 末尾のパディング '=' を削除
|
.TrimEnd('='); // 末尾のパディング '=' を削除
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -564,7 +564,7 @@ internal static class pixiv_common
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Pixiv は自前画像URLまたはプロキシ画像URLを出力するため、Base64への再変換は行わない
|
// Pixiv は自前画像URLまたはプロキシ画像URLを出力するため、Base64への再変換は行わない
|
||||||
await CmnUtil.ExportXMLFileAsync(fileName, feed, client, embedBase64: false);
|
await CmnUtil.ExportXMLFileAsync(fileName, feed, client, addDir: "pixiv.net", embedBase64: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -584,7 +584,7 @@ internal static class pixiv_common
|
|||||||
items
|
items
|
||||||
);
|
);
|
||||||
|
|
||||||
CmnUtil.ExportXMLFile(fileName, feed);
|
CmnUtil.ExportXMLFile(fileName, feed, addDir: "pixiv.net");
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Pixiv API レスポンス用データモデル
|
#region Pixiv API レスポンス用データモデル
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
@@ -30,27 +30,27 @@ internal static class skebetter
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Skebetter の全フィード(漫画急上昇・イラスト急上昇)を順次生成します。
|
/// Skebetter の全フィード(漫画急上昇・イラスト急上昇)を順次生成します。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static async Task CreateRSSAsync(HttpClient client)
|
public static async Task CreateRSSAsync(HttpClient client, string? sessionId = null)
|
||||||
{
|
{
|
||||||
// 1. 急上昇(漫画・総合)の生成
|
// 1. 急上昇(漫画・総合)の生成
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await CreateMangaHotRssAsync(client);
|
await CreateMangaHotRssAsync(client, sessionId);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] [skebetter] 漫画急上昇 RSS 生成失敗: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【skebetter】 漫画急上昇 RSS 生成失敗: {ex.Message}");
|
||||||
CmnUtil.PrintCallStackToEvent(ex);
|
CmnUtil.PrintCallStackToEvent(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. イラスト急上昇の生成
|
// 2. イラスト急上昇の生成
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await CreateIllustHotRssAsync(client);
|
await CreateIllustHotRssAsync(client, sessionId);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] [skebetter] イラスト急上昇 RSS 生成失敗: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【skebetter】 イラスト急上昇 RSS 生成失敗: {ex.Message}");
|
||||||
CmnUtil.PrintCallStackToEvent(ex);
|
CmnUtil.PrintCallStackToEvent(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,13 +59,13 @@ internal static class skebetter
|
|||||||
/// 急上昇(漫画・総合)の RSS フィード (skebetter.xml) を生成します。
|
/// 急上昇(漫画・総合)の RSS フィード (skebetter.xml) を生成します。
|
||||||
/// 複数ページつながっている漫画は同一記事内で全ページをつなげて出力します。
|
/// 複数ページつながっている漫画は同一記事内で全ページをつなげて出力します。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static async Task CreateMangaHotRssAsync(HttpClient client)
|
public static async Task CreateMangaHotRssAsync(HttpClient client, string? sessionId = null)
|
||||||
{
|
{
|
||||||
LogManager.AddLog("[情報] [skebetter] 漫画急上昇の取得を開始します");
|
LogManager.AddLog("[情報] 【skebetter】 漫画急上昇の取得を開始します");
|
||||||
var posts = await FetchPostsAsync(client, MangaApiUrl, MangaPageUrl, isIllust: false);
|
var posts = await FetchPostsAsync(client, MangaApiUrl, MangaPageUrl, isIllust: false, sessionId);
|
||||||
if (posts == null || posts.Count == 0)
|
if (posts == null || posts.Count == 0)
|
||||||
{
|
{
|
||||||
LogManager.AddLog("[警告] [skebetter] 漫画急上昇の投稿が取得できませんでした");
|
LogManager.AddLog("[警告] 【skebetter】 漫画急上昇の投稿が取得できませんでした");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,23 +75,23 @@ internal static class skebetter
|
|||||||
new Uri(MangaPageUrl)
|
new Uri(MangaPageUrl)
|
||||||
);
|
);
|
||||||
|
|
||||||
var items = await ConvertToSyndicationItemsAsync(client, posts, isIllust: false);
|
var items = await ConvertToSyndicationItemsAsync(client, posts, isIllust: false, sessionId);
|
||||||
feed.Items = items;
|
feed.Items = items;
|
||||||
|
|
||||||
// 急上昇フィードのため、過去の人気作品・連載が除外されないよう filter24Hours: false で出力
|
// 急上昇フィードのため、過去の人気作品・連載が除外されないよう filter24Hours: false で出力
|
||||||
await CmnUtil.ExportXMLFileAsync("skebetter.xml", feed, client, embedBase64: false, filter24Hours: false);
|
await CmnUtil.ExportXMLFileAsync("skebetter.xml", feed, client, addDir: "skebetter.com", embedBase64: false, filter24Hours: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// イラスト急上昇の RSS フィード (skebetter_illust.xml) を生成します。
|
/// イラスト急上昇の RSS フィード (skebetter_illust.xml) を生成します。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static async Task CreateIllustHotRssAsync(HttpClient client)
|
public static async Task CreateIllustHotRssAsync(HttpClient client, string? sessionId = null)
|
||||||
{
|
{
|
||||||
LogManager.AddLog("[情報] [skebetter] イラスト急上昇の取得を開始します");
|
LogManager.AddLog("[情報] 【skebetter】 イラスト急上昇の取得を開始します");
|
||||||
var posts = await FetchPostsAsync(client, IllustApiUrl, IllustPageUrl, isIllust: true);
|
var posts = await FetchPostsAsync(client, IllustApiUrl, IllustPageUrl, isIllust: true, sessionId);
|
||||||
if (posts == null || posts.Count == 0)
|
if (posts == null || posts.Count == 0)
|
||||||
{
|
{
|
||||||
LogManager.AddLog("[警告] [skebetter] イラスト急上昇の投稿が取得できませんでした");
|
LogManager.AddLog("[警告] 【skebetter】 イラスト急上昇の投稿が取得できませんでした");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,11 +101,11 @@ internal static class skebetter
|
|||||||
new Uri(IllustPageUrl)
|
new Uri(IllustPageUrl)
|
||||||
);
|
);
|
||||||
|
|
||||||
var items = await ConvertToSyndicationItemsAsync(client, posts, isIllust: true);
|
var items = await ConvertToSyndicationItemsAsync(client, posts, isIllust: true, sessionId);
|
||||||
feed.Items = items;
|
feed.Items = items;
|
||||||
|
|
||||||
// 急上昇フィードのため、過去の人気作品が除外されないよう filter24Hours: false で出力
|
// 急上昇フィードのため、過去の人気作品が除外されないよう filter24Hours: false で出力
|
||||||
await CmnUtil.ExportXMLFileAsync("skebetter_illust.xml", feed, client, embedBase64: false, filter24Hours: false);
|
await CmnUtil.ExportXMLFileAsync("skebetter_illust.xml", feed, client, addDir: "skebetter.com", embedBase64: false, filter24Hours: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -132,12 +132,12 @@ internal static class skebetter
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 投稿リストを常に FlareSolverr 経由で取得します(API または Web ページの __NEXT_DATA__)。
|
/// 投稿リストを常に FlareSolverr 経由で取得します(API または Web ページの __NEXT_DATA__)。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static async Task<List<SkebetterPost>> FetchPostsAsync(HttpClient client, string apiUrl, string pageUrl, bool isIllust)
|
private static async Task<List<SkebetterPost>> FetchPostsAsync(HttpClient client, string apiUrl, string pageUrl, bool isIllust, string? sessionId = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[情報] [skebetter] 常に FlareSolverr 経由で API 取得を実行します: {apiUrl}");
|
LogManager.AddLog($"[情報] 【skebetter】 常に FlareSolverr 経由で API 取得を実行します: {apiUrl}");
|
||||||
var flareJson = await CmnUtil.GetStringFlareSolverr(client, apiUrl);
|
var flareJson = await CmnUtil.GetStringFlareSolverr(client, apiUrl, session: sessionId ?? CmnUtil.SharedFlareSolverrSessionId);
|
||||||
if (!string.IsNullOrEmpty(flareJson))
|
if (!string.IsNullOrEmpty(flareJson))
|
||||||
{
|
{
|
||||||
var apiResult = JsonSerializer.Deserialize<SkebetterApiResponse>(flareJson, JsonOptions);
|
var apiResult = JsonSerializer.Deserialize<SkebetterApiResponse>(flareJson, JsonOptions);
|
||||||
@@ -146,28 +146,28 @@ internal static class skebetter
|
|||||||
var list = CombinePosts(apiResult);
|
var list = CombinePosts(apiResult);
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[情報] [skebetter] FlareSolverr 経由で {list.Count} 件の投稿を取得しました");
|
LogManager.AddLog($"[情報] 【skebetter】 FlareSolverr 経由で {list.Count} 件の投稿を取得しました");
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 万が一 API の取得が空だった場合、Web ページを FlareSolverr で取得して __NEXT_DATA__ をパース
|
// 万が一 API の取得が空だった場合、Web ページを FlareSolverr で取得して __NEXT_DATA__ をパース
|
||||||
LogManager.AddLog($"[情報] [skebetter] FlareSolverr 経由で Web ページからの抽出を試みます: {pageUrl}");
|
LogManager.AddLog($"[情報] 【skebetter】 FlareSolverr 経由で Web ページからの抽出を試みます: {pageUrl}");
|
||||||
var flareHtml = await CmnUtil.GetStringFlareSolverr(client, pageUrl);
|
var flareHtml = await CmnUtil.GetStringFlareSolverr(client, pageUrl, session: sessionId ?? CmnUtil.SharedFlareSolverrSessionId);
|
||||||
if (!string.IsNullOrEmpty(flareHtml))
|
if (!string.IsNullOrEmpty(flareHtml))
|
||||||
{
|
{
|
||||||
var list = ExtractPostsFromNextData(flareHtml);
|
var list = ExtractPostsFromNextData(flareHtml);
|
||||||
if (list != null && list.Count > 0)
|
if (list != null && list.Count > 0)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[情報] [skebetter] FlareSolverr 経由で Web ページから {list.Count} 件の投稿を抽出しました");
|
LogManager.AddLog($"[情報] 【skebetter】 FlareSolverr 経由で Web ページから {list.Count} 件の投稿を抽出しました");
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] [skebetter] FlareSolverr 取得例外: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【skebetter】 FlareSolverr 取得例外: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new List<SkebetterPost>();
|
return new List<SkebetterPost>();
|
||||||
@@ -246,12 +246,12 @@ internal static class skebetter
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// シリーズ作品の全ツイート・全ページ情報を常に FlareSolverr 経由で API から取得します。
|
/// シリーズ作品の全ツイート・全ページ情報を常に FlareSolverr 経由で API から取得します。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static async Task<List<SkebetterPost>?> FetchSeriesTweetsAsync(HttpClient client, long seriesId)
|
private static async Task<List<SkebetterPost>?> FetchSeriesTweetsAsync(HttpClient client, long seriesId, string? sessionId = null)
|
||||||
{
|
{
|
||||||
string url = $"{SeriesDetailApiUrl}{seriesId}";
|
string url = $"{SeriesDetailApiUrl}{seriesId}";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var flareJson = await CmnUtil.GetStringFlareSolverr(client, url);
|
var flareJson = await CmnUtil.GetStringFlareSolverr(client, url, session: sessionId ?? CmnUtil.SharedFlareSolverrSessionId);
|
||||||
if (!string.IsNullOrEmpty(flareJson))
|
if (!string.IsNullOrEmpty(flareJson))
|
||||||
{
|
{
|
||||||
var result = JsonSerializer.Deserialize<MangaSeriesDetailResponse>(flareJson, JsonOptions);
|
var result = JsonSerializer.Deserialize<MangaSeriesDetailResponse>(flareJson, JsonOptions);
|
||||||
@@ -264,7 +264,7 @@ internal static class skebetter
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[警告] [skebetter] シリーズ詳細 FlareSolverr 取得失敗 (series_id: {seriesId}): {ex.Message}");
|
LogManager.AddLog($"[警告] 【skebetter】 シリーズ詳細 FlareSolverr 取得失敗 (series_id: {seriesId}): {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -273,14 +273,14 @@ internal static class skebetter
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 通常作品のリプライツリー情報を常に FlareSolverr 経由で API から取得します。
|
/// 通常作品のリプライツリー情報を常に FlareSolverr 経由で API から取得します。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static async Task<List<SkebetterPost>?> FetchUserTweetDetailAsync(HttpClient client, string? userId, string? tweetId)
|
private static async Task<List<SkebetterPost>?> FetchUserTweetDetailAsync(HttpClient client, string? userId, string? tweetId, string? sessionId = null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(userId) || string.IsNullOrEmpty(tweetId)) return null;
|
if (string.IsNullOrEmpty(userId) || string.IsNullOrEmpty(tweetId)) return null;
|
||||||
|
|
||||||
string url = $"{UserTweetDetailApiUrl}?user_id={userId}&tweet_uri={tweetId}&ssr=1";
|
string url = $"{UserTweetDetailApiUrl}?user_id={userId}&tweet_uri={tweetId}&ssr=1";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var flareJson = await CmnUtil.GetStringFlareSolverr(client, url);
|
var flareJson = await CmnUtil.GetStringFlareSolverr(client, url, session: sessionId ?? CmnUtil.SharedFlareSolverrSessionId);
|
||||||
if (!string.IsNullOrEmpty(flareJson))
|
if (!string.IsNullOrEmpty(flareJson))
|
||||||
{
|
{
|
||||||
var result = JsonSerializer.Deserialize<UserTweetDetailResponse>(flareJson, JsonOptions);
|
var result = JsonSerializer.Deserialize<UserTweetDetailResponse>(flareJson, JsonOptions);
|
||||||
@@ -292,7 +292,7 @@ internal static class skebetter
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[警告] [skebetter] 個別詳細 FlareSolverr 取得失敗 (tweet: {tweetId}): {ex.Message}");
|
LogManager.AddLog($"[警告] 【skebetter】 個別詳細 FlareSolverr 取得失敗 (tweet: {tweetId}): {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -312,7 +312,7 @@ internal static class skebetter
|
|||||||
/// Skebetter 投稿一覧を SyndicationItem のリストに変換します。
|
/// Skebetter 投稿一覧を SyndicationItem のリストに変換します。
|
||||||
/// 複数ページつながっている漫画は全ページをつなげて1つの記事にします。
|
/// 複数ページつながっている漫画は全ページをつなげて1つの記事にします。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static async Task<List<SyndicationItem>> ConvertToSyndicationItemsAsync(HttpClient client, List<SkebetterPost> posts, bool isIllust)
|
private static async Task<List<SyndicationItem>> ConvertToSyndicationItemsAsync(HttpClient client, List<SkebetterPost> posts, bool isIllust, string? sessionId = null)
|
||||||
{
|
{
|
||||||
var items = new List<SyndicationItem>();
|
var items = new List<SyndicationItem>();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp.Dom;
|
using AngleSharp.Dom;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -36,19 +36,11 @@ internal static class spankbang
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 外部からセッションが渡されなかった場合は自前で作成
|
sessionId ??= CmnUtil.SharedFlareSolverrSessionId;
|
||||||
bool ownSession = sessionId == null;
|
|
||||||
if (ownSession)
|
|
||||||
{
|
|
||||||
sessionId = await CmnUtil.CreateFlareSolverrSession(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var document = await CmnUtil.GetDocumentFlareSolverr(client, TargetUrl, session: sessionId);
|
var document = await CmnUtil.GetDocumentFlareSolverr(client, TargetUrl, session: sessionId);
|
||||||
if (document == null)
|
if (document == null)
|
||||||
{
|
{
|
||||||
LogManager.AddLog("[警告] [spankbang] ドキュメントの取得に失敗しました。");
|
LogManager.AddLog("[警告] 【spankbang】 ドキュメントの取得に失敗しました。");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,18 +215,10 @@ internal static class spankbang
|
|||||||
|
|
||||||
feed.Items = items;
|
feed.Items = items;
|
||||||
await CmnUtil.ExportXMLFileAsync("spankbang.xml", feed, client);
|
await CmnUtil.ExportXMLFileAsync("spankbang.xml", feed, client);
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (ownSession && sessionId != null)
|
|
||||||
{
|
|
||||||
await CmnUtil.DestroyFlareSolverrSession(client, sessionId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] spankbang: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【spankbang】 {ex.Message}");
|
||||||
CmnUtil.PrintCallStackToEvent(ex);
|
CmnUtil.PrintCallStackToEvent(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System.ServiceModel.Syndication;
|
using System.ServiceModel.Syndication;
|
||||||
using rss_generator.Class.Common;
|
using rss_generator.Class.Common;
|
||||||
|
|
||||||
namespace rss_generator.Class.X;
|
namespace rss_generator.Class.X;
|
||||||
@@ -31,7 +31,7 @@ internal class x_list
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] Xリスト生成失敗 ({fileName}): {ex.Message}");
|
LogManager.AddLog($"[エラー] 【x_list】 Xリスト生成失敗 ({fileName}): {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,11 +92,11 @@ internal class x_list
|
|||||||
);
|
);
|
||||||
|
|
||||||
// X (Twitter) は画像リンクを Base64 変換せず、通常の画像リンクとして出力する
|
// X (Twitter) は画像リンクを Base64 変換せず、通常の画像リンクとして出力する
|
||||||
await CmnUtil.ExportXMLFileAsync($"{fileName}.xml", mergedFeed, client, embedBase64: false);
|
await CmnUtil.ExportXMLFileAsync($"{fileName}.xml", mergedFeed, client, addDir: "x.com", embedBase64: false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] fileName:{ex.Message}");
|
LogManager.AddLog($"[エラー] 【x_list】 {fileName}: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp.Dom;
|
using AngleSharp.Dom;
|
||||||
using PuppeteerSharp;
|
using PuppeteerSharp;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -17,23 +17,8 @@ internal class npb_6
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var pageURL = $"https://baseball.yahoo.co.jp/npb/teams/6/top";
|
var pageURL = $"https://baseball.yahoo.co.jp/npb/teams/6/top";
|
||||||
IDocument document;
|
sessionId ??= CmnUtil.SharedFlareSolverrSessionId;
|
||||||
bool ownSession = sessionId == null;
|
var document = await CmnUtil.GetDocumentFlareSolverr(client, pageURL, session: sessionId);
|
||||||
if (ownSession)
|
|
||||||
{
|
|
||||||
sessionId = await CmnUtil.CreateFlareSolverrSession(client);
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
document = await CmnUtil.GetDocumentFlareSolverr(client, pageURL, session: sessionId);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (ownSession && sessionId != null)
|
|
||||||
{
|
|
||||||
await CmnUtil.DestroyFlareSolverrSession(client, sessionId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var linkList = new List<string>();
|
var linkList = new List<string>();
|
||||||
if (document != null)
|
if (document != null)
|
||||||
@@ -86,7 +71,7 @@ internal class npb_6
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] npb_6:{ex.Message}");
|
LogManager.AddLog($"[エラー] 【npb_6】 {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
@@ -22,7 +22,7 @@ public static class YouTubeFeedManager
|
|||||||
/// <param name="client">HttpClient インスタンス</param>
|
/// <param name="client">HttpClient インスタンス</param>
|
||||||
public static async Task CreateRSSAsync(HttpClient client)
|
public static async Task CreateRSSAsync(HttpClient client)
|
||||||
{
|
{
|
||||||
LogManager.AddLog("[情報] YouTubeフィード生成を開始します");
|
LogManager.AddLog("[情報] 【YouTube】 YouTubeフィード生成を開始します");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -45,7 +45,7 @@ public static class YouTubeFeedManager
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] チャンネル処理失敗 ({channel.Name ?? channel.IdOrHandle}): {ex.Message}");
|
LogManager.AddLog($"[エラー] 【YouTube】 チャンネル処理失敗 ({channel.Name ?? channel.IdOrHandle}): {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -82,15 +82,15 @@ public static class YouTubeFeedManager
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] カテゴリ出力失敗 ({category}): {ex.Message}");
|
LogManager.AddLog($"[エラー] 【YouTube】 カテゴリ出力失敗 ({category}): {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogManager.AddLog("[情報] YouTubeフィード生成が完了しました");
|
LogManager.AddLog("[情報] 【YouTube】 YouTubeフィード生成が完了しました");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] YouTubeFeedManager.CreateRSSAsync: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【YouTube】 YouTubeFeedManager.CreateRSSAsync: {ex.Message}");
|
||||||
CmnUtil.PrintCallStackToEvent(ex);
|
CmnUtil.PrintCallStackToEvent(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ public static class YouTubeFeedManager
|
|||||||
int totalCount = liveItems.Count + videoItems.Count + shortsItems.Count;
|
int totalCount = liveItems.Count + videoItems.Count + shortsItems.Count;
|
||||||
if (totalCount == 0)
|
if (totalCount == 0)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[警告] 取得アイテム0件 【{channelDisplayName}】 ({channel.IdOrHandle})");
|
LogManager.AddLog($"[警告] 【YouTube】 取得アイテム0件 【{channelDisplayName}】 ({channel.IdOrHandle})");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 統合フィード用に蓄積
|
// 統合フィード用に蓄積
|
||||||
@@ -152,7 +152,7 @@ public static class YouTubeFeedManager
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// チャンネルごとのエラーを出力して処理を続行
|
// チャンネルごとのエラーを出力して処理を続行
|
||||||
LogManager.AddLog($"[エラー] チャンネル処理失敗 【{channelDisplayName}】 ({channel.IdOrHandle}): {ex.Message}");
|
LogManager.AddLog($"[エラー] 【YouTube】 チャンネル処理失敗 【{channelDisplayName}】 ({channel.IdOrHandle}): {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ public static class YouTubeFeedManager
|
|||||||
using var response = await client.SendAsync(request);
|
using var response = await client.SendAsync(request);
|
||||||
if (!response.IsSuccessStatusCode)
|
if (!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[警告] タブ取得HTTPエラー 【{channelDisplayName}】({feedType}) [{(int)response.StatusCode} {response.StatusCode}]: {url}");
|
LogManager.AddLog($"[警告] 【YouTube】 タブ取得HTTPエラー 【{channelDisplayName}】({feedType}) [{(int)response.StatusCode} {response.StatusCode}]: {url}");
|
||||||
return new List<YouTubeVideoItem>();
|
return new List<YouTubeVideoItem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ public static class YouTubeFeedManager
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] タブ取得失敗 【{channelDisplayName}】({feedType}): {ex.Message}");
|
LogManager.AddLog($"[エラー] 【YouTube】 タブ取得失敗 【{channelDisplayName}】({feedType}): {ex.Message}");
|
||||||
return new List<YouTubeVideoItem>();
|
return new List<YouTubeVideoItem>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
@@ -97,7 +97,7 @@ public static class YouTubeParser
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] YouTubeParser.ParseTabContent: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【YouTube】 YouTubeParser.ParseTabContent: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using AngleSharp.Html.Dom;
|
using AngleSharp.Html.Dom;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ServiceModel.Syndication;
|
using System.ServiceModel.Syndication;
|
||||||
@@ -57,8 +57,8 @@ internal class Youtube
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
AddLog($"[エラー] Youtube:{ex.Message}");
|
AddLog($"[エラー] 【YouTube】 {ex.Message}");
|
||||||
AddLog($"StackTrace\n{ex.StackTrace}");
|
AddLog($"[エラー] 【YouTube】 StackTrace\n{ex.StackTrace}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ internal class Youtube
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
AddLog($"[エラー] {url} の取得に失敗: {ex.Message}");
|
AddLog($"[エラー] 【YouTube】 {url} の取得に失敗: {ex.Message}");
|
||||||
return Enumerable.Empty<SyndicationItem>();
|
return Enumerable.Empty<SyndicationItem>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+85
-55
@@ -59,11 +59,11 @@ using var configWatcher = new ExternalConfigWatcher(httpClientFactory, execution
|
|||||||
configWatcher.RegisterHandler(YouTubeConfig.ConfigFileName, "YouTube", client => YouTubeFeedManager.CreateRSSAsync(client));
|
configWatcher.RegisterHandler(YouTubeConfig.ConfigFileName, "YouTube", client => YouTubeFeedManager.CreateRSSAsync(client));
|
||||||
configWatcher.Start();
|
configWatcher.Start();
|
||||||
|
|
||||||
LogManager.AddLog($"[情報] rss-generatorの起動");
|
LogManager.AddLog($"[情報] 【Program】 rss-generatorの起動");
|
||||||
var isFirst = true;
|
var isFirst = true;
|
||||||
|
|
||||||
// 生成完了後の待機時間(固定で5分)
|
// 生成完了後の待機時間(固定で30分)
|
||||||
TimeSpan waitInterval = TimeSpan.FromMinutes(5);
|
TimeSpan waitInterval = TimeSpan.FromMinutes(30);
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@@ -76,9 +76,9 @@ while (true)
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
#else
|
#else
|
||||||
var nextRunTime = DateTime.Now.Add(waitInterval);
|
var nextRunTime = DateTime.Now.Add(waitInterval);
|
||||||
LogManager.AddLog($"[情報] 次回実行予定: {nextRunTime:HH:mm:ss} (固定で5分待機)");
|
LogManager.AddLog($"[情報] 【Program】 次回実行予定: {nextRunTime:HH:mm:ss} (固定で30分待機)");
|
||||||
|
|
||||||
// 生成完了後、固定で5分待機(非同期スリープ)
|
// 生成完了後、固定で30分待機(非同期スリープ)
|
||||||
await Task.Delay(waitInterval);
|
await Task.Delay(waitInterval);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -88,90 +88,120 @@ while (true)
|
|||||||
// 指定時刻になったら処理を実行
|
// 指定時刻になったら処理を実行
|
||||||
Stopwatch totalSw = Stopwatch.StartNew();
|
Stopwatch totalSw = Stopwatch.StartNew();
|
||||||
Stopwatch sw = Stopwatch.StartNew();
|
Stopwatch sw = Stopwatch.StartNew();
|
||||||
LogManager.AddLog("[情報] 全フィードの取得処理を開始します");
|
LogManager.AddLog("[情報] 【Program】 全フィードの取得処理を開始します");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using var client = httpClientFactory.CreateClient("webClient");
|
// =====================================================================
|
||||||
client.DefaultRequestHeaders.UserAgent.Clear();
|
// 1. FlareSolverr を利用しない RSS 群(非同期で同時に取得処理を実行)
|
||||||
// ここでブラウザのUser-Agentを偽装(最新のChromeを偽装)
|
// =====================================================================
|
||||||
client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36");
|
var nonFlareActions = new List<(string Name, Func<HttpClient, Task> Action)>();
|
||||||
// サイトによってはAcceptヘッダーがないと弾く場合もあるため、念のため追加
|
|
||||||
client.DefaultRequestHeaders.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
|
||||||
|
|
||||||
// メモリ消費を最小化(512MB制限内)するため、各フィードを並行ではなく順次実行し、タスクごとにGCを実行
|
|
||||||
var feedActions = new List<(string Name, Func<Task> Action)>();
|
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
feedActions.Add(("YouTube", () => YouTubeFeedManager.CreateRSSAsync(client)));
|
nonFlareActions.Add(("YouTube", client => YouTubeFeedManager.CreateRSSAsync(client)));
|
||||||
#else
|
#else
|
||||||
feedActions.Add(("movie.eroterest.net", () => MovieEroterestFeedManager.CreateAllRSSAsync(client)));
|
// ※ movie.eroterest.net は取得処理停止のため除外
|
||||||
feedActions.Add(("YouTube", () => YouTubeFeedManager.CreateRSSAsync(client)));
|
nonFlareActions.Add(("YouTube", client => YouTubeFeedManager.CreateRSSAsync(client)));
|
||||||
feedActions.Add(("X (Twitter)", () => x_list.CreateRSSAsync(client)));
|
nonFlareActions.Add(("X (Twitter)", client => x_list.CreateRSSAsync(client)));
|
||||||
feedActions.Add(("kimochiinfo", () => kimochiinfo.CreateRSSAsync(client)));
|
nonFlareActions.Add(("kimochiinfo", client => kimochiinfo.CreateRSSAsync(client)));
|
||||||
feedActions.Add(("ci_en", () => ci_en.CreateRSSAsync(client)));
|
nonFlareActions.Add(("ci_en", client => ci_en.CreateRSSAsync(client)));
|
||||||
feedActions.Add(("javtwi", () => javtwi.CreateRSSAsync(client)));
|
nonFlareActions.Add(("javtwi", client => javtwi.CreateRSSAsync(client)));
|
||||||
feedActions.Add(("mangalear", () => mangalear.CreateRSSAsync(client)));
|
nonFlareActions.Add(("mangalear", client => mangalear.CreateRSSAsync(client)));
|
||||||
feedActions.Add(("e_hentai_ai", () => e_hentai_ai.CreateRSSAsync(client)));
|
nonFlareActions.Add(("e_hentai_ai", client => e_hentai_ai.CreateRSSAsync(client)));
|
||||||
feedActions.Add(("e_hentai_non_ai", () => e_hentai_non_ai.CreateRSSAsync(client)));
|
nonFlareActions.Add(("e_hentai_non_ai", client => e_hentai_non_ai.CreateRSSAsync(client)));
|
||||||
feedActions.Add(("pixiv_non_r18_non_ai", () => pixiv_non_r18_non_ai.CreateRSSAsync(client)));
|
nonFlareActions.Add(("pixiv_non_r18_non_ai", client => pixiv_non_r18_non_ai.CreateRSSAsync(client)));
|
||||||
feedActions.Add(("pixiv_non_r18_ai", () => pixiv_non_r18_ai.CreateRSSAsync(client)));
|
nonFlareActions.Add(("pixiv_non_r18_ai", client => pixiv_non_r18_ai.CreateRSSAsync(client)));
|
||||||
feedActions.Add(("pixiv_r18_non_ai", () => pixiv_r18_non_ai.CreateRSSAsync(client)));
|
nonFlareActions.Add(("pixiv_r18_non_ai", client => pixiv_r18_non_ai.CreateRSSAsync(client)));
|
||||||
feedActions.Add(("pixiv_r18_ai", () => pixiv_r18_ai.CreateRSSAsync(client)));
|
nonFlareActions.Add(("pixiv_r18_ai", client => pixiv_r18_ai.CreateRSSAsync(client)));
|
||||||
feedActions.Add(("momonga_fanzine", () => momonga_fanzine.CreateRSSAsync(client)));
|
nonFlareActions.Add(("momonga_fanzine", client => momonga_fanzine.CreateRSSAsync(client)));
|
||||||
feedActions.Add(("momonga_magazine", () => momonga_magazine.CreateRSSAsync(client)));
|
nonFlareActions.Add(("momonga_magazine", client => momonga_magazine.CreateRSSAsync(client)));
|
||||||
feedActions.Add(("skebetter", () => skebetter.CreateRSSAsync(client)));
|
nonFlareActions.Add(("anige_sokuhouvip", client => anige_sokuhouvip.CreateRSSAsync(client)));
|
||||||
feedActions.Add(("anige_sokuhouvip", () => anige_sokuhouvip.CreateRSSAsync(client)));
|
|
||||||
|
|
||||||
// FlareSolverr 利用タスク群(単一セッションで順次実行し、完了後に破棄してメモリ最小化)
|
|
||||||
feedActions.Add(("FlareSolverr", () => FlareSolverrFeedManager.CreateAllRSSAsync(client)));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
foreach (var (name, action) in feedActions)
|
LogManager.AddLog($"[情報] 【Program】 非FlareSolverrフィード ({nonFlareActions.Count} 件) の非同期同時取得を開始します");
|
||||||
|
var nonFlareSw = Stopwatch.StartNew();
|
||||||
|
|
||||||
|
var nonFlareTasks = nonFlareActions.Select(async item =>
|
||||||
{
|
{
|
||||||
|
// 各タスクに独立した HttpClient インスタンスを割り当てて競合・Cookie漏れを防止
|
||||||
|
using var taskClient = httpClientFactory.CreateClient("webClient");
|
||||||
|
taskClient.DefaultRequestHeaders.UserAgent.Clear();
|
||||||
|
taskClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36");
|
||||||
|
taskClient.DefaultRequestHeaders.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||||
|
|
||||||
|
var taskSw = Stopwatch.StartNew();
|
||||||
|
LogManager.AddLog($"[情報] 【{item.Name}】 取得開始");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var taskSw = Stopwatch.StartNew();
|
await item.Action(taskClient);
|
||||||
LogManager.AddLog($"[情報] 【{name}】 取得開始");
|
|
||||||
await action();
|
|
||||||
taskSw.Stop();
|
taskSw.Stop();
|
||||||
LogManager.AddLog($"[情報] 【{name}】 完了 ({taskSw.Elapsed.TotalSeconds:0.##}秒)");
|
LogManager.AddLog($"[情報] 【{item.Name}】 完了 ({taskSw.Elapsed.TotalSeconds:0.##}秒)");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.AddLog($"[エラー] 【{name}】 実行時エラー: {ex.Message}");
|
LogManager.AddLog($"[エラー] 【{item.Name}】 実行時エラー: {ex.Message}");
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
// 各タスク完了後にメモリを積極回収してOSに返却
|
|
||||||
GC.Collect(2, GCCollectionMode.Aggressive, true, true);
|
|
||||||
GC.WaitForPendingFinalizers();
|
|
||||||
GC.Collect(2, GCCollectionMode.Aggressive, true, true);
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 非FlareSolverrフィードをすべて同時に実行し、完了を待機
|
||||||
|
await Task.WhenAll(nonFlareTasks);
|
||||||
|
nonFlareSw.Stop();
|
||||||
|
LogManager.AddLog($"[情報] 【Program】 非FlareSolverrフィードの取得がすべて完了しました ({nonFlareSw.Elapsed.TotalSeconds:0.##}秒)");
|
||||||
|
|
||||||
|
// メモリ積極回収
|
||||||
|
GC.Collect(2, GCCollectionMode.Aggressive, true, true);
|
||||||
|
GC.WaitForPendingFinalizers();
|
||||||
|
GC.Collect(2, GCCollectionMode.Aggressive, true, true);
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
#else
|
||||||
|
// =====================================================================
|
||||||
|
// 2. FlareSolverr を利用する RSS 群
|
||||||
|
// (非FlareSolverr完了後に実行。全体セッションを共有し単一Chromiumインスタンスで順次実行)
|
||||||
|
// =====================================================================
|
||||||
|
LogManager.AddLog("[情報] 【Program】 FlareSolverr 利用フィードの取得を開始します");
|
||||||
|
using var flareClient = httpClientFactory.CreateClient("webClient");
|
||||||
|
flareClient.DefaultRequestHeaders.UserAgent.Clear();
|
||||||
|
flareClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36");
|
||||||
|
flareClient.DefaultRequestHeaders.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await FlareSolverrFeedManager.CreateAllRSSAsync(flareClient);
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogManager.AddLog($"[エラー] 【Program】 FlareSolverrタスク全体エラー: {ex.Message}");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
GC.Collect(2, GCCollectionMode.Aggressive, true, true);
|
||||||
|
GC.WaitForPendingFinalizers();
|
||||||
|
GC.Collect(2, GCCollectionMode.Aggressive, true, true);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
LogManager.AddLog($"[情報] RSS生成完了 実行時間:{sw.Elapsed.TotalSeconds:0.##}秒");
|
LogManager.AddLog($"[情報] 【Program】 RSS生成完了 実行時間:{sw.Elapsed.TotalSeconds:0.##}秒");
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
totalSw.Stop();
|
totalSw.Stop();
|
||||||
LogManager.AddLog($"[情報] 全処理完了 トータル実行時間:{totalSw.Elapsed.TotalSeconds:0.##}秒");
|
LogManager.AddLog($"[情報] 【Program】 全処理完了 トータル実行時間:{totalSw.Elapsed.TotalSeconds:0.##}秒");
|
||||||
LogManager.AddLog($"[情報] デバッグ完了");
|
LogManager.AddLog($"[情報] 【Program】 デバッグ完了");
|
||||||
|
|
||||||
await LogManager.FlushAndCloseAsync();
|
await LogManager.FlushAndCloseAsync();
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
totalSw.Stop();
|
totalSw.Stop();
|
||||||
LogManager.AddLog($"[情報] 全処理完了 トータル実行時間:{totalSw.Elapsed.TotalSeconds:0.##}秒");
|
LogManager.AddLog($"[情報] 【Program】 全処理完了 トータル実行時間:{totalSw.Elapsed.TotalSeconds:0.##}秒");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// 途中でエラーが起きてもプログラム全体がクラッシュして止まらないように保護
|
// 途中でエラーが起きてもプログラム全体がクラッシュして止まらないように保護
|
||||||
LogManager.AddLog($"[エラー] main:{ex.Message}");
|
LogManager.AddLog($"[エラー] 【Program】 main:{ex.Message}");
|
||||||
LogManager.AddLog($"{ex.StackTrace}");
|
LogManager.AddLog($"{ex.StackTrace}");
|
||||||
//await LogManager.FlushAndCloseAsync();
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user