Updated profile scrapers to use base actor instead of actor name. Fixes for Reality Kings and Cherry Pimps scrapers.

This commit is contained in:
DebaucheryLibrarian
2020-07-21 01:44:51 +02:00
parent 939eba8e61
commit dff4d15872
46 changed files with 91 additions and 94 deletions

View File

@@ -1,4 +1,3 @@
'use strict';
/* eslint-disable newline-per-chained-call */
@@ -7,7 +6,7 @@ const bhttp = require('bhttp');
const { CookieJar } = Promise.promisifyAll(require('tough-cookie'));
const moment = require('moment');
const { ex } = require('../utils/q');
const qu = require('../utils/qu');
const slugify = require('../utils/slugify');
const { inchesToCm, lbsToKg } = require('../utils/convert');
const { cookieToData } = require('../utils/cookies');
@@ -140,7 +139,7 @@ async function getSession(url) {
}
function scrapeProfile(data, html, releases = [], networkName) {
const { qa, qd } = ex(html);
const { query } = qu.extract(html);
const profile = {
description: data.bio,
@@ -169,8 +168,8 @@ function scrapeProfile(data, html, releases = [], networkName) {
|| data.images.card_main_rect[0].xs?.url;
}
const birthdate = qa('li').find(el => /Date of Birth/.test(el.textContent));
if (birthdate) profile.birthdate = qd(birthdate, 'span', 'MMMM Do, YYYY');
const birthdate = query.all('li').find(el => /Date of Birth/.test(el.textContent));
if (birthdate) profile.birthdate = query.date(birthdate, 'span', 'MMMM Do, YYYY');
profile.releases = releases.map(release => scrapeScene(release, null, null, networkName));
@@ -222,7 +221,7 @@ async function fetchScene(url, site) {
return null;
}
async function fetchProfile(actorName, networkSlug, actorPath = 'model') {
async function fetchProfile({ name: actorName }, networkSlug, actorPath = 'model') {
const url = `https://www.${networkSlug}.com`;
const { session, instanceToken } = await getSession(url);