Fixed Hookup Hotshot scraper breaking if scene page has no trailer video.

This commit is contained in:
DebaucheryLibrarian 2025-12-30 05:14:34 +01:00
parent 77ade22b08
commit 37b5e8c573
1 changed files with 24 additions and 22 deletions

View File

@ -29,6 +29,17 @@ function scrapeAll(scenes, _channel) {
});
}
async function fetchLatest(channel, page = 1) {
const url = `${channel.url}/categories/movies/${page}/latest/`;
const res = await unprint.get(url, { selectAll: '.items .item-video' });
if (res.ok) {
return scrapeAll(res.context, channel);
}
return res.status;
}
function scrapeScene({ query, html }, { url, entity, baseRelease }) {
const release = {};
@ -50,8 +61,9 @@ function scrapeScene({ query, html }, { url, entity, baseRelease }) {
release.trailer = unprint.prefixUrl(html.match(/src="(\/trailers\/.*\.mp4)"/)?.[1], entity.url);
const posterUrl = unprint.prefixUrl(html.match(/poster="(\/content\/.*\.jpg)"/)?.[1], entity.url);
const posterUrl = query.img('img.update_thumb', { attribute: 'src0_1x' }) || unprint.prefixUrl(html.match(/poster="(\/content\/.*\.jpg)"/)?.[1], entity.url);
if (posterUrl) {
const posterFallbacks = [
posterUrl.replace('-1x', '-2x'),
posterUrl.replace('-1x', '-3x'),
@ -64,6 +76,7 @@ function scrapeScene({ query, html }, { url, entity, baseRelease }) {
} else {
release.poster = posterFallbacks;
}
}
return release;
}
@ -83,17 +96,6 @@ function scrapeProfile({ query }) {
return profile;
}
async function fetchLatest(channel, page = 1) {
const url = `${channel.url}/categories/movies/${page}/latest/`;
const res = await unprint.get(url, { selectAll: '.items .item-video' });
if (res.ok) {
return scrapeAll(res.context, channel);
}
return res.status;
}
async function fetchProfile(actor, entity) {
const url = actor.url || `${entity.url}/models/${actor.slug}.html`;
const res = await unprint.get(url);