fix(route): add pdf files of nidc papers (#19478)

This commit is contained in:
Ethan Shen 2025-06-28 00:38:33 +08:00 committed by GitHub
parent ac86c0de14
commit 91131a7e36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 0 deletions

View File

@ -62,6 +62,22 @@ async function handler(ctx) {
const content = load(detailResponse.data);
item.description = content('div.qrd-content').html();
const $enclosureEl = content('div.report-bottom a').first();
const enclosureUrl = $enclosureEl.attr('href');
if (enclosureUrl) {
const enclosureItem = {
enclosure_url: new URL(enclosureUrl, rootUrl).href,
enclosure_type: `application/${enclosureUrl.split(/\./).pop() ?? 'pdf'}`,
enclosure_title: $enclosureEl.prev().text(),
};
item = {
...item,
...enclosureItem,
};
}
return item;
})
)