Added First Anal Quest and Double View Casting profile scrapers.

This commit is contained in:
DebaucheryLibrarian
2020-12-04 23:53:20 +01:00
parent be1821b9eb
commit 2e0fba3de9
11 changed files with 84 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
'use strict';
const qu = require('../utils/qu');
const slugify = require('../utils/slugify');
function scrapeAllA(scenes, channel) {
return scenes.map(({ query }) => {
@@ -65,6 +66,53 @@ function scrapeSceneA({ query }, url, channel) {
return release;
}
function scrapeProfileA({ query, el }, entity) {
const profile = {};
const bio = query.all('.list-model-info li, .profile-info li').reduce((acc, bioEl) => ({
...acc,
[slugify(query.cnt(bioEl, '.title, span'), '_')]: query.cnt(bioEl, ':nth-child(2)') || query.q(bioEl, ':nth-child(2)', 'title') || query.text(bioEl),
}), {});
profile.dateOfBirth = qu.parseDate(bio.birth_date || bio.date_of_birth, 'DD MMMM, YYYY');
profile.birthPlace = bio.nationality || bio.place_of_birth || null;
profile.weight = Number(bio.weight?.match(/\d+/)?.[0]);
profile.height = Number(bio.height?.match(/\d+/)?.[0]);
profile.eyes = bio.eye_color;
profile.hairColor = bio.hair || bio.hair_color;
profile.aliases = query.text('.sub-title')?.replace(/:\s*/, '').split(/,\s*/);
if (bio.measurements || bio.body_shape_dimensions) {
const [, bust, cup, waist, hip] = (bio.measurements || bio.body_shape_dimensions).match(/(\d+)(\w+)-(\d+)-(\d+)/);
profile.bust = Number(bust);
profile.cup = cup;
profile.waist = Number(waist);
profile.hip = Number(hip);
}
const description = query.cnt('.model-biography p');
const avatar = query.img('.model-box img, .profile-model-photo', 'src', { origin: entity.url });
if (!/there is no description/.test(description)) {
profile.description = description;
}
if (avatar) {
profile.avatar = [
avatar,
avatar.replace('s2_', 's1_'),
];
}
profile.scenes = scrapeAllA(qu.initAll(el, '.list-thumbs .thumb, .main-thumbs > li'), entity);
return profile;
}
async function fetchLatestA(channel, page) {
const url = channel.parameters?.latest
? `${channel.parameters.latest}/${page}`
@@ -89,9 +137,33 @@ async function fetchSceneA(url, channel) {
return res.status;
}
async function fetchProfileA({ name, slug }, { entity }) {
const searchRes = await qu.getAll(`${entity.url}/models/search/?q=${name}`, '.thumb-modal, .big-thumb');
if (!searchRes.ok) {
return searchRes.status;
}
const actor = searchRes.items.find(({ query }) => slugify(query.cnt('.thumb-title a, .title')) === slug);
if (!actor) {
return null;
}
const actorUrl = actor.query.url('a', 'href', { origin: entity.url });
const actorRes = await qu.get(actorUrl);
if (actorRes.ok) {
return scrapeProfileA(actorRes.item, entity);
}
return null;
}
module.exports = {
a: {
fetchLatest: fetchLatestA,
fetchScene: fetchSceneA,
fetchProfile: fetchProfileA,
},
};