Refactored media module. Returning 320p and 720p videos from MindGeek as teasers instead of trailers.

This commit is contained in:
2020-02-19 04:41:53 +01:00
parent b9e617edfc
commit 97f5e49187
12 changed files with 389 additions and 193 deletions

View File

@@ -47,7 +47,7 @@ function scrapeLatest(html, site) {
const actors = title.split(/[,&]|\band\b/).map(actor => actor.trim());
const poster = `https:${element.querySelector('img').src}`;
const trailer = sceneLinkElement.dataset.preview_clip_url;
const teaser = sceneLinkElement.dataset.preview_clip_url;
return [
...acc,
@@ -57,8 +57,8 @@ function scrapeLatest(html, site) {
title,
actors,
poster,
trailer: {
src: trailer,
teaser: {
src: teaser,
},
site,
},
@@ -99,7 +99,7 @@ async function scrapeScene(html, url, site) {
const lastPhotosUrl = Array.from(document.querySelectorAll('.pagination a')).slice(-1)[0].href;
const photos = await getPhotos(`${origin}${pathname}${lastPhotosUrl}`, site, url);
const stars = Math.floor(Number(document.querySelector('span[itemprop="average"]').textContent) / 2);
const stars = Math.floor(Number(document.querySelector('span[itemprop="average"]')?.textContent || document.querySelector('span[itemprop="ratingValue"]')?.textContent) / 2);
const tags = Array.from(document.querySelectorAll('.scene-details .categories a')).map(({ textContent }) => textContent);
return {