forked from DebaucheryLibrarian/traxxx
Filtering out empty or unidentified scenes from update scraper, with warning. Improved Jesse Loads Monster Facials reliability.
This commit is contained in:
@@ -1,23 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
const { get, initAll } = require('../utils/qu');
|
||||
const { get, initAll, formatDate } = require('../utils/qu');
|
||||
|
||||
function scrapeLatest(scenes, dates, site) {
|
||||
return scenes.map(({ qu }, index) => {
|
||||
const release = {};
|
||||
const path = qu.url('a[href*="videos/"]');
|
||||
|
||||
const path = qu.url('a');
|
||||
release.url = `${site.url}/visitors/${path}`;
|
||||
release.entryId = path.match(/videos\/([a-zA-Z0-9]+)(?:_hd)?_trailer/)?.[1];
|
||||
if (path) {
|
||||
release.url = `${site.url}/visitors/${path}`;
|
||||
}
|
||||
|
||||
if (dates && dates[index]) {
|
||||
release.date = dates[index].qu.date(null, 'MM/DD/YYYY');
|
||||
}
|
||||
|
||||
const entryId = path?.match(/videos\/([a-zA-Z0-9]+)(?:_hd)?_trailer/)?.[1]
|
||||
|| qu.img('img[src*="graphics/fft"]')?.match(/fft_(\w+).gif/)?.[1];
|
||||
|
||||
if (!entryId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
release.entryId = release.date ? `${formatDate(release.date, 'YYYY-MM-DD')}-${entryId}` : entryId;
|
||||
release.description = qu.q('tbody tr:nth-child(3) font', true);
|
||||
|
||||
const infoLine = qu.q('font[color="#663366"]', true);
|
||||
if (infoLine) release.duration = Number(infoLine.match(/(\d+) min/)[1]) * 60;
|
||||
|
||||
if (infoLine) {
|
||||
release.duration = Number(infoLine.match(/(\d+) min/i)?.[1] || infoLine.match(/video: (\d+)/i)?.[1]) * 60 || null;
|
||||
}
|
||||
|
||||
const poster = qu.img('img[src*="photos/"][width="400"]');
|
||||
release.poster = `${site.url}/visitors/${poster}`;
|
||||
|
||||
Reference in New Issue
Block a user