fix(route/anthropic): anthropic posts data (#21588)

This commit is contained in:
Tony 2026-04-01 22:42:57 +08:00 committed by GitHub
parent 3fb2954b18
commit bbae3e2346
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 3 deletions

View File

@ -68,8 +68,7 @@ async function handler() {
});
const sections = fd.flatMap((d) => (Array.isArray(d.data) ? d.data : [])).flatMap((item) => item?.page?.sections ?? []);
const tabPages = sections.flatMap((section) => section?.tabPages ?? []).filter((tabPage) => tabPage?.label === 'Overview');
const publicationSections = tabPages.flatMap((tabPage) => tabPage.sections).filter((section) => section?.title === 'Publications');
const publicationSections = sections.filter((section) => section?.title === 'Publications');
const posts = publicationSections
.flatMap((section) => section?.posts ?? [])
.map((post) => ({
@ -85,7 +84,10 @@ async function handler() {
const response = await ofetch(item.link);
const $ = load(response);
const content = $('div[class*="PostDetail_post-detail__"]');
const content = $('#main-content > article');
content
.find('[class$="__header"], [class$="__sidebar-container"], [class$="__controls"], [class$="__socialShare"], [class^="LandingPageSection-module-scss-module__"], [class^="SubjectNewsletter-module-scss-module__"]')
.remove();
content.find('img').each((_, e) => {
const $e = $(e);
$e.removeAttr('style srcset');