Fixed Hookup Hotshot scraper breaking if scene page has no trailer video.
This commit is contained in:
parent
77ade22b08
commit
37b5e8c573
|
|
@ -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 }) {
|
function scrapeScene({ query, html }, { url, entity, baseRelease }) {
|
||||||
const release = {};
|
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);
|
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 = [
|
const posterFallbacks = [
|
||||||
posterUrl.replace('-1x', '-2x'),
|
posterUrl.replace('-1x', '-2x'),
|
||||||
posterUrl.replace('-1x', '-3x'),
|
posterUrl.replace('-1x', '-3x'),
|
||||||
|
|
@ -64,6 +76,7 @@ function scrapeScene({ query, html }, { url, entity, baseRelease }) {
|
||||||
} else {
|
} else {
|
||||||
release.poster = posterFallbacks;
|
release.poster = posterFallbacks;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return release;
|
return release;
|
||||||
}
|
}
|
||||||
|
|
@ -83,17 +96,6 @@ function scrapeProfile({ query }) {
|
||||||
return profile;
|
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) {
|
async function fetchProfile(actor, entity) {
|
||||||
const url = actor.url || `${entity.url}/models/${actor.slug}.html`;
|
const url = actor.url || `${entity.url}/models/${actor.slug}.html`;
|
||||||
const res = await unprint.get(url);
|
const res = await unprint.get(url);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue