Added trailer support to legacy Aziani scraper.

This commit is contained in:
DebaucheryLibrarian 2023-08-03 23:35:10 +02:00
parent fa9153deb8
commit abbfedf3f7
1 changed files with 15 additions and 8 deletions

View File

@ -4,13 +4,20 @@ const slugify = require('../utils/slugify');
const { get, getAll, initAll, extractDate } = require('../utils/qu'); const { get, getAll, initAll, extractDate } = require('../utils/qu');
const { feetInchesToCm } = require('../utils/convert'); const { feetInchesToCm } = require('../utils/convert');
const imageRegex = /-\dx.jpg/;
function getFallbacks(source) { function getFallbacks(source) {
return [ if (source.includes('join.jpg')) {
source.replace('-1x.jpg', '-4x.jpg'), return null;
source.replace('-1x.jpg', '-3x.jpg'), }
source.replace('-1x.jpg', '-2x.jpg'),
return Array.from(new Set([
source.replace(imageRegex, '-4x.jpg'),
source.replace(imageRegex, '-3x.jpg'),
source.replace(imageRegex, '-2x.jpg'),
source.replace(imageRegex, '-1x.jpg'),
source, source,
]; ]));
} }
function scrapeAll(scenes, site) { function scrapeAll(scenes, site) {
@ -55,11 +62,11 @@ function scrapeScene({ html, qu }, url, channel) {
release.duration = qu.dur('.video_categories + p'); release.duration = qu.dur('.video_categories + p');
const poster = qu.img('a img'); release.poster = getFallbacks(qu.img('a img')) || getFallbacks(qu.img('#preview video', 'poster', { origin: channel.url }));
release.poster = getFallbacks(poster);
release.caps = qu.imgs('.featured-video img', 'src0_1x', { origin: channel.url }).map((source) => getFallbacks(source)); release.caps = qu.imgs('.featured-video img', 'src0_1x', { origin: channel.url }).map((source) => getFallbacks(source));
release.trailer = qu.video('#preview source');
return release; return release;
} }