From 9420473d41f04be608f640626e99cd5b8d49674e Mon Sep 17 00:00:00 2001 From: Ou Date: Fri, 25 Oct 2024 11:46:53 +0800 Subject: [PATCH] feat(source): add solidot.org --- public/icons/solidot.png | Bin 0 -> 2512 bytes server/glob.d.ts | 1 + server/sources/solidot.ts | 26 ++++++++++++++++++++++++++ shared/metadata.ts | 2 +- shared/sources.ts | 6 ++++++ 5 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 public/icons/solidot.png create mode 100644 server/sources/solidot.ts diff --git a/public/icons/solidot.png b/public/icons/solidot.png new file mode 100644 index 0000000000000000000000000000000000000000..02fd117d81cc8425c9894fd0b56ad267dec13329 GIT binary patch literal 2512 zcmV;>2`~1EP)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR91K%fHv1ONa40RR91KmY&$07g+lumAuFI!Q!9RCod9TYGF2MHv6~9;Gk( zI1W-k0TH3rLQ2H8K7yAJi6PDDbew$j1X3he2Z-?)B8x_5I$zvGrcQN|-M$b)JqP7;;-)7;Kvmnp>m9mwZ54g~ zd8-JD5lrj`sH{vQuXi2@ufXLrV$jR=to$;vT5GAUj{S&qiOm3RH#@WU!0kS1j=h8M z9eTu*RA0}|Q>s{{pc#1P%*XKCfQy}5s+3_6WG)pJo}iYNpJjv+?*Uque-*^5aam-T zBn?(oedq~qVMr_z9TH+aVD8*>x_WgZ6sf``ZnUIn-pxo+ShjLpcTic`7Q`S?r_AWe zu=4Hg^&mQ>o6U`K+e$e(Zu;PZPBVecdjNNP?Vq1!MkGbsZlkWQA}TI!pyp<;k&NaM zn%B!?zQPDuuRbp`lkOTdipCBfP9vO7a^&PtX1{)9@%K(WjQH!GudSs&&z*}Tq^cE| zs#%AHk&Rl7@epvkAH`JnA;5$jUKx~LG;=0RE-9g`^mHSBy;5IXT}{87IAKKF2R*82 z^X3hD0Qx;Zo9EX8A*%BH&#ss?ix#`xWV4!&C_Mp^P{%r~A-8+4UYroAAdh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*c+_(B=*BST0u+fip@{#khvQ0QN z&3QsmFmeh%e~Odh4@EmE&hke$07J16ii+)apP4H z5#$xoKABkqzmP4$Ac-)S{NCQ+P_&U8@&;f^|Dlhj%$=Z-**H$HS|_2IV}-uV9hmog zzbr9)F~;h})&m$bQ26YvcKq~N42!6#bO0@`JEydqxpMN>XCF?6YY_bDti+kaa59GP zhyr0??bBJCZGCV`YltJz5PuH{XY#-Ocskq={BHF5ysGk6avmVkyU{w~!7rfh6t1Lx aKL0Pu?DEvPU>m>y0000 { + const baseURL = "https://www.solidot.org/" + const html: any = await $fetch(baseURL) + const $ = cheerio.load(html) + const $main = $(".block_m") + const news: NewsItem[] = [] + $main.each((_, el) => { + const a = $(el).find(".bg_htit a") + const url = a.attr("href") + const title = a.text() + const date_raw = $(el).find(".talk_time").text().match(/发表于(.*?分)/)?.[1] + const date = date_raw?.replace(/[年月]/g, "-").replace("时", ":").replace(/[分日]/g, "") + if (url && title && date) { + news.push({ + url: baseURL + url, + title, + id: url, + pubDate: parseRelativeDate(date, "Asia/Shanghai").valueOf(), + }) + } + }) + return news +}) diff --git a/shared/metadata.ts b/shared/metadata.ts index 593b4ec..d57e032 100644 --- a/shared/metadata.ts +++ b/shared/metadata.ts @@ -15,7 +15,7 @@ const originMetadata: Metadata = { }, tech: { name: "科技", - sources: ["ithome", "v2ex", "coolapk"], + sources: ["ithome", "v2ex", "coolapk", "solidot"], }, finance: { name: "财经", diff --git a/shared/sources.ts b/shared/sources.ts index b18f0e1..e18f96d 100644 --- a/shared/sources.ts +++ b/shared/sources.ts @@ -185,6 +185,12 @@ export const originSources = { }, }, }, + "solidot": { + name: "Solidot", + color: "sky", + home: "https://solidot.org", + interval: Time.Slow, + }, } as const satisfies Record export const sources = genSources()