recommendations.ts
import { fetchFromGraphQL } from '../../utility/lib/fetch';
import { videoFields } from './lib';
export async function getRecommendations(req) {
const { referer } = req.headers;
const query = `{
recommendations {
popular {
${videoFields}
}
trending {
${videoFields}
}
latest {
${videoFields}
}
marvelous {
${videoFields}
}
lengthy {
${videoFields}
}
multistarrer {
${videoFields}
}
}
}
`;
const { recommendations } = await fetchFromGraphQL({
query,
referer
});
return recommendations;
}