1 Commits
Author SHA1 Message Date
ZSCGRandGitHub 87ab79bc81 Update pinyin.json 2025-08-19 13:25:48 +08:00
5 changed files with 134 additions and 167 deletions
+6 -70
View File
@@ -1,29 +1,3 @@
interface NewApiVideoItem {
id: string;
title: string;
desc: string;
cover: string;
author: string;
timestamp: number; // 注意这是毫秒时间戳
hot: number;
url: string;
mobileUrl: string;
}
interface NewApiResponse {
code: number;
name: string;
title: string;
type: string;
description: string;
parameData: any; // 可以根据需要细化
link: string;
total: number;
updateTime: string;
fromCache: boolean;
data: NewApiVideoItem[]; // 核心数据在这里
}
interface WapRes {
code: number
exp_str: string
@@ -146,56 +120,18 @@ const hotVideo = defineSource(async () => {
})
const ranking = defineSource(async () => {
// 1. 使用新接口的 URL
const newUrl = "https://api-hot.chgr.cc/bilibili?limit=20"; // <--- 替换成新接口的实际地址
// 假设 myFetch 可以正确获取并解析新接口的 JSON
const newRes: NewApiResponse = await myFetch(newUrl);
const url = "https://api.bilibili.com/x/web-interface/ranking/v2"
const res: HotVideoRes = await myFetch(url)
// 2. 数据转换适配层:将 NewApiResponse 转换为符合 HotVideoRes['data']['list'] 结构的数组
// 注意:我们只需要构建 map 函数需要的部分即可,不需要严格创建完整的 HotVideoRes
const adaptedList = newRes.data.map(newItem => {
// 创建一个符合 map 函数内部访问 video 对象结构的临时对象
return {
bvid: newItem.id,
title: newItem.title,
pubdate: Math.floor(newItem.timestamp / 1000), // 将毫秒转为秒 (整数)
owner: {
name: newItem.author,
// 如果 map 中需要其他 owner 字段,需提供默认值
mid: 0,
face: '',
},
stat: {
view: newItem.hot, // 使用 hot 作为观看数 (近似值)
like: 0, // <--- 新接口没有点赞数,这里设置为 0
// 如果 map 中需要其他 stat 字段,需提供默认值
danmaku: 0, reply: 0, favorite: 0, coin: 0, share: 0, now_rank: 0, his_rank: 0, dislike: 0,
},
desc: newItem.desc,
pic: newItem.cover,
// --- 以下字段如果 map 中没有用到,可以不映射 ---
aid: 0, videos: 1, tid: 0, tname: 'N/A', copyright: 1, ctime: Math.floor(newItem.timestamp / 1000),
state: 0, duration: 0, dynamic: '', cid: 0, dimension: { width: 0, height: 0, rotate: 0 },
short_link: newItem.url, short_link_v2: newItem.url, rcmd_reason: { content: '', corner_mark: 0 },
};
});
// 3. 使用转换后的 adaptedList 进行 map 操作,这部分代码保持不变
// map 函数现在操作的是我们手动适配过的对象数组
return adaptedList.map(video => ({
return res.data.list.map(video => ({
id: video.bvid,
title: video.title,
url: `https://www.bilibili.com/video/${video.bvid}`, // 保持原来的 URL 拼接方式
// 或者,如果你想用新接口提供的 URL:
// url: video.short_link, // short_link 在适配层映射自 newItem.url
pubDate: video.pubdate * 1000, // 将秒转换回毫秒
url: `https://www.bilibili.com/video/${video.bvid}`,
pubDate: video.pubdate * 1000,
extra: {
// 注意:因为 like 设置为 0,这里的点赞数会显示为 0
info: `${video.owner.name} · ${formatNumber(video.stat.view)}观看 · ${formatNumber(video.stat.like)}点赞`,
// 如果不想显示点赞数,可以修改 info 的格式:
// info: `${video.owner.name} · ${formatNumber(video.stat.view)}观看`,
hover: video.desc,
icon: proxyPicture(video.pic), // pic 来源于 newItem.cover
icon: proxyPicture(video.pic),
},
}))
})
+1 -1
View File
@@ -32,7 +32,7 @@ interface Res {
}
const hot = defineSource(async () => {
const res = await myFetch<Res>("https://n8n.chgr.cc/webhook/api?name=linuxdo")
const res = await myFetch<Res>("https://linux.do/top/daily.json")
return res.topic_list.topics
.filter(k => k.visible && !k.archived && !k.pinned)
.map(k => ({
+2 -2
View File
@@ -36,7 +36,7 @@
"kaopu": "kaopuxinwen",
"jin10": "jinshishuju",
"baidu": "baiduresou",
"linuxdo-latest": "LINUX DO-zuixin",
"linuxdo-latest": "LINUX DO-zuixin",
"linuxdo-hot": "LINUX DO-jinrizuire",
"ghxi": "guoheboke",
"smzdm": "shenmezhidemai",
@@ -46,4 +46,4 @@
"ifeng": "fenghuangwang-redianzixun",
"chongbuluo-latest": "chongbuluo-zuixin",
"chongbuluo-hot": "chongbuluo-zuire"
}
}
+106 -93
View File
@@ -13,81 +13,6 @@ const Time = {
}
export const originSources = {
"bilibili": {
name: "哔哩哔哩",
color: "blue",
home: "https://www.bilibili.com",
sub: {
"hot-search": {
title: "热搜",
column: "china",
type: "hottest",
},
"ranking": {
title: "排行榜",
column: "china",
disable: "cf",
type: "hottest",
interval: Time.Common,
},
},
},
"linuxdo": {
name: "LINUX DO",
column: "tech",
color: "slate",
home: "https://linux.do/",
disable: "cf",
sub: {
latest: {
title: "最新",
home: "https://linux.do/latest",
},
hot: {
title: "今日最热",
type: "hottest",
interval: Time.Common,
home: "https://linux.do/hot",
},
},
},
"github": {
name: "Github",
color: "gray",
home: "https://github.com/",
column: "tech",
sub: {
"trending-today": {
title: "Today",
type: "hottest",
},
},
},
"douyin": {
name: "抖音",
type: "hottest",
column: "china",
color: "gray",
home: "https://www.douyin.com",
},
"kuaishou": {
name: "快手",
type: "hottest",
column: "china",
color: "orange",
// cloudflare pages cannot access
disable: "cf",
home: "https://www.kuaishou.com",
},
"weibo": {
name: "微博",
title: "实时热搜",
type: "hottest",
column: "china",
color: "red",
interval: Time.Realtime,
home: "https://weibo.com",
},
"v2ex": {
name: "V2EX",
color: "slate",
@@ -106,27 +31,14 @@ export const originSources = {
color: "blue",
home: "https://www.zhihu.com",
},
"juejin": {
name: "稀土掘金",
column: "tech",
color: "blue",
"weibo": {
name: "微博",
title: "实时热搜",
type: "hottest",
home: "https://juejin.cn",
},
"baidu": {
name: "百度热搜",
column: "china",
color: "blue",
type: "hottest",
home: "https://www.baidu.com",
},
"hupu": {
name: "虎扑",
home: "https://hupu.com",
column: "china",
title: "主干道热帖",
type: "hottest",
color: "red",
interval: Time.Realtime,
home: "https://weibo.com",
},
"zaobao": {
name: "联合早报",
@@ -181,6 +93,21 @@ export const originSources = {
},
},
},
"douyin": {
name: "抖音",
type: "hottest",
column: "china",
color: "gray",
home: "https://www.douyin.com",
},
"hupu": {
name: "虎扑",
home: "https://hupu.com",
column: "china",
title: "主干道热帖",
type: "hottest",
color: "red",
},
"tieba": {
name: "百度贴吧",
title: "热议",
@@ -323,6 +250,52 @@ export const originSources = {
type: "hottest",
home: "https://www.producthunt.com/",
},
"github": {
name: "Github",
color: "gray",
home: "https://github.com/",
column: "tech",
sub: {
"trending-today": {
title: "Today",
type: "hottest",
},
},
},
"bilibili": {
name: "哔哩哔哩",
color: "blue",
home: "https://www.bilibili.com",
sub: {
"hot-search": {
title: "热搜",
column: "china",
type: "hottest",
},
"hot-video": {
title: "热门视频",
disable: "cf",
column: "china",
type: "hottest",
},
"ranking": {
title: "排行榜",
column: "china",
disable: "cf",
type: "hottest",
interval: Time.Common,
},
},
},
"kuaishou": {
name: "快手",
type: "hottest",
column: "china",
color: "orange",
// cloudflare pages cannot access
disable: "cf",
home: "https://www.kuaishou.com",
},
"kaopu": {
name: "靠谱新闻",
column: "world",
@@ -338,12 +311,45 @@ export const originSources = {
type: "realtime",
home: "https://www.jin10.com",
},
"baidu": {
name: "百度热搜",
column: "china",
color: "blue",
type: "hottest",
home: "https://www.baidu.com",
},
"linuxdo": {
name: "LINUX DO",
column: "tech",
color: "slate",
home: "https://linux.do/",
disable: "cf",
sub: {
latest: {
title: "最新",
home: "https://linux.do/latest",
},
hot: {
title: "今日最热",
type: "hottest",
interval: Time.Common,
home: "https://linux.do/hot",
},
},
},
"ghxi": {
name: "果核剥壳",
column: "china",
color: "yellow",
home: "https://www.ghxi.com/",
},
"smzdm": {
name: "什么值得买",
column: "china",
color: "red",
type: "hottest",
home: "https://www.smzdm.com",
},
"nowcoder": {
name: "牛客",
column: "china",
@@ -358,6 +364,13 @@ export const originSources = {
type: "hottest",
home: "https://sspai.com",
},
"juejin": {
name: "稀土掘金",
column: "tech",
color: "blue",
type: "hottest",
home: "https://juejin.cn",
},
"ifeng": {
name: "凤凰网",
column: "china",
+19 -1
View File
@@ -353,6 +353,16 @@
"interval": 600000,
"title": "热搜"
},
"bilibili-hot-video": {
"name": "哔哩哔哩",
"type": "hottest",
"disable": "cf",
"column": "china",
"home": "https://www.bilibili.com",
"color": "blue",
"interval": 600000,
"title": "热门视频"
},
"bilibili-ranking": {
"name": "哔哩哔哩",
"type": "hottest",
@@ -432,6 +442,14 @@
"color": "yellow",
"interval": 600000
},
"smzdm": {
"name": "什么值得买",
"type": "hottest",
"column": "china",
"home": "https://www.smzdm.com",
"color": "red",
"interval": 600000
},
"nowcoder": {
"name": "牛客",
"type": "hottest",
@@ -491,4 +509,4 @@
"interval": 1800000,
"title": "最热"
}
}
}