Enabled pagination on network page.

This commit is contained in:
2020-05-26 04:11:29 +02:00
parent fe69ec4175
commit 86377fec5f
43 changed files with 164 additions and 81 deletions

View File

@@ -16,7 +16,7 @@ function scrape(html, site) {
return sceneElements.map((element) => {
const sceneLinkElement = $(element).find('.thmb_lnk');
const title = sceneLinkElement.attr('title');
const url = site.legacy
const url = site.parameters?.legacy
? `https://${site.url}{sceneLinkElement.attr('href')}`
: `https://bangbros.com${sceneLinkElement.attr('href')}`;
const shootId = sceneLinkElement.attr('id') && sceneLinkElement.attr('id').split('-')[1];
@@ -150,14 +150,14 @@ function scrapeSceneLegacy({ qu }, url) {
return release;
}
function scrapeProfile(html) {
function scrapeProfile(html, scope) {
const { q } = ex(html);
const profile = {};
const avatar = q('.profilePic img', 'src');
if (avatar) profile.avatar = `https:${avatar}`;
profile.releases = scrape(html);
profile.releases = scrape(html, scope.network);
return profile;
}
@@ -221,7 +221,7 @@ async function fetchScene(url, site, release) {
return scrapeScene(res.item.html, url, site);
}
async function fetchProfile(actorName) {
async function fetchProfile(actorName, scope) {
const actorSlug = slugify(actorName);
const url = `https://bangbros.com/search/${actorSlug}`;
const res = await bhttp.get(url);
@@ -233,7 +233,7 @@ async function fetchProfile(actorName) {
const actorRes = await bhttp.get(actorUrl);
if (actorRes.statusCode === 200) {
return scrapeProfile(actorRes.body.toString());
return scrapeProfile(actorRes.body.toString(), scope);
}
}
}