From 8889ea5cf3866e202226f74ee24f16e7c85765a3 Mon Sep 17 00:00:00 2001 From: Niels Simenon Date: Wed, 19 Feb 2020 04:49:54 +0100 Subject: [PATCH] Using hasTeaser param instead of date comparison to skip upcoming release teasers in Gamma scraper. --- src/scrapers/gamma.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/scrapers/gamma.js b/src/scrapers/gamma.js index ba0004f4..4f5da4b3 100644 --- a/src/scrapers/gamma.js +++ b/src/scrapers/gamma.js @@ -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) {