diff --git a/seeds/02_sites.js b/seeds/02_sites.js index 9f86f3f8..cdc89028 100755 --- a/seeds/02_sites.js +++ b/seeds/02_sites.js @@ -12538,6 +12538,7 @@ const sites = [ url: 'https://www.familystrokes.com', parameters: { // endpoint: 'FS-organic-1rstmyhj44', + id: 'family-strokes', layout: 'search', endpoint: 'familybundle', }, diff --git a/src/scrapers/teamskeet.js b/src/scrapers/teamskeet.js index ad4899e1..5b504d7c 100755 --- a/src/scrapers/teamskeet.js +++ b/src/scrapers/teamskeet.js @@ -6,15 +6,16 @@ const slugify = require('../utils/slugify'); const { lbsToKg, feetInchesToCm } = require('../utils/convert'); function getChannelSlug(channelName, entity) { - if (entity.type === 'channel') { - return entity.slug; - } - if (!channelName) { return null; } const channelSlug = slugify(channelName, '', { removePunctuation: true }); + + if (entity.type === 'channel') { + return channelSlug; + } + const channel = entity.children.find((child) => new RegExp(channelSlug).test(child.slug)); return channel?.slug || null; @@ -156,7 +157,7 @@ async function fetchLatestOrganic(channel, page, context) { } 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}`); + const res = await http.get(`https://tours-store.psmcdn.net/${parameters.endpoint}/_search?q=(site.seo.seoSlug:%22${parameters.id}%22%20AND%20type:video)&sort=publishedDate:desc&size=30&from=${(page - 1) * 30}`); if (res.ok) { return scrapeAll(res.body.hits.hits.map(({ _source: scene }) => scene), channel, parameters);