2020-09-14 00:40:27 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const qu = require('../utils/q');
|
2020-09-15 23:42:15 +00:00
|
|
|
const slugify = require('../utils/slugify');
|
2020-09-14 00:40:27 +00:00
|
|
|
const capitalize = require('../utils/capitalize');
|
2020-09-15 23:42:15 +00:00
|
|
|
const { feetInchesToCm } = require('../utils/convert');
|
2020-09-14 00:40:27 +00:00
|
|
|
|
|
|
|
function scrapeAll(months, channel, year) {
|
|
|
|
return months.map(({ query: queryMonth, el }) => {
|
|
|
|
const month = queryMonth.cnt('h3');
|
|
|
|
const scenes = queryMonth.all(el.nextElementSibling, 'li:nth-child(2n)');
|
|
|
|
|
|
|
|
return qu.initAll(scenes).map(({ query }) => {
|
|
|
|
const release = {};
|
|
|
|
|
|
|
|
release.url = query.url('a.video-pop-up', 'href', { origin: `${channel.url}/submissive` });
|
|
|
|
release.entryId = new URL(release.url).searchParams.get('id');
|
|
|
|
|
|
|
|
release.title = query.cnt('.updates-item-title h4');
|
|
|
|
|
|
|
|
release.date = qu.parseDate(`${month} ${year}`, 'MMMM/YYYY');
|
|
|
|
release.datePrecision = 'month';
|
|
|
|
|
|
|
|
release.actors = [{
|
|
|
|
name: capitalize(query.q('a.video-pop-up', 'data-modelname'), { uncapitalize: true }),
|
2020-09-16 00:38:59 +00:00
|
|
|
gender: 'female',
|
2020-09-14 00:40:27 +00:00
|
|
|
url: query.url('a.video-pop-up', 'data-modellink', { origin: `${channel.url}/submissive` }),
|
2020-09-16 00:38:59 +00:00
|
|
|
}]
|
|
|
|
.filter(actor => !/lockdown/i.test(actor.name))
|
|
|
|
.concat({
|
|
|
|
name: 'Pascal White',
|
|
|
|
gender: 'male',
|
|
|
|
});
|
2020-09-14 00:40:27 +00:00
|
|
|
|
|
|
|
release.poster = query.img('img');
|
|
|
|
|
|
|
|
return release;
|
|
|
|
});
|
|
|
|
}).flat();
|
|
|
|
}
|
|
|
|
|
|
|
|
function scrapeScene({ html }, url) {
|
|
|
|
const release = {};
|
|
|
|
|
|
|
|
release.entryId = new URL(url).searchParams.get('id');
|
|
|
|
release.trailer = html.match(/file: '(.*)'/)[1];
|
|
|
|
|
|
|
|
return release;
|
|
|
|
}
|
|
|
|
|
2020-09-15 23:42:15 +00:00
|
|
|
function scrapeProfile({ query }) {
|
2020-09-14 00:40:27 +00:00
|
|
|
const profile = {};
|
|
|
|
|
2020-09-15 23:42:15 +00:00
|
|
|
const bio = query.all('.about-desc li').reduce((acc, el) => {
|
|
|
|
const key = query.cnt(el, 'strong');
|
|
|
|
const value = query.text(el);
|
2020-09-14 00:40:27 +00:00
|
|
|
|
2020-09-15 23:42:15 +00:00
|
|
|
return {
|
|
|
|
...acc,
|
|
|
|
[slugify(key, '_')]: value,
|
|
|
|
};
|
|
|
|
}, {});
|
2020-09-14 00:40:27 +00:00
|
|
|
|
2020-09-16 00:38:59 +00:00
|
|
|
profile.gender = 'female';
|
2020-09-15 23:42:15 +00:00
|
|
|
profile.nationality = bio.nationality;
|
2021-01-15 15:14:48 +00:00
|
|
|
profile.height = /cm/.test(bio.height) ? parseInt(bio.height, 10) : feetInchesToCm(bio.height);
|
2020-09-15 23:42:15 +00:00
|
|
|
profile.age = bio.age;
|
2020-09-16 02:55:30 +00:00
|
|
|
profile.hairColor = bio.hair;
|
2020-09-15 23:42:15 +00:00
|
|
|
|
|
|
|
profile.description = query.cnt('.twocolumns');
|
|
|
|
profile.avatar = query.img('#individual-description img');
|
|
|
|
|
|
|
|
// no dates or links available
|
|
|
|
// profile.releases = scrapeAll(qu.initAll(query.all('.individal-video-item'))); // sic
|
2020-09-14 00:40:27 +00:00
|
|
|
|
|
|
|
return profile;
|
|
|
|
}
|
|
|
|
|
|
|
|
async function fetchLatest(channel, page = 1) {
|
|
|
|
const year = new Date().getFullYear() - (page - 1);
|
|
|
|
|
|
|
|
const url = `${channel.url}/submissive/updates.php?y=${year}`;
|
|
|
|
const res = await qu.getAll(url, '.month');
|
|
|
|
|
|
|
|
if (res.ok) {
|
|
|
|
return scrapeAll(res.items, channel, year);
|
|
|
|
}
|
|
|
|
|
|
|
|
return res.status;
|
|
|
|
}
|
|
|
|
|
|
|
|
async function fetchScene(url, channel) {
|
|
|
|
const res = await qu.get(url);
|
|
|
|
|
|
|
|
if (res.ok) {
|
|
|
|
return scrapeScene(res.item, url, channel);
|
|
|
|
}
|
|
|
|
|
|
|
|
return res.status;
|
|
|
|
}
|
|
|
|
|
|
|
|
async function fetchProfile({ name: actorName }, entity, include) {
|
2020-09-15 23:42:15 +00:00
|
|
|
const url = `${entity.url}/submissive/subslut-${slugify(actorName)}.php`;
|
|
|
|
const res = await qu.get(url, null, null, {
|
|
|
|
followRedirects: false,
|
|
|
|
});
|
2020-09-14 00:40:27 +00:00
|
|
|
|
2020-09-15 23:42:15 +00:00
|
|
|
if (res.ok && res.status === 200) {
|
2020-09-14 00:40:27 +00:00
|
|
|
return scrapeProfile(res.item, actorName, entity, include);
|
|
|
|
}
|
|
|
|
|
|
|
|
return res.status;
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
fetchLatest,
|
|
|
|
fetchScene,
|
2020-09-15 23:42:15 +00:00
|
|
|
fetchProfile,
|
2020-09-14 00:40:27 +00:00
|
|
|
};
|