diff --git a/lib/routes/1point3acres/offer.tsx b/lib/routes/1point3acres/offer.tsx index b5dce3bf8..ebfc7315c 100644 --- a/lib/routes/1point3acres/offer.tsx +++ b/lib/routes/1point3acres/offer.tsx @@ -32,7 +32,7 @@ export const route: Route = { 2. 打开控制台 3. 切换到 Network 面板 4. 点击 搜索 按钮 - 5. 点击 results?ps=15\&pg=1 POST 请求 + 5. 点击 results?ps=15&pg=1 POST 请求 6. 找到 Request Payload 请求参数,例如 \`filters: {planyr: "13", planmajor: "1", outname_w: "ACADIAU"}\` ,则三个 id 分别为: 13,1,ACADIAU :::`, }; diff --git a/lib/routes/3dmgame/news-center.ts b/lib/routes/3dmgame/news-center.ts index d106acbd0..716fddc77 100644 --- a/lib/routes/3dmgame/news-center.ts +++ b/lib/routes/3dmgame/news-center.ts @@ -31,7 +31,7 @@ export const route: Route = { handler, description: `| 新闻推荐 | 游戏新闻 | 动漫影视 | 智能数码 | 时事焦点 | | -------- | -------- | -------- | -------- | ----------- | -| | game | acg | next | news\_36\_1 |`, +| | game | acg | next | news_36_1 |`, }; async function handler(ctx) { diff --git a/lib/routes/56kog/class.ts b/lib/routes/56kog/class.ts index 8d7fe4ecc..cf003c08c 100644 --- a/lib/routes/56kog/class.ts +++ b/lib/routes/56kog/class.ts @@ -21,11 +21,11 @@ export const route: Route = { handler, description: `| [玄幻魔法](https://www.56kog.com/class/1_1.html) | [武侠修真](https://www.56kog.com/class/2_1.html) | [历史军事](https://www.56kog.com/class/4_1.html) | [侦探推理](https://www.56kog.com/class/5_1.html) | [网游动漫](https://www.56kog.com/class/6_1.html) | | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | -| 1\_1 | 2\_1 | 4\_1 | 5\_1 | 6\_1 | +| 1_1 | 2_1 | 4_1 | 5_1 | 6_1 | | [恐怖灵异](https://www.56kog.com/class/8_1.html) | [都市言情](https://www.56kog.com/class/3_1.html) | [科幻](https://www.56kog.com/class/7_1.html) | [女生小说](https://www.56kog.com/class/9_1.html) | [其他](https://www.56kog.com/class/10_1.html) | | ------------------------------------------------ | ------------------------------------------------ | -------------------------------------------- | ------------------------------------------------ | --------------------------------------------- | -| 8\_1 | 3\_1 | 7\_1 | 9\_1 | 10\_1 |`, +| 8_1 | 3_1 | 7_1 | 9_1 | 10_1 |`, }; async function handler(ctx) { diff --git a/lib/routes/7mmtv/index.tsx b/lib/routes/7mmtv/index.tsx index 9e429346a..0024f279c 100644 --- a/lib/routes/7mmtv/index.tsx +++ b/lib/routes/7mmtv/index.tsx @@ -34,11 +34,11 @@ export const route: Route = { | Chinese subtitles AV | Censored | Amateur | Uncensored | Asian self-timer | H comics | | -------------------- | -------------- | ---------------- | ---------------- | ---------------- | ------------ | -| chinese\_list | censored\_list | amateurjav\_list | uncensored\_list | amateur\_list | hcomic\_list | +| chinese_list | censored_list | amateurjav_list | uncensored_list | amateur_list | hcomic_list | | Chinese subtitles AV random | Censored random | Amateur random | Uncensored random | Asian self-timer random | H comics random | | --------------------------- | ---------------- | ------------------ | ------------------ | ----------------------- | --------------- | -| chinese\_random | censored\_random | amateurjav\_random | uncensored\_random | amateur\_random | hcomic\_random | +| chinese_random | censored_random | amateurjav_random | uncensored_random | amateur_random | hcomic_random | **Server** diff --git a/lib/routes/91porn/index.ts b/lib/routes/91porn/index.ts index 2f76cefd4..184864e2d 100644 --- a/lib/routes/91porn/index.ts +++ b/lib/routes/91porn/index.ts @@ -34,7 +34,7 @@ export const route: Route = { url: '91porn.com/index.php', description: `| English | 简体中文 | 繁體中文 | | ------- | -------- | -------- | -| en\_US | cn\_CN | zh\_ZH |`, +| en_US | cn_CN | zh_ZH |`, }; async function handler(ctx) { diff --git a/lib/routes/atcoder/contest.ts b/lib/routes/atcoder/contest.ts index 270a9689a..c6add824f 100644 --- a/lib/routes/atcoder/contest.ts +++ b/lib/routes/atcoder/contest.ts @@ -23,7 +23,7 @@ export const route: Route = { handler, description: `Rated Range -| ABC Class (Rated for \~1999) | ARC Class (Rated for \~2799) | AGC Class (Rated for \~9999) | +| ABC Class (Rated for ~1999) | ARC Class (Rated for ~2799) | AGC Class (Rated for ~9999) | | ---------------------------- | ---------------------------- | ---------------------------- | | 1 | 2 | 3 | diff --git a/lib/routes/bilibili/app.ts b/lib/routes/bilibili/app.ts index 408e846e8..2d0d3d403 100644 --- a/lib/routes/bilibili/app.ts +++ b/lib/routes/bilibili/app.ts @@ -27,7 +27,7 @@ export const route: Route = { handler, description: `| 安卓版 | iPhone 版 | iPad HD 版 | UWP 版 | TV 版 | | ------- | --------- | ---------- | ------ | ---------------- | -| android | iphone | ipad | win | android\_tv\_yst |`, +| android | iphone | ipad | win | android_tv_yst |`, }; async function handler(ctx) { diff --git a/lib/routes/bilibili/cache.ts b/lib/routes/bilibili/cache.ts index 85f5cbc7b..63c3a201f 100644 --- a/lib/routes/bilibili/cache.ts +++ b/lib/routes/bilibili/cache.ts @@ -91,7 +91,7 @@ const getWbiVerifyString = () => { }); const imgUrl = navResponse.data.wbi_img.img_url; const subUrl = navResponse.data.wbi_img.sub_url; - const r = imgUrl.substring(imgUrl.lastIndexOf('/') + 1, imgUrl.length).split('.')[0] + subUrl.substring(subUrl.lastIndexOf('/') + 1, subUrl.length).split('.')[0]; + const r = imgUrl.slice(imgUrl.lastIndexOf('/') + 1).split('.')[0] + subUrl.slice(subUrl.lastIndexOf('/') + 1).split('.')[0]; // const { body: spaceResponse } = await got('https://space.bilibili.com/1', { // headers: { // Referer: 'https://www.bilibili.com/', diff --git a/lib/routes/bilibili/link-news.ts b/lib/routes/bilibili/link-news.ts index 3a43bc62b..e3846aeda 100644 --- a/lib/routes/bilibili/link-news.ts +++ b/lib/routes/bilibili/link-news.ts @@ -34,6 +34,8 @@ async function handler(ctx) { case 'wh': productTitle = '相簿'; break; + default: + throw new Error(`Unknown product: ${product}`); } const response = await got({ diff --git a/lib/routes/bilibili/live-area.ts b/lib/routes/bilibili/live-area.ts index d19530615..ed5b0791e 100644 --- a/lib/routes/bilibili/live-area.ts +++ b/lib/routes/bilibili/live-area.ts @@ -34,6 +34,8 @@ async function handler(ctx) { case 'online': orderTitle = '人气直播'; break; + default: + throw new Error(`Unknown order: ${order}`); } const nameResponse = await got({ diff --git a/lib/routes/bilibili/live-search.ts b/lib/routes/bilibili/live-search.ts index e06e4b826..ef7e7480e 100644 --- a/lib/routes/bilibili/live-search.ts +++ b/lib/routes/bilibili/live-search.ts @@ -36,6 +36,8 @@ async function handler(ctx) { case 'online': orderTitle = '人气直播'; break; + default: + throw new Error(`Unknown order: ${order}`); } const wbiVerifyString = await cache.getWbiVerifyString(); let params = `__refresh__=true&_extra=&context=&page=1&page_size=42&order=${order}&duration=&from_source=&from_spmid=333.337&platform=pc&highlight=1&single_column=0&keyword=${urlEncodedKey}&ad_resource=&source_tag=3&gaia_vtoken=&category_id=&search_type=live&dynamic_offset=0&web_location=1430654`; diff --git a/lib/routes/bossdesign/index.ts b/lib/routes/bossdesign/index.ts index fa4db84ce..28f8e4a61 100644 --- a/lib/routes/bossdesign/index.ts +++ b/lib/routes/bossdesign/index.ts @@ -21,7 +21,7 @@ export const route: Route = { handler, description: `| Boss 笔记 | 电脑日志 | 素材资源 | 设计师神器 | 设计教程 | 设计资讯 | | --------- | --------------- | ---------------- | --------------- | --------------- | ------------------- | -| note | computer-skills | design-resources | design-software | design-tutorial | design\_information |`, +| note | computer-skills | design-resources | design-software | design-tutorial | design_information |`, }; async function handler(ctx) { diff --git a/lib/routes/bse/index.ts b/lib/routes/bse/index.ts index 96a3d1712..77e0b4421 100644 --- a/lib/routes/bse/index.ts +++ b/lib/routes/bse/index.ts @@ -144,23 +144,23 @@ export const route: Route = { url: 'bse.cn/', description: `| 本所要闻 | 人才招聘 | 采购信息 | 业务通知 | | --------------- | -------- | -------- | ---------- | -| important\_news | recruit | purchase | news\_list | +| important_news | recruit | purchase | news_list | | 法律法规 | 公开征求意见 | 部门规章 | 发行融资 | | --------- | --------------- | ---------------- | ---------- | -| law\_list | public\_opinion | regulation\_list | fxrz\_list | +| law_list | public_opinion | regulation_list | fxrz_list | | 持续监管 | 交易管理 | 市场管理 | 上市委会议公告 | | ---------- | ---------- | ---------- | --------------- | -| cxjg\_list | jygl\_list | scgl\_list | meeting\_notice | +| cxjg_list | jygl_list | scgl_list | meeting_notice | | 上市委会议结果公告 | 上市委会议变更公告 | 并购重组委会议公告 | | ------------------ | ------------------ | ------------------ | -| meeting\_result | meeting\_change | bgcz\_notice | +| meeting_result | meeting_change | bgcz_notice | | 并购重组委会议结果公告 | 并购重组委会议变更公告 | 终止审核 | 注册结果 | | ---------------------- | ---------------------- | ------------------ | ------------- | -| bgcz\_result | bgcz\_change | termination\_audit | audit\_result |`, +| bgcz_result | bgcz_change | termination_audit | audit_result |`, }; async function handler(ctx) { @@ -187,7 +187,7 @@ async function handler(ctx) { let items = []; - switch (nodes[category].type) { + switch (type) { case '/info/listse': items = data.data.content.map((item) => ({ title: item.title, @@ -205,6 +205,9 @@ async function handler(ctx) { pubDate: parseDate(item.pubDate.time), })); break; + + default: + throw new Error(`Unknown type: ${type}`); } return { diff --git a/lib/routes/caixin/category.ts b/lib/routes/caixin/category.ts index ba2d71265..7a6f19533 100644 --- a/lib/routes/caixin/category.ts +++ b/lib/routes/caixin/category.ts @@ -36,13 +36,13 @@ export const route: Route = { | 监管 | 银行 | 证券基金 | 信托保险 | 投资 | 创新 | 市场 | | ---------- | ---- | -------- | ---------------- | ---------- | ---------- | ------ | -| regulation | bank | stock | insurance\_trust | investment | innovation | market | +| regulation | bank | stock | insurance_trust | investment | innovation | market | Category 列表: | 封面报道 | 开卷 | 社论 | 时事 | 编辑寄语 | 经济 | 金融 | 商业 | 环境与科技 | 民生 | 副刊 | | ---------- | ----- | --------- | ---------------- | ------------ | ------- | ------- | -------- | ----------------------- | ------- | ------ | -| coverstory | first | editorial | current\_affairs | editor\_desk | economy | finance | business | environment\_technology | cwcivil | column |`, +| coverstory | first | editorial | current_affairs | editor_desk | economy | finance | business | environment_technology | cwcivil | column |`, }; async function handler(ctx) { diff --git a/lib/routes/ccf/news.ts b/lib/routes/ccf/news.ts index 98daceb06..99f634eb9 100644 --- a/lib/routes/ccf/news.ts +++ b/lib/routes/ccf/news.ts @@ -29,7 +29,7 @@ export const route: Route = { handler, description: `| CCF 新闻 | CCF 聚焦 | ACM 信息 | | ----------- | -------- | --------- | -| Media\_list | Focus | ACM\_News |`, +| Media_list | Focus | ACM_News |`, }; async function handler(ctx) { diff --git a/lib/routes/chaoxing/qk.tsx b/lib/routes/chaoxing/qk.tsx index 9fe9c5020..18e962e13 100644 --- a/lib/routes/chaoxing/qk.tsx +++ b/lib/routes/chaoxing/qk.tsx @@ -25,7 +25,7 @@ export const route: Route = { description: `::: tip 全部期刊可以在 [这里](http://qk.chaoxing.com/space/index) 找到,你也可以从 [学科分类](https://qikan.chaoxing.com/jourclassify) 和 [期刊导航](https://qikan.chaoxing.com/search/openmag) 中发现更多期刊。 - 如订阅 [**上海文艺**](http://m.chaoxing.com/mqk/list?sw=\&mags=6b5c39b3dd84352be512e29df0297437\&isort=20\&from=space),其 URL 为 \`http://m.chaoxing.com/mqk/list?mags=6b5c39b3dd84352be512e29df0297437\`。\`6b5c39b3dd84352be512e29df0297437\` 即为期刊 id,所得路由为 [\`/chaoxing/qk/6b5c39b3dd84352be512e29df0297437\`](https://rsshub.app/chaoxing/qk/6b5c39b3dd84352be512e29df0297437) + 如订阅 [**上海文艺**](http://m.chaoxing.com/mqk/list?sw=&mags=6b5c39b3dd84352be512e29df0297437&isort=20&from=space),其 URL 为 \`http://m.chaoxing.com/mqk/list?mags=6b5c39b3dd84352be512e29df0297437\`。\`6b5c39b3dd84352be512e29df0297437\` 即为期刊 id,所得路由为 [\`/chaoxing/qk/6b5c39b3dd84352be512e29df0297437\`](https://rsshub.app/chaoxing/qk/6b5c39b3dd84352be512e29df0297437) ::: ::: warning diff --git a/lib/routes/coolapk/utils.ts b/lib/routes/coolapk/utils.ts index 607ce5f77..b225b9496 100644 --- a/lib/routes/coolapk/utils.ts +++ b/lib/routes/coolapk/utils.ts @@ -9,7 +9,7 @@ const dynamicTpye = { 0: '基本动态', 8: '酷图', 9: '评论', 10: '提问', const getRandomDEVICE_ID = () => { let id = [10, 6, 6, 6, 14]; - id = id.map((i) => Math.random().toString(36).substring(2, i)); + id = id.map((i) => Math.random().toString(36).slice(2, i)); return id.join('-'); }; diff --git a/lib/routes/douban/channel/subject.ts b/lib/routes/douban/channel/subject.ts index 2575783ad..1b0ff5eaf 100644 --- a/lib/routes/douban/channel/subject.ts +++ b/lib/routes/douban/channel/subject.ts @@ -60,6 +60,8 @@ async function handler(ctx) { case '3': nav_name = '唱片'; break; + default: + throw new Error(`Unknown nav: ${nav}`); } return { diff --git a/lib/routes/douban/other/explore-column.ts b/lib/routes/douban/other/explore-column.ts index c5a502da7..5f0955aa2 100644 --- a/lib/routes/douban/other/explore-column.ts +++ b/lib/routes/douban/other/explore-column.ts @@ -1,5 +1,3 @@ -import * as url from 'node:url'; - import { load } from 'cheerio'; import type { Route } from '@/types'; @@ -15,7 +13,7 @@ export const route: Route = { async function handler(ctx) { const id = ctx.req.param('id'); - const link = url.resolve(host, id); + const link = new URL(id, host).href; const response = await got.get(link); const $ = load(response.data); const title = $('div.h1').text(); diff --git a/lib/routes/douban/other/list.ts b/lib/routes/douban/other/list.ts index 24a48bd27..40bc5613b 100644 --- a/lib/routes/douban/other/list.ts +++ b/lib/routes/douban/other/list.ts @@ -28,24 +28,24 @@ export const route: Route = { handler, description: `| 榜单 / 集合 | 路由 | | ------------------ | ----------------------------- | -| 实时热门书影音 | subject\_real\_time\_hotest | -| 影院热映 | movie\_showing | -| 实时热门电影 | movie\_real\_time\_hotest | -| 实时热门电视 | tv\_real\_time\_hotest | -| 一周口碑电影榜 | movie\_weekly\_best | -| 华语口碑剧集榜 | tv\_chinese\_best\_weekly | -| 全球口碑剧集榜 | tv\_global\_best\_weekly | -| 国内口碑综艺榜 | show\_chinese\_best\_weekly | -| 国外口碑综艺榜 | show\_global\_best\_weekly | -| 热播新剧国产剧 | tv\_domestic | -| 热播新剧欧美剧 | tv\_american | -| 热播新剧日剧 | tv\_japanese | -| 热播新剧韩剧 | tv\_korean | -| 热播新剧动画 | tv\_animation | -| 虚构类小说热门榜 | book\_fiction\_hot\_weekly | -| 非虚构类小说热门榜 | book\_nonfiction\_hot\_weekly | -| 热门单曲榜 | music\_single | -| 华语新碟榜 | music\_chinese | +| 实时热门书影音 | subject_real_time_hotest | +| 影院热映 | movie_showing | +| 实时热门电影 | movie_real_time_hotest | +| 实时热门电视 | tv_real_time_hotest | +| 一周口碑电影榜 | movie_weekly_best | +| 华语口碑剧集榜 | tv_chinese_best_weekly | +| 全球口碑剧集榜 | tv_global_best_weekly | +| 国内口碑综艺榜 | show_chinese_best_weekly | +| 国外口碑综艺榜 | show_global_best_weekly | +| 热播新剧国产剧 | tv_domestic | +| 热播新剧欧美剧 | tv_american | +| 热播新剧日剧 | tv_japanese | +| 热播新剧韩剧 | tv_korean | +| 热播新剧动画 | tv_animation | +| 虚构类小说热门榜 | book_fiction_hot_weekly | +| 非虚构类小说热门榜 | book_nonfiction_hot_weekly | +| 热门单曲榜 | music_single | +| 华语新碟榜 | music_chinese | | ... | ... | | 额外参数 | 含义 | 接受的值 | 默认值 | diff --git a/lib/routes/douban/other/weekly-best.tsx b/lib/routes/douban/other/weekly-best.tsx index 3909b5dd4..9775f5082 100644 --- a/lib/routes/douban/other/weekly-best.tsx +++ b/lib/routes/douban/other/weekly-best.tsx @@ -21,7 +21,7 @@ export const route: Route = { handler, description: `| 一周口碑电影榜 | 华语口碑剧集榜 | | ------------------- | ------------------------- | -| movie\_weekly\_best | tv\_chinese\_best\_weekly |`, +| movie_weekly_best | tv_chinese_best_weekly |`, }; async function handler(ctx) { diff --git a/lib/routes/earthquake/ceic.ts b/lib/routes/earthquake/ceic.ts index b9ad819d3..7c482c05f 100644 --- a/lib/routes/earthquake/ceic.ts +++ b/lib/routes/earthquake/ceic.ts @@ -77,7 +77,7 @@ async function handler(ctx) { const response = await got(api); const data = response.data.replace(/,"page":"(.*?)","num":/, ',"num":'); - let json = JSON.parse(data.substring(1, data.length - 1)).shuju; + let json = JSON.parse(data.slice(1, -1)).shuju; if (json.length > 20) { json = json.slice(0, 20); } diff --git a/lib/routes/ehentai/namespace.ts b/lib/routes/ehentai/namespace.ts index 65b118d97..6d99c96e3 100644 --- a/lib/routes/ehentai/namespace.ts +++ b/lib/routes/ehentai/namespace.ts @@ -7,6 +7,6 @@ export const namespace: Namespace = { | Key | Meaning | Accepted keys | Default value | | ------------ | ------------------------------------------------------------------------------- | -------------- | ------------- | | bittorrent | Whether include a link to the latest torrent | 0/1/true/false | false | -| embed\_thumb | Whether the cover image is embedded in the RSS feed rather than given as a link | 0/1/true/false | false |`, +| embed_thumb | Whether the cover image is embedded in the RSS feed rather than given as a link | 0/1/true/false | false |`, lang: 'en', }; diff --git a/lib/routes/ekantipur/issue.ts b/lib/routes/ekantipur/issue.ts index 63181c3f8..b3107fb93 100644 --- a/lib/routes/ekantipur/issue.ts +++ b/lib/routes/ekantipur/issue.ts @@ -31,7 +31,7 @@ export const route: Route = { | समाचार | अर्थ / वाणिज्य | विचार | खेलकुद | उपत्यका | मनोरञ्जन | फोटोफिचर | फिचर | विश्व | ब्लग | | ---- | -------- | ------- | ------ | -------- | ------------- | -------------- | ------- | ----- | ---- | -| news | business | opinion | sports | national | entertainment | photo\_feature | feature | world | blog |`, +| news | business | opinion | sports | national | entertainment | photo_feature | feature | world | blog |`, }; async function handler(ctx) { diff --git a/lib/routes/fantia/search.ts b/lib/routes/fantia/search.ts index 78a386c65..945e031b2 100644 --- a/lib/routes/fantia/search.ts +++ b/lib/routes/fantia/search.ts @@ -134,7 +134,7 @@ export const route: Route = { | 更新の新しい順 | 更新の古い順 | 投稿の新しい順 | 投稿の古い順 | お気に入り数順 | | -------------- | ------------ | -------------- | ------------ | -------------- | -| updater | update\_old | newer | create\_old | popular | +| updater | update_old | newer | create_old | popular | Rating @@ -201,6 +201,9 @@ async function handler(ctx) { description: `${item.buyable_lowest_plan.description ? `

${item.buyable_lowest_plan.description}

` : ''}`, })); break; + + default: + throw new Error(`Unknown type: ${type}`); } return { diff --git a/lib/routes/flyert/creditcard.ts b/lib/routes/flyert/creditcard.ts index ea92ab34e..4ff98ade6 100644 --- a/lib/routes/flyert/creditcard.ts +++ b/lib/routes/flyert/creditcard.ts @@ -117,6 +117,9 @@ async function handler(ctx) { break; case 'intcreditcard': bankname = '境外信用卡'; + break; + default: + throw new Error(`Unknown bank: ${bank}`); } const response = await got.get(target, { diff --git a/lib/routes/gcores/parser.ts b/lib/routes/gcores/parser.ts index 4fc13d65c..e7e6c9feb 100644 --- a/lib/routes/gcores/parser.ts +++ b/lib/routes/gcores/parser.ts @@ -196,9 +196,9 @@ const parseBlock = (block: Block, entityMap: Readonly>): let lastOffset = 0; for (const range of groupedRanges) { - resultParts.push(text.substring(lastOffset, range.offset)); + resultParts.push(text.slice(lastOffset, range.offset)); - let styledText = text.substring(range.offset, range.offset + range.length); + let styledText = text.slice(range.offset, range.offset + range.length); if (range.styles.length > 0) { const combinedStyle: Style = {}; diff --git a/lib/routes/gelonghui/home.ts b/lib/routes/gelonghui/home.ts index 083cdd877..9f3a2aa97 100644 --- a/lib/routes/gelonghui/home.ts +++ b/lib/routes/gelonghui/home.ts @@ -36,7 +36,7 @@ export const route: Route = { handler, description: `| 推荐 | 股票 | 基金 | 新股 | 研报 | | --------------- | ----- | ---- | ---------- | -------- | -| web\_home\_page | stock | fund | new\_stock | research |`, +| web_home_page | stock | fund | new_stock | research |`, }; async function handler(ctx) { diff --git a/lib/routes/github/search.ts b/lib/routes/github/search.ts index d591edea9..4ce75effc 100644 --- a/lib/routes/github/search.ts +++ b/lib/routes/github/search.ts @@ -1,5 +1,3 @@ -import * as url from 'node:url'; - import type { DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; @@ -39,7 +37,7 @@ async function handler(ctx) { } const suffix = 'search?o='.concat(order, '&q=', encodeURIComponent(query), '&s=', sort, '&type=Repositories'); - const link = url.resolve(host, suffix); + const link = new URL(suffix, host).href; const response = await ofetch(link, { headers: { accept: 'application/json', diff --git a/lib/routes/github/topic.ts b/lib/routes/github/topic.ts index 61ef585ed..74d1b9616 100644 --- a/lib/routes/github/topic.ts +++ b/lib/routes/github/topic.ts @@ -32,7 +32,7 @@ export const route: Route = { | \`o\` | Sorting Order | \`asc\`, \`desc\` | | \`s\` | Sorting Criteria | \`stars\`, \`forks\`, \`updated\` | - For instance, the \`/github/topics/framework/l=php&o=desc&s=stars\` route will generate the RSS feed corresponding to this [page](https://github.com/topics/framework?l=php\&o=desc\&s=stars).`, + For instance, the \`/github/topics/framework/l=php&o=desc&s=stars\` route will generate the RSS feed corresponding to this [page](https://github.com/topics/framework?l=php&o=desc&s=stars).`, }; async function handler(ctx) { diff --git a/lib/routes/google/scholar.ts b/lib/routes/google/scholar.ts index 23d9f571e..fe0cce432 100644 --- a/lib/routes/google/scholar.ts +++ b/lib/routes/google/scholar.ts @@ -25,7 +25,7 @@ export const route: Route = { 1. Basic mode, sample query is the keywords desired, eg.「data visualization」, [https://rsshub.app/google/scholar/data+visualization](https://rsshub.app/google/scholar/data+visualization). - 2. Advanced mode, visit [Google Scholar](https://scholar.google.com/schhp?hl=en\&as_sdt=0,5), click the top left corner and select「Advanced Search」, fill in your conditions and submit the search. The URL should look like this: [https://scholar.google.com/scholar?as\_q=data+visualization\&as\_epq=\&as\_oq=\&as\_eq=\&as\_occt=any\&as\_sauthors=\&as\_publication=\&as\_ylo=2018\&as\_yhi=\&hl=en\&as\_sdt=0%2C5](https://scholar.google.com/scholar?as_q=data+visualization\&as_epq=\&as_oq=\&as_eq=\&as_occt=any\&as_sauthors=\&as_publication=\&as_ylo=2018\&as_yhi=\&hl=en\&as_sdt=0%2C5), copy everything after \`https://scholar.google.com/scholar?\` from the URL and use it as the query for this route. The complete URL for the above example should look like this: [https://rsshub.app/google/scholar/as\_q=data+visualization\&as\_epq=\&as\_oq=\&as\_eq=\&as\_occt=any\&as\_sauthors=\&as\_publication=\&as\_ylo=2018\&as\_yhi=\&hl=en\&as\_sdt=0%2C5](https://rsshub.app/google/scholar/as_q=data+visualization\&as_epq=\&as_oq=\&as_eq=\&as_occt=any\&as_sauthors=\&as_publication=\&as_ylo=2018\&as_yhi=\&hl=en\&as_sdt=0%2C5).`, + 2. Advanced mode, visit [Google Scholar](https://scholar.google.com/schhp?hl=en&as_sdt=0,5), click the top left corner and select「Advanced Search」, fill in your conditions and submit the search. The URL should look like this: [https://scholar.google.com/scholar?as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=en&as_sdt=0%2C5](https://scholar.google.com/scholar?as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=en&as_sdt=0%2C5), copy everything after \`https://scholar.google.com/scholar?\` from the URL and use it as the query for this route. The complete URL for the above example should look like this: [https://rsshub.app/google/scholar/as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=en&as_sdt=0%2C5](https://rsshub.app/google/scholar/as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=en&as_sdt=0%2C5).`, }; async function handler(ctx) { diff --git a/lib/routes/gov/chongqing/gzw.ts b/lib/routes/gov/chongqing/gzw.ts index 479d0069d..bca2db4ba 100644 --- a/lib/routes/gov/chongqing/gzw.ts +++ b/lib/routes/gov/chongqing/gzw.ts @@ -23,7 +23,7 @@ export const route: Route = { ], description: `| 通知公告 | 国企资讯 | 国企简介 | 国企招聘 | | --------- | -------- | -------- | -------- | -| tzgg\_191 | gqdj | gqjj | gqzp |`, +| tzgg_191 | gqdj | gqjj | gqzp |`, }; async function handler(ctx) { diff --git a/lib/routes/gov/maoming/maoming.ts b/lib/routes/gov/maoming/maoming.ts index 916b21494..bde7c1822 100644 --- a/lib/routes/gov/maoming/maoming.ts +++ b/lib/routes/gov/maoming/maoming.ts @@ -98,6 +98,8 @@ async function handler(ctx) { case undefined: list_element = '#d11_li ul a[href*="content"], .two-o ul a[href*="content"]'; break; + default: + break; } break; case 'zwgk': @@ -110,10 +112,16 @@ async function handler(ctx) { case undefined: list_element = '.swiper-slide a, .bt a, .zcjdlist a'; break; + default: + break; } break; + default: + break; } break; + default: + break; } title_element = '#ScDetailTitle'; description_element = '#zoomcon'; @@ -143,8 +151,12 @@ async function handler(ctx) { case undefined: list_element = '.zw-news-list a'; break; + default: + break; } break; + default: + break; } title_element = '.title'; description_element = '.content'; @@ -170,6 +182,8 @@ async function handler(ctx) { case 'xwzx': list_element = '.news_title li a, .news_title_ li a'; break; + default: + break; } } title_element = '.article_title'; @@ -233,6 +247,8 @@ async function handler(ctx) { case 'zwxx': list_element = '.marqueetop a, .gud-file ul li a, .dyn-box ul li a, .org-list a'; break; + default: + break; } } title_element = '.pre-box h3'; @@ -287,6 +303,8 @@ async function handler(ctx) { list_element = '.img a'; } break; + default: + break; } title_element = '.bt'; title_match = '(.*)\n'; @@ -365,6 +383,8 @@ async function handler(ctx) { pubDate_element = '.HTime'; pubDate_match = '发布日期:(.*)   点击率'; break; + default: + throw new Error(`Unknown path[1]: ${path[1]}`); } const info = { pathstartat, diff --git a/lib/routes/gov/maonan/maonan.ts b/lib/routes/gov/maonan/maonan.ts index e9a0ca486..bbdb67c19 100644 --- a/lib/routes/gov/maonan/maonan.ts +++ b/lib/routes/gov/maonan/maonan.ts @@ -62,6 +62,8 @@ async function handler(ctx) { id = 'zwgk/zcjd'; name = '政策解读'; break; + default: + throw new Error(`Unknown category: ${ctx.req.param('category')}`); } const res = await got(`${host}/${id}/`); @@ -111,6 +113,8 @@ async function handler(ctx) { author: content('.author').text().trim() === '本网' ? '茂名市茂南区人民政府网' : content('.author').text().trim(), }; } + default: + throw new Error(`Unknown host: ${url.host}`); } }); }) diff --git a/lib/routes/gov/moe/moe.ts b/lib/routes/gov/moe/moe.ts index 6334ebc71..edb672d56 100644 --- a/lib/routes/gov/moe/moe.ts +++ b/lib/routes/gov/moe/moe.ts @@ -33,7 +33,7 @@ export const route: Route = { handler, description: `| 政策解读 | 最新文件 | 公告公示 | 教育部简报 | 教育要闻 | | :----------: | :----------: | :------: | :-----------------: | :--------------: | -| policy\_anal | newest\_file | notice | edu\_ministry\_news | edu\_focus\_news |`, +| policy_anal | newest_file | notice | edu_ministry_news | edu_focus_news |`, }; async function handler(ctx) { diff --git a/lib/routes/gov/nea/ghs.ts b/lib/routes/gov/nea/ghs.ts index adae6b0b7..e94ce83f7 100644 --- a/lib/routes/gov/nea/ghs.ts +++ b/lib/routes/gov/nea/ghs.ts @@ -1,5 +1,3 @@ -import { URL } from 'node:url'; - import { load } from 'cheerio'; import type { DataItem, Route } from '@/types'; diff --git a/lib/routes/greasyfork/scripts.ts b/lib/routes/greasyfork/scripts.ts index e9ee07e2a..ec6b0724b 100644 --- a/lib/routes/greasyfork/scripts.ts +++ b/lib/routes/greasyfork/scripts.ts @@ -28,7 +28,7 @@ export const route: Route = { description: `| Sort | Description | | --------------- | -------------- | | today | Daily installs | -| total\_installs | Total installs | +| total_installs | Total installs | | ratings | Ratings | | created | Created date | | updated | Updated date | diff --git a/lib/routes/guangdiu/index.ts b/lib/routes/guangdiu/index.ts index 83bfe2e78..a321261ba 100644 --- a/lib/routes/guangdiu/index.ts +++ b/lib/routes/guangdiu/index.ts @@ -24,7 +24,7 @@ export const route: Route = { maintainers: ['Fatpandac'], handler, description: `::: tip - 海外折扣: [\`/guangdiu/k=daily&c=us\`](https://rsshub.app/guangdiu/k=daily\&c=us) + 海外折扣: [\`/guangdiu/k=daily&c=us\`](https://rsshub.app/guangdiu/k=daily&c=us) :::`, }; diff --git a/lib/routes/hafu/utils.tsx b/lib/routes/hafu/utils.tsx index 77911f1e0..bfe3e8376 100644 --- a/lib/routes/hafu/utils.tsx +++ b/lib/routes/hafu/utils.tsx @@ -104,7 +104,7 @@ async function ggtzParse(ctx, $) { author = header.slice(0, index - 2) || ''; - const date = header.substring(index + 3, index + 19); + const date = header.slice(index + 3, index + 19); pubDate = parseDate(date, 'YYYY-MM-DD HH:mm'); } else { const date = $(item).find('a[class=c269582_date]').text(); diff --git a/lib/routes/hellobtc/kepu.ts b/lib/routes/hellobtc/kepu.ts index 0607a6f4b..c69590e5d 100644 --- a/lib/routes/hellobtc/kepu.ts +++ b/lib/routes/hellobtc/kepu.ts @@ -46,7 +46,7 @@ export const route: Route = { name: '科普', maintainers: ['Fatpandac'], handler, - description: `| latest | bitcoin | ethereum | defi | inter\_blockchain | mining | safety | satoshi\_nakomoto | public\_blockchain | + description: `| latest | bitcoin | ethereum | defi | inter_blockchain | mining | safety | satoshi_nakomoto | public_blockchain | | ------ | ------- | -------- | ---- | ----------------- | ------ | ------ | ----------------- | ------------------ | | 最新 | 比特币 | 以太坊 | DeFi | 跨链 | 挖矿 | 安全 | 中本聪 | 公链 |`, }; diff --git a/lib/routes/hongkong/dh.ts b/lib/routes/hongkong/dh.ts index e92ec10ef..a07dea3b1 100644 --- a/lib/routes/hongkong/dh.ts +++ b/lib/routes/hongkong/dh.ts @@ -31,7 +31,7 @@ export const route: Route = { | English | 中文简体 | 中文繁體 | | ------- | -------- | -------- | -| english | chs | tc\_chi |`, +| english | chs | tc_chi |`, }; async function handler(ctx) { diff --git a/lib/routes/hunau/xky/index.ts b/lib/routes/hunau/xky/index.ts index f4fdcab4f..c0580e91e 100644 --- a/lib/routes/hunau/xky/index.ts +++ b/lib/routes/hunau/xky/index.ts @@ -27,7 +27,7 @@ export const route: Route = { url: 'xky.hunau.edu.cn/', description: `| 分类 | 通知公告 | 学院新闻 | 其他分类通知... | | ---- | ---------- | -------- | --------------- | -| 参数 | tzgg\_8472 | xyxw | 对应 URL |`, +| 参数 | tzgg_8472 | xyxw | 对应 URL |`, }; async function handler(ctx) { diff --git a/lib/routes/informedainews/docs.ts b/lib/routes/informedainews/docs.ts deleted file mode 100644 index fbf9646dc..000000000 --- a/lib/routes/informedainews/docs.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { load } from 'cheerio'; // 类似 jQuery 的 API HTML 解析器 - -import type { Route } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; // 统一使用的请求库 -import { parseDate } from '@/utils/parse-date'; - -export const route: Route = { - path: '/zh-Hans/docs/:type', - categories: ['new-media'], - example: '/informedainews/zh-Hans/docs/world-news-daily', - parameters: { type: 'world-news-daily|tech-enthusiast-weekly|ai-enthusiast-daily' }, - features: { - requireConfig: false, - requirePuppeteer: false, - antiCrawler: false, - supportBT: false, - supportPodcast: false, - supportScihub: false, - }, - radar: [ - { - source: ['informedainews.com', 'informedainews.com/zh-Hans/docs/:type', 'informedainews.com/docs/:type'], - target: '/zh-Hans/docs/:type', - }, - ], - name: '知闻AI', - maintainers: ['guicaiyue'], - handler, -}; - -async function handler(ctx) { - const { type } = ctx.req.param(); - const response = await ofetch(`https://informedainews.com/zh-Hans/docs/${type}`); - const $ = load(response); - const list = $('li.theme-doc-sidebar-item-category ul li') - .toArray() - .map((item) => { - item = $(item); - const a = item.find('a').first(); - const text = a.text(); - // 找到第一个'('字符的位置 - const start = text.indexOf('('); - // 找到第一个')'字符的位置 - const end = text.indexOf(')'); - // 从第一个'('到第一个')'之间的子字符串就是日期 - const date = text.substring(start + 1, end); - return { - title: text, - link: `https://informedainews.com${a.attr('href')}`, - pubDate: parseDate(date), - author: 'AI', - }; - }); - - const items = await Promise.all( - list.map((item) => - cache.tryGet(item.link, async () => { - const response = await ofetch(item.link); - const $ = load(response); - - // 选择类名为“comment-body”的第一个元素 - item.description = $('.theme-doc-markdown.markdown').first().html(); - - // 上面每个列表项的每个属性都在此重用, - // 并增加了一个新属性“description” - return item; - }) - ) - ); - return { - // 源标题 - title: `${type} docs`, - // 源链接 - link: `https://informedainews.com/zh-Hans/docs/${type}`, - // 源文章 - item: items, - }; -} diff --git a/lib/routes/informedainews/namespace.ts b/lib/routes/informedainews/namespace.ts deleted file mode 100644 index 7526998b1..000000000 --- a/lib/routes/informedainews/namespace.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { Namespace } from '@/types'; - -export const namespace: Namespace = { - name: 'Informed AI News', - url: 'informedainews.com', - description: ` -::: tip -informed AI RSS feeds: - -- World News Daily: 'https://rsshub.app/informedainews/zh-Hans/docs/world-news-daily' -- Tech Enthusiast Weekly: 'https://rsshub.app/informedainews/zh-Hans/docs/tech-enthusiast-weekly' -- AI Enthusiast Weekly: 'https://rsshub.app/informedainews/zh-Hans/docs/ai-enthusiast-daily' -:::`, - - zh: { - name: '知闻AI', - }, - lang: 'en', -}; diff --git a/lib/routes/japanpost/utils.ts b/lib/routes/japanpost/utils.ts index fe8fec433..be5eac182 100644 --- a/lib/routes/japanpost/utils.ts +++ b/lib/routes/japanpost/utils.ts @@ -63,6 +63,8 @@ const utils = { case 'en': customFormat = dayjs(t, formatEnDate, true).isValid() ? formatEnDate : dayjs(t, formatEnDateTime, true).isValid() ? formatEnDateTime : undefined; break; + default: + // empty } if (o) { diff --git a/lib/routes/javdb/namespace.ts b/lib/routes/javdb/namespace.ts index 1c79c3289..219919577 100644 --- a/lib/routes/javdb/namespace.ts +++ b/lib/routes/javdb/namespace.ts @@ -6,7 +6,7 @@ export const namespace: Namespace = { description: `::: tip JavDB 有多个备用域名,本路由默认使用永久域名 \`https://javdb.com\` ,若该域名无法访问,可以通过在路由最后加上 \`?domain=<域名>\` 指定路由访问的域名。如指定备用域名为 \`https://javdb36.com\`,则在所有 JavDB 路由最后加上 \`?domain=javdb36.com\` 即可,此时路由为 [\`/javdb?domain=javdb36.com\`](https://rsshub.app/javdb?domain=javdb36.com) -如果加入了 **分類** 参数,直接在分類参数后加入 \`?domain=<域名>\` 即可。如指定分類 URL 为 \`https://javdb.com/tags?c2=5&c10=1\` 并指定备用域名为 \`https://javdb36.com\`,即在 \`/javdb/tags/c2=5&c10=1\` 最后加上 \`?domain=javdb36.com\`,此时路由为 [\`/javdb/tags/c2=5&c10=1?domain=javdb36.com\`](https://rsshub.app/javdb/tags/c2=5\&c10=1?domain=javdb36.com) +如果加入了 **分類** 参数,直接在分類参数后加入 \`?domain=<域名>\` 即可。如指定分類 URL 为 \`https://javdb.com/tags?c2=5&c10=1\` 并指定备用域名为 \`https://javdb36.com\`,即在 \`/javdb/tags/c2=5&c10=1\` 最后加上 \`?domain=javdb36.com\`,此时路由为 [\`/javdb/tags/c2=5&c10=1?domain=javdb36.com\`](https://rsshub.app/javdb/tags/c2=5&c10=1?domain=javdb36.com) **排行榜**、**搜索**、**演員**、**片商** 参数同适用于 **分類** 参数的上述规则 ::: diff --git a/lib/routes/jiemian/lists.ts b/lib/routes/jiemian/lists.ts index 49909a574..60c2d5c67 100644 --- a/lib/routes/jiemian/lists.ts +++ b/lib/routes/jiemian/lists.ts @@ -87,7 +87,7 @@ export const route: Route = { | [正午](https://www.jiemian.com/lists/53.html) | [箭厂](https://www.jiemian.com/video/lists/195_1.html) | | --------------------------------------------- | ------------------------------------------------------ | -| 53 | video/lists/195\_1 | +| 53 | video/lists/195_1 | #### [快报](https://www.jiemian.com/lists/4.html) diff --git a/lib/routes/jiemian/video.ts b/lib/routes/jiemian/video.ts index 6c6fa0619..24e000f40 100644 --- a/lib/routes/jiemian/video.ts +++ b/lib/routes/jiemian/video.ts @@ -11,9 +11,9 @@ export const route: Route = { handler, description: `| [界面 Vnews](https://www.jiemian.com/video/lists/258_1.html) | [直播](https://www.jiemian.com/videoLive/lists_1.html) | [箭厂](https://www.jiemian.com/video/lists/195_1.html) | [面谈](https://www.jiemian.com/video/lists/111_1.html) | [品牌创酷](https://www.jiemian.com/video/lists/226_1.html) | [番 茄社](https://www.jiemian.com/video/lists/567_1.html) | | ------------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ---------------------------------------------------------- | --------------------------------------------------------- | -| 258\_1 | videoLive/lists\_1 | 195\_1 | 111\_1 | 226\_1 | 567\_1 | +| 258_1 | videoLive/lists_1 | 195_1 | 111_1 | 226_1 | 567_1 | | [商业微史记](https://www.jiemian.com/video/lists/882_1.html) | | ------------------------------------------------------------ | -| 882\_1 |`, +| 882_1 |`, }; diff --git a/lib/routes/leiphone/utils.ts b/lib/routes/leiphone/utils.ts index f219995f0..8c15a44f3 100644 --- a/lib/routes/leiphone/utils.ts +++ b/lib/routes/leiphone/utils.ts @@ -1,5 +1,3 @@ -import * as url from 'node:url'; - import { load } from 'cheerio'; import got from '@/utils/got'; @@ -10,7 +8,7 @@ const ProcessFeed = async (list, cache) => { const items = await Promise.all( list.map(async (e) => { - const link = url.resolve(host, e); + const link = new URL(e, host).href; const single = await cache.tryGet(link, async () => { const response = await got.get(link); diff --git a/lib/routes/linkedin/cn/index.ts b/lib/routes/linkedin/cn/index.ts index ef3e42555..276f05bd2 100644 --- a/lib/routes/linkedin/cn/index.ts +++ b/lib/routes/linkedin/cn/index.ts @@ -31,7 +31,7 @@ export const route: Route = { | \`period\` | 发布时间 | \`1/7/30\` | 空 | 例如: - [\`/linkedin/cn/jobs/Software?location=shanghai&period=1\`](https://rsshub.app/linkedin/cn/jobs/Software?location=shanghai\&period=1): 查找所有在上海的今日发布的所有 Software 工作 + [\`/linkedin/cn/jobs/Software?location=shanghai&period=1\`](https://rsshub.app/linkedin/cn/jobs/Software?location=shanghai&period=1): 查找所有在上海的今日发布的所有 Software 工作 **为了方便起见,建议您在 [LinkedIn.cn](https://www.linkedin.cn/incareer/jobs/search) 上进行搜索,并使用 [RSSHub Radar](https://github.com/DIYgod/RSSHub-Radar) 加载特定的 feed。**`, }; diff --git a/lib/routes/lxixsxa/jsonp-helper.ts b/lib/routes/lxixsxa/jsonp-helper.ts index 81d3e1edd..0fa2f5211 100644 --- a/lib/routes/lxixsxa/jsonp-helper.ts +++ b/lib/routes/lxixsxa/jsonp-helper.ts @@ -2,7 +2,7 @@ function parseJSONP(jsonpData) { try { const startPos = jsonpData.indexOf('({'); const endPos = jsonpData.lastIndexOf('})'); - let jsonString = jsonpData.substring(startPos + 1, endPos + 1); + let jsonString = jsonpData.slice(startPos + 1, endPos + 1); // remove escaped single quotes since they are not valid json jsonString = jsonString.replaceAll(String.raw`\'`, "'"); diff --git a/lib/routes/manhuagui/subscribe.tsx b/lib/routes/manhuagui/subscribe.tsx index 25834b196..a13b68c97 100644 --- a/lib/routes/manhuagui/subscribe.tsx +++ b/lib/routes/manhuagui/subscribe.tsx @@ -39,7 +39,7 @@ export const route: Route = { url: 'www.mhgui.com/user/book/shelf', description: `::: tip 个人订阅需要自建 - 环境变量需要添加 MHGUI\_COOKIE + 环境变量需要添加 MHGUI_COOKIE :::`, }; diff --git a/lib/routes/medsci/index.ts b/lib/routes/medsci/index.ts index 93e0c498f..c8553a58b 100644 --- a/lib/routes/medsci/index.ts +++ b/lib/routes/medsci/index.ts @@ -24,7 +24,7 @@ export const route: Route = { description: `::: tip 下表为科室对应的 sid,若想获得 tid,可以到对应科室页面 URL 中寻找 \`t_id\` 字段的值,下面是一个例子: - 如 [肿瘤 - NSCLC](https://www.medsci.cn/department/details?s_id=5\&t_id=277) 的 URL 为 \`https://www.medsci.cn/department/details?s_id=5&t_id=277\`,可以看到此时 \`s_id\` 对应 \`sid\` 的值为 5, \`t_id\` 对应 \`tid\` 的值为 277,所以可以得到路由 [\`/medsci/5/277\`](https://rsshub.app/medsci/5/277) + 如 [肿瘤 - NSCLC](https://www.medsci.cn/department/details?s_id=5&t_id=277) 的 URL 为 \`https://www.medsci.cn/department/details?s_id=5&t_id=277\`,可以看到此时 \`s_id\` 对应 \`sid\` 的值为 5, \`t_id\` 对应 \`tid\` 的值为 277,所以可以得到路由 [\`/medsci/5/277\`](https://rsshub.app/medsci/5/277) ::: | 心血管 | 内分泌 | 消化 | 呼吸 | 神经科 | diff --git a/lib/routes/metacritic/release.ts b/lib/routes/metacritic/release.ts index a5f2f37e3..9990ea292 100644 --- a/lib/routes/metacritic/release.ts +++ b/lib/routes/metacritic/release.ts @@ -18,6 +18,9 @@ const handler = async (ctx) => { type = 'available'; title = 'All Releases'; break; + default: + // defaults to 'new-releases' + break; } const url = `https://www.metacritic.com/browse/games/release-date/${type}/${ctx.req.param('platform')}/${sort}`; diff --git a/lib/routes/modian/zhongchou.ts b/lib/routes/modian/zhongchou.ts index eece4feca..cef711845 100644 --- a/lib/routes/modian/zhongchou.ts +++ b/lib/routes/modian/zhongchou.ts @@ -33,7 +33,7 @@ export const route: Route = { | 最新上线 | 金额最高 | 评论最多 | | --------- | ---------- | ------------ | -| top\_time | top\_money | top\_comment | +| top_time | top_money | top_comment | 状态 diff --git a/lib/routes/mrm/index.ts b/lib/routes/mrm/index.ts index fd3e6dbf0..4dfae6f6a 100644 --- a/lib/routes/mrm/index.ts +++ b/lib/routes/mrm/index.ts @@ -23,7 +23,7 @@ export const route: Route = { handler, description: `| 交易通知 | 政策规定 | 业务通知 | | ------------ | -------------------- | ----------------- | -| zonghezixun3 | zhengceguiding\_list | yewutongzhi\_list |`, +| zonghezixun3 | zhengceguiding_list | yewutongzhi_list |`, }; async function handler(ctx) { diff --git a/lib/routes/ncc-cma/cmdp.tsx b/lib/routes/ncc-cma/cmdp.tsx index 39dc973af..4643b7b5a 100644 --- a/lib/routes/ncc-cma/cmdp.tsx +++ b/lib/routes/ncc-cma/cmdp.tsx @@ -127,19 +127,19 @@ export const route: Route = { | 气温距平(最近10天) | 气温距平(最近20天) | 气温距平(最近30天) | 气温距平(最近90天) | 最低气温距平(最近30天) | | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------------------------------------------ | -| [glbtmeana10\_](https://rsshub.app/ncc-cma/cmdp/image/glbtmeana10_) | [glbtmeana20\_](https://rsshub.app/ncc-cma/cmdp/image/glbtmeana20_) | [glbtmeana30\_](https://rsshub.app/ncc-cma/cmdp/image/glbtmeana30_) | [glbtmeana90\_](https://rsshub.app/ncc-cma/cmdp/image/glbtmeana90_) | [glbtmina30\_](https://rsshub.app/ncc-cma/cmdp/image/glbtmina30_) | +| [glbtmeana10_](https://rsshub.app/ncc-cma/cmdp/image/glbtmeana10_) | [glbtmeana20_](https://rsshub.app/ncc-cma/cmdp/image/glbtmeana20_) | [glbtmeana30_](https://rsshub.app/ncc-cma/cmdp/image/glbtmeana30_) | [glbtmeana90_](https://rsshub.app/ncc-cma/cmdp/image/glbtmeana90_) | [glbtmina30_](https://rsshub.app/ncc-cma/cmdp/image/glbtmina30_) | | 最低气温距平(最近90天) | 最高气温距平(最近30天) | 最高气温距平(最近90天) | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| [glbtmina90\_](https://rsshub.app/ncc-cma/cmdp/image/glbtmina90_) | [glbtmaxa30\_](https://rsshub.app/ncc-cma/cmdp/image/glbtmaxa30_) | [glbtmaxa90\_](https://rsshub.app/ncc-cma/cmdp/image/glbtmaxa90_) | +| [glbtmina90_](https://rsshub.app/ncc-cma/cmdp/image/glbtmina90_) | [glbtmaxa30_](https://rsshub.app/ncc-cma/cmdp/image/glbtmaxa30_) | [glbtmaxa90_](https://rsshub.app/ncc-cma/cmdp/image/glbtmaxa90_) | | 降水量(最近10天) | 降水量(最近20天) | 降水量(最近30天) | 降水量(最近90天) | 降水距平百分率(最近10天) | | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------ | -| [glbrain10\_](https://rsshub.app/ncc-cma/cmdp/image/glbrain10_) | [glbrain20\_](https://rsshub.app/ncc-cma/cmdp/image/glbrain20_) | [glbrain30\_](https://rsshub.app/ncc-cma/cmdp/image/glbrain30_) | [glbrain90\_](https://rsshub.app/ncc-cma/cmdp/image/glbrain90_) | [glbraina10\_](https://rsshub.app/ncc-cma/cmdp/image/glbraina10_) | +| [glbrain10_](https://rsshub.app/ncc-cma/cmdp/image/glbrain10_) | [glbrain20_](https://rsshub.app/ncc-cma/cmdp/image/glbrain20_) | [glbrain30_](https://rsshub.app/ncc-cma/cmdp/image/glbrain30_) | [glbrain90_](https://rsshub.app/ncc-cma/cmdp/image/glbrain90_) | [glbraina10_](https://rsshub.app/ncc-cma/cmdp/image/glbraina10_) | | 降水距平百分率(最近20天) | 降水距平百分率(最近30天) | 降水距平百分率(最近90天) | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| [glbraina20\_](https://rsshub.app/ncc-cma/cmdp/image/glbraina20_) | [glbraina30\_](https://rsshub.app/ncc-cma/cmdp/image/glbraina30_) | [glbraina90\_](https://rsshub.app/ncc-cma/cmdp/image/glbraina90_) | +| [glbraina20_](https://rsshub.app/ncc-cma/cmdp/image/glbraina20_) | [glbraina30_](https://rsshub.app/ncc-cma/cmdp/image/glbraina30_) | [glbraina90_](https://rsshub.app/ncc-cma/cmdp/image/glbraina90_) | `, categories: ['forecast'], diff --git a/lib/routes/neu/bmie.ts b/lib/routes/neu/bmie.ts index 66d8c7243..22a88e985 100644 --- a/lib/routes/neu/bmie.ts +++ b/lib/routes/neu/bmie.ts @@ -45,19 +45,19 @@ export const route: Route = { | ----------------------- | ---------- | | news | 学院新闻 | | academic | 学术科研 | -| talent\_development | 人才培养 | -| international\_exchange | 国际交流 | +| talent_development | 人才培养 | +| international_exchange | 国际交流 | | announcement | 通知公告 | -| undergraduate\_dev | 本科生培养 | -| postgraduate\_dev | 研究生培养 | -| undergraduate\_recruit | 本科生招募 | -| postgraduate\_recruit | 研究生招募 | -| CPC\_build | 党的建设 | -| CPC\_work | 党委工作 | -| union\_work | 工会工作 | -| CYL\_work | 共青团工作 | -| security\_management | 安全管理 | -| alumni\_style | 校友风采 |`, +| undergraduate_dev | 本科生培养 | +| postgraduate_dev | 研究生培养 | +| undergraduate_recruit | 本科生招募 | +| postgraduate_recruit | 研究生招募 | +| CPC_build | 党的建设 | +| CPC_work | 党委工作 | +| union_work | 工会工作 | +| CYL_work | 共青团工作 | +| security_management | 安全管理 | +| alumni_style | 校友风采 |`, }; async function handler(ctx) { @@ -84,11 +84,11 @@ async function handler(ctx) { const info = $($('.ny_con p')[1]).text(); const s = info.search(/\d{4}-\d{2}-\d{2}/); - const date = info.substring(s, s + 10); + const date = info.slice(s, s + 10); const au_start = info.indexOf('作者:') + 3; const au_end = info.lastIndexOf('|'); - const auhor = info.substring(au_start, au_end).trim(); + const auhor = info.slice(au_start, au_end).trim(); $('.entry') .find('span') .each(function () { diff --git a/lib/routes/newrank/namespace.ts b/lib/routes/newrank/namespace.ts index 3be235f00..9e51ce412 100644 --- a/lib/routes/newrank/namespace.ts +++ b/lib/routes/newrank/namespace.ts @@ -4,7 +4,7 @@ export const namespace: Namespace = { name: '新榜', url: 'newrank.cn', description: `::: warning -部署时需要配置 NEWRANK\_COOKIE,具体见部署文档 +部署时需要配置 NEWRANK_COOKIE,具体见部署文档 请勿过高频抓取,新榜疑似对每天调用 token 总次数进行了限制,超限会报错 :::`, lang: 'zh-CN', diff --git a/lib/routes/nio/nioradio.ts b/lib/routes/nio/nioradio.ts index 1adc7c38f..7b4f7695b 100644 --- a/lib/routes/nio/nioradio.ts +++ b/lib/routes/nio/nioradio.ts @@ -1,5 +1,3 @@ -import { URLSearchParams } from 'node:url'; - import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/njnu/ceai/ceai.ts b/lib/routes/njnu/ceai/ceai.ts index fc9b6af10..fa8fb40f6 100644 --- a/lib/routes/njnu/ceai/ceai.ts +++ b/lib/routes/njnu/ceai/ceai.ts @@ -43,6 +43,8 @@ async function handler(ctx) { title = '学生资讯'; path = '1659'; break; + default: + throw new Error(`Unknown type: ${type}`); } const base = 'http://ceai.njnu.edu.cn/Item/List.asp?ID=' + path; diff --git a/lib/routes/njnu/jwc/jwc.ts b/lib/routes/njnu/jwc/jwc.ts index 63141e6bc..9df6aa2b2 100644 --- a/lib/routes/njnu/jwc/jwc.ts +++ b/lib/routes/njnu/jwc/jwc.ts @@ -42,6 +42,9 @@ async function handler(ctx) { case 'xstz': title = '学生通知'; path = 'xstz.htm'; + break; + default: + throw new Error(`Unknown type: ${type}`); } const base = 'http://jwc.njnu.edu.cn/index/' + path; diff --git a/lib/routes/nju/admission.ts b/lib/routes/nju/admission.ts index 4fecc0a4a..0ba564d6f 100644 --- a/lib/routes/nju/admission.ts +++ b/lib/routes/nju/admission.ts @@ -44,7 +44,7 @@ async function handler() { const start = script.indexOf('['); const end = script.lastIndexOf(']'); - const t = JSON.parse(script.substring(start, end + 1)); + const t = JSON.parse(script.slice(start, end + 1)); // only read first page return t[0].infolist.map((item) => ({ diff --git a/lib/routes/nju/hosptial.ts b/lib/routes/nju/hosptial.ts index c8b20e757..878e96934 100644 --- a/lib/routes/nju/hosptial.ts +++ b/lib/routes/nju/hosptial.ts @@ -44,7 +44,7 @@ async function handler() { const start = script.indexOf('['); const end = script.lastIndexOf(']'); - const t = JSON.parse(script.substring(start, end + 1)); + const t = JSON.parse(script.slice(start, end + 1)); // only read first page return t[0].infolist.map((item) => ({ diff --git a/lib/routes/nju/zcc.ts b/lib/routes/nju/zcc.ts index 96a7043a0..00ff1d8e6 100644 --- a/lib/routes/nju/zcc.ts +++ b/lib/routes/nju/zcc.ts @@ -44,7 +44,7 @@ async function handler() { const start = script.indexOf('['); const end = script.lastIndexOf(']'); - const t = JSON.parse(script.substring(start, end + 1)); + const t = JSON.parse(script.slice(start, end + 1)); // only read first page return t[0].infolist.map((item) => ({ diff --git a/lib/routes/njust/gs.ts b/lib/routes/njust/gs.ts index 5e430eb92..7709e79b2 100644 --- a/lib/routes/njust/gs.ts +++ b/lib/routes/njust/gs.ts @@ -32,7 +32,7 @@ export const route: Route = { handler, description: `| 首页通知公告 | 首页新闻动态 | 最新通知 | 招生信息 | 培养信息 | 学术活动 | | ------------ | ------------ | -------- | -------- | -------- | -------- | -| sytzgg\_4568 | sytzgg | 14686 | 14687 | 14688 | xshdggl |`, +| sytzgg_4568 | sytzgg | 14686 | 14687 | 14688 | xshdggl |`, }; async function handler(ctx) { diff --git a/lib/routes/notefolio/search.tsx b/lib/routes/notefolio/search.tsx index 5b720213a..6cf26f560 100644 --- a/lib/routes/notefolio/search.tsx +++ b/lib/routes/notefolio/search.tsx @@ -202,6 +202,9 @@ async function handler(ctx) { case 'three-month': startTime = dayjs().subtract(90, 'd').startOf('d').format('YYYY-MM-DDTHH:mm:ss.SSS'); break; + + default: + throw new Error(`Unknown time: ${time}`); } searchUrl += `&publishedAt=${startTime}Z&publishedAt=${endTime}Z`; } diff --git a/lib/routes/now/news.ts b/lib/routes/now/news.ts index 916c30f99..19202ec18 100644 --- a/lib/routes/now/news.ts +++ b/lib/routes/now/news.ts @@ -46,7 +46,7 @@ export const route: Route = { description: `::: tip **编号** 仅对事件追蹤、評論節目、新聞專題三个分类起作用,例子如下: - 对于 [事件追蹤](https://news.now.com/home/tracker) 中的 [塔利班奪權](https://news.now.com/home/tracker/detail?catCode=123\&topicId=1056) 话题,其网址为 \`https://news.now.com/home/tracker/detail?catCode=123&topicId=1056\`,其中 \`topicId\` 为 1056,则对应路由为 [\`/now/news/tracker/1056\`](https://rsshub.app/now/news/tracker/1056) + 对于 [事件追蹤](https://news.now.com/home/tracker) 中的 [塔利班奪權](https://news.now.com/home/tracker/detail?catCode=123&topicId=1056) 话题,其网址为 \`https://news.now.com/home/tracker/detail?catCode=123&topicId=1056\`,其中 \`topicId\` 为 1056,则对应路由为 [\`/now/news/tracker/1056\`](https://rsshub.app/now/news/tracker/1056) ::: | 首頁 | 港聞 | 兩岸國際 | 娛樂 | diff --git a/lib/routes/nowcoder/jobcenter.ts b/lib/routes/nowcoder/jobcenter.ts index b07544680..e7882faf4 100644 --- a/lib/routes/nowcoder/jobcenter.ts +++ b/lib/routes/nowcoder/jobcenter.ts @@ -1,5 +1,3 @@ -import * as url from 'node:url'; - import { load } from 'cheerio'; import type { Route } from '@/types'; @@ -78,7 +76,7 @@ async function handler(ctx) { } return { title: `${company.text()} | ${title.text()}`, - link: url.resolve(rootUrl, title.attr('href')), + link: new URL(title.attr('href'), rootUrl).href, pubDate: date.toUTCString(), }; }); diff --git a/lib/routes/nuist/namespace.ts b/lib/routes/nuist/namespace.ts index 461660d65..2cdb79563 100644 --- a/lib/routes/nuist/namespace.ts +++ b/lib/routes/nuist/namespace.ts @@ -10,7 +10,7 @@ export const namespace: Namespace = { 以[南信大信息公告栏](https://bulletin.nuist.edu.cn)为例,点开任意一个栏目 -获得 URL 中的**分域名**和**栏目编号(可选)**:https\://\`bulletin\`.nuist.edu.cn/\`791\`/list.htm +获得 URL 中的**分域名**和**栏目编号(可选)**:https://\`bulletin\`.nuist.edu.cn/\`791\`/list.htm 将其替换到 RSS 路由地址中即可: diff --git a/lib/routes/oo-software/changelog.ts b/lib/routes/oo-software/changelog.ts index db97a7408..8f4f43e0e 100644 --- a/lib/routes/oo-software/changelog.ts +++ b/lib/routes/oo-software/changelog.ts @@ -22,10 +22,10 @@ export const route: Route = { handler, description: `| Software | Id | | --------------- | ----------- | -| O\&O ShutUp10++ | shutup10 | -| O\&O AppBuster | ooappbuster | -| O\&O Lanytix | oolanytix | -| O\&O DeskInfo | oodeskinfo |`, +| O&O ShutUp10++ | shutup10 | +| O&O AppBuster | ooappbuster | +| O&O Lanytix | oolanytix | +| O&O DeskInfo | oodeskinfo |`, }; async function handler(ctx) { diff --git a/lib/routes/parliament/section77.ts b/lib/routes/parliament/section77.ts index 753fdd9b9..e86cc96b0 100644 --- a/lib/routes/parliament/section77.ts +++ b/lib/routes/parliament/section77.ts @@ -22,7 +22,7 @@ export const route: Route = { name: "Thailand Parliament Draft of Law's public hearing system", maintainers: ['itpcc'], handler, - description: `| Presented by MP \* | Presented by People \* | Hearing Ongoing | Hearing ended | Hearing result reported | Waiting for PM approval | Assigned into the session | Processed | PM Rejected | + description: `| Presented by MP * | Presented by People * | Hearing Ongoing | Hearing ended | Hearing result reported | Waiting for PM approval | Assigned into the session | Processed | PM Rejected | | ------------------------ | ---------------------- | ------------------- | --------------- | ------------------------ | ----------------------- | ------------------------- | ---------- | ------------- | | presentbymp | presentbyperson | openwsu | closewsu | reportwsu | substatus1 | substatus2 | substatus3 | closewsubypm | | เสนอโดยสมาชิกสภาผู้แทนราษฏร | เสนอโดยประชาชน | กำลังเปิดรับฟังความคิดเห็น | ปิดรับฟังความคิดเห็น | รายงานผลการรับฟังความคิดเห็น | รอคำรับรองจากนายกรัฐมนตรี | บรรจุเข้าระเบียบวาระ | พิจารณาแล้ว | นายกฯ ไม่รับรอง | diff --git a/lib/routes/people/xjpjh.ts b/lib/routes/people/xjpjh.ts index 0aa1f01a4..48f1a63d9 100644 --- a/lib/routes/people/xjpjh.ts +++ b/lib/routes/people/xjpjh.ts @@ -1,5 +1,3 @@ -import * as url from 'node:url'; - import { load } from 'cheerio'; import type { Route } from '@/types'; @@ -68,7 +66,7 @@ async function handler(ctx) { const out = await Promise.all( list.map(async (info) => { const title = info.title; - const itemUrl = url.resolve(host, info.link); + const itemUrl = new URL(info.link, host).href; const cacheIn = await cache.get(itemUrl); if (cacheIn) { diff --git a/lib/routes/pingwest/user.ts b/lib/routes/pingwest/user.ts index 83bace538..0cdd51c9c 100644 --- a/lib/routes/pingwest/user.ts +++ b/lib/routes/pingwest/user.ts @@ -80,6 +80,8 @@ async function handler(ctx) { case 'state': item = utils.statusListParser($); break; + default: + throw new Error(`Unknown type: ${type}`); } const typeToLabel = { diff --git a/lib/routes/pixabay/search.tsx b/lib/routes/pixabay/search.tsx index fb400f24d..8996a8bd5 100644 --- a/lib/routes/pixabay/search.tsx +++ b/lib/routes/pixabay/search.tsx @@ -71,9 +71,11 @@ async function handler(ctx) { const items = data.hits.map((item) => { const { pageURL, tags, user } = item; + const lastSlashIndex = pageURL.lastIndexOf('/'); + const secondLastSlashIndex = pageURL.lastIndexOf('/', lastSlashIndex - 1); return { title: pageURL - .substring(pageURL.lastIndexOf('/', pageURL.lastIndexOf('/') - 1) + 1, pageURL.lastIndexOf('/')) + .slice(secondLastSlashIndex + 1, lastSlashIndex) .replace(/(-\d+)$/, '') .replaceAll('-', ' '), description: renderToString(), diff --git a/lib/routes/readhub/index.ts b/lib/routes/readhub/index.ts index 881568460..c56b8e62f 100644 --- a/lib/routes/readhub/index.ts +++ b/lib/routes/readhub/index.ts @@ -26,7 +26,7 @@ export const route: Route = { handler, description: `| 热门话题 | 科技动态 | 医疗产业 | 财经快讯 | | -------- | -------- | -------- | ------------------ | -| | news | medical | financial\_express |`, +| | news | medical | financial_express |`, }; async function handler(ctx) { diff --git a/lib/routes/scut/jwc/news.ts b/lib/routes/scut/jwc/news.ts index 8c86719d8..62f472903 100644 --- a/lib/routes/scut/jwc/news.ts +++ b/lib/routes/scut/jwc/news.ts @@ -1,5 +1,4 @@ import querystring from 'node:querystring'; -import * as url from 'node:url'; import type { Route } from '@/types'; import cache from '@/utils/cache'; @@ -34,7 +33,7 @@ const generateArticlePubDate = (createDateStr) => { const isRedirectPage = (data) => !!data.link; -const resolveRelativeUrl = (html) => html.replaceAll('src="/', `src="${url.resolve(baseUrl, '.')}`).replaceAll('href="/', `href="${url.resolve(baseUrl, '.')}`); +const resolveRelativeUrl = (html) => html.replaceAll('src="/', `src="${new URL('.', baseUrl).href}`).replaceAll('href="/', `href="${new URL('.', baseUrl).href}`); const apiSuccessAssert = (data) => { if (!data.success) { diff --git a/lib/routes/scut/jwc/notice.ts b/lib/routes/scut/jwc/notice.ts index fd807371a..f826a3fe5 100644 --- a/lib/routes/scut/jwc/notice.ts +++ b/lib/routes/scut/jwc/notice.ts @@ -1,5 +1,4 @@ import querystring from 'node:querystring'; -import * as url from 'node:url'; import type { Route } from '@/types'; import cache from '@/utils/cache'; @@ -44,7 +43,7 @@ const generateArticlePubDate = (createDateStr) => { const isRedirectPage = (data) => !!data.link; -const resolveRelativeUrl = (html) => html.replaceAll('src="/', `src="${url.resolve(baseUrl, '.')}`).replaceAll('href="/', `href="${url.resolve(baseUrl, '.')}`); +const resolveRelativeUrl = (html) => html.replaceAll('src="/', `src="${new URL('.', baseUrl).href}`).replaceAll('href="/', `href="${new URL('.', baseUrl).href}`); const apiSuccessAssert = (data) => { if (!data.success) { diff --git a/lib/routes/scut/jwc/school.ts b/lib/routes/scut/jwc/school.ts index 0b0879f21..f10b34b4a 100644 --- a/lib/routes/scut/jwc/school.ts +++ b/lib/routes/scut/jwc/school.ts @@ -1,5 +1,4 @@ import querystring from 'node:querystring'; -import * as url from 'node:url'; import type { Route } from '@/types'; import cache from '@/utils/cache'; @@ -41,7 +40,7 @@ const generateArticlePubDate = (createDateStr) => { const isRedirectPage = (data) => !!data.link; -const resolveRelativeUrl = (html) => html.replaceAll('src="/', `src="${url.resolve(baseUrl, '.')}`).replaceAll('href="/', `href="${url.resolve(baseUrl, '.')}`); +const resolveRelativeUrl = (html) => html.replaceAll('src="/', `src="${new URL('.', baseUrl).href}`).replaceAll('href="/', `href="${new URL('.', baseUrl).href}`); const apiSuccessAssert = (data) => { if (!data.success) { diff --git a/lib/routes/sdzk/index.ts b/lib/routes/sdzk/index.ts index a67563983..2d70ce470 100644 --- a/lib/routes/sdzk/index.ts +++ b/lib/routes/sdzk/index.ts @@ -24,7 +24,7 @@ export const route: Route = { description: `::: tip 若订阅 [信息与政策](https://www.sdzk.cn/NewsList.aspx?BCID=1),网址为 \`https://www.sdzk.cn/NewsList.aspx?BCID=1\`。截取 \`BCID=1\` 作为参数,此时路由为 [\`/sdzk/1\`](https://rsshub.app/sdzk/1)。 - 若订阅 [通知公告](https://www.sdzk.cn/NewsList.aspx?BCID=1\&CID=16),网址为 \`https://www.sdzk.cn/NewsList.aspx?BCID=1&CID=16\`。截取 \`BCID=1\` 与 \`CID=16\` 作为参数,此时路由为 [\`/sdzk/1/16\`](https://rsshub.app/sdzk/1/16)。 + 若订阅 [通知公告](https://www.sdzk.cn/NewsList.aspx?BCID=1&CID=16),网址为 \`https://www.sdzk.cn/NewsList.aspx?BCID=1&CID=16\`。截取 \`BCID=1\` 与 \`CID=16\` 作为参数,此时路由为 [\`/sdzk/1/16\`](https://rsshub.app/sdzk/1/16)。 :::`, }; diff --git a/lib/routes/sourceforge/index.ts b/lib/routes/sourceforge/index.ts index 1ede6067a..1f91e5990 100644 --- a/lib/routes/sourceforge/index.ts +++ b/lib/routes/sourceforge/index.ts @@ -20,7 +20,7 @@ export const route: Route = { name: 'Software', maintainers: ['JimenezLi'], handler, - description: `For some URL like [https://sourceforge.net/directory/artificial-intelligence/windows/](https://sourceforge.net/directory/artificial-intelligence/windows/), it is equal to [https://sourceforge.net/directory/?topic=artificial-intelligence\&os=windows"](https://sourceforge.net/directory/?topic=artificial-intelligence\&os=windows), thus subscribing to \`/sourceforge/topic=artificial-intelligence&os=windows\`. + description: `For some URL like [https://sourceforge.net/directory/artificial-intelligence/windows/](https://sourceforge.net/directory/artificial-intelligence/windows/), it is equal to [https://sourceforge.net/directory/?topic=artificial-intelligence&os=windows"](https://sourceforge.net/directory/?topic=artificial-intelligence&os=windows), thus subscribing to \`/sourceforge/topic=artificial-intelligence&os=windows\`. URL params can duplicate, such as \`/sourceforge/topic=artificial-intelligence&os=windows&os=linux\`.`, }; diff --git a/lib/routes/sputniknews/index.ts b/lib/routes/sputniknews/index.ts index d69ce7114..4e0f0c7bd 100644 --- a/lib/routes/sputniknews/index.ts +++ b/lib/routes/sputniknews/index.ts @@ -64,7 +64,7 @@ export const route: Route = { | 新闻 | 中国 | 俄罗斯 | 国际 | 俄中关系 | 评论 | | ---- | ----- | ------ | --------------- | ------------------------ | ------- | -| news | china | russia | category\_guoji | russia\_china\_relations | opinion | +| news | china | russia | category_guoji | russia_china_relations | opinion | Language diff --git a/lib/routes/sspai/activity.ts b/lib/routes/sspai/activity.ts index d837c4a61..86c7880c2 100644 --- a/lib/routes/sspai/activity.ts +++ b/lib/routes/sspai/activity.ts @@ -95,6 +95,8 @@ async function handler(ctx) { item_desc = content_data.comment; item_url = content_data.comment; break; + default: + throw new Error(`Unknown action key: ${item.key}`); } return { diff --git a/lib/routes/szse/notice.ts b/lib/routes/szse/notice.ts index 585b9f286..dc3091a17 100644 --- a/lib/routes/szse/notice.ts +++ b/lib/routes/szse/notice.ts @@ -1,5 +1,3 @@ -import * as url from 'node:url'; - import { load } from 'cheerio'; import type { Route } from '@/types'; @@ -72,7 +70,7 @@ async function handler() { list.map(async (info) => { const title = info.title; const date = info.date; - const itemUrl = url.resolve(host, info.link); + const itemUrl = new URL(info.link, host).href; const cacheIn = await cache.get(itemUrl); if (cacheIn) { return JSON.parse(cacheIn); diff --git a/lib/routes/twitter/utils.ts b/lib/routes/twitter/utils.ts index 7eb9c5481..fbc6b79e8 100644 --- a/lib/routes/twitter/utils.ts +++ b/lib/routes/twitter/utils.ts @@ -1,12 +1,10 @@ -import URL from 'node:url'; - import { TwitterApi } from 'twitter-api-v2'; import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; import { fallback, queryToBoolean, queryToInteger } from '@/utils/readable-social'; -const getQueryParams = (url) => URL.parse(url, true).query; +const getQueryParams = (url) => Object.fromEntries(new URL(url).searchParams.entries()); const getOriginalImg = (url) => { // https://greasyfork.org/zh-CN/scripts/2312-resize-image-on-open-image-in-new-tab/code#n150 let m = null; @@ -519,4 +517,10 @@ export const keepOnlyMedia = function (tweets) { return excluded; }; -export default { ProcessFeed, getAppClient, parseRouteParams, excludeRetweet, keepOnlyMedia }; +export default { + ProcessFeed, + getAppClient, + parseRouteParams, + excludeRetweet, + keepOnlyMedia, +}; diff --git a/lib/routes/ulapia/index.ts b/lib/routes/ulapia/index.ts index 32f4a4cd8..3d472eaa6 100644 --- a/lib/routes/ulapia/index.ts +++ b/lib/routes/ulapia/index.ts @@ -42,7 +42,7 @@ export const route: Route = { handler, description: `| 个股研报 | 行业研报 | 策略研报 | 宏观研报 | 新股研报 | 券商晨报(今日晨报) | | :-------------: | :----------------: | :----------------: | :-------------: | :-----------: | :------------------: | -| stock\_research | industry\_research | strategy\_research | macro\_research | ipo\_research | brokerage\_news |`, +| stock_research | industry_research | strategy_research | macro_research | ipo_research | brokerage_news |`, }; async function handler(ctx) { diff --git a/lib/routes/ustc/job.ts b/lib/routes/ustc/job.ts index 8c5a7fc42..d34f8ede7 100644 --- a/lib/routes/ustc/job.ts +++ b/lib/routes/ustc/job.ts @@ -56,6 +56,8 @@ async function handler(ctx) { return 'get'; case 'Doublechoice': return 'post'; + default: + throw new Error(`Unknown category: ${category}`); } })(), @@ -69,6 +71,8 @@ async function handler(ctx) { return `${apiRootUrl}/API/Web/index10358.ashx?rd=${rand}&pagesize=20&pageindex=1&action=bookinglist2&kind=2`; case 'joblist2': return `${apiRootUrl}/API/Web/index10358.ashx?action=joblist2&pagesize=50&pageindex=1&rand=${rand}&keyword=`; + default: + throw new Error(`Unknown category: ${category}`); } })(), @@ -85,6 +89,8 @@ async function handler(ctx) { action: 'recruitlist', rand, }; + default: + throw new Error(`Unknown category: ${category}`); } })(), @@ -135,6 +141,8 @@ async function handler(ctx) { return 'get'; case 'Doublechoice': return 'post'; + default: + throw new Error(`Unknown category: ${category}`); } })(), @@ -148,6 +156,8 @@ async function handler(ctx) { return `${apiRootUrl}/API/Web/index10358.ashx?rd=${rand}&action=binfo&rid=${item.title}&rand=${rand}`; case 'joblist2': return `${apiRootUrl}/API/Web/index10358.ashx?rd=${rand}&action=jobinfo2&jid=${item.title}&rand=${rand}`; + default: + throw new Error(`Unknown category: ${category}`); } })(), @@ -165,6 +175,8 @@ async function handler(ctx) { rid: item.ID, rand, }; + default: + throw new Error(`Unknown category: ${category}`); } })(), @@ -180,6 +192,8 @@ async function handler(ctx) { return item.title; case 'joblist2': return detailResponse.data.JobName; + default: + throw new Error(`Unknown category: ${category}`); } })(); @@ -207,6 +221,8 @@ async function handler(ctx) { case 'joblist2': return detailResponse.data.PostionDesc; + default: + throw new Error(`Unknown category: ${category}`); } })(); diff --git a/lib/routes/uw/gix/news.ts b/lib/routes/uw/gix/news.ts index bc2476403..5c2364953 100644 --- a/lib/routes/uw/gix/news.ts +++ b/lib/routes/uw/gix/news.ts @@ -50,6 +50,8 @@ async function handler(ctx) { feedTitle += 'In The News'; listSelector += 'div.news-wrapper > section.news-list > article'; break; + default: + throw new Error(`Unknown category: ${category}`); } const response = await got(newsURL); diff --git a/lib/routes/wallhaven/index.ts b/lib/routes/wallhaven/index.ts index f2601fbd3..d20d0e170 100644 --- a/lib/routes/wallhaven/index.ts +++ b/lib/routes/wallhaven/index.ts @@ -32,7 +32,7 @@ export const route: Route = { description: `::: tip Subscribe pages starting with \`https://wallhaven.cc/search\`, fill the text after \`?\` as \`filter\` in the route. The following is an example: - The text after \`?\` is \`q=id%3A711&sorting=random&ref=fp&seed=8g0dgd\` for [Wallpaper Search: #landscape - wallhaven.cc](https://wallhaven.cc/search?q=id%3A711\&sorting=random\&ref=fp\&seed=8g0dgd), so the route is [/wallhaven/q=id%3A711\&sorting=random\&ref=fp\&seed=8g0dgd](https://rsshub.app/wallhaven/q=id%3A711\&sorting=random\&ref=fp\&seed=8g0dgd) + The text after \`?\` is \`q=id%3A711&sorting=random&ref=fp&seed=8g0dgd\` for [Wallpaper Search: #landscape - wallhaven.cc](https://wallhaven.cc/search?q=id%3A711&sorting=random&ref=fp&seed=8g0dgd), so the route is [/wallhaven/q=id%3A711&sorting=random&ref=fp&seed=8g0dgd](https://rsshub.app/wallhaven/q=id%3A711&sorting=random&ref=fp&seed=8g0dgd) :::`, }; diff --git a/lib/routes/wechat/mp.ts b/lib/routes/wechat/mp.ts index 34e190fad..d080dc708 100755 --- a/lib/routes/wechat/mp.ts +++ b/lib/routes/wechat/mp.ts @@ -23,7 +23,7 @@ export const route: Route = { handler, description: `只适用拥有首页模板 (分享链接带有 homepage) 的公众号。例如从公众号分享出来的链接为 \`https://mp.weixin.qq.com/mp/homepage?__biz=MzA3MDM3NjE5NQ==&hid=4\`,\`biz\` 为 \`MzA3MDM3NjE5NQ==\`,\`hid\` 为 \`4\`。 - 有些页面里会有分栏, \`cid\` 可以通过元素选择器选中栏目查看\`data-index\`。如[链接](https://mp.weixin.qq.com/mp/homepage?__biz=MzA3MDM3NjE5NQ==\&hid=4)里的 \`京都职人\` 栏目的 \`cid\` 为 \`0\`,\`文艺时光\` 栏目的 \`cid\` 为 \`2\`。如果不清楚的话最左边的栏目为\`0\`,其右方栏目依次递增 \`1\`。`, + 有些页面里会有分栏, \`cid\` 可以通过元素选择器选中栏目查看\`data-index\`。如[链接](https://mp.weixin.qq.com/mp/homepage?__biz=MzA3MDM3NjE5NQ==&hid=4)里的 \`京都职人\` 栏目的 \`cid\` 为 \`0\`,\`文艺时光\` 栏目的 \`cid\` 为 \`2\`。如果不清楚的话最左边的栏目为\`0\`,其右方栏目依次递增 \`1\`。`, }; async function handler(ctx) { diff --git a/lib/routes/weibo/namespace.ts b/lib/routes/weibo/namespace.ts index 99fdf0512..9c8448767 100644 --- a/lib/routes/weibo/namespace.ts +++ b/lib/routes/weibo/namespace.ts @@ -39,7 +39,7 @@ export const namespace: Namespace = { 指定更多与默认值不同的参数选项可以改善 RSS 的可读性,如 -[https://rsshub.app/weibo/user/1642909335/readable=1\&authorNameBold=1\&showAuthorInTitle=1\&showAuthorInDesc=1\&showAuthorAvatarInDesc=1\&showEmojiForRetweet=1\&showRetweetTextInTitle=0\&addLinkForPics=1\&showTimestampInDescription=1\&showTimestampInDescription=1\&heightOfPics=150](https://rsshub.app/weibo/user/1642909335/readable=1\&authorNameBold=1\&showAuthorInTitle=1\&showAuthorInDesc=1\&showAuthorAvatarInDesc=1\&showEmojiForRetweet=1\&showRetweetTextInTitle=0\&addLinkForPics=1\&showTimestampInDescription=1\&showTimestampInDescription=1\&heightOfPics=150) +[https://rsshub.app/weibo/user/1642909335/readable=1&authorNameBold=1&showAuthorInTitle=1&showAuthorInDesc=1&showAuthorAvatarInDesc=1&showEmojiForRetweet=1&showRetweetTextInTitle=0&addLinkForPics=1&showTimestampInDescription=1&showTimestampInDescription=1&heightOfPics=150](https://rsshub.app/weibo/user/1642909335/readable=1&authorNameBold=1&showAuthorInTitle=1&showAuthorInDesc=1&showAuthorAvatarInDesc=1&showEmojiForRetweet=1&showRetweetTextInTitle=0&addLinkForPics=1&showTimestampInDescription=1&showTimestampInDescription=1&heightOfPics=150) 的效果为 diff --git a/lib/routes/weibo/super-index.ts b/lib/routes/weibo/super-index.ts index fc2f37223..a0f36e4e9 100644 --- a/lib/routes/weibo/super-index.ts +++ b/lib/routes/weibo/super-index.ts @@ -40,8 +40,8 @@ export const route: Route = { | soul | 精华 | | video | 视频(暂不支持) | | album | 相册(暂不支持) | -| hot\_sort | 热门 | -| sort\_time | 最新帖子 | +| hot_sort | 热门 | +| sort_time | 最新帖子 | | feed | 最新评论 |`, }; diff --git a/lib/routes/wsj/news.ts b/lib/routes/wsj/news.ts index c48d9ee5c..146df4a89 100644 --- a/lib/routes/wsj/news.ts +++ b/lib/routes/wsj/news.ts @@ -27,7 +27,7 @@ export const route: Route = { name: 'News', maintainers: ['oppilate'], handler, - description: `en\_us + description: `en_us | World | U.S. | Politics | Economy | Business | Tech | Markets | Opinion | Books & Arts | Real Estate | Life & Work | Sytle | Sports | | ----- | ---- | -------- | ------- | -------- | ---------- | ------- | ------- | ------------ | ----------- | ----------- | ------------------- | ------ | diff --git a/lib/routes/wsyu/news.ts b/lib/routes/wsyu/news.ts index ba881bcea..9bc318ce9 100644 --- a/lib/routes/wsyu/news.ts +++ b/lib/routes/wsyu/news.ts @@ -1,5 +1,3 @@ -import * as url from 'node:url'; - import { load } from 'cheerio'; import type { Route } from '@/types'; @@ -73,7 +71,7 @@ async function handler(ctx) { const out = await Promise.all( urlList.map(async (itemUrl, index) => { - itemUrl = url.resolve(baseUrl, itemUrl); + itemUrl = new URL(itemUrl, baseUrl).href; if (itemUrl.includes('.htm')) { const cacheIn = await cache.get(itemUrl); if (cacheIn) { diff --git a/lib/routes/wzu/news.ts b/lib/routes/wzu/news.ts index 3df184969..27799bc52 100644 --- a/lib/routes/wzu/news.ts +++ b/lib/routes/wzu/news.ts @@ -1,5 +1,3 @@ -import { URL } from 'node:url'; - import { load } from 'cheerio'; import type { Route } from '@/types'; diff --git a/lib/routes/yicai/news.ts b/lib/routes/yicai/news.ts index ca7e05faf..019e7edd6 100644 --- a/lib/routes/yicai/news.ts +++ b/lib/routes/yicai/news.ts @@ -42,7 +42,7 @@ export const route: Route = { | books | 阅读周刊 | | loushi | 地产 | | automobile | 汽车 | -| china\_financial\_herald | 对话陆家嘴 | +| china_financial_herald | 对话陆家嘴 | | fashion | 时尚 | | ad | 商业资讯 | | info | 资讯 | diff --git a/lib/routes/yoasobi-music/jsonp-helper.ts b/lib/routes/yoasobi-music/jsonp-helper.ts index 81d3e1edd..0fa2f5211 100644 --- a/lib/routes/yoasobi-music/jsonp-helper.ts +++ b/lib/routes/yoasobi-music/jsonp-helper.ts @@ -2,7 +2,7 @@ function parseJSONP(jsonpData) { try { const startPos = jsonpData.indexOf('({'); const endPos = jsonpData.lastIndexOf('})'); - let jsonString = jsonpData.substring(startPos + 1, endPos + 1); + let jsonString = jsonpData.slice(startPos + 1, endPos + 1); // remove escaped single quotes since they are not valid json jsonString = jsonString.replaceAll(String.raw`\'`, "'"); diff --git a/lib/routes/youtube/channel.ts b/lib/routes/youtube/channel.ts index 399c49c2b..fa53b06c6 100644 --- a/lib/routes/youtube/channel.ts +++ b/lib/routes/youtube/channel.ts @@ -30,7 +30,7 @@ export const route: Route = { ::: ::: tip -YouTube provides official RSS feeds for channels, for instance [https://www.youtube.com/feeds/videos.xml?channel\_id=UCDwDMPOZfxVV0x\_dz0eQ8KQ](https://www.youtube.com/feeds/videos.xml?channel_id=UCDwDMPOZfxVV0x_dz0eQ8KQ). +YouTube provides official RSS feeds for channels, for instance [https://www.youtube.com/feeds/videos.xml?channel_id=UCDwDMPOZfxVV0x_dz0eQ8KQ](https://www.youtube.com/feeds/videos.xml?channel_id=UCDwDMPOZfxVV0x_dz0eQ8KQ). :::`, features: { requireConfig: [ diff --git a/lib/routes/yxdzqb/index.tsx b/lib/routes/yxdzqb/index.tsx index 0981e6ad0..463a1c1be 100644 --- a/lib/routes/yxdzqb/index.tsx +++ b/lib/routes/yxdzqb/index.tsx @@ -39,7 +39,7 @@ export const route: Route = { url: 'yxdzqb.com/', description: `| Steam 最新折扣 | Steam 热门游戏折扣 | Steam 热门中文游戏折扣 | Steam 历史低价 | Steam 中文游戏历史低价 | | -------------- | ------------------ | ---------------------- | -------------- | ---------------------- | -| discount | popular | popular\_cn | low | low\_cn |`, +| discount | popular | popular_cn | low | low_cn |`, }; async function handler(ctx) { diff --git a/lib/routes/yyets/article.ts b/lib/routes/yyets/article.ts index f3da25b69..f4de56910 100644 --- a/lib/routes/yyets/article.ts +++ b/lib/routes/yyets/article.ts @@ -42,7 +42,7 @@ export const route: Route = { handler, description: `| 全部 | 影视资讯 | 收视快报 | 人人影评 | 人人剧评 | 新剧评测 | 片单推荐 | | ---- | -------- | -------- | --------- | --------- | ----------- | -------- | -| | news | report | m\_review | t\_review | new\_review | recom |`, +| | news | report | m_review | t_review | new_review | recom |`, }; async function handler(ctx) {