0

Update single_url.ts

This commit is contained in:
Nicolas 2024-04-28 12:44:00 -07:00
parent d8ee4e90d6
commit 68838c9e0d

View File

@ -20,10 +20,15 @@ export async function generateRequestParams(
headers: { "ScrapingService-Request": "TRUE" }, headers: { "ScrapingService-Request": "TRUE" },
}; };
const urlKey = new URL(url).hostname; try {
if (urlSpecificParams.hasOwnProperty(urlKey)) { const urlKey = new URL(url).hostname;
return { ...defaultParams, ...urlSpecificParams[urlKey] }; if (urlSpecificParams.hasOwnProperty(urlKey)) {
} else { return { ...defaultParams, ...urlSpecificParams[urlKey] };
} else {
return defaultParams;
}
} catch (error) {
console.error(`Error generating URL key: ${error}`);
return defaultParams; return defaultParams;
} }
} }