|
|
|
|
@@ -42,7 +42,7 @@ async function scrapeSceneData(scene, channel, context, isDeep) {
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
release.tags = scene.resources?.data?.filter((tag) => tag.type === 'category').map((tag) => tag.title);
|
|
|
|
|
release.language = scene.videos?.data?.film?.[0]?.language;
|
|
|
|
|
release.language = scene.videos?.data?.film?.[0]?.language || null;
|
|
|
|
|
|
|
|
|
|
if (isDeep) {
|
|
|
|
|
const thumb = scene.images?.data?.thumb?.[0];
|
|
|
|
|
@@ -80,13 +80,13 @@ function scrapeAll(scenes, channel, context) {
|
|
|
|
|
|
|
|
|
|
const release = await scrapeSceneData(scene, channel, context, false);
|
|
|
|
|
|
|
|
|
|
if (release.language && channel.parameters.languages && !channel.parameters.languages?.includes(release.language)) {
|
|
|
|
|
if (!channel.parameters.languages || channel.parameters.languages.includes(release.language)) {
|
|
|
|
|
// all MVH sites list the entire network, but we want to store Flemish scenes under Vurig Vlaanderen
|
|
|
|
|
// the international releases should go on MVH, but the API can't filter for NL+EN, so we do it here
|
|
|
|
|
return { ...acc, unextracted: [...acc.unextracted, release] };
|
|
|
|
|
return { ...acc, scenes: [...acc.scenes, release] };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return { ...acc, scenes: [...acc.scenes, release] };
|
|
|
|
|
return { ...acc, unextracted: [...acc.unextracted, release] };
|
|
|
|
|
}, Promise.resolve({
|
|
|
|
|
scenes: [],
|
|
|
|
|
unextracted: [],
|
|
|
|
|
@@ -95,8 +95,6 @@ function scrapeAll(scenes, channel, context) {
|
|
|
|
|
|
|
|
|
|
async function fetchLatest(channel, page, context) {
|
|
|
|
|
// query seems to break if any component is left out or even moved
|
|
|
|
|
// const res = await unprint.get(`https://apiv2.sysero.nl/api${context.parameters.apiPath}/resources/nl?query=(content:videos,types:(0:video),sort:(published_at:DESC),filters:(active:1,status:published),pagination:(page:${page},per_page:20),include:((resources:(filters:((types:(0:category),status:published)),images:(filters:((types:(0:thumb))))),images:(filters:((types:(0:cover,1:home_cover,2:thumb,3:cover_thumb)))),clips:(),videos:(),categories:())))`, {
|
|
|
|
|
// const res = await unprint.get(`https://apiv2.sysero.nl/api${context.parameters.apiPath}/resources/nl?query=(content:videos,types:(0:video),sort:(published_at:DESC),filters:(active:1,status:published),pagination:(page:${page},per_page:20),include:((resources:(filters:((types:(0:category),status:published)),images:(filters:((types:(0:thumb))))),images:(filters:((types:(0:cover,1:home_cover,2:thumb,3:cover_thumb)))),clips:(),videos:(),categories:())))`, {
|
|
|
|
|
const res = await unprint.get(`https://apiv2.sysero.nl/api${context.parameters.apiPath}/resources/nl?query=(content:videos,types:(0:video),sort:(published_at:DESC),filters:(active:1,status:published),pagination:(page:${page},per_page:20),include:((resources:(filters:((types:(0:category),status:published)),images:(filters:((types:(0:thumb))))),images:(filters:((types:(0:cover,1:home_cover,2:thumb,3:cover_thumb)))),clips:(),videos:(),categories:())))`, {
|
|
|
|
|
headers: {
|
|
|
|
|
Origin: channel.origin,
|
|
|
|
|
@@ -133,34 +131,32 @@ function getLocation(model) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function scrapeProfile(model, { entity }) {
|
|
|
|
|
const actor = {};
|
|
|
|
|
const profile = {};
|
|
|
|
|
|
|
|
|
|
// gender unreliable, seems to report everyone as 'vrouw' (woman)
|
|
|
|
|
|
|
|
|
|
actor.name = model.title;
|
|
|
|
|
actor.url = unprint.prefixUrl(`/modellen/${model.slug}`, entity.url);
|
|
|
|
|
profile.entryId = model.id;
|
|
|
|
|
profile.url = unprint.prefixUrl(`/modellen/${model.slug}`, entity.origin);
|
|
|
|
|
|
|
|
|
|
actor.entryId = model.id;
|
|
|
|
|
profile.description = model.description;
|
|
|
|
|
|
|
|
|
|
actor.description = model.description;
|
|
|
|
|
profile.dateOfBirth = model.birth_date && model.age > 18 ? new Date(model.birth_date) : null; // sometimes seems to be profile creation date
|
|
|
|
|
profile.age = model.age > 18 ? model.age : null;
|
|
|
|
|
profile.orientation = model.sexual_orientation;
|
|
|
|
|
|
|
|
|
|
actor.dateOfBirth = model.birth_date && model.age > 18 ? new Date(model.birth_date) : null; // sometimes seems to be profile creation date
|
|
|
|
|
actor.age = model.age > 18 ? model.age : null;
|
|
|
|
|
actor.orientation = model.sexual_orientation;
|
|
|
|
|
profile.birthPlace = getLocation(model);
|
|
|
|
|
|
|
|
|
|
actor.birthPlace = getLocation(model);
|
|
|
|
|
profile.height = Number(model.length) || null;
|
|
|
|
|
profile.weight = Number(model.weight) || null;
|
|
|
|
|
|
|
|
|
|
actor.height = Number(model.length) || null;
|
|
|
|
|
actor.weight = Number(model.weight) || null;
|
|
|
|
|
profile.eyes = model.eye_color;
|
|
|
|
|
profile.hairColor = model.hair_color;
|
|
|
|
|
|
|
|
|
|
actor.eyes = model.eye_color;
|
|
|
|
|
actor.hairColor = model.hair_color;
|
|
|
|
|
profile.avatar = unprint.prefixUrl(model.images?.data?.square?.[0]?.path, 'https://cdndo.sysero.nl');
|
|
|
|
|
|
|
|
|
|
actor.avatar = unprint.prefixUrl(model.images?.[0]?.path, 'https://cdndo.sysero.nl');
|
|
|
|
|
profile.scenes = await Promise.all(model.video?.map(async (video) => scrapeSceneData(video, entity, false)));
|
|
|
|
|
|
|
|
|
|
actor.scenes = await Promise.all(model.video?.map(async (video) => scrapeSceneData(video, entity, false)));
|
|
|
|
|
|
|
|
|
|
return actor;
|
|
|
|
|
return profile;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function fetchProfile(actor, { entity, parameters }) {
|
|
|
|
|
@@ -177,7 +173,7 @@ async function fetchProfile(actor, { entity, parameters }) {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (res.ok) {
|
|
|
|
|
const data = res.context.window.__NUXT__?.state?.modelStore?.model;
|
|
|
|
|
const data = res.context.window.__NUXT__?.state?.resourcesStore?.model;
|
|
|
|
|
|
|
|
|
|
if (data) {
|
|
|
|
|
return scrapeProfile(data, { entity });
|
|
|
|
|
|