From e196e2aac7603cfb2d0c40504f8640cf1c7f3e9a Mon Sep 17 00:00:00 2001 From: Goestav <27970303+goestav@users.noreply.github.com> Date: Tue, 30 Sep 2025 14:57:03 +0000 Subject: [PATCH] fix(route/anthropic): ensure news route includes article content (#20205) * fix(route/anthropic): ensure news route includes article content * refactor: change order of maintainers array * refactor: simplify selector for redundant elements that should be removed * refactor: remove redundant codeblock control elements --- lib/routes/anthropic/news.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/routes/anthropic/news.ts b/lib/routes/anthropic/news.ts index c8e1539fa..9665209cf 100644 --- a/lib/routes/anthropic/news.ts +++ b/lib/routes/anthropic/news.ts @@ -15,7 +15,7 @@ export const route: Route = { }, ], name: 'News', - maintainers: ['etShaw-zh'], + maintainers: ['etShaw-zh', 'goestav'], handler, url: 'www.anthropic.com/news', }; @@ -49,9 +49,18 @@ async function handler(ctx) { const response = await ofetch(item.link!); const $ = load(response); - $('div[class^="PostDetail_b-social-share"]').remove(); + const content = $('#main-content'); + + // Remove meaningless information (heading, sidebar, quote carousel, footer and codeblock controls) + $(` + [class^="PostDetail_post-heading"], + [class^="ArticleDetail_sidebar-container"], + [class^="QuoteCarousel_carousel-controls"], + [class^="PostDetail_b-social-share"], + [class^="LandingPageSection_root"], + [class^="CodeBlock_controls"] + `).remove(); - const content = $('div[class*="PostDetail_post-detail__"]'); content.find('img').each((_, e) => { const $e = $(e); $e.removeAttr('style srcset');