From abbfedf3f7b04e4f9746a5ddb6f06a486a81d521 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Thu, 3 Aug 2023 23:35:10 +0200 Subject: [PATCH] Added trailer support to legacy Aziani scraper. --- src/scrapers/aziani.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/scrapers/aziani.js b/src/scrapers/aziani.js index 9656a11e..00718fc7 100755 --- a/src/scrapers/aziani.js +++ b/src/scrapers/aziani.js @@ -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; }