Added Family Strokes' API to Team Skeet scraper.

This commit is contained in:
DebaucheryLibrarian 2025-08-21 03:16:12 +02:00
parent 4335c4693d
commit 32d0eb13e7
2 changed files with 26 additions and 9 deletions

View File

@ -12537,8 +12537,9 @@ const sites = [
alias: ['fams'],
url: 'https://www.familystrokes.com',
parameters: {
layout: 'organic',
endpoint: 'FS-organic-1rstmyhj44',
// endpoint: 'FS-organic-1rstmyhj44',
layout: 'search',
endpoint: 'familybundle',
},
tags: ['family'],
parent: 'teamskeet',

View File

@ -30,11 +30,11 @@ function scrapeScene(scene, channel, parameters) {
release.description = scene.description;
release.date = qu.extractDate(scene.publishedDate);
release.actors = scene.models?.map((model) => model.modelName) || [];
// release.actors = scene.models?.map((model) => model.modelName) || [];
release.actors = scene.models?.map((model) => ({
name: model.modelName,
avatar: parameters.avatars && `${parameters.avatars}/${slugify(model.modelName, '_')}.jpg`,
url: `${channel.url}/models/${model.modelId}`,
name: model.modelName || model.name || model.title,
avatar: parameters.avatars && `${parameters.avatars}/${slugify(model.modelName || model.name || model.title, '_')}.jpg`,
url: `${channel.url}/models/${model.modelId || model.id}`,
}));
release.poster = [
@ -155,6 +155,16 @@ async function fetchLatestOrganic(channel, page, context) {
return res.status;
}
async function fetchLatestSearch(channel, page = 1, { parameters }) {
const res = await http.get(`https://tours-store.psmcdn.net/${parameters.endpoint}/_search?sort=publishedDate:desc&q=(type:video%20AND%20isXSeries:false%20)&size=30&from=${(page - 1) * 30}`);
if (res.ok) {
return scrapeAll(res.body.hits.hits.map(({ _source: scene }) => scene), channel, parameters);
}
return res.status;
}
async function fetchScene(url, channel, baseScene, { parameters }) {
if (parameters.layout !== 'organic' && baseScene?.entryId) {
// overview and deep data is the same in elastic API, don't hit server unnecessarily
@ -163,9 +173,11 @@ async function fetchScene(url, channel, baseScene, { parameters }) {
const sceneSlug = new URL(url).pathname.match(/\/([\w-]+$)/)[1];
const res = await http.get(parameters.layout === 'organic'
? `https://store.psmcdn.net/${parameters.endpoint}/moviesContent/${sceneSlug}.json`
: `https://tours-store.psmcdn.net/${parameters.endpoint}-videoscontent/_doc/${sceneSlug}`);
const res = await http.get({
organic: `https://store.psmcdn.net/${parameters.endpoint}/moviesContent/${sceneSlug}.json`,
search: `https://tours-store.psmcdn.net/ts_network/_search/?q=(id:${sceneSlug})&size=1`,
undefined: `https://tours-store.psmcdn.net/${parameters.endpoint}-videoscontent/_doc/${sceneSlug}`,
}[parameters.layout]);
if (res.ok && res.body.found) {
return scrapeScene(res.body._source, channel, parameters);
@ -201,4 +213,8 @@ module.exports = {
fetchLatest: fetchLatestOrganic,
fetchScene,
},
search: {
fetchLatest: fetchLatestSearch,
fetchScene,
},
};