fix(together): x.com 埋め込みURLのトラッキングパラメータを除去してJina取得精度改善

This commit is contained in:
posimai 2026-04-22 10:04:24 +09:00
parent e0c2211e0d
commit 9f0bb8eae7
1 changed files with 7 additions and 0 deletions

View File

@ -2594,6 +2594,13 @@ ${excerpt}
// fire-and-forget アーカイブ: Jina Reader → Gemini 要約(直列) // fire-and-forget アーカイブ: Jina Reader → Gemini 要約(直列)
async function archiveShare(shareId, url) { async function archiveShare(shareId, url) {
// x.com / twitter.com のトラッキングパラメータを除去埋め込みURLの ?ref_src=twsrc... 等)
try {
const u = new URL(url);
if (/^(x\.com|twitter\.com)$/.test(u.hostname.replace('www.', ''))) {
url = `${u.origin}${u.pathname}`;
}
} catch (_) {}
if (!url || !isSsrfSafe(url)) { if (!url || !isSsrfSafe(url)) {
await pool.query(`UPDATE together_shares SET archive_status='failed' WHERE id=$1`, [shareId]); await pool.query(`UPDATE together_shares SET archive_status='failed' WHERE id=$1`, [shareId]);
return; return;