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