forked from DebaucheryLibrarian/traxxx
Added Naughty America profile and actor releases scraper.
This commit is contained in:
@@ -32,6 +32,7 @@ const { argv } = yargs
|
||||
.option('with-releases', {
|
||||
describe: 'Fetch all releases for an actor',
|
||||
type: 'boolean',
|
||||
alias: 'with-scenes',
|
||||
default: false,
|
||||
})
|
||||
.option('scene', {
|
||||
|
||||
@@ -5,6 +5,9 @@ const bhttp = require('bhttp');
|
||||
const cheerio = require('cheerio');
|
||||
const moment = require('moment');
|
||||
|
||||
const slugify = require('../utils/slugify');
|
||||
const { ex } = require('../utils/q');
|
||||
|
||||
function titleExtractor(pathname) {
|
||||
const components = pathname.split('/')[2].split('-');
|
||||
const entryId = components.slice(-1)[0];
|
||||
@@ -48,7 +51,7 @@ function scrapeLatest(html, site) {
|
||||
});
|
||||
}
|
||||
|
||||
async function scrapeScene(html, url, site) {
|
||||
function scrapeScene(html, url, site) {
|
||||
const $ = cheerio.load(html, { normalizeWhitespace: true });
|
||||
const sceneElement = $('.scene-info');
|
||||
|
||||
@@ -97,6 +100,20 @@ async function scrapeScene(html, url, site) {
|
||||
};
|
||||
}
|
||||
|
||||
function scrapeProfile(html) {
|
||||
const { q, qu } = ex(html);
|
||||
const profile = {};
|
||||
|
||||
profile.description = q('.bio_about_text', true);
|
||||
|
||||
const avatar = q('img.performer-pic', 'src');
|
||||
if (avatar) profile.avatar = `https:${avatar}`;
|
||||
|
||||
profile.releases = qu('.scene-item > a:first-child');
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
async function fetchLatest(site, page = 1) {
|
||||
const res = await bhttp.get(`${site.url}?page=${page}`);
|
||||
|
||||
@@ -109,7 +126,20 @@ async function fetchScene(url, site) {
|
||||
return scrapeScene(res.body.toString(), url, site);
|
||||
}
|
||||
|
||||
async function fetchProfile(actorName) {
|
||||
const actorSlug = slugify(actorName);
|
||||
|
||||
const res = await bhttp.get(`https://www.naughtyamerica.com/pornstar/${actorSlug}`);
|
||||
|
||||
if (res.statusCode === 200) {
|
||||
return scrapeProfile(res.body.toString());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
fetchLatest,
|
||||
fetchScene,
|
||||
fetchProfile,
|
||||
};
|
||||
|
||||
@@ -17,7 +17,6 @@ const pornpros = require('./pornpros');
|
||||
const privateNetwork = require('./private'); // reserved keyword
|
||||
const puretaboo = require('./puretaboo');
|
||||
const mindgeek = require('./mindgeek');
|
||||
const naughtyamerica = require('./naughtyamerica');
|
||||
const realitykings = require('./realitykings');
|
||||
const teamskeet = require('./teamskeet');
|
||||
const vixen = require('./vixen');
|
||||
@@ -34,6 +33,7 @@ const legalporno = require('./legalporno');
|
||||
const men = require('./men');
|
||||
const metrohd = require('./metrohd');
|
||||
const mofos = require('./mofos');
|
||||
const naughtyamerica = require('./naughtyamerica');
|
||||
const twentyonesextury = require('./21sextury');
|
||||
const xempire = require('./xempire');
|
||||
|
||||
@@ -89,6 +89,7 @@ module.exports = {
|
||||
mofos,
|
||||
realitykings,
|
||||
digitalplayground,
|
||||
brazzers,
|
||||
fakehub,
|
||||
babes,
|
||||
metrohd,
|
||||
@@ -99,7 +100,7 @@ module.exports = {
|
||||
xempire,
|
||||
blowpass,
|
||||
julesjordan,
|
||||
brazzers,
|
||||
naughtyamerica,
|
||||
boobpedia,
|
||||
legalporno,
|
||||
kellymadison,
|
||||
|
||||
Reference in New Issue
Block a user