From 1928c79b7a541903e1effadccce512640ca2b073 Mon Sep 17 00:00:00 2001 From: mace Date: Fri, 9 Oct 2026 10:11:58 +0200 Subject: [PATCH] Strip taz product-teaser promo from readable view The "taz FUTURZWEI im Abo entdecken" box has neither an /abo/ link nor an "Abo" aria-label, so the existing taz rules missed it. Remove its section.article-produktteaser-container before Readability parses the page. --- .../composables/__tests__/useFeeds.spec.js | 32 +++++++++++++++++++ vue/src/composables/useFeeds.js | 4 +++ 2 files changed, 36 insertions(+) diff --git a/vue/src/composables/__tests__/useFeeds.spec.js b/vue/src/composables/__tests__/useFeeds.spec.js index b198de8..a6b765c 100644 --- a/vue/src/composables/__tests__/useFeeds.spec.js +++ b/vue/src/composables/__tests__/useFeeds.spec.js @@ -1280,6 +1280,38 @@ describe('useFeeds', () => { expect(feeds.value[0].content).not.toContain(' { + feeds.value = [{ + id: 1, + title: 'Article one', + url: 'https://taz.de/Article-one/!6218657/', + content: '', + }] + axios.post.mockResolvedValueOnce({ + data: { + content: `
+

some article text long enough for readability to keep the paragraph as the main content body, padded with extra words to pass the content-length heuristics used by Mozilla Readability when scoring candidate nodes.

+
+

more article text long enough to survive readability's content-length heuristics as well, since it needs to look like part of the main body too.

+
`, + }, + }) + + await getReadable(feeds.value[0], 0) + + expect(feeds.value[0].readable).toBe(true) + expect(feeds.value[0].content).toContain('main content body') + expect(feeds.value[0].content).not.toContain('FUTURZWEI') + expect(feeds.value[0].content).not.toContain('Jetzt abonnieren') + }) + it('strips Al-Jazeera-style "Recommended Stories" sections', async () => { feeds.value = [{ id: 1, diff --git a/vue/src/composables/useFeeds.js b/vue/src/composables/useFeeds.js index b584238..36c22e1 100644 --- a/vue/src/composables/useFeeds.js +++ b/vue/src/composables/useFeeds.js @@ -291,6 +291,10 @@ async function getReadable(feed, index) { const container = el.closest('section') ?? el.closest('article') if (container) container.remove() }) + // taz product teasers (e.g. the "taz FUTURZWEI im Abo entdecken" box): a + //
whose link has neither an /abo/ href nor an "Abo" aria-label, + // so only its container class identifies it. + doc.querySelectorAll('section.article-produktteaser-container').forEach(el => el.remove()) // Al Jazeera embeds a "Recommended Stories" section (a heading followed by // a list of unrelated article teasers), marked up as
. // It's not part of the article, so strip it before Readability pulls it