Getting more and higher quality Vixen photos.

This commit is contained in:
ThePendulum 2020-01-18 23:10:31 +01:00
parent 67c1e6c556
commit 4e4323704a
3 changed files with 6 additions and 4 deletions

View File

@ -43,6 +43,7 @@ module.exports = {
media: { media: {
path: './', path: './',
thumbnailSize: 320, // width for 16:9 will be exactly 576px thumbnailSize: 320, // width for 16:9 will be exactly 576px
thumbnailQuality: 90,
limit: 25, // max number of photos per release limit: 25, // max number of photos per release
}, },
}; };

View File

@ -43,7 +43,7 @@ async function createThumbnail(buffer) {
withoutEnlargement: true, withoutEnlargement: true,
}) })
.jpeg({ .jpeg({
quality: 75, quality: config.media.thumbnailQuality,
}) })
.toBuffer(); .toBuffer();
} }

View File

@ -60,15 +60,16 @@ function scrapeLatest(html, site) {
async function scrapeScene(html, url, site) { async function scrapeScene(html, url, site) {
const $ = cheerio.load(html, { normalizeWhitespace: true }); const $ = cheerio.load(html, { normalizeWhitespace: true });
const { pathname, search } = new URL(url);
const stateObject = $('script:contains("INITIAL_STATE")'); const stateObject = $('script:contains("INITIAL_STATE")');
const data = JSON.parse(stateObject.html().trim().slice(27, -1)); const data = JSON.parse(stateObject.html().trim().slice(27, -1));
const entryId = data.page.data[`${pathname}${search}`].data.video; const pageData = data.page.data[data.location.pathname].data;
const entryId = pageData.video;
const scene = data.videos.find(video => video.newId === entryId); const scene = data.videos.find(video => video.newId === entryId);
const [poster, ...photos] = scene.rotatingThumbsUrlSizes.map(photo => photo['1040w']); const poster = scene.rotatingThumbsUrlSizes[0]['1040w'];
const photos = pageData.pictureset.map(photo => photo.main[0].src);
const trailer = scene.previews.listing.find(preview => preview.height === 353) || null; const trailer = scene.previews.listing.find(preview => preview.height === 353) || null;
const { const {