From b30fe4a43cdbc30b51f7e9926954112feb9a51a4 Mon Sep 17 00:00:00 2001 From: rayou Date: Sun, 9 May 2021 08:13:55 +1000 Subject: [PATCH] fix(facebook): replace facebook tracking link with original link (#7460) --- lib/routes/facebook/page.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/routes/facebook/page.js b/lib/routes/facebook/page.js index 1a994a9ac4a3db..e33bab9d520398 100644 --- a/lib/routes/facebook/page.js +++ b/lib/routes/facebook/page.js @@ -24,6 +24,13 @@ const parseStoryPage = async (linkPath, cache) => { const $box = $story.find('div > div > div > div').eq(0); const $header = $box.find('header').eq(0); const $content = $box.find('div > div').eq(0); + $content.find('a[href^="https://lm.facebook.com/l.php"]').each((_, ele) => { + const link = $(ele); + const originalLink = new URL(link.attr('href')).searchParams.get('u'); + if (originalLink) { + link.attr('href', decodeURIComponent(originalLink)); + } + }); const $attach = $story.find('div > div > div > div:nth-child(3)').eq(0); const attachLinkList = $attach