Fixed Team Skeet search API returning generic results.
This commit is contained in:
parent
a01b570f0e
commit
c23b3a1e19
|
@ -12538,6 +12538,7 @@ const sites = [
|
||||||
url: 'https://www.familystrokes.com',
|
url: 'https://www.familystrokes.com',
|
||||||
parameters: {
|
parameters: {
|
||||||
// endpoint: 'FS-organic-1rstmyhj44',
|
// endpoint: 'FS-organic-1rstmyhj44',
|
||||||
|
id: 'family-strokes',
|
||||||
layout: 'search',
|
layout: 'search',
|
||||||
endpoint: 'familybundle',
|
endpoint: 'familybundle',
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,15 +6,16 @@ const slugify = require('../utils/slugify');
|
||||||
const { lbsToKg, feetInchesToCm } = require('../utils/convert');
|
const { lbsToKg, feetInchesToCm } = require('../utils/convert');
|
||||||
|
|
||||||
function getChannelSlug(channelName, entity) {
|
function getChannelSlug(channelName, entity) {
|
||||||
if (entity.type === 'channel') {
|
|
||||||
return entity.slug;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!channelName) {
|
if (!channelName) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const channelSlug = slugify(channelName, '', { removePunctuation: true });
|
const channelSlug = slugify(channelName, '', { removePunctuation: true });
|
||||||
|
|
||||||
|
if (entity.type === 'channel') {
|
||||||
|
return channelSlug;
|
||||||
|
}
|
||||||
|
|
||||||
const channel = entity.children.find((child) => new RegExp(channelSlug).test(child.slug));
|
const channel = entity.children.find((child) => new RegExp(channelSlug).test(child.slug));
|
||||||
|
|
||||||
return channel?.slug || null;
|
return channel?.slug || null;
|
||||||
|
@ -156,7 +157,7 @@ async function fetchLatestOrganic(channel, page, context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchLatestSearch(channel, page = 1, { parameters }) {
|
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) {
|
if (res.ok) {
|
||||||
return scrapeAll(res.body.hits.hits.map(({ _source: scene }) => scene), channel, parameters);
|
return scrapeAll(res.body.hits.hits.map(({ _source: scene }) => scene), channel, parameters);
|
||||||
|
|
Loading…
Reference in New Issue