fix(route): lhratings.com research pdf links (#22866)

This commit is contained in:
Ethan Shen
2026-07-29 11:09:27 +08:00
committed by GitHub
parent 598cd9184f
commit 3645d3411d
+1 -2
View File
@@ -24,11 +24,10 @@ export const handler = async (ctx: Context): Promise<Data> => {
.toArray()
.map((el): Element => {
const $el: Cheerio<Element> = $(el);
const $aEl: Cheerio<Element> = $el.find('a').first();
const title: string = $el.find('h2').text();
const pubDateStr: string | undefined = $el.find('p').text().split('', 2)[1]?.trim();
const linkUrl: string | undefined = $aEl.attr('href') ? new URL($aEl.attr('href') ?? '', baseUrl).href : undefined;
const linkUrl: string | undefined = $el.attr('href') ? new URL($el.attr('href') ?? '', baseUrl).href : undefined;
const categoryEls: Array<Cheerio<Element>> = [$el.find('h3').contents()].filter(Boolean);
const categories: string[] = [...new Set(categoryEls.map((el) => $(el).text()).filter(Boolean))];
const image: string | undefined = $el.find('div.xylist_img img').attr('src') ? new URL($el.find('div.xylist_img img').attr('src') ?? '', baseUrl).href : undefined;