Skip to content

Commit 88095e7

Browse files
committed
chore: clean code
1 parent c1215b9 commit 88095e7

File tree

5 files changed

+46
-102
lines changed

5 files changed

+46
-102
lines changed

server/sources/iqiyi.ts

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import dayjs from "dayjs/esm"
21
import { myFetch } from "#/utils/fetch"
32
import { defineSource } from "#/utils/source"
43

@@ -46,68 +45,13 @@ const hotRankList = defineSource(async () => {
4645
})
4746

4847
return resp?.items[0]?.video[0]?.data.map((item) => {
49-
const creator = item.creator?.map(a => a.name).join(" ")
50-
const contributor = item.contributor?.map(a => a.name).join(" ")
51-
const info = [item.desc, creator, contributor].filter(Boolean).join("|")
5248
return {
5349
id: item.entity_id,
5450
title: item.title,
5551
url: item.page_url,
5652
pubDate: item?.showDate,
5753
extra: {
58-
info,
59-
hover: item.description,
60-
tag: item.tag,
61-
},
62-
}
63-
})
64-
})
65-
66-
interface WarpCartoon {
67-
code: number
68-
cname: string
69-
items: {
70-
order: number
71-
channel: string
72-
temp: any
73-
video: {
74-
basisDataUrls: string
75-
title: string
76-
block_id: string
77-
card_source: string
78-
links: any[]
79-
data: VideoInfo[]
80-
adverts: any[]
81-
config: any[]
82-
}[]
83-
lib_keys: any
84-
}[]
85-
extData: any
86-
}
87-
88-
const cartoonToday = defineSource(async () => {
89-
const url = "https://mesh.if.iqiyi.com/portal/lw/v7/channel/cartoon"
90-
const resp = await myFetch<WarpCartoon>(url, {
91-
headers: { Referer: "https://www.iqiyi.com" },
92-
})
93-
94-
// items[2] 为追番表数据
95-
const items = resp?.items[2]
96-
// 获取今天是一周的第几天
97-
const weekday = dayjs().day() || 7
98-
// 获取今天的追番表数据
99-
const videos = items?.video[weekday - 1] // 减去1是因为数组索引从0开始
100-
return videos?.data.map((item) => {
101-
const creator = item.creator?.map(a => a.name).join(" ")
102-
const contributor = item.contributor?.map(a => a.name).join(" ")
103-
const info = [item.desc, item.dq_updatestatus, creator, contributor].filter(Boolean).join("|")
104-
return {
105-
id: item.entity_id,
106-
title: item.title,
107-
url: item.page_url,
108-
pubDate: item?.showDate,
109-
extra: {
110-
info,
54+
info: item.desc,
11155
hover: item.description,
11256
tag: item.tag,
11357
},
@@ -117,5 +61,4 @@ const cartoonToday = defineSource(async () => {
11761

11862
export default defineSource({
11963
"iqiyi-hot-ranklist": hotRankList,
120-
"iqiyi-cartoon-today": cartoonToday,
12164
})

server/sources/qqvideo.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import dayjs from "dayjs/esm"
2-
import { myFetch } from "#/utils/fetch.ts"
3-
import { defineSource } from "#/utils/source.ts"
2+
import { myFetch } from "#/utils/fetch"
3+
import { defineSource } from "#/utils/source"
44

55
interface WapResp {
66
data: {
@@ -138,23 +138,12 @@ const hotSearch = defineSource(async () => {
138138
})
139139

140140
return resp?.data?.card?.children_list?.list?.cards?.map((item) => {
141-
const uni_imgtag = JSON.parse(item?.params?.uni_imgtag)
142-
// 去掉空值
143-
const info = [
144-
item?.params?.second_title,
145-
item?.params?.topic_label,
146-
uni_imgtag?.tag_2?.text,
147-
uni_imgtag?.tag_4?.text,
148-
]
149-
.filter(Boolean)
150-
.join(" ")
151141
return {
152142
id: item?.id,
153143
title: item?.params?.title,
154144
url: getQqVideoUrl(item?.id),
155145
pubDate: item?.params?.publish_date ?? getTodaySlash(),
156146
extra: {
157-
info,
158147
hover: item?.params?.sub_title,
159148
},
160149
}

shared/pinyin.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@
4747
"steam": "Steam-zaixianrenshu",
4848
"tencent-hot": "tengxunxinwen-zonghezaobao",
4949
"freebuf": "Freebuf-wangluoanquan",
50-
51-
"qqvideo-tv-hotsearch": "tengxunshipin-dianshiju-resoubang"
52-
53-
"iqiyi-hot-ranklist": "aiqiyi-rebobang",
54-
"iqiyi-cartoon-today": "aiqiyi-dongman-zhuifanbiao",
55-
56-
"youku-webcomic-today": "youku-dongman-zhuifanbiao"
50+
"qqvideo-tv-hotsearch": "tengxunshipin-dianshiju-resoubang",
51+
"iqiyi-hot-ranklist": "aiqiyi-rebobang"
5752
}

shared/pre-sources.ts

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -461,13 +461,13 @@ export const originSources = {
461461
home: "https://v.qq.com/",
462462
sub: {
463463
"tv-hotsearch": {
464-
title: "电视剧-热搜榜",
464+
title: "热搜榜",
465465
type: "hottest",
466466
interval: Time.Common,
467467
home: "https://v.qq.com/channel/tv",
468468

469-
}
470-
}
469+
},
470+
},
471471
},
472472
"iqiyi": {
473473
name: "爱奇艺",
@@ -481,26 +481,6 @@ export const originSources = {
481481
interval: Time.Common,
482482
home: "https://www.iqiyi.com",
483483
},
484-
"cartoon-today": {
485-
title: "动漫-追番表",
486-
type: "hottest",
487-
interval: Time.Slow,
488-
home: "https://www.iqiyi.com/comic",
489-
},
490-
},
491-
},
492-
"youku": {
493-
name: "优酷",
494-
column: "china",
495-
color: "blue",
496-
home: "https://www.youku.com/ku/webhome",
497-
sub: {
498-
"webcomic-today": {
499-
title: "动漫-追番表",
500-
type: "hottest",
501-
interval: Time.Slow,
502-
home: "https://www.youku.com/ku/webcomic",
503-
},
504484
},
505485
},
506486
} as const satisfies Record<string, OriginSource>

shared/sources.json

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,5 +526,42 @@
526526
"color": "green",
527527
"interval": 600000
528528
},
529-
529+
"qqvideo": {
530+
"redirect": "qqvideo-tv-hotsearch",
531+
"name": "腾讯视频",
532+
"type": "hottest",
533+
"column": "china",
534+
"home": "https://v.qq.com/channel/tv",
535+
"color": "blue",
536+
"interval": 1800000,
537+
"title": "电视剧-热搜榜"
538+
},
539+
"qqvideo-tv-hotsearch": {
540+
"name": "腾讯视频",
541+
"type": "hottest",
542+
"column": "china",
543+
"home": "https://v.qq.com/channel/tv",
544+
"color": "blue",
545+
"interval": 1800000,
546+
"title": "电视剧-热搜榜"
547+
},
548+
"iqiyi": {
549+
"redirect": "iqiyi-hot-ranklist",
550+
"name": "爱奇艺",
551+
"type": "hottest",
552+
"column": "china",
553+
"home": "https://www.iqiyi.com",
554+
"color": "green",
555+
"interval": 1800000,
556+
"title": "热播榜"
557+
},
558+
"iqiyi-hot-ranklist": {
559+
"name": "爱奇艺",
560+
"type": "hottest",
561+
"column": "china",
562+
"home": "https://www.iqiyi.com",
563+
"color": "green",
564+
"interval": 1800000,
565+
"title": "热播榜"
566+
}
530567
}

0 commit comments

Comments
 (0)