forked from DebaucheryLibrarian/traxxx
Added Top Web Models profile scraper.
This commit is contained in:
@@ -267,6 +267,7 @@ const scrapers = {
|
||||
sexyhub: mindgeek,
|
||||
silverstonedvd: famedigital,
|
||||
silviasaint: famedigital,
|
||||
topwebmodels,
|
||||
swallowed: mikeadriano,
|
||||
teamskeet,
|
||||
teencoreclub,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
const qu = require('../utils/qu');
|
||||
const http = require('../utils/http');
|
||||
const slugify = require('../utils/slugify');
|
||||
const { convert } = require('../utils/convert');
|
||||
|
||||
function scrapeSceneX(scene) {
|
||||
const release = {};
|
||||
@@ -41,6 +42,43 @@ function scrapeAll(scenes) {
|
||||
return scenes.map(scrapeSceneX);
|
||||
}
|
||||
|
||||
async function scrapeProfile(actor, options) {
|
||||
const profile = {};
|
||||
|
||||
profile.dateOfBirth = /1969-12-31/.test(actor.attributes.birthdate.value) ? null : qu.extractDate(actor.attributes.birthdate.value, 'YYYY-MM-DD'); // ignore epoch
|
||||
profile.age = actor.attributes.age.value === 51 ? null : actor.attributes.age.value; // ignore epoch
|
||||
profile.gender = actor.attributes.gender || null;
|
||||
|
||||
profile.height = convert(actor.attributes.height.value, 'cm');
|
||||
profile.weight = convert(actor.attributes.weight.value, 'lb', 'kg');
|
||||
|
||||
const [bust, cup, waist, hip] = actor.attributes.measurements.value?.match(/(\d+)(\w+)-(\d+)-(\d+)/)?.slice(1) || [];
|
||||
|
||||
profile.bust = Number(bust);
|
||||
profile.cup = cup;
|
||||
profile.waist = Number(waist);
|
||||
profile.hip = Number(hip);
|
||||
|
||||
profile.ethnicity = actor.attributes.ethnicity.value;
|
||||
profile.birthPlace = actor.attributes.born.value;
|
||||
|
||||
profile.eyes = actor.attributes.eyes.value;
|
||||
profile.hairColor = actor.attributes.hair.value.split('/')[0];
|
||||
|
||||
profile.url = `https://tour.topwebmodels.com/models/${actor.id}/${slugify(actor.name, '-', { removePunctuation: true })}`;
|
||||
profile.avatar = actor.thumb;
|
||||
|
||||
if (options.includeActorScenes) {
|
||||
const res = await http.get(profile.url, { extract: { runScripts: 'dangerously' } });
|
||||
|
||||
if (res.ok) {
|
||||
profile.scenes = scrapeAll(res.window.__DATA__?.data?.videos?.items);
|
||||
}
|
||||
}
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
async function fetchLatest(channel, page) {
|
||||
const res = await http.get(`https://tour.topwebmodels.com/api/sites/${channel.parameters?.slug || channel.slug}?page=${page}`, {
|
||||
headers: {
|
||||
@@ -71,7 +109,30 @@ async function fetchScene(url) {
|
||||
return res.status;
|
||||
}
|
||||
|
||||
async function fetchProfile(baseActor, entity, options) {
|
||||
const searchRes = await http.get(`https://tour.topwebmodels.com/api/search-preview/${baseActor.name}`, {
|
||||
headers: {
|
||||
Referer: 'https://tour.topwebmodels.com',
|
||||
'api-key': entity.parameters?.apiKey,
|
||||
'x-Requested-With': 'XMLHttpRequest',
|
||||
},
|
||||
});
|
||||
|
||||
if (!searchRes.ok) {
|
||||
return searchRes.status;
|
||||
}
|
||||
|
||||
const actor = searchRes.body.models.items.find(model => slugify(model.name) === slugify(baseActor.name));
|
||||
|
||||
if (actor) {
|
||||
return scrapeProfile(actor, options);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
fetchLatest,
|
||||
fetchScene,
|
||||
fetchProfile,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user