|
|
|
|
@@ -33,7 +33,7 @@ function extractShootId(title) {
|
|
|
|
|
return title.trim().match(/[A-Z]{2,3}\d{3,4}\w?/)?.[0].toUpperCase();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function scrapeScene(data, channel, include) {
|
|
|
|
|
async function scrapeScene(data, channel, context) {
|
|
|
|
|
const release = {};
|
|
|
|
|
const entityUrl = new URL(channel.url).origin;
|
|
|
|
|
|
|
|
|
|
@@ -41,7 +41,10 @@ async function scrapeScene(data, channel, include) {
|
|
|
|
|
|
|
|
|
|
release.title = data.scene_name || data.custom_name;
|
|
|
|
|
|
|
|
|
|
release.url = `${entityUrl}/watch/${data.id}/${slugify(release.title, '_') || ''}`;
|
|
|
|
|
release.url = context.parameters?.usePornboxUrl
|
|
|
|
|
? `https://pornbox.com/application/watch-page/${data.id}`
|
|
|
|
|
: `${entityUrl}/watch/${data.id}/${slugify(release.title, '_') || ''}`;
|
|
|
|
|
|
|
|
|
|
release.shootId = extractShootId(release.title);
|
|
|
|
|
|
|
|
|
|
release.date = new Date(data.release_date || data.publish_date);
|
|
|
|
|
@@ -77,7 +80,7 @@ async function scrapeScene(data, channel, include) {
|
|
|
|
|
|
|
|
|
|
release.teaser = data.video_preview;
|
|
|
|
|
|
|
|
|
|
if (include?.includeTrailers) {
|
|
|
|
|
if (context?.includeTrailers) {
|
|
|
|
|
release.trailer = await getTrailer(data);
|
|
|
|
|
release.qualities = release.trailer?.map((src) => src.quality);
|
|
|
|
|
}
|
|
|
|
|
@@ -91,11 +94,11 @@ async function scrapeScene(data, channel, include) {
|
|
|
|
|
return release;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function scrapeAll(scenes, channel) {
|
|
|
|
|
return Promise.all(scenes.map(async (data) => scrapeScene(data, channel)));
|
|
|
|
|
function scrapeAll(scenes, channel, context) {
|
|
|
|
|
return Promise.all(scenes.map(async (data) => scrapeScene(data, channel, context)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function fetchLatest(channel, page = 1) {
|
|
|
|
|
async function fetchLatest(channel, page = 1, context) {
|
|
|
|
|
if (!channel.parameters?.studioId) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
@@ -104,18 +107,18 @@ async function fetchLatest(channel, page = 1) {
|
|
|
|
|
const res = await unprint.get(url);
|
|
|
|
|
|
|
|
|
|
if (res.ok && res.data?.contents) {
|
|
|
|
|
return scrapeAll(res.data.contents, channel);
|
|
|
|
|
return scrapeAll(res.data.contents, channel, context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res.status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function fetchScene(url, entity, baseRelease, include) {
|
|
|
|
|
async function fetchScene(url, entity, baseRelease, context) {
|
|
|
|
|
const entryId = new URL(url).pathname.match(/\/watch(?:-page)?\/(\d+)/)[1];
|
|
|
|
|
const res = await unprint.get(`https://pornbox.com/contents/${entryId}`);
|
|
|
|
|
|
|
|
|
|
if (res.ok) {
|
|
|
|
|
return scrapeScene(res.data, entity, include);
|
|
|
|
|
return scrapeScene(res.data, entity, context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res.status;
|
|
|
|
|
|