'use strict'; const { fetchLatest, fetchProfile } = require('./julesjordan'); const qu = require('../utils/q'); const slugify = require('../utils/slugify'); function scrapeScene({ query }, channel) { const release = {}; const title = query.cnt('.update_title', false); release.title = title.trim(); release.description = query.cnt('.latest_update_description'); release.date = query.date('.update_date', 'MM/DD/YYYY'); release.actors = query.all('.tour_update_models a').map(actorEl => ({ name: query.cnt(actorEl), url: query.url(actorEl, null), })); release.entryId = slugify(release.title); release.duration = Number(query.cnt('.update_counts_preview_table').match(/(\d+) min/)[1]) * 60; const poster = query.img('.large_update_thumb', 'src', { origin: channel.url }); const trailer = query.q('.update_image a', 'onclick')?.match(/'(.+)'/)?.[1]; release.poster = [ poster.replace(/.jpg$/, '-full.jpg'), poster, ]; release.photos = query.imgs('.small_update_thumb', 'src', { origin: channel.url }).map(img => [ img.replace(/.jpg$/, '-full.jpg'), img, ]); if (trailer) { release.trailer = qu.prefixUrl(encodeURI(trailer), channel.url); } release.tags = query.cnts('.tour_update_tags a'); return release; } async function fetchLatestLocal(channel, page, include, preData) { return fetchLatest(channel, page, include, preData, true); } async function fetchScene(url, channel) { const res = await qu.get(url); if (res.ok) { return scrapeScene(res.item, channel); } return res.status; } module.exports = { fetchLatest: fetchLatestLocal, fetchScene, fetchProfile, // don't scrape scenes, no URL };