Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@
"dayjs": "1.11.13",
"db0": "^0.3.1",
"defu": "^6.1.4",
"fast-xml-parser": "^5.0.8",
"fast-xml-parser": "^5.3.3",
"framer-motion": "^12.4.7",
"h3": "^1.15.1",
"i18next": "^25.7.4",
"iconv-lite": "^0.6.3",
"jose": "^6.0.8",
"jotai": "^2.12.1",
Expand All @@ -57,6 +58,7 @@
"react": "^19.0.0",
"react-device-detect": "^2.2.3",
"react-dom": "^19.0.0",
"react-i18next": "^16.5.1",
"react-use": "^17.6.0",
"uncrypto": "^0.1.3",
"zod": "^3.24.2"
Expand Down
Binary file added public/icons/bbc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions public/icons/globe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions server/glob.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare module 'glob:./sources/{*.ts,**/index.ts}' {
export const _36kr: typeof import('./sources/_36kr')
export const baidu: typeof import('./sources/baidu')
export const bbc: typeof import('./sources/bbc')
export const bilibili: typeof import('./sources/bilibili')
export const cankaoxiaoxi: typeof import('./sources/cankaoxiaoxi')
export const chongbuluo: typeof import('./sources/chongbuluo')
Expand Down
38 changes: 38 additions & 0 deletions server/sources/bbc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { XMLParser } from "fast-xml-parser"
import type { NewsItem } from "@shared/types"
import { myFetch } from "#/utils/fetch.ts"

const hot = defineSource(async () => {
const parser = new XMLParser({
ignoreAttributes: false,
})
const xmlText = await myFetch(
"https://feeds.bbci.co.uk/news/rss.xml",
{ responseType: "text" },
)
if (!xmlText) {
return []
}
const parsed = parser.parse(xmlText)
const items = Array.isArray(parsed.rss.channel.item)
? parsed.rss.channel.item
: [parsed.rss.channel.item]
const news: NewsItem[] = []
for (const item of items) {
const url
= typeof item.link === "string"
? item.link
: item.link?.["#text"]
if (!url) continue
news.push({
id: item.guid ?? item.link,
title: item.title,
url,
})
}
return news
})

export default defineSource({
bbc: hot,
})
7 changes: 7 additions & 0 deletions shared/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,31 @@ import type { ColumnID, HiddenColumnID, Metadata, SourceID } from "./types"
export const columns = {
china: {
zh: "国内",
en: "china",
},
world: {
zh: "国际",
en: "world",
},
tech: {
zh: "科技",
en: "tech",
},
finance: {
zh: "财经",
en: "finance",
},
focus: {
zh: "关注",
en: "Focus",
},
realtime: {
zh: "实时",
en: "Realtime",
},
hottest: {
zh: "最热",
en: "Hottest",
},
} as const

Expand Down
1 change: 1 addition & 0 deletions shared/pinyin.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"bbc": "BBC",
"v2ex-share": "V2EX-zuixinfenxiang",
"zhihu": "zhihu",
"weibo": "weibo-shishiresou",
Expand Down
Loading