Added Mike Adriano scraper (True Anal, All Anal, Swallowed, Nympho). Updated README.

This commit is contained in:
2019-11-09 01:22:50 +01:00
parent 9f0a48f581
commit e9277028e2
16 changed files with 547 additions and 74 deletions

View File

@@ -277,7 +277,7 @@ async function fetchNewReleases(scraper, site, afterDate, accReleases = [], page
const oldestReleaseOnPage = latestReleases.slice(-1)[0].date;
if (uniqueReleases.length > 0 && moment(oldestReleaseOnPage).isAfter(afterDate) && (!oldestReleaseOnPage && page < argv.pages)) {
if (uniqueReleases.length > 0 && moment(oldestReleaseOnPage).isAfter(afterDate) && (oldestReleaseOnPage || page < argv.pages)) {
return fetchNewReleases(scraper, site, afterDate, accReleases.concat(uniqueReleases), page + 1);
}

View File

@@ -29,6 +29,7 @@ async function curateRelease(release) {
actors,
director: release.director,
tags,
duration: release.duration,
photos: media.filter(item => item.role === 'photo'),
poster: media.filter(item => item.role === 'poster')[0],
trailer: media.filter(item => item.role === 'trailer')[0],

View File

@@ -10,6 +10,7 @@ const evilangel = require('./evilangel');
const julesjordan = require('./julesjordan');
const kink = require('./kink');
const legalporno = require('./legalporno');
const mikeadriano = require('./mikeadriano');
const mofos = require('./mofos');
const pervcity = require('./pervcity');
const privateNetwork = require('./private'); // reserved keyword
@@ -30,6 +31,7 @@ module.exports = {
julesjordan,
kink,
legalporno,
mikeadriano,
mofos,
pervcity,
private: privateNetwork,

256
src/scrapers/mikeadriano.js Normal file
View File

@@ -0,0 +1,256 @@
'use strict';
/* eslint-disable newline-per-chained-call */
const bhttp = require('bhttp');
const { JSDOM } = require('jsdom');
const cheerio = require('cheerio');
const moment = require('moment');
const { matchTags } = require('../tags');
const defaultTags = {
swallowed: ['blowjob', 'deepthroat', 'facefuck'],
trueanal: ['anal'],
allanal: ['anal', 'fmf'],
nympho: [],
};
const descriptionTags = {
'anal cream pie': 'anal creampie',
'ass to mouth': 'ass to mouth',
'cream pie in her ass': 'anal creampie',
'eats ass': 'ass eating',
facial: 'facial',
gaped: 'gaping',
gapes: 'gaping',
gape: 'gaping',
'rectal cream pie': 'anal creampie',
rimming: 'ass eating',
};
function deriveTagsFromDescription(description) {
const matches = (description || '').toLowerCase().match(new RegExp(Object.keys(descriptionTags).join('|'), 'g'));
return matches
? matches.map(match => descriptionTags[match])
: [];
}
async function scrapeLatestA(html, site) {
const { document } = new JSDOM(html).window;
const sceneElements = document.querySelectorAll('.content-item-large, .content-item');
return Promise.all(Array.from(sceneElements, async (element) => {
const $ = cheerio.load(element.innerHTML, { normalizeWhitespace: true });
const titleElement = element.querySelector('h3.title a');
const title = titleElement.textContent;
const url = titleElement.href;
const entryId = url.split('/').slice(-2)[0];
const descriptionElement = element.querySelector('.desc');
const description = descriptionElement && descriptionElement.textContent.trim();
const date = moment(element.querySelector('.date, time').textContent, 'Do MMM YYYY').toDate();
const actors = Array.from(element.querySelectorAll('h4.models a'), actorElement => actorElement.textContent);
const durationString = element.querySelector('.total-time').textContent.trim();
// timestamp is somethines 00:00, sometimes 0:00:00
const duration = durationString.split(':').length === 3
? moment.duration(durationString).asSeconds()
: moment.duration(`00:${durationString}`).asSeconds();
const ratingElement = element.querySelector('.rating');
const stars = ratingElement && ratingElement.dataset.rating;
const [poster, ...primaryPhotos] = Array.from(element.querySelectorAll('img'), imageElement => imageElement.src);
const secondaryPhotos = $('.thumb-top, .thumb-bottom')
.map((photoIndex, photoElement) => $(photoElement).css()['background-image'])
.toArray()
.map(photoUrl => photoUrl.slice(photoUrl.indexOf('http'), photoUrl.indexOf('.jpg') + 4));
const photos = [...primaryPhotos, ...secondaryPhotos];
const tags = await matchTags([...defaultTags[site.slug], ...deriveTagsFromDescription(description)]);
const scene = {
url,
entryId,
title,
description,
actors,
director: 'Mike Adriano',
date,
duration,
tags,
poster,
photos,
rating: {
stars,
},
site,
};
return scene;
}));
}
async function scrapeLatestB(html, site) {
const { document } = new JSDOM(html).window;
const sceneElements = document.querySelectorAll('.content-border');
return Promise.all(Array.from(sceneElements, async (element) => {
const $ = cheerio.load(element.innerHTML, { normalizeWhitespace: true });
const titleElement = element.querySelector('.content-title-wrap a');
const title = titleElement.title || titleElement.textContent.trim();
const url = titleElement.href;
const entryId = url.split('/').slice(-2)[0];
const description = element.querySelector('.content-description').textContent.trim();
const date = (moment(element.querySelector('.mobile-date').textContent, 'MM/DD/YYYY')
|| moment(element.querySelector('.date').textContent, 'Do MMM YYYY')).toDate();
const actors = Array.from(element.querySelectorAll('.content-models a'), actorElement => actorElement.textContent);
const durationString = element.querySelector('.total-time').textContent.trim();
// timestamp is somethines 00:00, sometimes 0:00:00
const duration = durationString.split(':').length === 3
? moment.duration(durationString).asSeconds()
: moment.duration(`00:${durationString}`).asSeconds();
const [poster, ...primaryPhotos] = Array.from(element.querySelectorAll('a img'), imageElement => imageElement.src);
const secondaryPhotos = $('.thumb-mouseover')
.map((photoIndex, photoElement) => $(photoElement).css()['background-image'])
.toArray()
.map(photoUrl => photoUrl.slice(photoUrl.indexOf('http'), photoUrl.indexOf('.jpg') + 4));
const photos = [...primaryPhotos, ...secondaryPhotos];
const tags = await matchTags([...defaultTags[site.slug], ...deriveTagsFromDescription(description)]);
return {
url,
entryId,
title,
description,
actors,
director: 'Mike Adriano',
date,
duration,
tags,
poster,
photos,
site,
};
}));
}
async function scrapeSceneA(html, url, site) {
const { document } = new JSDOM(html).window;
const element = document.querySelector('.content-page-info');
const entryId = url.split('/').slice(-2)[0];
const title = element.querySelector('.title').textContent.trim();
const description = element.querySelector('.desc').textContent.trim();
const date = moment(element.querySelector('.post-date').textContent.trim(), 'Do MMM YYYY').toDate();
const actors = Array.from(element.querySelectorAll('.models a'), actorElement => actorElement.textContent);
const durationString = element.querySelector('.total-time').textContent.trim();
// timestamp is somethines 00:00, sometimes 0:00:00
const duration = durationString.split(':').length === 3
? moment.duration(durationString).asSeconds()
: moment.duration(`00:${durationString}`).asSeconds();
const { poster } = document.querySelector('.content-page-header video');
const { src, type } = document.querySelector('.content-page-header source');
const tags = await matchTags([...defaultTags[site.slug], ...deriveTagsFromDescription(description)]);
return {
url,
entryId,
title,
description,
actors,
director: 'Mike Adriano',
date,
duration,
tags,
poster,
trailer: {
src,
type,
},
site,
};
}
async function scrapeSceneB(html, url, site) {
const { document } = new JSDOM(html).window;
const element = document.querySelector('.content-page-info');
const entryId = url.split('/').slice(-2)[0];
const title = element.querySelector('.title').textContent.trim();
const description = element.querySelector('.desc').textContent.trim();
const date = moment(element.querySelector('.date').textContent.trim(), 'Do MMM YYYY').toDate();
const actors = Array.from(element.querySelectorAll('.models a'), actorElement => actorElement.textContent);
const durationString = element.querySelector('.total-time').textContent.trim();
// timestamp is somethines 00:00, sometimes 0:00:00
const duration = durationString.split(':').length === 3
? moment.duration(durationString).asSeconds()
: moment.duration(`00:${durationString}`).asSeconds();
const { poster } = document.querySelector('.content-page-header-inner video');
const { src, type } = document.querySelector('.content-page-header-inner source');
const tags = await matchTags([...defaultTags[site.slug], ...deriveTagsFromDescription(description)]);
const scene = {
url,
entryId,
title,
description,
actors,
director: 'Mike Adriano',
date,
duration,
tags,
poster,
trailer: {
src,
type,
},
site,
};
return scene;
}
async function fetchLatest(site, page = 1) {
const { host } = new URL(site.url);
const res = await bhttp.get(`https://tour.${host}/videos?page=${page}`);
if (host === 'trueanal.com' || host === 'swallowed.com') {
return scrapeLatestA(res.body.toString(), site);
}
return scrapeLatestB(res.body.toString(), site);
}
async function fetchScene(url, site) {
const { host } = new URL(site.url);
const res = await bhttp.get(url);
if (host === 'trueanal.com' || host === 'swallowed.com') {
return scrapeSceneA(res.body.toString(), url, site);
}
return scrapeSceneB(res.body.toString(), url, site);
}
module.exports = {
fetchLatest,
fetchScene,
};

View File

@@ -4,38 +4,71 @@
const Promise = require('bluebird');
const bhttp = require('bhttp');
const { CookieJar } = Promise.promisifyAll(require('tough-cookie'));
const cheerio = require('cheerio');
const moment = require('moment');
const { JSDOM } = require('jsdom');
const { matchTags } = require('../tags');
function scrapeLatest(html, site) {
const $ = cheerio.load(html, { normalizeWhitespace: true });
const sceneElements = $('.card.card--release').toArray();
async function scrapeLatest(html, site) {
const { document } = new JSDOM(html).window;
console.log(sceneElements);
const scriptString = document.querySelector('script').textContent;
const prefix = 'window.__JUAN.initialState = {';
return sceneElements.map((element) => {
const sceneLinkElement = $(element).find('.card-info__title a');
const title = sceneLinkElement.attr('title');
const url = `${site.url}${sceneLinkElement.attr('href')}`;
const entryId = url.split('/').slice(-3)[0];
const dataStart = scriptString.slice(scriptString.indexOf(prefix) + prefix.length - 1);
const dataString = dataStart.slice(0, dataStart.indexOf('};') + 1);
const data = JSON.parse(dataString);
const date = moment.utc($(element).find('.card-info__meta-date').text(), 'MMMM DD, YYYY').toDate();
const actors = $(element).find('.card-info__cast a').map((actorIndex, actorElement) => $(actorElement).text().trim()).toArray();
const actorsMap = data.entities.actors;
const tagsMap = data.entities.tags;
const scenes = Object.values(data.entities.releases);
console.log(date, actors, title);
return Promise.all(scenes.map(async (scene) => {
const {
id: entryId,
title,
description,
} = scene;
const url = `https://www.realitykings.com/scene/${entryId}`;
const date = new Date(scene.dateReleased);
const actors = scene.actors.map(actorId => actorsMap[actorId].name);
const rawTags = scene.tags.map(tagId => tagsMap[tagId].name);
const tags = await matchTags(rawTags);
if (!scene.images.poster) {
console.log(site.name, site.id);
console.log(scene);
console.log(title, url, scene.images);
}
const [poster, ...photos] = scene.images.poster.map(image => image.xl.url);
const duration = scene.videos.mediabook.length;
const trailer720p = scene.videos.mediabook.files['720p'] && scene.videos.mediabook.files['720p'].urls.view;
const trailer360p = scene.videos.mediabook.files['360p'] && scene.videos.mediabook.files['360p'].urls.view;
const { likes, dislikes } = scene.stats;
return {
url,
entryId,
title,
description,
actors,
date,
rating: null,
tags,
duration,
poster,
photos,
trailer: {
src: trailer720p || trailer360p,
quality: trailer720p ? 720 : 360,
},
rating: { likes, dislikes },
site,
};
});
}));
}
async function scrapeScene(data, url, site) {
@@ -46,23 +79,19 @@ async function scrapeScene(data, url, site) {
} = data;
const date = new Date(data.dateReleased);
const actors = data.actors
.sort(({ gender: genderA }, { gender: genderB }) => {
if (genderA === 'female' && genderB === 'male') return -1;
if (genderA === 'male' && genderB === 'female') return 1;
return 0;
})
.map(actor => actor.name);
const actors = data.actors.map(actor => actor.name);
const { likes, dislikes } = data.stats;
const duration = data.videos.mediabook.length;
console.log(data);
const rawTags = data.tags.map(tag => tag.name);
const tags = await matchTags(rawTags);
const [poster, ...photos] = data.images.poster.map(image => image.xl.url);
const duration = data.videos.mediabook.length;
const trailer720p = data.videos.mediabook.files['720p'] && data.videos.mediabook.files['720p'].urls.view;
const trailer360p = data.videos.mediabook.files['360p'] && data.videos.mediabook.files['360p'].urls.view;
return {
url,
entryId,
@@ -72,6 +101,12 @@ async function scrapeScene(data, url, site) {
date,
duration,
tags,
poster,
photos,
trailer: {
src: trailer720p || trailer360p,
quality: trailer720p ? 720 : 360,
},
rating: {
likes,
dislikes,
@@ -81,13 +116,25 @@ async function scrapeScene(data, url, site) {
}
async function fetchLatest(site, page = 1) {
const res = await bhttp.get(`https://www.realitykings.com/tour/videos/${site.name.replace(/\s+/g, '-').toLowerCase()}/all-categories/all-time/recent/${page}`);
const { hostname, search } = new URL(site.url);
return scrapeLatest(res.body.toString(), site);
if (hostname.match(/(www\.)?realitykings\.com/) && search.match(/\?site=\d+/)) {
const res = await bhttp.get(`${site.url}&page=${page}`);
return scrapeLatest(res.body.toString(), site);
}
if (site.parameters && site.parameters.siteId) {
const res = await bhttp.get(`https://www.realitykings.com/scenes?site=${site.parameters.siteId}&page=${page}`);
return scrapeLatest(res.body.toString(), site);
}
throw new Error(`Reality Kings site '${site.name}' (${site.url}) not supported`);
}
async function fetchScene(url, site) {
if (site.isFallback || (site.parameters && site.parameters.altLayout)) {
if (site.isFallback) {
throw new Error('Cannot fetch scene details from this resource');
}

View File

@@ -2,13 +2,13 @@
/* eslint-disable newline-per-chained-call */
const bhttp = require('bhttp');
const cheerio = require('cheerio');
const { JSDOM } = require('jsdom');
const moment = require('moment');
const { matchTags } = require('../tags');
function scrapeLatest(html, site) {
const $ = cheerio.load(html, { normalizeWhitespace: true });
const { document } = new JSDOM(html).window;
const sceneElements = $('.scenes-latest').toArray();
return sceneElements.map((element) => {
@@ -31,7 +31,7 @@ function scrapeLatest(html, site) {
}
function scrapeUpcoming(html, site) {
const $ = cheerio.load(html, { normalizeWhitespace: true });
const { document } = new JSDOM(html).window;
const sceneElements = $('.scenes-upcoming').toArray();
return sceneElements.map((element) => {