From 16041e7aa364a2ac4e427e1269fb390d10cab4b4 Mon Sep 17 00:00:00 2001 From: Xunco Date: Tue, 21 Apr 2020 19:46:23 +0800 Subject: [PATCH] fix: facebook pages not working (#4501) --- lib/routes/facebook/page.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/routes/facebook/page.js b/lib/routes/facebook/page.js index c2f0c3a10..7f9ba36d9 100644 --- a/lib/routes/facebook/page.js +++ b/lib/routes/facebook/page.js @@ -80,9 +80,10 @@ module.exports = async (ctx) => { const html = await fetchPageHtml(linkPath, pageId, ctx.cache); const $ = cheerio.load(html); - const itemLinks = $('div[role=article] > div:nth-child(2) > div:nth-child(2)') + const itemLinks = $('footer > div:nth-child(2) > a:nth-child(1)') .toArray() - .map((div) => $(div).find('a').last().attr('href')); + .map((a) => $(a).attr('href')); + const items = await Promise.all( itemLinks.map(async (itemLink) => { if (new RegExp(`^/.+/photos/`).test(itemLink)) {