From 5a282cc3729ad232375b3b49864a3a08be21d44b Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Mon, 23 Feb 2026 23:48:01 +0100 Subject: [PATCH] Following redirects in Hush / Hussiepass scraper. --- src/scrapers/hush.js | 5 +++-- src/tags.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/scrapers/hush.js b/src/scrapers/hush.js index 9f10da1a..f88dad4e 100755 --- a/src/scrapers/hush.js +++ b/src/scrapers/hush.js @@ -334,13 +334,14 @@ async function fetchProfile({ name: actorName }, { channel }, options) { const t1 = channel.parameters?.t1 ? 't1/' : ''; + // follow redirects because a lot of profiles redirect from lowercase to uppercase or vice versa const res1 = channel.parameters?.profile ? await qu.get(util.format(channel.parameters.profile, actorSlugA)) - : await qu.get(`${channel.url}/${t1}models/${actorSlugA}.html`, null, null, { followRedirects: false }); + : await qu.get(`${channel.url}/${t1}models/${actorSlugA}.html`, null, null, { followRedirects: true }); const res = (res1.ok && res1) || (channel.parameters?.profile && await qu.get(util.format(channel.parameters.profile, actorSlugB))) - || await qu.get(`${channel.url}/${t1}models/${actorSlugB}.html`, null, null, { followRedirects: false }); + || await qu.get(`${channel.url}/${t1}models/${actorSlugB}.html`, null, null, { followRedirects: true }); if (!res.ok) { return res.status; diff --git a/src/tags.js b/src/tags.js index c13f8dba..b6e4b26b 100755 --- a/src/tags.js +++ b/src/tags.js @@ -200,14 +200,15 @@ async function reassociateTagEntries(tagEntries, rematch) { })).filter((tagEntry) => tagEntry.tag_id); if (updatedTagEntries.length > 0) { + // TODO: prevent wiping tags if insert fails await knex('releases_tags') .whereIn('id', updatedTagEntries.map((tagEntry) => tagEntry.id)) .delete(); - await knex('releases_tags').insert(updatedTagEntries.map((tagEntry) => ({ + await bulkInsert('releases_tags', updatedTagEntries.map((tagEntry) => ({ ...tagEntry, id: undefined, - }))); + })), true); } logger.info(`Updated ${updatedTagEntries.length} tags in ${new Set(updatedTagEntries.map((tagEntry) => tagEntry.release_id)).size} scenes`);