Passing context object with site or network instead of scraper slug and 'site or network' to all profile scrapers.
This commit is contained in:
@@ -120,13 +120,15 @@ async function fetchScene(url, site, release) {
|
||||
return res.ok ? scrapeScene(res.item, url, site, release) : res.status;
|
||||
}
|
||||
|
||||
async function fetchProfile(actorName, scraperSlug) {
|
||||
async function fetchProfile(actorName, { site, network, scraper }) {
|
||||
const actorSlug = slugify(actorName);
|
||||
const actorSlug2 = slugify(actorName, '');
|
||||
|
||||
const [url, url2] = ['cherrypimps', 'wildoncam'].includes(scraperSlug)
|
||||
? [`https://${scraperSlug}.com/models/${actorSlug}.html`, `https://${scraperSlug}.com/models/${actorSlug2}.html`]
|
||||
: [`https://${scraperSlug.replace('xxx', '')}.xxx/models/${actorSlug}.html`, `https://${scraperSlug.replace('xxx', '')}.xxx/models/${actorSlug2}.html`];
|
||||
const origin = site?.url || network.url;
|
||||
|
||||
const [url, url2] = ['cherrypimps', 'wildoncam'].includes(scraper)
|
||||
? [`${origin}/models/${actorSlug}.html`, `${origin}/models/${actorSlug2}.html`]
|
||||
: [`${origin}/models/${actorSlug}.html`, `${origin}/models/${actorSlug2}.html`];
|
||||
|
||||
const res = await get(url);
|
||||
if (res.ok) return scrapeProfile(res.item);
|
||||
|
||||
Reference in New Issue
Block a user