Using hasTeaser param instead of date comparison to skip upcoming release teasers in Gamma scraper.

This commit is contained in:
ThePendulum 2020-02-19 04:49:54 +01:00
parent 372ff54261
commit 8889ea5cf3
1 changed files with 4 additions and 2 deletions

View File

@ -173,13 +173,15 @@ function scrapeAll(html, site, networkUrl, hasTeaser = true) {
const posterEl = $(element).find('.imgLink img, .tlcImageItem');
if (posterEl) release.poster = posterEl.attr('data-original') || posterEl.attr('src');
if (hasTeaser && release.date && new Date() - release.date > 0) {
if (hasTeaser) {
release.teaser = [
{ src: `https://videothumb.gammacdn.com/600x339/${release.entryId}.mp4` },
{ src: `https://videothumb.gammacdn.com/307x224/${release.entryId}.mp4` },
];
}
console.log(release.title, release.teaser);
return release;
});
}
@ -454,7 +456,7 @@ async function fetchUpcoming(site) {
const url = getUpcomingUrl(site);
const res = await bhttp.get(url);
return scrapeAll(res.body.toString(), site);
return scrapeAll(res.body.toString(), site, null, false);
}
function getDeepUrl(url, site, release) {