From bf1ca4d8b94da077cbd85493518e6775b4b129e5 Mon Sep 17 00:00:00 2001 From: Henry Wang Date: Tue, 19 Feb 2019 03:25:48 +0000 Subject: [PATCH] fix: handle 9to5 missing cover photo (#1544) --- lib/routes/9to5/utils.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/routes/9to5/utils.js b/lib/routes/9to5/utils.js index 846a5c95b2..1db063a4cf 100644 --- a/lib/routes/9to5/utils.js +++ b/lib/routes/9to5/utils.js @@ -4,6 +4,11 @@ const ProcessFeed = (data) => { const $ = cheerio.load(data); const content = $('div[itemprop="articleBody"]'); + const cover = $('meta[property="og:image"]'); + if (cover.length > 0) { + $(``).insertBefore(content[0].firstChild); + } + // remove useless DOMs content .find('hr')