Improved Vixen and XEmpire scrapers. Added media to Blowpass scraper. Improved release fetch code.

This commit is contained in:
2019-09-26 03:27:01 +02:00
parent 96d8cfbcb6
commit 298eabe56e
11 changed files with 123 additions and 79 deletions

View File

@@ -10,8 +10,8 @@ const { matchTags } = require('../tags');
function scrapeLatest(html, site) {
const $ = cheerio.load(html, { normalizeWhitespace: true });
const stateObject = $('script:contains("INITIAL_STATE")');
const { videos: scenes } = JSON.parse(stateObject.html().trim().slice(27, -1));
const stateScript = $('script:contains("INITIAL_STATE")').html();
const { videos: scenes } = JSON.parse(stateScript.slice(stateScript.indexOf('{'), stateScript.indexOf('};') + 1));
return scenes.map((scene) => {
const shootId = String(scene.newId);
@@ -59,7 +59,8 @@ async function scrapeScene(html, url, site) {
const shootId = data.page.data[`${pathname}${search}`].data.video;
const scene = data.videos.find(video => video.newId === shootId);
// console.log(scene);
const [poster, ...photos] = scene.rotatingThumbsUrlSizes.map(photo => photo['1040w']);
const trailer = scene.previews.listing.find(preview => preview.height === 353) || null;
const {
title,
@@ -84,6 +85,13 @@ async function scrapeScene(html, url, site) {
date,
duration,
tags,
photos,
poster,
trailer: trailer && {
src: trailer.src,
type: trailer.type,
quality: 353,
},
rating: {
stars,
},