Following redirects in Hush / Hussiepass scraper.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user