traxxx/src/scrapers/traxxx.js

277 lines
5.6 KiB
JavaScript

'use strict';
/* eslint-disable no-unused-vars */
const config = require('config');
const faker = require('faker');
const nanoid = require('nanoid');
const moment = require('moment');
const knex = require('../knex');
const capitalize = require('../utils/capitalize');
function random(array) {
return array[Math.floor(Math.random() * array.length)];
}
function femaleAdjective() {
return random([
'hot',
'young',
'new',
'busty',
'insatiable',
'depraved',
'horny',
'flexible',
'bubble butt',
'voluptuous',
'curvy',
'skinny',
'nerdy',
'oiled',
'tied up',
'bound',
'Asian',
'Russian',
'Latina',
'ebony',
]);
}
function maleAdjective() {
return random([
'toned',
'nerdy',
]);
}
function sceneAdjective() {
return random([
'first',
'hottest',
'wildest',
'deepest',
]);
}
function groupSceneAdjective() {
return random([
'biggest',
]);
}
function dickAdjective() {
return random([
'big',
'giant',
'throbbing',
'thick',
'long',
'monster',
`${Math.floor(Math.random() * 12) + 9} inch`,
]);
}
function femaleNoun() {
return random([
'MILF',
'teen',
'spinner',
'coed',
'redhead',
'beauty',
'blonde',
'nympho',
'brunette',
'maid',
'student',
'dominatrix',
'stepsister',
'schoolgirl',
'nurse',
]);
}
function maleNoun() {
return random([
'guy',
'stud',
'lad',
'boyfriend',
'stranger',
'stepbrother',
'stepdad',
]);
}
function sceneNoun() {
return random([
'anal',
'sex',
'pounding',
]);
}
function groupSceneNoun() {
return random([
'double penetration',
'gangbang',
'airtight',
'orgy',
'bukkake',
'double anal',
'triple anal',
'triple penetration',
]);
}
function bodyNoun() {
return random([
'ass',
'asshole',
'gaping asshole',
'squirting pussy',
'pussy',
'cunt',
]);
}
function dickNoun() {
return random([
'dick',
'cock',
'BBC',
'BWC',
]);
}
function verb() {
return random([
'fucked',
'fingered',
'fisted',
'titty-fucked',
'creampied',
'facialized',
'plowed',
'creamed',
'gaped',
'dicked',
'pounded',
'manhandled',
'facefucked',
'ass-fucked',
'analized',
'banged',
'sodomized',
]);
}
function groupVerb() {
return random([
'gangbanged',
'DP\'d',
'double dicked',
'double penetrated',
]);
}
function title(release) {
if (release.actors.length > 3) {
// group scene
return capitalize(random([
`${femaleAdjective()} ${femaleNoun()} gets ${groupVerb()} by ${release.actors.length - 1} ${maleNoun()}s`,
`${femaleNoun()} does her ${groupSceneAdjective()} ${groupSceneNoun()}`,
`${femaleNoun()} in ${sceneAdjective()} ${groupSceneNoun()}`,
`${femaleAdjective()} ${femaleNoun()}'s ${groupSceneNoun()} with ${release.actors.length - 1} ${dickNoun()}s`,
`${femaleAdjective()} ${femaleNoun()}'s ${release.actors.length - 1}-${dickNoun()} ${groupSceneNoun()}`,
`${sceneAdjective()} ${groupSceneNoun()} for ${femaleAdjective()} ${femaleNoun()}`,
]));
}
return capitalize(random([
`${femaleAdjective()} ${femaleNoun()} gets ${verb()} by ${dickAdjective()} ${dickNoun()}`,
`${femaleAdjective()} ${femaleNoun()} gets her ${bodyNoun()} ${verb()}`,
`${femaleAdjective()} ${femaleNoun()} in her ${sceneAdjective()} ${sceneNoun()} scene`,
`${sceneAdjective()} ${sceneNoun()} for ${femaleAdjective()} ${femaleNoun()}`,
`${femaleAdjective()} ${femaleNoun()}'s ${sceneAdjective()} ${sceneNoun()} scene`,
`${femaleAdjective()} ${femaleNoun()} ${verb()} in her ${bodyNoun()}`,
`${femaleAdjective()} ${femaleNoun()}'s ${bodyNoun()} ${verb()}`,
`${femaleAdjective()} ${femaleNoun()} does ${sceneAdjective()} ${sceneNoun()} with ${dickAdjective()} ${dickNoun()}`,
]));
}
function gender() {
return random([
'female',
'female',
'female',
'female',
'female',
'male',
'male',
'male',
'transsexual',
]);
}
function actors(release) {
const length = release.tags.some((tag) => ['dp', 'dap', 'gangbang'].includes(tag))
? Math.floor(Math.random() * 6) + 3
: Math.floor(Math.random() * 3) + 2;
return Array.from({ length }, () => ({
name: faker.name
.findName()
.split(' ')
.slice(0, Math.random() < 0.2 ? 1 : 2) // sometimes only use the first name
.join(' '),
gender: gender(),
}));
}
async function fetchLatest(entity, page, options) {
return Promise.all(Array.from({ length: 100 }, async (value, index) => {
const release = {};
release.entryId = nanoid();
release.date = moment().subtract(Math.floor(Math.random() * index), 'days').toDate();
if (options.source) {
// select from configured random image source
release.poster = `${options.source}?id=${nanoid()}`; // ensure source is unique
release.photos = Array.from({ length: Math.floor(Math.random() * 10) + 1 }, () => `${options.source}?id=${nanoid()}`); // ensure source is unique
} else {
// select from local SFW database
const [poster, ...photos] = await knex('media')
.select('path')
.where('is_sfw', true)
.pluck('path')
.orderByRaw('random()')
.limit(Math.floor(Math.random() * 10) + 1);
// const poster = 'sfw/kittens/thumbs/iNEXVlX-RLs.jpeg';
release.poster = `http://${config.web.host}:${config.web.port}/img/${poster}?id=${nanoid()}`; // ensure source is unique
release.photos = photos.map((photo) => `http://${config.web.host}:${config.web.port}/img/${photo}?id=${nanoid()}`);
}
release.tags = await knex('tags')
.select('name')
.where('priority', '>', 7)
.orderByRaw('random()')
.limit(faker.random.number({ min: 2, max: 15 }))
.pluck('name');
release.actors = [...actors(release), null]; // include empty actor to ensure proper handling
release.title = title(release);
return release;
}));
}
module.exports = {
fetchLatest,
};