From 417ab04f06f6f4dbeb16d02478e180afd47e1e6a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 20 Jun 2026 23:11:27 +0800 Subject: [PATCH] chore(deps-dev): bump eslint-plugin-unicorn from 66.0.0 to 68.0.0 (#22310) * chore(deps-dev): bump eslint-plugin-unicorn from 66.0.0 to 68.0.0 Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 66.0.0 to 68.0.0. - [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases) - [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v66.0.0...v68.0.0) --- updated-dependencies: - dependency-name: eslint-plugin-unicorn dependency-version: 68.0.0 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * style: fix no-useless-coercion * style: fix prefer-boolean-return * style: fix no-useless-logical-operand * style: fix prefer-single-replace * style: fix consistent-conditional-object-spread * style: fix no-useless-else * style: fix prefer-unicode-code-point-escapes * style: fix operator-assignment * style: fix prefer-continue * style: fix prefer-math-constants * style: fix prefer-hoisting-branch-code * style: fix prefer-array-slice * style: fix consistent-class-member-order * style: fix no-return-array-push * style: fix prefer-promise-with-resolvers * style: fix no-array-concat-in-loop * style: fix no-loop-iterable-mutation * style: fix no-invalid-argument-count * style: fix no-duplicate-if-branches * style: fix prefer-else-if * style: fix no-unreadable-for-of-expression * style: fix logical-assignment-operators * style: fix default-export-style * style: revert false positve in prefer-type-literal-last in #22274 * style: fix arrow-body-style * style: add v68 recommended preset * style: refactor GraphQL queries to use template literals for better readability --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tony --- .oxlintrc.json | 66 +++++++-- eslint-plugins/nsfw-flag.js | 30 ++-- lib/api/category/one.ts | 26 ++-- lib/errors/types/captcha.ts | 4 +- lib/errors/types/config-not-found.ts | 4 +- lib/errors/types/invalid-parameter.ts | 4 +- lib/errors/types/not-found.ts | 4 +- lib/errors/types/reject.ts | 4 +- lib/errors/types/request-in-progress.ts | 4 +- lib/middleware/anti-hotlink.test.ts | 2 +- lib/middleware/logger.ts | 14 +- lib/middleware/parameter-re2.test.ts | 9 +- lib/middleware/parameter.ts | 28 ++-- lib/middleware/template.tsx | 10 +- lib/routes/005/index.tsx | 2 +- lib/routes/0818tuan/index.ts | 2 +- lib/routes/163/exclusive.ts | 2 +- lib/routes/163/today.ts | 2 +- lib/routes/18comic/search.ts | 2 +- lib/routes/19lou/index.ts | 2 +- lib/routes/1lou/index.ts | 4 +- lib/routes/2048/index.tsx | 2 +- lib/routes/21caijing/channel.ts | 6 +- lib/routes/2cycd/index.ts | 2 +- lib/routes/36kr/hot-list.ts | 2 +- lib/routes/4chan/utils.tsx | 6 +- lib/routes/4ksj/forum.tsx | 8 +- lib/routes/50forum/zhuanjia.ts | 2 +- lib/routes/51cto/recommend.ts | 2 +- lib/routes/52hrtt/index.ts | 2 +- lib/routes/52hrtt/symposium.ts | 2 +- lib/routes/56kog/util.tsx | 2 +- lib/routes/69shu/article.ts | 5 +- lib/routes/6park/index.ts | 2 +- lib/routes/6park/news.ts | 2 +- lib/routes/6v123/utils.ts | 2 +- lib/routes/78dm/index.ts | 4 +- lib/routes/81/81rc/index.ts | 4 +- lib/routes/8264/list.tsx | 2 +- lib/routes/9to5/subsite.ts | 4 +- lib/routes/a9vg/index.ts | 4 +- lib/routes/abc/index.ts | 2 +- lib/routes/acpaa/index.ts | 2 +- lib/routes/adquan/case-library.ts | 4 +- lib/routes/adquan/index.ts | 4 +- lib/routes/agri/index.ts | 2 +- lib/routes/ahjzu/news.ts | 2 +- lib/routes/aibase/topic.ts | 2 +- lib/routes/aibase/util.tsx | 2 +- lib/routes/aip/journal-pupp.ts | 1 + lib/routes/air-level/levelrank.ts | 4 +- lib/routes/aisixiang/column.ts | 2 +- lib/routes/aisixiang/utils.ts | 2 +- lib/routes/aisixiang/zhuanti.ts | 2 +- lib/routes/ali213/news.ts | 2 +- lib/routes/aliresearch/information.ts | 2 +- lib/routes/aliyun/notice.ts | 2 +- lib/routes/ally/rail.ts | 4 +- lib/routes/anquanke/category.ts | 2 +- lib/routes/anquanke/vul.ts | 1 + lib/routes/apiseven/blog.ts | 2 +- lib/routes/appstorrent/programs.tsx | 2 +- lib/routes/asmr-200/index.tsx | 2 +- lib/routes/atcoder/post.ts | 2 +- lib/routes/auto-stats/index.ts | 2 +- lib/routes/bad/index.ts | 2 +- lib/routes/baidu/tieba/forum.tsx | 2 +- lib/routes/baidu/tieba/post.tsx | 2 +- lib/routes/baidu/tieba/search.tsx | 2 +- lib/routes/baidu/tieba/user.ts | 2 +- lib/routes/bangumi.tv/calendar/_base.ts | 3 +- lib/routes/bangumi.tv/calendar/today.tsx | 2 +- lib/routes/bangumi.tv/group/reply.ts | 4 +- lib/routes/bangumi.tv/subject/comments.ts | 3 +- lib/routes/bangumi.tv/subject/ep.tsx | 3 +- lib/routes/bangumi.tv/subject/index.ts | 6 +- .../bangumi.tv/subject/offcial-subject-api.ts | 3 +- lib/routes/banyuetan/index.ts | 4 +- lib/routes/baobua/article.ts | 6 +- lib/routes/baobua/category.ts | 2 +- lib/routes/baobua/latest.ts | 2 +- lib/routes/baobua/search.ts | 2 +- lib/routes/barronschina/index.ts | 4 +- lib/routes/bast/index.ts | 2 +- lib/routes/bbc/utils.tsx | 3 +- lib/routes/bdys/index.tsx | 2 +- lib/routes/behance/user.tsx | 2 +- lib/routes/bendibao/news.ts | 2 +- lib/routes/bilibili/cache.ts | 10 +- lib/routes/bilibili/live-area.ts | 16 ++- lib/routes/bilibili/message-sessions.ts | 4 +- lib/routes/bilibili/partion-ranking.ts | 2 +- lib/routes/bilibili/wasm-exec.ts | 2 +- lib/routes/binance/announcement.ts | 4 +- lib/routes/biquge/index.ts | 2 +- lib/routes/bjfu/it/utils.ts | 2 +- lib/routes/bjfu/jwc/utils.ts | 2 +- lib/routes/bjfu/news/utils.ts | 2 +- lib/routes/bjnews/column.ts | 4 +- lib/routes/bjnews/utils.ts | 2 +- lib/routes/bjwxdxh/index.ts | 2 +- lib/routes/bjx/huanbao.ts | 2 +- lib/routes/bmkg/earthquake.ts | 2 +- lib/routes/bnext/index.ts | 2 +- lib/routes/bntnews/index.ts | 2 +- lib/routes/bse/index.ts | 2 +- lib/routes/bsky/templates/post.tsx | 4 +- lib/routes/btzj/index.tsx | 2 +- lib/routes/buaa/jiaowu.ts | 2 +- lib/routes/buaa/lib/space/newbook.tsx | 2 +- lib/routes/buaa/news/index.ts | 2 +- lib/routes/buaa/sme.ts | 2 +- lib/routes/bupt/jwc.ts | 2 +- lib/routes/bupt/rczp.ts | 2 +- lib/routes/bupt/scss.ts | 2 +- lib/routes/byau/xinwen/index.ts | 2 +- lib/routes/c114/roll.ts | 4 +- lib/routes/caai/utils.tsx | 2 +- lib/routes/cahkms/index.tsx | 2 +- lib/routes/caijing/roll.ts | 2 +- lib/routes/caixin/category.ts | 2 +- lib/routes/caixin/database.ts | 2 +- lib/routes/cankaoxiaoxi/index.tsx | 2 +- lib/routes/cast/index.ts | 2 +- lib/routes/cbpanet/index.ts | 2 +- lib/routes/ccagm/index.ts | 8 +- lib/routes/cccfna/index.ts | 2 +- lib/routes/ccf/tfbd/utils.tsx | 2 +- lib/routes/ccmn/price-adjustment.tsx | 2 +- lib/routes/ccreports/index.ts | 2 +- lib/routes/cctv/category.ts | 6 +- lib/routes/cctv/lm.ts | 2 +- lib/routes/cctv/utils/mzzlbg.ts | 5 +- lib/routes/cctv/utils/news.ts | 5 +- lib/routes/cctv/utils/xinwen1j1.ts | 3 +- lib/routes/cctv/xwlb.ts | 2 +- lib/routes/cdi/index.ts | 2 +- lib/routes/ce/district.ts | 2 +- lib/routes/cfachina/analygarden.ts | 4 +- lib/routes/cffex/announcement.ts | 2 +- lib/routes/cfmmc/index.ts | 2 +- lib/routes/cgtn/podcast.ts | 2 +- lib/routes/chiculture/topic.ts | 10 +- lib/routes/china/finance/finance.ts | 2 +- lib/routes/chinadaily/language.ts | 4 +- lib/routes/chinamoney/notice.ts | 4 +- lib/routes/chinanews/index.ts | 6 +- lib/routes/chinathinktanks/viewpoint.ts | 2 +- lib/routes/chinaventure/index.ts | 2 +- lib/routes/chinawriter/index.ts | 2 +- lib/routes/chiphell/portal.ts | 2 +- lib/routes/chlinlearn/daily-blog.ts | 2 +- lib/routes/chnmuseum/xingnew.ts | 2 +- lib/routes/chnmuseum/zl.tsx | 3 +- lib/routes/cih-index/report.ts | 2 +- lib/routes/ciidbnu/index.ts | 2 +- lib/routes/ciweimao/chapter.ts | 2 +- lib/routes/cjlu/yjsy/index.ts | 2 +- lib/routes/cloudnative/blog.ts | 2 +- lib/routes/cma/channel.tsx | 2 +- lib/routes/cmde/index.ts | 2 +- lib/routes/cna/index.ts | 2 +- lib/routes/cna/web/index.ts | 2 +- lib/routes/cnbeta/common.ts | 2 +- lib/routes/cnbeta/utils.ts | 2 +- lib/routes/cnblogs/common.ts | 2 +- lib/routes/cncf/reports.ts | 2 +- lib/routes/cneb/yjxw.ts | 2 +- lib/routes/cneb/yjxx.ts | 2 +- lib/routes/cngal/entry.tsx | 2 +- lib/routes/coomer/index.tsx | 3 +- lib/routes/cosplaytele/article.ts | 6 +- lib/routes/cosplaytele/category.ts | 2 +- lib/routes/cosplaytele/latest.ts | 2 +- lib/routes/cosplaytele/popular.ts | 2 +- lib/routes/cosplaytele/tag.ts | 2 +- lib/routes/cpcaauto/index.ts | 2 +- lib/routes/cs/index.ts | 4 +- lib/routes/cs/video.ts | 4 +- lib/routes/cztv/daily.tsx | 2 +- lib/routes/cztv/zjxwlb.tsx | 2 +- lib/routes/dangdang/notice.ts | 2 +- lib/routes/dapenti/utils.ts | 2 +- lib/routes/dayanzai/index.ts | 2 +- lib/routes/dbaplus/new.ts | 4 +- lib/routes/ddosi/index.ts | 4 +- lib/routes/decrypt/index.ts | 2 +- lib/routes/dedao/knowledge.tsx | 2 +- lib/routes/dedao/user.tsx | 2 +- lib/routes/denonbu/news.ts | 2 +- lib/routes/dewu/declaration.ts | 2 +- lib/routes/dgjyw/index.ts | 2 +- lib/routes/dgtle/video.ts | 4 +- lib/routes/dlsite/ci-en/article.ts | 2 +- lib/routes/dlsite/utils.ts | 4 +- lib/routes/dmzj/news.ts | 2 +- lib/routes/dn/news.ts | 4 +- lib/routes/dnaindia/common.ts | 2 +- lib/routes/dol/announce.ts | 2 +- lib/routes/domp4/utils.ts | 1 + lib/routes/dora-world/article.ts | 4 +- lib/routes/douban/other/replied.ts | 3 +- lib/routes/douban/other/replies.ts | 3 +- lib/routes/douyin/hashtag.ts | 6 +- lib/routes/douyin/user.ts | 7 +- lib/routes/douyu/group.ts | 2 +- lib/routes/dpm/exhibitions.tsx | 2 +- lib/routes/duozhi/index.ts | 4 +- lib/routes/dykszx/news.ts | 2 +- lib/routes/dytt/index.ts | 4 +- lib/routes/eagle/changelog.ts | 3 +- lib/routes/earthquake/ceic.ts | 4 +- lib/routes/earthquake/index.ts | 2 +- lib/routes/eastday/24.ts | 2 +- lib/routes/eastday/portrait.ts | 2 +- lib/routes/eastday/sh.ts | 2 +- lib/routes/eastmoney/ttjj/user.ts | 2 +- lib/routes/ecnu/art.ts | 2 +- lib/routes/ecnu/bksy.ts | 2 +- lib/routes/ecnu/cee.ts | 2 +- lib/routes/ecnu/chem.ts | 2 +- lib/routes/ecnu/chinese.ts | 2 +- lib/routes/ecnu/comm.ts | 2 +- lib/routes/ecnu/cs.ts | 2 +- lib/routes/ecnu/cxcy.ts | 2 +- lib/routes/ecnu/dase.ts | 2 +- lib/routes/ecnu/dx.ts | 2 +- lib/routes/ecnu/dxb.ts | 2 +- lib/routes/ecnu/ed.ts | 2 +- lib/routes/ecnu/geoai.ts | 2 +- lib/routes/ecnu/ghcollege.ts | 2 +- lib/routes/ecnu/history.ts | 2 +- lib/routes/ecnu/jiaoliu.ts | 2 +- lib/routes/ecnu/jwc.ts | 7 +- lib/routes/ecnu/mks.ts | 2 +- lib/routes/ecnu/mxcsy.ts | 2 +- lib/routes/ecnu/pharm.ts | 2 +- lib/routes/ecnu/philo.ts | 2 +- lib/routes/ecnu/phy.ts | 2 +- lib/routes/ecnu/psy.ts | 2 +- lib/routes/ecnu/sees.ts | 2 +- lib/routes/ecnu/sei.ts | 2 +- lib/routes/ecnu/spm.ts | 2 +- lib/routes/ecnu/stat.ts | 2 +- lib/routes/ecnu/tyxx.ts | 2 +- lib/routes/ecust/e/news.ts | 2 +- lib/routes/eeo/kuaixun.ts | 8 +- lib/routes/ehentai/ehapi.ts | 8 +- lib/routes/elasticsearch-cn/index.ts | 2 +- lib/routes/eshukan/academic.ts | 4 +- lib/routes/everia/article.ts | 6 +- lib/routes/everia/category.ts | 2 +- lib/routes/everia/latest.ts | 2 +- lib/routes/everia/search.ts | 2 +- lib/routes/everia/tag.ts | 2 +- lib/routes/f95zone/post.ts | 2 +- lib/routes/f95zone/thread.ts | 2 +- lib/routes/f95zone/utils.ts | 3 +- lib/routes/fangchan/list.tsx | 4 +- lib/routes/fansly/utils.tsx | 2 +- lib/routes/fanxinzhui/index.tsx | 2 +- lib/routes/farmatters/index.tsx | 2 +- lib/routes/fashionnetwork/index.ts | 2 +- lib/routes/ff14/ff14-zh.ts | 2 +- lib/routes/flyert/preferential.ts | 2 +- lib/routes/flyert/util.ts | 4 +- lib/routes/focustaiwan/index.tsx | 2 +- lib/routes/foresightnews/util.tsx | 2 +- lib/routes/foreverblog/feeds.ts | 2 +- lib/routes/forklog/index.ts | 26 ++-- lib/routes/freewechat/profile.ts | 2 +- lib/routes/fx678/kx.ts | 2 +- lib/routes/gamebase/news.tsx | 4 +- lib/routes/gamer/ani/new-anime.ts | 2 +- lib/routes/gamer/gnn-index.ts | 16 +-- lib/routes/gamer/hot.ts | 2 +- lib/routes/gamersecret/index.ts | 2 +- lib/routes/gdut/oa-news.ts | 2 +- lib/routes/gelonghui/utils.ts | 2 +- lib/routes/gf-cn/news.ts | 2 +- lib/routes/gihyo/group.ts | 2 +- lib/routes/github/eventapi.ts | 6 +- lib/routes/gov/ah/kjt.ts | 4 +- lib/routes/gov/beijing/bjedu/gh.ts | 4 +- lib/routes/gov/beijing/bphc/index.ts | 2 +- lib/routes/gov/beijing/jw/tzgg.ts | 2 +- lib/routes/gov/caac/cjwt.tsx | 4 +- lib/routes/gov/ccdi/utils.ts | 2 +- lib/routes/gov/chinamine-safety/util.ts | 4 +- lib/routes/gov/chinamine-safety/xw.ts | 2 +- lib/routes/gov/chongqing/gzw.ts | 2 +- lib/routes/gov/cmse/fxrw.ts | 2 +- lib/routes/gov/cmse/index.ts | 2 +- lib/routes/gov/cnnic/index.ts | 2 +- lib/routes/gov/forestry/gjlckjdjt.ts | 2 +- lib/routes/gov/general/general.ts | 4 +- lib/routes/gov/guizhou/jyt.ts | 2 +- lib/routes/gov/hangzhou/zwfw.tsx | 17 +-- lib/routes/gov/huizhou/zwgk/index.ts | 4 +- lib/routes/gov/jgjcndrc/index.ts | 2 +- .../healthcommission/medical-exam-notice.ts | 2 +- lib/routes/gov/lswz/index.ts | 2 +- lib/routes/gov/maonan/maonan.ts | 2 +- lib/routes/gov/mee/nnsa.ts | 4 +- lib/routes/gov/mee/ywdt.ts | 2 +- lib/routes/gov/mfa/wjdt.ts | 2 +- lib/routes/gov/miit/wjfb.ts | 2 +- lib/routes/gov/miit/wjgs.ts | 2 +- lib/routes/gov/miit/yjzj.ts | 2 +- lib/routes/gov/miit/zcjd.ts | 2 +- lib/routes/gov/moa/gjs.ts | 4 +- lib/routes/gov/moa/szcpxx.ts | 2 +- lib/routes/gov/moe/moe.ts | 8 +- lib/routes/gov/moe/s78.ts | 2 +- lib/routes/gov/mof/bond.ts | 2 +- lib/routes/gov/mof/gss.ts | 2 +- lib/routes/gov/moj/aac/news.ts | 2 +- lib/routes/gov/moj/lfyjzj.ts | 4 +- lib/routes/gov/ndrc/fggz.ts | 2 +- lib/routes/gov/nea/bureau.ts | 4 +- lib/routes/gov/nfra/index.ts | 4 +- lib/routes/gov/nifdc/index.ts | 2 +- lib/routes/gov/nmpa/generic.ts | 2 +- lib/routes/gov/nopss/index.ts | 2 +- lib/routes/gov/npc/index.ts | 2 +- lib/routes/gov/nrta/news.ts | 2 +- lib/routes/gov/pbc/goutongjiaoliu.ts | 2 +- lib/routes/gov/pbc/trade-announcement.ts | 2 +- lib/routes/gov/pbc/zcyj.ts | 2 +- lib/routes/gov/sh/fgw/index.tsx | 2 +- lib/routes/gov/sh/yjj/index.ts | 2 +- lib/routes/gov/shaanxi/kjt.ts | 2 +- .../gov/sichuan/deyang/govpublicinfo.tsx | 2 +- lib/routes/gov/sichuan/deyang/mztoday.tsx | 2 +- lib/routes/gov/stats/index.tsx | 10 +- lib/routes/gov/suzhou/fg.ts | 2 +- lib/routes/gov/taiyuan/rsj.ts | 2 +- lib/routes/gov/wuhan/whyw.ts | 2 +- lib/routes/gov/xuzhou/hrss.ts | 2 +- lib/routes/gov/zhengce/govall.ts | 2 +- lib/routes/gov/zhengce/index.ts | 4 +- lib/routes/grainoil/category.ts | 4 +- lib/routes/guancha/headline.ts | 2 +- lib/routes/guancha/index.ts | 2 +- lib/routes/guancha/member.ts | 4 +- lib/routes/guanhai/index.ts | 2 +- lib/routes/gxmzu/lib.ts | 2 +- lib/routes/gxmzu/utils/index.ts | 4 +- lib/routes/gzdaily/app.tsx | 2 +- lib/routes/hacking8/index.ts | 2 +- lib/routes/hacking8/search.ts | 2 +- lib/routes/hafu/news.ts | 2 +- lib/routes/hafu/utils.tsx | 9 +- lib/routes/hakkatv/type.ts | 2 +- lib/routes/hameln/chapter.ts | 2 +- lib/routes/hbooker/chapter.ts | 2 +- .../hebtv/nong-bo-shi-zai-xing-dong.tsx | 6 +- lib/routes/hedwig/posts.ts | 2 +- lib/routes/hellobtc/information.ts | 2 +- lib/routes/hellobtc/news.ts | 2 +- lib/routes/hitwh/today.ts | 7 +- lib/routes/hkej/index.tsx | 2 +- lib/routes/hkepc/index.ts | 2 +- lib/routes/hket/index.tsx | 4 +- lib/routes/hko/earthquake.ts | 2 +- lib/routes/hljucm/yjsy.ts | 2 +- lib/routes/hnrb/index.ts | 2 +- lib/routes/hostmonit/cloudflareyes.tsx | 10 +- lib/routes/hrbust/cs.ts | 2 +- lib/routes/hrbust/gzc.ts | 2 +- lib/routes/hrbust/jwzx.ts | 2 +- lib/routes/hrbust/lib.ts | 2 +- lib/routes/hrbust/news.ts | 4 +- lib/routes/hrbust/nic.ts | 2 +- lib/routes/hudsonrivertrading/index.ts | 2 +- lib/routes/huggingface/models.ts | 11 +- lib/routes/huijin-inv/news.ts | 2 +- lib/routes/hunanpea/rsks.ts | 2 +- lib/routes/hunau/gfxy/index.ts | 2 +- lib/routes/hunau/ied.ts | 2 +- lib/routes/hunau/jwc.ts | 2 +- lib/routes/hunau/utils/category-title.ts | 4 +- lib/routes/hunau/utils/common.ts | 12 +- lib/routes/hunau/utils/index-page.ts | 4 +- lib/routes/hunau/utils/news-content.ts | 8 +- lib/routes/hunau/xky/index.ts | 2 +- lib/routes/hupu/all.tsx | 4 +- lib/routes/hupu/bbs.tsx | 2 +- lib/routes/hupu/index.ts | 2 +- lib/routes/hupu/news.ts | 2 +- lib/routes/hupu/utils.ts | 2 +- lib/routes/hust/mse.ts | 4 +- lib/routes/huxiu/util.ts | 2 +- lib/routes/idolmaster/news.ts | 2 +- lib/routes/iehou/index.ts | 4 +- lib/routes/ielts/index.ts | 2 +- lib/routes/ifeng/feng.ts | 5 +- lib/routes/ifeng/news.tsx | 2 +- lib/routes/imdb/types.ts | 8 +- lib/routes/indienova/gamedb.ts | 2 +- lib/routes/indienova/usergames.ts | 2 +- lib/routes/indienova/utils.ts | 2 +- lib/routes/inewsweek/index.ts | 2 +- lib/routes/infzm/utils.ts | 2 +- lib/routes/instagram/web-api/utils.ts | 2 +- lib/routes/iresearch/report.ts | 16 +-- lib/routes/itch/devlog.ts | 2 +- lib/routes/ithome/tag.ts | 2 +- lib/routes/ithome/tw/feeds.ts | 2 +- lib/routes/ithome/zt.tsx | 4 +- lib/routes/j-test/news.ts | 2 +- lib/routes/jbma/report.ts | 16 ++- lib/routes/jianshu/utils.ts | 2 +- lib/routes/jike/user.ts | 4 +- lib/routes/jisilu/util.ts | 6 +- lib/routes/jjwxc/author.tsx | 2 +- lib/routes/jjwxc/book.ts | 2 +- lib/routes/jl1mall/forum.ts | 4 +- lib/routes/joins/chinese.tsx | 2 +- lib/routes/jou/utils/index.ts | 4 +- lib/routes/jump/discount.tsx | 8 +- lib/routes/kbs/news.ts | 2 +- lib/routes/kbs/today.ts | 2 +- lib/routes/kcna/news.tsx | 4 +- lib/routes/kcna/utils.ts | 2 +- lib/routes/kemono/index.tsx | 3 +- lib/routes/kepu/live.tsx | 4 +- lib/routes/keylol/index.ts | 4 +- lib/routes/koreaherald/index.ts | 2 +- lib/routes/kpopping/news.ts | 4 +- lib/routes/kuaishou/profile.ts | 5 +- lib/routes/kurogames/wutheringwaves/news.ts | 2 +- lib/routes/last-origin/news.ts | 2 +- lib/routes/latepost/index.ts | 4 +- lib/routes/layoffs/index.ts | 8 +- .../leetcode/dailyquestion-solution-cn.ts | 4 +- .../leetcode/dailyquestion-solution-en.ts | 4 +- lib/routes/lenovo/drive.tsx | 2 +- lib/routes/letterboxd/index.ts | 2 +- lib/routes/lifeweek/channel.ts | 2 +- lib/routes/lifeweek/tag.ts | 2 +- lib/routes/lifeweek/utils.ts | 8 +- lib/routes/linkresearcher/index.tsx | 4 +- lib/routes/lkong/query.ts | 130 ++++++++++-------- lib/routes/locals/feed.ts | 4 +- lib/routes/logclub/report.ts | 2 +- lib/routes/lorientlejour/index.tsx | 6 +- lib/routes/lovelive-anime/news.tsx | 2 +- lib/routes/lvv2/news.ts | 2 +- lib/routes/lvv2/top.ts | 2 +- lib/routes/m4/index.ts | 4 +- lib/routes/maccms/index.tsx | 2 +- lib/routes/mail/imap.ts | 3 +- lib/routes/mangadex/mdlist/feed.ts | 4 +- lib/routes/manus/blog.ts | 22 +-- lib/routes/mcmod/index.tsx | 2 +- lib/routes/medieval-china/post.ts | 2 +- lib/routes/meishichina/index.ts | 2 +- lib/routes/metacritic/index.tsx | 3 +- lib/routes/metacritic/release.ts | 1 + lib/routes/mihoyo/bbs/img-ranking.ts | 8 +- lib/routes/mihoyo/sr/news.ts | 2 +- lib/routes/mihoyo/zzz/news.ts | 2 +- lib/routes/mixi2/utils.ts | 3 +- lib/routes/miyuki/news.ts | 2 +- lib/routes/modb/topic.ts | 2 +- lib/routes/mpaypass/main.ts | 2 +- lib/routes/mpaypass/news.ts | 2 +- lib/routes/musikguru/news.ts | 4 +- lib/routes/my-formosa/index.ts | 2 +- lib/routes/mydrivers/index.tsx | 4 +- lib/routes/mydrivers/util.ts | 2 +- lib/routes/myfans/types.ts | 12 +- lib/routes/myfigurecollection/activity.tsx | 2 +- lib/routes/nankai/ai-notice.ts | 2 +- lib/routes/nankai/cc-notice.ts | 4 +- lib/routes/nankai/graduate-notice.ts | 2 +- lib/routes/nankai/jwc.ts | 4 +- lib/routes/nankai/notice.ts | 2 +- lib/routes/nankai/yzb.ts | 2 +- lib/routes/natgeo/dailyselection.ts | 12 +- .../nationalgeographic/latest-stories.tsx | 4 +- lib/routes/nbd/index.ts | 2 +- lib/routes/ncepu/master/masterinfo.ts | 2 +- lib/routes/neea/index.ts | 4 +- lib/routes/neu/yz.ts | 4 +- lib/routes/newrank/utils.ts | 2 +- lib/routes/news/xhsxw.ts | 2 +- lib/routes/newslaundry/utils.tsx | 3 +- lib/routes/nga/post.ts | 2 +- lib/routes/nhk/news-web-easy.tsx | 2 +- lib/routes/nikkei/cn/index.ts | 4 +- lib/routes/njglyy/utils/index.ts | 2 +- lib/routes/njnu/ceai/utils.ts | 2 +- lib/routes/njnu/jwc/utils.ts | 2 +- lib/routes/nju/dafls.ts | 2 +- lib/routes/nju/gra.ts | 2 +- lib/routes/nju/hqjt.ts | 2 +- lib/routes/nju/itsc.ts | 2 +- lib/routes/nju/jjc.ts | 2 +- lib/routes/nju/jw.ts | 2 +- lib/routes/nju/scit.ts | 2 +- lib/routes/nju/zbb.ts | 4 +- lib/routes/njucm/utils/index.ts | 2 +- lib/routes/njust/cs.ts | 2 +- lib/routes/njust/cwc.ts | 2 +- lib/routes/njust/dgxg.ts | 2 +- lib/routes/njust/eo.ts | 2 +- lib/routes/njust/eoe.ts | 2 +- lib/routes/njust/gs.ts | 2 +- lib/routes/njust/jwc.ts | 2 +- lib/routes/njust/utils.ts | 7 +- lib/routes/njxzc/lib.ts | 4 +- lib/routes/njxzc/utils/index.ts | 4 +- lib/routes/nltimes/news.ts | 2 +- lib/routes/nmc/publish.ts | 8 +- lib/routes/nmtv/column.tsx | 2 +- lib/routes/nowcoder/discuss.ts | 4 +- lib/routes/nowcoder/experience.ts | 2 +- lib/routes/ntdtv/channel.ts | 2 +- lib/routes/nua/utils.ts | 2 +- lib/routes/nuaa/college/cae.ts | 2 +- lib/routes/nuaa/college/cs.ts | 2 +- lib/routes/nuaa/jwc/jwc.ts | 2 +- lib/routes/nuaa/yjsy/yjsy.ts | 2 +- lib/routes/nuist/cas.ts | 2 +- lib/routes/nuist/yjs.ts | 2 +- lib/routes/nyaa/main.ts | 8 +- lib/routes/nyc/mayors-office-news.ts | 10 +- lib/routes/oceanengine/arithmetic-index.tsx | 2 +- lib/routes/odaily/activity.ts | 2 +- lib/routes/odaily/newsflash.ts | 2 +- lib/routes/odaily/post.ts | 2 +- lib/routes/odaily/search-news.ts | 2 +- lib/routes/odaily/user.ts | 2 +- lib/routes/oeeee/app/channel.ts | 2 +- lib/routes/oeeee/utils.ts | 2 +- lib/routes/oeeee/web.ts | 2 +- lib/routes/oilchem/index.ts | 2 +- lib/routes/oncc/money18.ts | 6 +- lib/routes/onehu/common.ts | 2 +- lib/routes/oreno3d/get-sec-page-data.ts | 6 +- lib/routes/oreno3d/main.tsx | 2 +- lib/routes/oschina/column.ts | 6 +- lib/routes/oschina/topic.ts | 2 +- lib/routes/oshwhub/templates/description.tsx | 12 +- lib/routes/osu/beatmaps/latest-ranked.tsx | 5 +- lib/routes/p-articles/utils.ts | 2 +- lib/routes/papers/category.ts | 4 +- lib/routes/parliament/section77.ts | 4 +- lib/routes/patreon/render-content-json.tsx | 3 +- lib/routes/people/index.ts | 2 +- lib/routes/people/liuyan.ts | 2 +- lib/routes/people/xjpjh.ts | 4 +- lib/routes/peopo/topic.ts | 2 +- lib/routes/pixiv/novel-api/content/types.ts | 28 ++-- lib/routes/pixiv/novel-api/content/utils.ts | 4 +- lib/routes/pku/bbs/hot.ts | 2 +- lib/routes/pts/index.ts | 4 +- lib/routes/qianzhan/column.ts | 2 +- lib/routes/qianzhan/rank.ts | 2 +- lib/routes/qiche365/recall.ts | 2 +- lib/routes/qingting/channel.ts | 2 +- lib/routes/qingting/podcast.ts | 2 +- lib/routes/qm120/news.ts | 2 +- lib/routes/qq/cfhd/index.ts | 2 +- lib/routes/qq/kg/cache.ts | 2 +- lib/routes/qq/lol/news.ts | 8 +- lib/routes/qqorw/index.ts | 4 +- lib/routes/quicker/qa.ts | 2 +- lib/routes/quicker/share.ts | 2 +- lib/routes/quicker/user.ts | 2 +- lib/routes/qztc/home/index.ts | 2 +- lib/routes/qztc/jwc/index.ts | 2 +- lib/routes/qztc/sjxy/index.ts | 2 +- lib/routes/radio-canada/latest.ts | 3 +- lib/routes/radio/album.ts | 2 +- lib/routes/reuters/common.tsx | 12 +- lib/routes/right/forum.ts | 2 +- lib/routes/rsc/journal.tsx | 4 +- lib/routes/ruancan/category.ts | 2 +- lib/routes/ruancan/index.ts | 2 +- lib/routes/ruancan/search.ts | 2 +- lib/routes/ruancan/user.ts | 2 +- lib/routes/ruancan/utils.ts | 3 +- lib/routes/ruc/ai.ts | 2 +- lib/routes/rustcc/jobs.ts | 2 +- lib/routes/rustcc/news.ts | 2 +- lib/routes/sakurazaka46/blog.ts | 2 +- lib/routes/samd/news.ts | 2 +- lib/routes/saraba1st/digest.tsx | 2 +- lib/routes/saraba1st/thread.ts | 18 +-- lib/routes/sciencenet/blog.ts | 2 +- lib/routes/sciencenet/user.ts | 2 +- lib/routes/scientificamerican/podcast.ts | 8 +- lib/routes/scitechvista/index.tsx | 2 +- .../physics-school-announcements-and-news.ts | 2 +- lib/routes/sctv/programme.tsx | 12 +- .../sdo/ff14risingstones/types/party.ts | 4 +- .../sdo/ff14risingstones/user-resently.ts | 2 +- lib/routes/sdo/ff14risingstones/utils.tsx | 6 +- lib/routes/sdu/epe.ts | 2 +- lib/routes/sdu/extractor/index.ts | 9 +- lib/routes/sdu/extractor/sdrj.ts | 5 +- lib/routes/sdu/extractor/view.ts | 5 +- lib/routes/sdu/extractor/wh/jwc.ts | 5 +- lib/routes/sdu/extractor/wh/news.ts | 5 +- lib/routes/sdu/mech.ts | 2 +- lib/routes/sdu/wh/jwc.ts | 2 +- lib/routes/sega/pjsekai.ts | 2 +- lib/routes/setn/index.ts | 2 +- lib/routes/sfacg/novel-chapter.ts | 2 +- lib/routes/shcstheatre/programs.tsx | 2 +- lib/routes/shmeea/index.ts | 2 +- lib/routes/shmeea/self-study.ts | 2 +- lib/routes/showstart/service.ts | 16 +-- lib/routes/shu/global.ts | 2 +- lib/routes/shu/gs.ts | 2 +- lib/routes/shu/index.ts | 2 +- lib/routes/shu/xxgk.ts | 2 +- lib/routes/shu/xykd.ts | 2 +- lib/routes/shuiguopai/index.tsx | 2 +- lib/routes/sicau/dky.ts | 2 +- lib/routes/sicau/jiaowu.ts | 2 +- lib/routes/sicau/jk.ts | 2 +- lib/routes/sicau/yan.ts | 2 +- lib/routes/simpleinfo/index.tsx | 2 +- lib/routes/sina/utils.tsx | 2 +- lib/routes/sinchew/index.tsx | 4 +- lib/routes/sis001/common.ts | 6 +- lib/routes/sjtu/cs/tzgg.tsx | 6 +- lib/routes/sjtu/cs/xshd.tsx | 4 +- lib/routes/sjtu/gs.ts | 2 +- lib/routes/sjtu/seiee/index.ts | 2 +- lib/routes/smzdm/article.ts | 2 +- lib/routes/smzdm/baoliao.ts | 2 +- lib/routes/smzdm/keyword.ts | 2 +- lib/routes/smzdm/ranking.ts | 2 +- lib/routes/sobooks/date.ts | 2 +- lib/routes/sobooks/index.ts | 2 +- lib/routes/sobooks/tag.ts | 2 +- lib/routes/sobooks/utils.ts | 3 +- lib/routes/sohu/mobile.ts | 32 +++-- lib/routes/sohu/mp.tsx | 2 +- lib/routes/solidot/_article.ts | 2 +- lib/routes/southcn/nfapp/column.ts | 2 +- lib/routes/southcn/nfapp/reporter.ts | 2 +- lib/routes/sqmc/www.ts | 2 +- lib/routes/sse/sselawsrules.ts | 2 +- lib/routes/sspai/shortcuts-gallery.ts | 22 ++- lib/routes/sspu/jwc.ts | 2 +- lib/routes/stbu/jsjxy.ts | 2 +- lib/routes/stbu/xyxw.ts | 2 +- lib/routes/stcn/index.ts | 8 +- lib/routes/stcn/kx.ts | 4 +- lib/routes/stcn/rank.ts | 4 +- lib/routes/stdaily/digitalpaper.tsx | 2 +- lib/routes/straitstimes/index.tsx | 8 +- lib/routes/studygolang/utils.ts | 2 +- lib/routes/subhd/index.ts | 2 +- lib/routes/swpu/bgw.ts | 10 +- lib/routes/swpu/cjxy.ts | 10 +- lib/routes/swpu/dean.ts | 10 +- lib/routes/swpu/dxy.ts | 10 +- lib/routes/swpu/is.ts | 10 +- lib/routes/swpu/scs.ts | 10 +- lib/routes/swpu/utils.ts | 2 +- lib/routes/syosetu/ranking-isekai.ts | 2 +- lib/routes/syosetu/ranking-r18.ts | 2 +- lib/routes/syosetu/ranking.ts | 2 +- lib/routes/syosetu/search.ts | 2 +- lib/routes/szse/disclosure/listed-notice.ts | 4 +- lib/routes/szse/projectdynamic.tsx | 2 +- lib/routes/szse/rule.ts | 2 +- lib/routes/taiwannews/hot.ts | 2 +- lib/routes/taoguba/util.ts | 2 +- lib/routes/techflowpost/utils.ts | 2 +- lib/routes/telegram/channel.ts | 8 +- lib/routes/telegram/stories.ts | 3 +- lib/routes/thecover/channel.ts | 2 +- lib/routes/themoviedb/api-key.ts | 3 +- lib/routes/themoviedb/collection.ts | 2 +- lib/routes/themoviedb/episodes.ts | 2 +- lib/routes/themoviedb/seasons.ts | 2 +- lib/routes/themoviedb/sheet.ts | 2 +- lib/routes/themoviedb/trending.ts | 2 +- lib/routes/thepaper/factpaper.tsx | 2 +- lib/routes/thepaper/utils.tsx | 2 +- lib/routes/tingshuitz/shenzhen.tsx | 2 +- lib/routes/tju/cic/index.ts | 2 +- lib/routes/tju/news/index.ts | 2 +- lib/routes/tju/oaa/index.ts | 2 +- lib/routes/tju/yzb/index.ts | 2 +- lib/routes/toodaylab/index.ts | 4 +- lib/routes/topys/index.ts | 2 +- lib/routes/toutiao/a-bogus.ts | 4 +- lib/routes/tqyb/sncsyjxh.tsx | 4 +- lib/routes/tradingview/desktop.ts | 2 +- lib/routes/trow/portal.ts | 2 +- lib/routes/ttv/index.ts | 2 +- lib/routes/tumblr/utils.ts | 6 +- lib/routes/tver/series.ts | 2 +- lib/routes/twitter/api/developer-api/api.ts | 3 +- .../twitter/api/developer-api/search.ts | 1 + lib/routes/twitter/api/index.ts | 4 +- lib/routes/twitter/api/mobile-api/api.ts | 72 +++++----- lib/routes/twitter/api/mobile-api/login.ts | 4 +- lib/routes/twitter/api/web-api/utils.ts | 120 ++++++++-------- lib/routes/twitter/utils.ts | 4 +- lib/routes/txrjy/fornumtopic.tsx | 2 +- lib/routes/u9a9/index.ts | 2 +- lib/routes/udn/breaking-news.tsx | 2 +- lib/routes/udn/global/index.ts | 2 +- lib/routes/udn/global/tag.ts | 2 +- lib/routes/uestc/bbs.ts | 2 +- lib/routes/uestc/gr.ts | 2 +- lib/routes/uestc/jwc.ts | 2 +- lib/routes/uestc/scse.ts | 8 +- lib/routes/upc/jwc.ts | 2 +- lib/routes/uptimerobot/rss.tsx | 2 +- lib/routes/ustc/eeis.ts | 2 +- lib/routes/ustc/gs.ts | 2 +- lib/routes/ustc/index.ts | 2 +- lib/routes/ustc/jwc.ts | 4 +- lib/routes/ustc/sist.ts | 2 +- lib/routes/usts/jwch.ts | 2 +- lib/routes/utgd/utils.tsx | 2 +- lib/routes/visionias/utils.ts | 2 +- lib/routes/washingtonpost/app.tsx | 8 +- lib/routes/wechat/ershcimi.ts | 2 +- lib/routes/wechat/feeddd.ts | 1 + lib/routes/weibo/keyword.ts | 4 +- lib/routes/weibo/search/hot.tsx | 3 +- lib/routes/weibo/super-index.ts | 3 +- lib/routes/weibo/user-bookmarks.ts | 2 +- lib/routes/weibo/user.ts | 7 +- lib/routes/weibo/utils.ts | 2 +- lib/routes/wfu/news.ts | 2 +- lib/routes/whu/cs.ts | 2 +- lib/routes/whu/rsgis.ts | 2 +- lib/routes/whu/util.ts | 2 +- lib/routes/wikipedia/current-events.ts | 28 ++-- lib/routes/wkjyqh/research.ts | 4 +- lib/routes/wmc-bj/publish.tsx | 2 +- lib/routes/wsj/news.ts | 2 +- lib/routes/x6d/index.ts | 2 +- lib/routes/xaut/index.ts | 2 +- lib/routes/xiaoheihe/discount.ts | 36 ++--- lib/routes/xiaohongshu/user.ts | 3 +- lib/routes/xiaohongshu/util.ts | 6 +- lib/routes/xjtu/2yuan/news.ts | 4 +- lib/routes/xjtu/dean.ts | 2 +- lib/routes/xjtu/ee-jzxx.ts | 2 +- lib/routes/xjtu/ee.ts | 2 +- lib/routes/xjtu/job.tsx | 2 +- lib/routes/xjtu/std.tsx | 2 +- lib/routes/xjtu/yz.ts | 2 +- lib/routes/xjtu/zs.ts | 4 +- lib/routes/xkb/index.tsx | 2 +- lib/routes/xmnn/epaper.ts | 2 +- lib/routes/xmnn/news.ts | 4 +- lib/routes/xueqiu/fund.ts | 2 +- lib/routes/xyu/notices.ts | 2 +- lib/routes/yangtzeu/dongke.ts | 2 +- lib/routes/ycwb/index.tsx | 2 +- lib/routes/yicai/brief.ts | 2 +- lib/routes/yicai/news.ts | 16 ++- lib/routes/yicai/utils.ts | 2 +- lib/routes/yicai/video.ts | 16 ++- lib/routes/yna/index.ts | 2 +- lib/routes/ynet/list.ts | 8 +- lib/routes/yomiuri/news.ts | 4 +- lib/routes/youtube/api/google.ts | 14 +- lib/routes/yxdown/news.ts | 2 +- lib/routes/yxdown/recommend.ts | 2 +- lib/routes/yxrb/home.ts | 2 +- lib/routes/yyets/article.ts | 2 +- lib/routes/zaker/utils.ts | 2 +- lib/routes/zaobao/util.tsx | 8 +- lib/routes/zhibo8/forum.ts | 2 +- lib/routes/zhibo8/luxiang.ts | 2 +- lib/routes/zhibo8/more.ts | 4 +- lib/routes/zhibo8/post.ts | 2 +- lib/routes/zhihu/execlib/x-zse-96-v3.ts | 6 +- lib/routes/zhihu/pin/utils.ts | 2 +- lib/routes/zhihu/utils.ts | 4 +- lib/routes/zju/cse/index.ts | 2 +- lib/routes/zju/grs/index.ts | 2 +- lib/routes/zjut/cs/index.ts | 2 +- lib/routes/zjut/jwc/index.ts | 2 +- lib/routes/zjut/www/index.ts | 2 +- lib/routes/zuvio/student5.ts | 2 +- lib/utils/cache/memory.ts | 2 +- lib/utils/cache/redis.ts | 2 +- lib/utils/camelcase-keys.spec.ts | 4 +- lib/utils/common-config.ts | 3 +- lib/utils/header-generator.ts | 6 +- lib/utils/ofetch.ts | 2 +- lib/utils/playwright.ts | 6 +- lib/utils/playwright.worker.ts | 6 +- lib/utils/proxy/multi-proxy.ts | 12 +- lib/utils/proxy/unify-proxy.ts | 2 +- lib/utils/readable-social.test.ts | 6 +- lib/utils/readable-social.ts | 5 +- lib/utils/request-rewriter/get.ts | 2 +- lib/utils/wechat-mp.ts | 2 +- package.json | 4 +- pnpm-lock.yaml | 46 +++---- scripts/workflow/build-docs.ts | 8 +- scripts/workflow/build-routes.ts | 8 +- 810 files changed, 1628 insertions(+), 1591 deletions(-) diff --git a/.oxlintrc.json b/.oxlintrc.json index d9f0abc3a..5a132d5da 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -151,10 +151,11 @@ // "unicorn-js/better-dom-traversing": "error", false positive on cheerio "unicorn/catch-error-name": "error", "unicorn-js/class-reference-in-static-methods": "error", - // "unicorn-js/comment-content": "error", re-evaluate when unicorn > 66.0.0 "unicorn/consistent-assert": "error", + // "unicorn-js/consistent-boolean-name": "error", // unopinionated "unicorn-js/consistent-class-member-order": "error", "unicorn-js/consistent-compound-words": "error", + "unicorn-js/consistent-conditional-object-spread": "error", "unicorn/consistent-date-clone": "error", "unicorn/consistent-empty-array-spread": "error", "unicorn/consistent-existence-index-check": "error", @@ -163,6 +164,7 @@ "unicorn-js/consistent-json-file-read": "error", "unicorn-js/consistent-optional-chaining": "error", "unicorn/consistent-template-literal-escape": "error", + "unicorn-js/default-export-style": "error", "unicorn/empty-brace-spaces": "error", "unicorn/error-message": "error", "unicorn/escape-case": "error", @@ -172,12 +174,16 @@ // "unicorn/filename-case": "error", "unicorn/import-style": "error", "unicorn-js/isolated-functions": "error", + "unicorn-js/logical-assignment-operators": "error", "unicorn-js/max-nested-calls": "error", + // "unicorn-js/name-replacements": "error", // unopinionated, rebranded prevent-abbreviations "unicorn/new-for-builtins": "error", "unicorn/no-abusive-eslint-disable": "error", "unicorn/no-accessor-recursion": "error", + "unicorn-js/no-accidental-bitwise-operator": "error", "unicorn/no-anonymous-default-export": "error", // "unicorn/no-array-callback-reference": "error", + "unicorn-js/no-array-concat-in-loop": "error", "unicorn/no-array-fill-with-reference-type": "error", "unicorn/no-array-for-each": "error", "unicorn-js/no-array-from-fill": "error", @@ -185,17 +191,26 @@ // "unicorn/no-array-reduce": "error", "unicorn/no-array-reverse": "error", // "unicorn/no-array-sort": "error", + "unicorn-js/no-array-sort-for-min-max": "error", + "unicorn-js/no-array-splice": "error", // "unicorn/no-await-expression-member": "error", "unicorn/no-await-in-promise-methods": "error", "unicorn-js/no-blob-to-file": "error", - // "unicorn-js/no-break-in-nested-loop": "error", unopinionated + "unicorn-js/no-boolean-sort-comparator": "error", + // "unicorn-js/no-break-in-nested-loop": "error", // unopinionated // "unicorn-js/no-canvas-to-image": "error", // unused + "unicorn-js/no-chained-comparison": "error", + "unicorn-js/no-collection-bracket-access": "error", "unicorn-js/no-computed-property-existence-check": "error", "unicorn-js/no-confusing-array-splice": "error", "unicorn-js/no-confusing-array-with": "error", "unicorn/no-console-spaces": "error", - // "unicorn-js/no-declarations-before-early-exit": "error", re-evaluate when unicorn > 66.0.0 + "unicorn-js/no-constant-zero-expression": "error", + // "unicorn-js/no-declarations-before-early-exit": "error", // unopinionated "unicorn/no-document-cookie": "error", + "unicorn-js/no-double-comparison": "error", + "unicorn-js/no-duplicate-if-branches": "error", + "unicorn-js/no-duplicate-logical-operands": "error", "unicorn-js/no-duplicate-loops": "error", "unicorn-js/no-duplicate-set-values": "error", // "unicorn/no-empty-file": "error", @@ -203,18 +218,21 @@ "unicorn-js/no-exports-in-scripts": "error", // "unicorn/no-for-loop": "error", // won't be implemented "unicorn-js/no-global-object-property-assignment": "error", - // "unicorn/no-hex-escape": "error", "unicorn/no-immediate-mutation": "error", + "unicorn-js/no-impossible-length-comparison": "error", "unicorn-js/no-incorrect-query-selector": "error", - // "unicorn-js/no-incorrect-template-string-interpolation": "error", too many false positives + // "unicorn-js/no-incorrect-template-string-interpolation": "error", // unopinionated, too many false positives in v68 "unicorn/no-instanceof-builtins": "error", "unicorn-js/no-invalid-argument-count": "error", + "unicorn-js/no-invalid-character-comparison": "error", "unicorn/no-invalid-fetch-options": "error", "unicorn/no-invalid-remove-event-listener": "error", "unicorn-js/no-late-current-target-access": "error", "unicorn/no-lonely-if": "error", + "unicorn-js/no-loop-iterable-mutation": "error", "unicorn/no-magic-array-flat-depth": "error", "unicorn-js/no-mismatched-map-key": "error", + "unicorn-js/no-misrefactored-assignment": "error", // "unicorn/no-named-default": "error", -> use import/no-named-default "unicorn-js/no-negated-array-predicate": "error", "unicorn-js/no-negated-comparison": "error", @@ -225,6 +243,8 @@ // "unicorn/no-nested-ternary": "error", "unicorn/no-new-array": "error", "unicorn/no-new-buffer": "error", + "unicorn-js/no-non-function-verb-prefix": "error", + "unicorn-js/no-nonstandard-builtin-properties": "error", // "unicorn/no-null": "error", // "unicorn/no-object-as-default-parameter": "error", "unicorn-js/no-object-methods-with-collections": "error", @@ -232,64 +252,81 @@ // "unicorn/no-process-exit": "error", "unicorn-js/no-redundant-comparison": "error", "unicorn-js/no-return-array-push": "error", + "unicorn-js/no-selector-as-dom-name": "error", "unicorn/no-single-promise-in-promise-methods": "error", "unicorn/no-static-only-class": "error", "unicorn-js/no-subtraction-comparison": "error", "unicorn/no-thenable": "error", "unicorn/no-this-assignment": "error", "unicorn-js/no-this-outside-of-class": "error", + // "unicorn-js/no-top-level-assignment-in-function": "error", // unopinionated // "unicorn-js/no-top-level-side-effects": "error", // allows dayjs.extend() "unicorn/no-typeof-undefined": "error", + "unicorn-js/no-uncalled-method": "error", "unicorn-js/no-undeclared-class-members": "error", "unicorn/no-unnecessary-array-flat-depth": "error", "unicorn/no-unnecessary-array-splice-count": "error", "unicorn/no-unnecessary-await": "error", + "unicorn-js/no-unnecessary-boolean-comparison": "error", "unicorn-js/no-unnecessary-global-this": "error", "unicorn-js/no-unnecessary-nested-ternary": "error", "unicorn-js/no-unnecessary-polyfills": "error", "unicorn/no-unnecessary-slice-end": "error", "unicorn-js/no-unnecessary-splice": "error", "unicorn/no-unreadable-array-destructuring": "error", + "unicorn-js/no-unreadable-for-of-expression": "error", "unicorn/no-unreadable-iife": "error", - // "unicorn-js/no-unreadable-new-expression": "error", // allows new URL(x).href "unicorn-js/no-unreadable-object-destructuring": "error", "unicorn-js/no-unsafe-buffer-conversion": "error", "unicorn-js/no-unsafe-property-key": "error", "unicorn-js/no-unsafe-string-replacement": "error", "unicorn-js/no-unused-array-method-return": "error", "unicorn-js/no-useless-boolean-cast": "error", + "unicorn-js/no-useless-coercion": "error", "unicorn/no-useless-collection-argument": "error", + "unicorn-js/no-useless-compound-assignment": "error", "unicorn-js/no-useless-concat": "error", + "unicorn-js/no-useless-continue": "error", + "unicorn-js/no-useless-delete-check": "error", "unicorn-js/no-useless-else": "error", "unicorn/no-useless-error-capture-stack-trace": "error", "unicorn/no-useless-fallback-in-spread": "error", // "unicorn/no-useless-iterator-to-array": "error", "unicorn/no-useless-length-check": "error", + "unicorn-js/no-useless-logical-operand": "error", + "unicorn-js/no-useless-override": "error", "unicorn/no-useless-promise-resolve-reject": "error", // "unicorn-js/no-useless-recursion": "error", unopinionated "unicorn/no-useless-spread": "error", // "unicorn/no-useless-switch-case": "error", "unicorn-js/no-useless-template-literals": "error", // "unicorn/no-useless-undefined": "error", + "unicorn-js/no-xor-as-exponentiation": "error", "unicorn/no-zero-fractions": "error", // "unicorn/number-literal-case": "error", // "unicorn/numeric-separators-style": "error", + "unicorn-js/operator-assignment": "error", "unicorn/prefer-add-event-listener": "error", "unicorn-js/prefer-add-event-listener-options": "error", "unicorn/prefer-array-find": "error", "unicorn/prefer-array-flat": "error", "unicorn/prefer-array-flat-map": "error", + "unicorn-js/prefer-array-from-async": "error", "unicorn-js/prefer-array-from-map": "error", "unicorn/prefer-array-index-of": "error", + "unicorn-js/prefer-array-iterable-methods": "error", "unicorn-js/prefer-array-last-methods": "error", + "unicorn-js/prefer-array-slice": "error", "unicorn/prefer-array-some": "error", "unicorn/prefer-at": "error", "unicorn-js/prefer-await": "error", "unicorn/prefer-bigint-literals": "error", "unicorn/prefer-blob-reading-methods": "error", + "unicorn-js/prefer-boolean-return": "error", "unicorn/prefer-class-fields": "error", "unicorn/prefer-classlist-toggle": "error", // "unicorn/prefer-code-point": "error", + "unicorn-js/prefer-continue": "error", "unicorn/prefer-date-now": "error", "unicorn/prefer-default-parameters": "error", "unicorn-js/prefer-direct-iteration": "error", @@ -298,11 +335,15 @@ "unicorn/prefer-dom-node-remove": "error", "unicorn/prefer-dom-node-text-content": "error", "unicorn-js/prefer-early-return": "error", + "unicorn-js/prefer-else-if": "error", "unicorn/prefer-event-target": "error", "unicorn/prefer-export-from": "error", + "unicorn-js/prefer-flat-math-min-max": "error", "unicorn-js/prefer-get-or-insert-computed": "error", "unicorn-js/prefer-global-number-constants": "error", // "unicorn/prefer-global-this": "error", + "unicorn-js/prefer-has-check": "error", + "unicorn-js/prefer-hoisting-branch-code": "error", // "unicorn-js/prefer-https": "error", "unicorn-js/prefer-identifier-import-export-specifiers": "error", "unicorn/prefer-includes": "error", @@ -313,10 +354,12 @@ "unicorn/prefer-keyboard-event-key": "error", "unicorn-js/prefer-location-assign": "error", "unicorn/prefer-logical-operator-over-ternary": "error", + "unicorn-js/prefer-map-from-entries": "error", "unicorn-js/prefer-math-abs": "error", + "unicorn-js/prefer-math-constants": "error", "unicorn/prefer-math-min-max": "error", "unicorn/prefer-math-trunc": "error", - // "unicorn-js/prefer-minimal-ternary": "error", re-evaluate when unicorn > 66.0.0 + // "unicorn-js/prefer-minimal-ternary": "error", // unopinionated, fixes have less readability "unicorn/prefer-modern-dom-apis": "error", "unicorn/prefer-modern-math-apis": "error", // "unicorn/prefer-module": "error", @@ -333,6 +376,7 @@ "unicorn/prefer-optional-catch-binding": "error", // "unicorn-js/prefer-path2d": "error", // unused "unicorn-js/prefer-private-class-fields": "error", + "unicorn-js/prefer-promise-with-resolvers": "error", "unicorn/prefer-prototype-methods": "error", "unicorn/prefer-query-selector": "error", "unicorn-js/prefer-queue-microtask": "error", @@ -342,12 +386,13 @@ "unicorn-js/prefer-scoped-selector": "error", "unicorn/prefer-set-has": "error", "unicorn/prefer-set-size": "error", - "unicorn-js/prefer-short-arrow-method": "error", + "unicorn-js/prefer-short-arrow-method": "warn", "unicorn-js/prefer-simple-condition-first": "error", "unicorn-js/prefer-simple-sort-comparator": "error", "unicorn-js/prefer-single-array-predicate": "error", "unicorn/prefer-single-call": "error", "unicorn-js/prefer-single-object-destructuring": "error", + "unicorn-js/prefer-single-replace": "error", "unicorn-js/prefer-smaller-scope": "error", "unicorn-js/prefer-split-limit": "error", // "unicorn/prefer-spread": "error", @@ -366,7 +411,11 @@ "unicorn/prefer-type-error": "error", "unicorn-js/prefer-type-literal-last": "error", // "unicorn-js/prefer-uint8array-base64": "error", re-evaluate when node > 25 + "unicorn-js/prefer-unary-minus": "error", + "unicorn-js/prefer-unicode-code-point-escapes": "error", + "unicorn-js/prefer-url-can-parse": "error", "unicorn-js/prefer-url-href": "error", + "unicorn-js/prefer-while-loop-condition": "error", // "unicorn/prevent-abbreviations": "error", "unicorn/relative-url-style": "error", "unicorn/require-array-join-separator": "error", @@ -600,7 +649,6 @@ "unicorn/no-await-expression-member": "off", "unicorn/no-empty-file": "warn", // "unicorn/no-for-loop": "off", // won't be implemented - "unicorn/no-hex-escape": "warn", "unicorn/no-nested-ternary": "off", "unicorn/no-null": "off", "unicorn/no-object-as-default-parameter": "warn", diff --git a/eslint-plugins/nsfw-flag.js b/eslint-plugins/nsfw-flag.js index aed8717ad..a4cbc5eb1 100644 --- a/eslint-plugins/nsfw-flag.js +++ b/eslint-plugins/nsfw-flag.js @@ -147,20 +147,24 @@ export default eslintCompatPlugin({ // 查找 features 属性 for (const prop of routeObject.properties) { - if (prop.type === 'Property' && prop.key && prop.key.name === 'features') { - featuresProperty = prop; - - // 在 features 中查找 nsfw 属性 - if (prop.value && prop.value.type === 'ObjectExpression') { - for (const featureProp of prop.value.properties) { - if (featureProp.type === 'Property' && featureProp.key && featureProp.key.name === 'nsfw') { - nsfwProperty = featureProp; - break; - } - } - } - break; + if (!(prop.type === 'Property' && prop.key && prop.key.name === 'features')) { + continue; } + + featuresProperty = prop; + + // 在 features 中查找 nsfw 属性 + if (prop.value && prop.value.type === 'ObjectExpression') { + for (const featureProp of prop.value.properties) { + if (!(featureProp.type === 'Property' && featureProp.key && featureProp.key.name === 'nsfw')) { + continue; + } + + nsfwProperty = featureProp; + break; + } + } + break; } // 检查是否需要添加或修复 nsfw 标志 diff --git a/lib/api/category/one.ts b/lib/api/category/one.ts index e6f7d4266..60fb290c3 100644 --- a/lib/api/category/one.ts +++ b/lib/api/category/one.ts @@ -7,19 +7,21 @@ const categoryList: Record = {}; for (const namespace in namespaces) { for (const path in namespaces[namespace].routes) { - if (namespaces[namespace].routes[path].categories?.length) { - for (const category of namespaces[namespace].routes[path].categories!) { - if (!Object.hasOwn(categoryList, category)) { - categoryList[category] = {}; - } - if (!Object.hasOwn(categoryList[category], namespace)) { - categoryList[category][namespace] = { - ...namespaces[namespace], - routes: {}, - }; - } - categoryList[category][namespace].routes[path] = namespaces[namespace].routes[path]; + if (!namespaces[namespace].routes[path].categories?.length) { + continue; + } + const categories = namespaces[namespace].routes[path].categories!; + for (const category of categories) { + if (!Object.hasOwn(categoryList, category)) { + categoryList[category] = {}; } + if (!Object.hasOwn(categoryList[category], namespace)) { + categoryList[category][namespace] = { + ...namespaces[namespace], + routes: {}, + }; + } + categoryList[category][namespace].routes[path] = namespaces[namespace].routes[path]; } } } diff --git a/lib/errors/types/captcha.ts b/lib/errors/types/captcha.ts index 46bc07e15..4df270d48 100644 --- a/lib/errors/types/captcha.ts +++ b/lib/errors/types/captcha.ts @@ -1,5 +1,3 @@ -class CaptchaError extends Error { +export default class CaptchaError extends Error { name = 'CaptchaError'; } - -export default CaptchaError; diff --git a/lib/errors/types/config-not-found.ts b/lib/errors/types/config-not-found.ts index c96cea03c..b8a3d2e14 100644 --- a/lib/errors/types/config-not-found.ts +++ b/lib/errors/types/config-not-found.ts @@ -1,5 +1,3 @@ -class ConfigNotFoundError extends Error { +export default class ConfigNotFoundError extends Error { name = 'ConfigNotFoundError'; } - -export default ConfigNotFoundError; diff --git a/lib/errors/types/invalid-parameter.ts b/lib/errors/types/invalid-parameter.ts index 8599ec4d2..482a65e80 100644 --- a/lib/errors/types/invalid-parameter.ts +++ b/lib/errors/types/invalid-parameter.ts @@ -1,5 +1,3 @@ -class InvalidParameterError extends Error { +export default class InvalidParameterError extends Error { name = 'InvalidParameterError'; } - -export default InvalidParameterError; diff --git a/lib/errors/types/not-found.ts b/lib/errors/types/not-found.ts index 9cba16b31..2c4687dac 100644 --- a/lib/errors/types/not-found.ts +++ b/lib/errors/types/not-found.ts @@ -1,5 +1,3 @@ -class NotFoundError extends Error { +export default class NotFoundError extends Error { name = 'NotFoundError'; } - -export default NotFoundError; diff --git a/lib/errors/types/reject.ts b/lib/errors/types/reject.ts index b6b91fe49..3e350672f 100644 --- a/lib/errors/types/reject.ts +++ b/lib/errors/types/reject.ts @@ -1,5 +1,3 @@ -class RejectError extends Error { +export default class RejectError extends Error { name = 'RejectError'; } - -export default RejectError; diff --git a/lib/errors/types/request-in-progress.ts b/lib/errors/types/request-in-progress.ts index 73ae4b570..aceb4bb08 100644 --- a/lib/errors/types/request-in-progress.ts +++ b/lib/errors/types/request-in-progress.ts @@ -1,5 +1,3 @@ -class RequestInProgressError extends Error { +export default class RequestInProgressError extends Error { name = 'RequestInProgressError'; } - -export default RequestInProgressError; diff --git a/lib/middleware/anti-hotlink.test.ts b/lib/middleware/anti-hotlink.test.ts index d718fad4c..fafc2fb04 100644 --- a/lib/middleware/anti-hotlink.test.ts +++ b/lib/middleware/anti-hotlink.test.ts @@ -272,7 +272,7 @@ const testAntiHotlink = async (path, expectObj, query?: string | Record `${key}=${value}`) .join('&'); } - path = path + (queryStr ? `?${queryStr}` : ''); + path += (queryStr ? `?${queryStr}` : ''); const response = await app.request(path); const parsed = await parser.parseString(await response.text()); diff --git a/lib/middleware/logger.ts b/lib/middleware/logger.ts index 19b038aa3..64c77e817 100644 --- a/lib/middleware/logger.ts +++ b/lib/middleware/logger.ts @@ -12,13 +12,13 @@ enum LogPrefix { const colorStatus = (status: number) => { const out: { [key: string]: string } = { - 7: `\u001B[35m${status}\u001B[0m`, - 5: `\u001B[31m${status}\u001B[0m`, - 4: `\u001B[33m${status}\u001B[0m`, - 3: `\u001B[36m${status}\u001B[0m`, - 2: `\u001B[32m${status}\u001B[0m`, - 1: `\u001B[32m${status}\u001B[0m`, - 0: `\u001B[33m${status}\u001B[0m`, + 7: `\u{1B}[35m${status}\u{1B}[0m`, + 5: `\u{1B}[31m${status}\u{1B}[0m`, + 4: `\u{1B}[33m${status}\u{1B}[0m`, + 3: `\u{1B}[36m${status}\u{1B}[0m`, + 2: `\u{1B}[32m${status}\u{1B}[0m`, + 1: `\u{1B}[32m${status}\u{1B}[0m`, + 0: `\u{1B}[33m${status}\u{1B}[0m`, }; const calculateStatus = Math.trunc(status / 100); diff --git a/lib/middleware/parameter-re2.test.ts b/lib/middleware/parameter-re2.test.ts index 7cbabd69d..546ab1c63 100644 --- a/lib/middleware/parameter-re2.test.ts +++ b/lib/middleware/parameter-re2.test.ts @@ -2,16 +2,17 @@ import { describe, expect, it, vi } from 'vitest'; class FakeRE2 { static CASE_INSENSITIVE = 1; + + static compile(pattern: string) { + return new FakeRE2(pattern); + } + private pattern: string; constructor(pattern: string) { this.pattern = pattern; } - static compile(pattern: string) { - return new FakeRE2(pattern); - } - matcher(text: string) { return { find: () => text.includes(this.pattern), diff --git a/lib/middleware/parameter.ts b/lib/middleware/parameter.ts index ea5e81da8..ce7780cf2 100644 --- a/lib/middleware/parameter.ts +++ b/lib/middleware/parameter.ts @@ -74,11 +74,11 @@ const middleware: MiddlewareHandler = async (ctx, next) => { } // fix allowEmpty - data.item = data.item || []; + data.item ||= []; // decode HTML entities - data.title && (data.title = entities.decodeXML(data.title + '')); - data.description && (data.description = entities.decodeXML(data.description + '')); + data.title &&= entities.decodeXML(data.title + ''); + data.description &&= entities.decodeXML(data.description + ''); // sort items if (ctx.req.query('sorted') !== 'false') { @@ -86,7 +86,7 @@ const middleware: MiddlewareHandler = async (ctx, next) => { } const handleItem = (item: DataItem) => { - item.title && (item.title = entities.decodeXML(item.title + '')); + item.title &&= entities.decodeXML(item.title + ''); // handle pubDate if (item.pubDate) { @@ -227,15 +227,15 @@ const middleware: MiddlewareHandler = async (ctx, next) => { } if (ctx.req.query('filter_description')) { const descriptionRegex = makeRegex(ctx.req.query('filter_description')!); - isFilter = isFilter && (descriptionRegex instanceof RE2JS ? descriptionRegex.matcher(description).find() : !!descriptionRegex.test(description)); + isFilter &&= descriptionRegex instanceof RE2JS ? descriptionRegex.matcher(description).find() : !!descriptionRegex.test(description); } if (ctx.req.query('filter_author')) { const authorRegex = makeRegex(ctx.req.query('filter_author')!); - isFilter = isFilter && (authorRegex instanceof RE2JS ? authorRegex.matcher(author).find() : !!authorRegex.test(author)); + isFilter &&= authorRegex instanceof RE2JS ? authorRegex.matcher(author).find() : !!authorRegex.test(author); } if (ctx.req.query('filter_category')) { const categoryRegex = makeRegex(ctx.req.query('filter_category')!); - isFilter = isFilter && category.some((c) => (categoryRegex instanceof RE2JS ? categoryRegex.matcher(c).find() : c.match(categoryRegex))); + isFilter &&= category.some((c) => (categoryRegex instanceof RE2JS ? categoryRegex.matcher(c).find() : c.match(categoryRegex))); } return isFilter; @@ -256,15 +256,15 @@ const middleware: MiddlewareHandler = async (ctx, next) => { } if (ctx.req.query('filterout') || ctx.req.query('filterout_description')) { const descriptionRegex = makeRegex(ctx.req.query('filterout_description') || ctx.req.query('filterout')!); - isFilter = isFilter && (descriptionRegex instanceof RE2JS ? !descriptionRegex.matcher(description).find() : !descriptionRegex.test(description)); + isFilter &&= descriptionRegex instanceof RE2JS ? !descriptionRegex.matcher(description).find() : !descriptionRegex.test(description); } if (ctx.req.query('filterout_author')) { const authorRegex = makeRegex(ctx.req.query('filterout_author')!); - isFilter = isFilter && (authorRegex instanceof RE2JS ? !authorRegex.matcher(author).find() : !authorRegex.test(author)); + isFilter &&= authorRegex instanceof RE2JS ? !authorRegex.matcher(author).find() : !authorRegex.test(author); } if (ctx.req.query('filterout_category')) { const categoryRegex = makeRegex(ctx.req.query('filterout_category')!); - isFilter = isFilter && category.every((c) => !(categoryRegex instanceof RE2JS ? categoryRegex.matcher(c).find() : c.match(categoryRegex))); + isFilter &&= category.every((c) => !(categoryRegex instanceof RE2JS ? categoryRegex.matcher(c).find() : c.match(categoryRegex))); } return isFilter; @@ -406,10 +406,12 @@ const middleware: MiddlewareHandler = async (ctx, next) => { if (num.test(ctx.req.query('brief')!)) { const brief: number = Number.parseInt(ctx.req.query('brief')!); for (const item of data.item) { - if (item.description) { - const text = sanitizeHtml(item.description, { allowedTags: [], allowedAttributes: {} }); - item.description = text.length > brief ? `

${text.slice(0, brief)}…

` : `

${text}

`; + if (!item.description) { + continue; } + + const text = sanitizeHtml(item.description, { allowedTags: [], allowedAttributes: {} }); + item.description = text.length > brief ? `

${text.slice(0, brief)}…

` : `

${text}

`; } } else { throw new Error('Invalid parameter brief. Please check the doc https://docs.rsshub.app/guide/parameters#shu-chu-jian-xun'); diff --git a/lib/middleware/template.tsx b/lib/middleware/template.tsx index 1b3038ad3..ecc947ee5 100644 --- a/lib/middleware/template.tsx +++ b/lib/middleware/template.tsx @@ -36,8 +36,8 @@ const middleware: MiddlewareHandler = async (ctx, next) => { if (data) { data.title = collapseWhitespace(data.title) || ''; - data.description && (data.description = collapseWhitespace(data.description) || ''); - data.author && (data.author = collapseWhitespace(data.author) || ''); + data.description &&= collapseWhitespace(data.description) || ''; + data.author &&= collapseWhitespace(data.author) || ''; if (data.item) { for (const item of data.item) { @@ -59,7 +59,7 @@ const middleware: MiddlewareHandler = async (ctx, next) => { // remove unicode control characters // see #14940 #14943 #15262 // oxlint-disable-next-line no-control-regex - item.description = item.description.replaceAll(/[\u0000-\u0009\v\f\u000E-\u001F\u007F\u200B\uFFFF]/g, ''); + item.description = item.description.replaceAll(/[\u{0000}-\u{0009}\v\f\u{000E}-\u{001F}\u{007F}\u{200B}\u{FFFF}]/gu, ''); } if (typeof item.author === 'string') { @@ -81,12 +81,12 @@ const middleware: MiddlewareHandler = async (ctx, next) => { if (outputType !== 'rss') { try { - item.pubDate && (item.pubDate = convertDateToISO8601(item.pubDate) || ''); + item.pubDate &&= convertDateToISO8601(item.pubDate) || ''; } catch { item.pubDate = ''; } try { - item.updated && (item.updated = convertDateToISO8601(item.updated) || ''); + item.updated &&= convertDateToISO8601(item.updated) || ''; } catch { item.updated = ''; } diff --git a/lib/routes/005/index.tsx b/lib/routes/005/index.tsx index 166d73015..734edf37c 100644 --- a/lib/routes/005/index.tsx +++ b/lib/routes/005/index.tsx @@ -67,7 +67,7 @@ export const handler = async (ctx) => { item.title = title; item.description = description; - item.pubDate = timezone(parseDate($$('.time').text()), +8); + item.pubDate = timezone(parseDate($$('.time').text()), 8); item.category = $$('meta[name="keywords"]').prop('content').split(/,/); item.content = { html: description, diff --git a/lib/routes/0818tuan/index.ts b/lib/routes/0818tuan/index.ts index a6df25136..39fcc7f56 100644 --- a/lib/routes/0818tuan/index.ts +++ b/lib/routes/0818tuan/index.ts @@ -55,7 +55,7 @@ async function handler(ctx) { $('.pageLink, .alert, p[style="margin:15px;"]').remove(); item.description = $('.post-content').html(); - item.pubDate = timezone(parseDate($('.panel-body > .text-center').text().replace('时间:', ''), 'YYYY-MM-DD HH:mm:ss'), +8); + item.pubDate = timezone(parseDate($('.panel-body > .text-center').text().replace('时间:', ''), 'YYYY-MM-DD HH:mm:ss'), 8); return item; }) diff --git a/lib/routes/163/exclusive.ts b/lib/routes/163/exclusive.ts index ef265de1b..881efdb75 100644 --- a/lib/routes/163/exclusive.ts +++ b/lib/routes/163/exclusive.ts @@ -134,7 +134,7 @@ async function handler(ctx) { title: item.title, author: item.source, link: item.skipURL || item.url || `${rootUrl}/dy/article/${item.docid}.html`, - pubDate: timezone(parseDate(item.ptime), +8), + pubDate: timezone(parseDate(item.ptime), 8), videoId: item.skipType === 'video' ? item.stitle : '', })); diff --git a/lib/routes/163/today.ts b/lib/routes/163/today.ts index d259642ce..5ccefa862 100644 --- a/lib/routes/163/today.ts +++ b/lib/routes/163/today.ts @@ -48,7 +48,7 @@ async function handler(ctx) { let items = response.data.data.items.map((item) => ({ title: item.title, author: item.source, - pubDate: timezone(parseDate(item.ptime), +8), + pubDate: timezone(parseDate(item.ptime), 8), description: `

${item.digest}

`, link: item.url || `https://c.m.163.com/news/a/${item.docid}.html`, })); diff --git a/lib/routes/18comic/search.ts b/lib/routes/18comic/search.ts index ffd8324b8..3b9a81c78 100644 --- a/lib/routes/18comic/search.ts +++ b/lib/routes/18comic/search.ts @@ -56,7 +56,7 @@ async function handler(ctx) { let apiUrl = getApiUrl(); order = time === 'a' ? order : `${order}_${time}`; - apiUrl = `${apiUrl}/search?search_query=${encodedKeyword}&o=${order}`; + apiUrl += `/search?search_query=${encodedKeyword}&o=${order}`; const apiResult = await processApiItems(apiUrl); let filteredItemsByCategory = apiResult.content; // Filter items by category if not 'all' diff --git a/lib/routes/19lou/index.ts b/lib/routes/19lou/index.ts index fb5be0179..00c01289a 100644 --- a/lib/routes/19lou/index.ts +++ b/lib/routes/19lou/index.ts @@ -100,7 +100,7 @@ async function handler(ctx) { item.author = content('.uname, .user-name').first().text(); item.description = content('.post-cont').first().html() || content('.thread-cont').html(); - item.pubDate = timezone(parseDate(content('.cont-top-left meta').first().attr('content')), +8); + item.pubDate = timezone(parseDate(content('.cont-top-left meta').first().attr('content')), 8); return item; }) diff --git a/lib/routes/1lou/index.ts b/lib/routes/1lou/index.ts index abc54f06b..166c57a10 100644 --- a/lib/routes/1lou/index.ts +++ b/lib/routes/1lou/index.ts @@ -34,7 +34,7 @@ export const handler = async (ctx) => { return { title: subjectEl.text(), - pubDate: timezone(parseDate(item.find('span.date').text()), +8), + pubDate: timezone(parseDate(item.find('span.date').text()), 8), link: new URL(subjectEl.prop('href'), rootUrl).href, category: [ item.find('a.text-secondary').text().replaceAll('[]', ''), @@ -63,7 +63,7 @@ export const handler = async (ctx) => { item.title = title; item.description = description; - item.pubDate = timezone(parseDate($$('span.date').text()), +8); + item.pubDate = timezone(parseDate($$('span.date').text()), 8); item.category = $$('a.badge') .toArray() .map((c) => $$(c).text()); diff --git a/lib/routes/2048/index.tsx b/lib/routes/2048/index.tsx index 4cf967857..6feaef974 100644 --- a/lib/routes/2048/index.tsx +++ b/lib/routes/2048/index.tsx @@ -143,7 +143,7 @@ async function handler(ctx) { }); item.author = content('.fl.black').first().text(); - item.pubDate = timezone(parseDate(content('span.fl.gray').first().attr('title')), +8); + item.pubDate = timezone(parseDate(content('span.fl.gray').first().attr('title')), 8); const readTpc = content('#read_tpc').first(); const copyLink = content('#copytext')?.first()?.text(); diff --git a/lib/routes/21caijing/channel.ts b/lib/routes/21caijing/channel.ts index 1cecf429a..f0e235293 100644 --- a/lib/routes/21caijing/channel.ts +++ b/lib/routes/21caijing/channel.ts @@ -101,7 +101,7 @@ export const handler = async (ctx: Context): Promise => { const processedItem: DataItem = { title, - pubDate: pubDate ? timezone(parseRelativeDate(pubDate), +8) : undefined, + pubDate: pubDate ? timezone(parseRelativeDate(pubDate), 8) : undefined, link: linkUrl, category: categories, author: authors, @@ -141,13 +141,13 @@ export const handler = async (ctx: Context): Promise => { const processedItem: DataItem = { title, description, - pubDate: pubDateStr ? timezone(parseDate(pubDateStr), +8) : item.pubDate, + pubDate: pubDateStr ? timezone(parseDate(pubDateStr), 8) : item.pubDate, category: categories, content: { html: description, text: description, }, - updated: upDatedStr ? timezone(parseDate(upDatedStr), +8) : item.updated, + updated: upDatedStr ? timezone(parseDate(upDatedStr), 8) : item.updated, language, }; diff --git a/lib/routes/2cycd/index.ts b/lib/routes/2cycd/index.ts index 5a5ad7cf1..4b52e7599 100644 --- a/lib/routes/2cycd/index.ts +++ b/lib/routes/2cycd/index.ts @@ -53,7 +53,7 @@ async function handler(ctx) { const first_post = content('td[id^="postmessage_"]').first(); const dateobj = content('em[id^="authorposton"]').first(); item.description = first_post.html(); - item.pubDate = timezone(parseDate(dateobj.find('span').attr('title'), 'YYYY-M-D HH:mm:ss'), +8); + item.pubDate = timezone(parseDate(dateobj.find('span').attr('title'), 'YYYY-M-D HH:mm:ss'), 8); return item; }) diff --git a/lib/routes/36kr/hot-list.ts b/lib/routes/36kr/hot-list.ts index 3c48333cb..7712bdcc6 100644 --- a/lib/routes/36kr/hot-list.ts +++ b/lib/routes/36kr/hot-list.ts @@ -56,7 +56,7 @@ const getProperty = (object, key) => { let result = object; const keys = key.split('.'); for (const k of keys) { - result = result && result[k]; + result &&= result[k]; } return result; }; diff --git a/lib/routes/4chan/utils.tsx b/lib/routes/4chan/utils.tsx index f961ef8ec..7ad52002c 100644 --- a/lib/routes/4chan/utils.tsx +++ b/lib/routes/4chan/utils.tsx @@ -35,11 +35,7 @@ const processCatalog = ({ data, board, viewOptions }: { data: CatalogApiReturn; return false; } - if (viewOptions.maxReplies !== undefined && replies > viewOptions.maxReplies) { - return false; - } - - return true; + return !(viewOptions.maxReplies !== undefined && replies > viewOptions.maxReplies); }) .map((thread) => ({ author: `${thread.name} ${thread.trip ?? thread.no}`, diff --git a/lib/routes/4ksj/forum.tsx b/lib/routes/4ksj/forum.tsx index 91c10204a..f4f811c68 100644 --- a/lib/routes/4ksj/forum.tsx +++ b/lib/routes/4ksj/forum.tsx @@ -182,9 +182,9 @@ async function handler(ctx) { const title = l.contents().first().text(); const link = l.next().prop('href') ?? l.nextUntil('a').next().prop('href'); - item.enclosure_url = item.enclosure_url ?? link; - item.enclosure_type = item.enclosure_type ?? 'application/x-bittorrent'; - item.enclosure_title = item.enclosure_title ?? title; + item.enclosure_url ??= link; + item.enclosure_type ??= 'application/x-bittorrent'; + item.enclosure_title ??= title; return { title, @@ -237,7 +237,7 @@ async function handler(ctx) { info: $$('div.nex_drama_sums').html(), links, }); - item.pubDate = timezone(parseDate(pubDate, 'YYYY-M-D HH:mm:ss'), +8); + item.pubDate = timezone(parseDate(pubDate, 'YYYY-M-D HH:mm:ss'), 8); item.category = Object.values(mergedDetails) .flatMap((c) => c.split(/\s/)) .filter(Boolean); diff --git a/lib/routes/50forum/zhuanjia.ts b/lib/routes/50forum/zhuanjia.ts index c5687eb29..4251b4c60 100644 --- a/lib/routes/50forum/zhuanjia.ts +++ b/lib/routes/50forum/zhuanjia.ts @@ -46,7 +46,7 @@ async function handler() { return { title: keyword[1], author: keyword[2], - pubDate: timezone(parseDate(keyword[3], 'YYYY-MM-DD'), +8), + pubDate: timezone(parseDate(keyword[3], 'YYYY-MM-DD'), 8), link, }; }); diff --git a/lib/routes/51cto/recommend.ts b/lib/routes/51cto/recommend.ts index 27f78306c..ee8b1b85b 100644 --- a/lib/routes/51cto/recommend.ts +++ b/lib/routes/51cto/recommend.ts @@ -53,7 +53,7 @@ async function getFullcontent(item, cookie = '') { return { title: item.title, link: item.url, - pubDate: parseDate(item.pubdate, +8), + pubDate: parseDate(item.pubdate, 8), description: fullContent || item.abstract, // Return item.abstract if fullContent is null }; } diff --git a/lib/routes/52hrtt/index.ts b/lib/routes/52hrtt/index.ts index 76cc9a6b3..ece291d5b 100644 --- a/lib/routes/52hrtt/index.ts +++ b/lib/routes/52hrtt/index.ts @@ -52,7 +52,7 @@ async function handler(ctx) { .map((item) => ({ title: item.infoTitle, author: item.quoteFrom, - pubDate: timezone(parseDate(item.infoStartTime), +8), + pubDate: timezone(parseDate(item.infoStartTime), 8), link: `${rootUrl}/${area}/n/w/info/${item.infoCentreId}`, })); diff --git a/lib/routes/52hrtt/symposium.ts b/lib/routes/52hrtt/symposium.ts index b8c568479..d2ffd22f1 100644 --- a/lib/routes/52hrtt/symposium.ts +++ b/lib/routes/52hrtt/symposium.ts @@ -62,7 +62,7 @@ async function handler(ctx) { .map((item) => ({ title: item.infoTitle, author: item.quoteFrom, - pubDate: timezone(parseDate(item.infoStartTime), +8), + pubDate: timezone(parseDate(item.infoStartTime), 8), link: `${rootUrl}/global/n/w/info/${item.infoCentreId}`, })); diff --git a/lib/routes/56kog/util.tsx b/lib/routes/56kog/util.tsx index 0673e0227..e0b67ece7 100644 --- a/lib/routes/56kog/util.tsx +++ b/lib/routes/56kog/util.tsx @@ -79,7 +79,7 @@ const fetchItems = async (limit, currentUrl, tryGet) => { item.author = details.find((detail) => detail.label === '作者').value; item.category = [details.find((detail) => detail.label === '状态').value, details.find((detail) => detail.label === '类型').value.text].filter(Boolean); item.guid = `56kog-${item.link.match(/\/(\d+)\.html$/)[1]}#${pubDate}`; - item.pubDate = timezone(parseDate(pubDate), +8); + item.pubDate = timezone(parseDate(pubDate), 8); } catch { // no-empty } diff --git a/lib/routes/69shu/article.ts b/lib/routes/69shu/article.ts index c38d92ded..b01f21322 100644 --- a/lib/routes/69shu/article.ts +++ b/lib/routes/69shu/article.ts @@ -70,7 +70,8 @@ const parseObject = (reg: RegExp, str: string): Record => { const obj = {}; const match = reg.exec(str); if (match) { - for (const line of match[0].matchAll(/(\w+):\s?["']?([\s\S]+?)["']?[\n,}]/g)) { + const matchedLines = match[0].matchAll(/(\w+):\s?["']?([\s\S]+?)["']?[\n,}]/g); + for (const line of matchedLines) { obj[line[1]] = line[2]; } } @@ -91,7 +92,7 @@ const decrypt = (txt: string, articleid: string, chapterid: string, decryptionMa } return txt - .replaceAll(/\u2003|\n/g, '') + .replaceAll(/\u{2003}|\n/gu, '') .split('

') .flatMap((line, index, array) => { const mapped = lineMap[index]; diff --git a/lib/routes/6park/index.ts b/lib/routes/6park/index.ts index e3904f8f9..fd6123acc 100644 --- a/lib/routes/6park/index.ts +++ b/lib/routes/6park/index.ts @@ -67,7 +67,7 @@ async function handler(ctx) { item.title = content('title').text().replace(' -6park.com', ''); item.author = detailResponse.data.match(/送交者:[^>]*>([^<]*)<\/a>/)[1].trim(); - item.pubDate = timezone(parseDate(detailResponse.data.match(/于 (.*) 已读/)[1], 'YYYY-MM-DD h:m'), +8); + item.pubDate = timezone(parseDate(detailResponse.data.match(/于 (.*) 已读/)[1], 'YYYY-MM-DD h:m'), 8); item.description = content('pre') .html() .replaceAll('

', '') diff --git a/lib/routes/6park/news.ts b/lib/routes/6park/news.ts index 30941bde8..c6d53cb59 100644 --- a/lib/routes/6park/news.ts +++ b/lib/routes/6park/news.ts @@ -80,7 +80,7 @@ async function handler(ctx) { item.title = content('h2').text(); item.author = matches[1].trim(); - item.pubDate = timezone(parseDate(matches[2], 'YYYY-MM-DD h:m'), +8); + item.pubDate = timezone(parseDate(matches[2], 'YYYY-MM-DD h:m'), 8); item.description = content('#shownewsc').html().replaceAll('

', ''); } catch { // no-empty diff --git a/lib/routes/6v123/utils.ts b/lib/routes/6v123/utils.ts index f4e8bab90..7ea686a78 100644 --- a/lib/routes/6v123/utils.ts +++ b/lib/routes/6v123/utils.ts @@ -42,7 +42,7 @@ export async function processItems(ctx, baseURL, exclude) { list.map((item) => { const link = $(item).find('a'); const href = link.attr('href'); - const pubDate = timezone(parseDate($(item).find('span').text().replaceAll(/[[\]]/g, ''), 'MM-DD'), +8); + const pubDate = timezone(parseDate($(item).find('span').text().replaceAll(/[[\]]/g, ''), 'MM-DD'), 8); const text = link.text(); if (href === undefined) { diff --git a/lib/routes/78dm/index.ts b/lib/routes/78dm/index.ts index 1fb95b2de..fdebe8826 100644 --- a/lib/routes/78dm/index.ts +++ b/lib/routes/78dm/index.ts @@ -49,7 +49,7 @@ export const handler = async (ctx) => { return { title, description, - pubDate: pubDate && /\d{4}(?:\.\d{2}){2}\s\d{2}:\d{2}/.test(pubDate) ? timezone(parseDate(pubDate, 'YYYY.MM.DD HH:mm'), +8) : undefined, + pubDate: pubDate && /\d{4}(?:\.\d{2}){2}\s\d{2}:\d{2}/.test(pubDate) ? timezone(parseDate(pubDate, 'YYYY.MM.DD HH:mm'), 8) : undefined, link: href?.startsWith('//') ? `https:${href}` : href, category: [ ...new Set([ @@ -104,7 +104,7 @@ export const handler = async (ctx) => { item.title = title; item.description = description; - item.pubDate = timezone(parseDate($$('p.push-time').text().split(/:/).pop()), +8); + item.pubDate = timezone(parseDate($$('p.push-time').text().split(/:/).pop()), 8); item.author = $$('a.push-username').contents().first().text(); item.content = { html: description, diff --git a/lib/routes/81/81rc/index.ts b/lib/routes/81/81rc/index.ts index b9f6b974b..18bdf4f9a 100644 --- a/lib/routes/81/81rc/index.ts +++ b/lib/routes/81/81rc/index.ts @@ -27,7 +27,7 @@ export const handler = async (ctx) => { return { title: item.find('a').text(), - pubDate: timezone(parseDate(item.find('span').text()), +8), + pubDate: timezone(parseDate(item.find('span').text()), 8), link: item.find('a').prop('href'), language, }; @@ -44,7 +44,7 @@ export const handler = async (ctx) => { item.title = $$('h2').text(); item.description = description; - item.pubDate = timezone(parseDate($$('div.time span').last().text()), +8); + item.pubDate = timezone(parseDate($$('div.time span').last().text()), 8); item.author = $$('div.time span').first().text(); item.content = { html: description, diff --git a/lib/routes/8264/list.tsx b/lib/routes/8264/list.tsx index 1ff231569..3a752f13e 100644 --- a/lib/routes/8264/list.tsx +++ b/lib/routes/8264/list.tsx @@ -145,7 +145,7 @@ async function handler(ctx) { item.category = content('div.fl_dh a, div.site a') .toArray() .map((c) => content(c).text().trim()); - item.pubDate = timezone(parseDate(pubDate, ['YYYY-MM-DD HH:mm', 'YYYY-M-D HH:mm']), +8); + item.pubDate = timezone(parseDate(pubDate, ['YYYY-MM-DD HH:mm', 'YYYY-M-D HH:mm']), 8); return item; }) diff --git a/lib/routes/9to5/subsite.ts b/lib/routes/9to5/subsite.ts index 2695c7559..eefa7f300 100644 --- a/lib/routes/9to5/subsite.ts +++ b/lib/routes/9to5/subsite.ts @@ -41,10 +41,10 @@ async function handler(ctx) { } if (ctx.req.param('tag')) { - link = `${link}/guides/${ctx.req.param('tag')}/feed/`; + link += `/guides/${ctx.req.param('tag')}/feed/`; title = `${ctx.req.param('tag')} | ${title}`; } else { - link = `${link}/feed/`; + link += '/feed/'; } const feed = await parser.parseURL(link); diff --git a/lib/routes/a9vg/index.ts b/lib/routes/a9vg/index.ts index a38a32455..5259262cb 100644 --- a/lib/routes/a9vg/index.ts +++ b/lib/routes/a9vg/index.ts @@ -43,7 +43,7 @@ export const handler = async (ctx) => { ] : undefined, }), - pubDate: timezone(parseDate(item.find('div.a9-rich-card-list_infos').text()), +8), + pubDate: timezone(parseDate(item.find('div.a9-rich-card-list_infos').text()), 8), language, }; }); @@ -95,7 +95,7 @@ export const handler = async (ctx) => { .match(/发表于 (\d+-\d+-\d+ \d+:\d+)/)?.[1] ?? $$('span.c-article-main_content-intro-item').first().text(), ['YYYY-M-D HH:mm', 'YYYY-MM-DD HH:mm'] ), - +8 + 8 ); item.language = language; diff --git a/lib/routes/abc/index.ts b/lib/routes/abc/index.ts index 7c1c969a9..dbcd8dfc3 100644 --- a/lib/routes/abc/index.ts +++ b/lib/routes/abc/index.ts @@ -56,7 +56,7 @@ async function handler(ctx) { const $ = load(currentResponse); - documentId = documentId ?? $('div[data-uri^="coremedia://collection/"]').first().prop('data-uri').split(/\//).pop(); + documentId ??= $('div[data-uri^="coremedia://collection/"]').first().prop('data-uri').split(/\//).pop(); const response = await ofetch(apiUrl, { query: { diff --git a/lib/routes/acpaa/index.ts b/lib/routes/acpaa/index.ts index b33d67603..77976aa56 100644 --- a/lib/routes/acpaa/index.ts +++ b/lib/routes/acpaa/index.ts @@ -44,7 +44,7 @@ async function handler(ctx) { return { title: item.prop('title'), link: new URL(item.prop('href'), rootUrl).href, - pubDate: timezone(parseDate(item.find('span[title]').prop('title')), +8), + pubDate: timezone(parseDate(item.find('span[title]').prop('title')), 8), }; }); diff --git a/lib/routes/adquan/case-library.ts b/lib/routes/adquan/case-library.ts index 5264e229d..096685cee 100644 --- a/lib/routes/adquan/case-library.ts +++ b/lib/routes/adquan/case-library.ts @@ -81,14 +81,14 @@ export const handler = async (ctx: Context): Promise => { const processedItem: DataItem = { title, description, - pubDate: pubDateStr ? timezone(parseDate(pubDateStr), +8) : item.pubDate, + pubDate: pubDateStr ? timezone(parseDate(pubDateStr), 8) : item.pubDate, category: categories, author: authors, content: { html: description, text: description, }, - updated: upDatedStr ? timezone(parseDate(upDatedStr), +8) : item.updated, + updated: upDatedStr ? timezone(parseDate(upDatedStr), 8) : item.updated, language, }; diff --git a/lib/routes/adquan/index.ts b/lib/routes/adquan/index.ts index aef56ed7e..a739a7cf4 100644 --- a/lib/routes/adquan/index.ts +++ b/lib/routes/adquan/index.ts @@ -81,14 +81,14 @@ export const handler = async (ctx: Context): Promise => { const processedItem: DataItem = { title, description, - pubDate: pubDateStr ? timezone(parseDate(pubDateStr), +8) : item.pubDate, + pubDate: pubDateStr ? timezone(parseDate(pubDateStr), 8) : item.pubDate, category: categories, author: authors, content: { html: description, text: description, }, - updated: upDatedStr ? timezone(parseDate(upDatedStr), +8) : item.updated, + updated: upDatedStr ? timezone(parseDate(upDatedStr), 8) : item.updated, language, }; diff --git a/lib/routes/agri/index.ts b/lib/routes/agri/index.ts index 308c0cb87..de2d4248a 100644 --- a/lib/routes/agri/index.ts +++ b/lib/routes/agri/index.ts @@ -72,7 +72,7 @@ export const handler = async (ctx) => { item.title = title; item.description = description; - item.pubDate = timezone(parseDate($$('meta[name="publishdate"]').prop('content')), +8); + item.pubDate = timezone(parseDate($$('meta[name="publishdate"]').prop('content')), 8); item.author = $$('meta[name="author"]').prop('content') || $$('meta[name="source"]').prop('content'); item.content = { html: description, diff --git a/lib/routes/ahjzu/news.ts b/lib/routes/ahjzu/news.ts index f3f663645..4ee5ad425 100644 --- a/lib/routes/ahjzu/news.ts +++ b/lib/routes/ahjzu/news.ts @@ -54,7 +54,7 @@ async function handler() { return { title: item.find('a').attr('title'), link, - pubDate: timezone(parseDate(date), +8), + pubDate: timezone(parseDate(date), 8), }; }); diff --git a/lib/routes/aibase/topic.ts b/lib/routes/aibase/topic.ts index c7e6c623f..e9a445caa 100644 --- a/lib/routes/aibase/topic.ts +++ b/lib/routes/aibase/topic.ts @@ -22,7 +22,7 @@ export const handler = async (ctx) => { data: { results: apiTagProcs }, } = await ofetch(apiTagProcUrl, { query: { - ...(id ? { tag: id } : {}), + ...(id && { tag: id }), page: 1, pagesize: 20, f: filter, diff --git a/lib/routes/aibase/util.tsx b/lib/routes/aibase/util.tsx index 19364d0d3..72724c270 100644 --- a/lib/routes/aibase/util.tsx +++ b/lib/routes/aibase/util.tsx @@ -91,7 +91,7 @@ const processItems = (items: any[]): any[] => return { title, description, - pubDate: timezone(parseDate(item.addtime), +8), + pubDate: timezone(parseDate(item.addtime), 8), link: new URL(`tool/${item.zurl}`, rootUrl).href, category: [...new Set([...strToArray(item.categories), ...strToArray(item.tags), item.catname, item.procattrname, item.procformname, item.proctypename])].filter(Boolean), guid, diff --git a/lib/routes/aip/journal-pupp.ts b/lib/routes/aip/journal-pupp.ts index 3e0412b5a..5372bfb3d 100644 --- a/lib/routes/aip/journal-pupp.ts +++ b/lib/routes/aip/journal-pupp.ts @@ -61,4 +61,5 @@ const handler = async (ctx) => { allowEmpty: true, }; }; +// TODO: missing route export export default handler; diff --git a/lib/routes/air-level/levelrank.ts b/lib/routes/air-level/levelrank.ts index de24aca9b..c2391f913 100644 --- a/lib/routes/air-level/levelrank.ts +++ b/lib/routes/air-level/levelrank.ts @@ -37,9 +37,7 @@ async function handler(ctx) { if (status === 'best') { title = titleBest; table = `${tableBest}
`; - } - - if (status === 'worsest') { + } else if (status === 'worsest') { title = titleWorst; table = `${tableWorst}
`; } diff --git a/lib/routes/aisixiang/column.ts b/lib/routes/aisixiang/column.ts index 537bec3e9..af373beaa 100644 --- a/lib/routes/aisixiang/column.ts +++ b/lib/routes/aisixiang/column.ts @@ -50,7 +50,7 @@ async function handler(ctx) { title: a.text(), link: new URL(a.prop('href'), rootUrl).href, author: a.text().split(':', 1)[0], - pubDate: timezone(parseDate(item.find('span').text()), +8), + pubDate: timezone(parseDate(item.find('span').text()), 8), }; }); diff --git a/lib/routes/aisixiang/utils.ts b/lib/routes/aisixiang/utils.ts index 84fc1e56b..2521fca4b 100644 --- a/lib/routes/aisixiang/utils.ts +++ b/lib/routes/aisixiang/utils.ts @@ -28,7 +28,7 @@ const ProcessFeed = (limit, tryGet, items) => .find('u') .toArray() .map((c) => content(c).text()); - item.pubDate = timezone(parseDate(content('div.info').text().split('时间:').pop()), +8); + item.pubDate = timezone(parseDate(content('div.info').text().split('时间:').pop()), 8); item.upvotes = content('span.like-num').text() ? Number(content('span.like-num').text()) : 0; item.comments = commentMatches ? Number(commentMatches[1]) : 0; diff --git a/lib/routes/aisixiang/zhuanti.ts b/lib/routes/aisixiang/zhuanti.ts index de3175a73..2ecf4e9c0 100644 --- a/lib/routes/aisixiang/zhuanti.ts +++ b/lib/routes/aisixiang/zhuanti.ts @@ -53,7 +53,7 @@ async function handler(ctx) { title: a.text(), link: new URL(a.prop('href'), rootUrl).href, author: a.text().split(':', 1)[0], - pubDate: timezone(parseDate(item.find('span').text()), +8), + pubDate: timezone(parseDate(item.find('span').text()), 8), }; }); diff --git a/lib/routes/ali213/news.ts b/lib/routes/ali213/news.ts index 1fd9538f7..bdb7b6442 100644 --- a/lib/routes/ali213/news.ts +++ b/lib/routes/ali213/news.ts @@ -134,7 +134,7 @@ export const handler = async (ctx: Context): Promise => { ...item, title, description, - pubDate: timezone(parseDate($$('div.newstag_l').text().split(/\s/, 1)[0]), +8), + pubDate: timezone(parseDate($$('div.newstag_l').text().split(/\s/, 1)[0]), 8), content: { html: description, text: $$('div#Content').html() ?? '', diff --git a/lib/routes/aliresearch/information.ts b/lib/routes/aliresearch/information.ts index 2baf52a7c..79df0c446 100644 --- a/lib/routes/aliresearch/information.ts +++ b/lib/routes/aliresearch/information.ts @@ -52,7 +52,7 @@ async function handler(ctx) { let items = response.data.data.slice(0, limit).map((item) => ({ title: item.articleCode, author: item.author, - pubDate: timezone(parseDate(item.gmtCreated), +8), + pubDate: timezone(parseDate(item.gmtCreated), 8), link: `${rootUrl}/ch/information/informationdetails?articleCode=${item.articleCode}`, })); diff --git a/lib/routes/aliyun/notice.ts b/lib/routes/aliyun/notice.ts index f86cb0b64..027bf7452 100644 --- a/lib/routes/aliyun/notice.ts +++ b/lib/routes/aliyun/notice.ts @@ -55,7 +55,7 @@ async function handler(ctx) { const title = element.find('a').text().trim(); const link = 'https://help.aliyun.com' + element.find('a').attr('href').trim(); const date = element.find('.y-right').text(); - const pubDate = timezone(parseDate(date), +8); + const pubDate = timezone(parseDate(date), 8); return { title, description: '', diff --git a/lib/routes/ally/rail.ts b/lib/routes/ally/rail.ts index 8f5d6dbc5..2d18beac5 100644 --- a/lib/routes/ally/rail.ts +++ b/lib/routes/ally/rail.ts @@ -47,7 +47,7 @@ async function handler(ctx) { const linkText = $(link).text(); title = title ? `${title} - ${linkText}` : linkText; } - title = title || (category && topic ? `${category} - ${topic}` : category) || '首页'; + title ||= (category && topic ? `${category} - ${topic}` : category) || '首页'; let links = [ // list page: http://rail.ally.net.cn/html/lujuzixun/ $('.left .hynewsO h2 a').toArray(), @@ -106,7 +106,7 @@ async function handler(ctx) { let innerHtml; if (child.name === 'div') { innerHtml = $child.html(); - innerHtml = innerHtml && innerHtml.trim(); + innerHtml &&= innerHtml.trim(); description += !innerHtml || innerHtml === ' ' ? (description ? '
' : '') : innerHtml; } else { // bare text node or something else diff --git a/lib/routes/anquanke/category.ts b/lib/routes/anquanke/category.ts index 2da6a9349..90911962e 100644 --- a/lib/routes/anquanke/category.ts +++ b/lib/routes/anquanke/category.ts @@ -48,7 +48,7 @@ async function handler(ctx) { return content('#js-article').html(); }) : item.desc, - pubDate: timezone(parseDate(item.date), +8), + pubDate: timezone(parseDate(item.date), 8), link: art_url, author: item.author.nickname, }; diff --git a/lib/routes/anquanke/vul.ts b/lib/routes/anquanke/vul.ts index 1ecdf681a..7a30a7f38 100644 --- a/lib/routes/anquanke/vul.ts +++ b/lib/routes/anquanke/vul.ts @@ -34,4 +34,5 @@ const handler = async () => { }; }; +// TODO: missing route export export default handler; diff --git a/lib/routes/apiseven/blog.ts b/lib/routes/apiseven/blog.ts index eb53f4bcd..af685ff6f 100644 --- a/lib/routes/apiseven/blog.ts +++ b/lib/routes/apiseven/blog.ts @@ -19,7 +19,7 @@ async function getArticles() { return json.props.pageProps.list.map((item) => ({ title: item.title, link: 'https://www.apiseven.com' + item.slug, - pubDate: timezone(parseDate(item.published_at), +8), + pubDate: timezone(parseDate(item.published_at), 8), category: item.tags, })); } diff --git a/lib/routes/appstorrent/programs.tsx b/lib/routes/appstorrent/programs.tsx index ced480153..009ca2d29 100644 --- a/lib/routes/appstorrent/programs.tsx +++ b/lib/routes/appstorrent/programs.tsx @@ -98,7 +98,7 @@ async function handler(ctx?: Context): Promise { return { title: $('title').text(), - link: currentUrl.toString(), + link: currentUrl, allowEmpty: true, item: items, }; diff --git a/lib/routes/asmr-200/index.tsx b/lib/routes/asmr-200/index.tsx index 7916bf48d..7a97941a7 100644 --- a/lib/routes/asmr-200/index.tsx +++ b/lib/routes/asmr-200/index.tsx @@ -85,7 +85,7 @@ export const route: Route = { image: each.mainCoverUrl, author: each.name, link: `https://asmr-200.com/work/${each.source_id}`, - pubDate: timezone(parseDate(each.release, 'YYYY-MM-DD'), +8), + pubDate: timezone(parseDate(each.release, 'YYYY-MM-DD'), 8), category, description: render(each, `https://asmr-200.com/work/${each.source_id}`), }; diff --git a/lib/routes/atcoder/post.ts b/lib/routes/atcoder/post.ts index 55130f768..18e2ff937 100644 --- a/lib/routes/atcoder/post.ts +++ b/lib/routes/atcoder/post.ts @@ -46,7 +46,7 @@ async function handler(ctx) { title: item.find('.panel-title').text(), description: item.find('.panel-body').html(), link: `${rootUrl}${item.find('.panel-title a').attr('href')}`, - pubDate: timezone(parseDate(item.find('.timeago').attr('datetime')), +9), + pubDate: timezone(parseDate(item.find('.timeago').attr('datetime')), 9), }; }); diff --git a/lib/routes/auto-stats/index.ts b/lib/routes/auto-stats/index.ts index 36bd61d41..dd9b81d8e 100644 --- a/lib/routes/auto-stats/index.ts +++ b/lib/routes/auto-stats/index.ts @@ -53,7 +53,7 @@ async function handler(ctx) { return { title: title.replace(/●/, '').split(/(\d+/, 1)[0], link: new URL(item.parent().prop('href'), rootUrl).href, - pubDate: timezone(parseDate(pubDate, 'YYYY/M/D H:mm:ss'), +8), + pubDate: timezone(parseDate(pubDate, 'YYYY/M/D H:mm:ss'), 8), }; }); diff --git a/lib/routes/bad/index.ts b/lib/routes/bad/index.ts index 74fcfe60b..0bd8050db 100644 --- a/lib/routes/bad/index.ts +++ b/lib/routes/bad/index.ts @@ -52,7 +52,7 @@ async function handler(ctx) { link: a.attr('href'), description: item.find('.coverdiv').html(), author: item.find('.author').text().trim(), - pubDate: timezone(parseDate(item.find('time').attr('datetime')), +8), + pubDate: timezone(parseDate(item.find('time').attr('datetime')), 8), category: item .find('.label') .toArray() diff --git a/lib/routes/baidu/tieba/forum.tsx b/lib/routes/baidu/tieba/forum.tsx index 9c001b7e5..9433fa3e0 100644 --- a/lib/routes/baidu/tieba/forum.tsx +++ b/lib/routes/baidu/tieba/forum.tsx @@ -72,7 +72,7 @@ async function handler(ctx) {

作者:{author_name}

), - pubDate: timezone(parseDate(time, ['HH:mm', 'M-D', 'YYYY-MM'], true), +8), + pubDate: timezone(parseDate(time, ['HH:mm', 'M-D', 'YYYY-MM'], true), 8), link: `https://tieba.baidu.com/p/${id}`, }; }); diff --git a/lib/routes/baidu/tieba/post.tsx b/lib/routes/baidu/tieba/post.tsx index cfc0a02dd..32eea6f95 100644 --- a/lib/routes/baidu/tieba/post.tsx +++ b/lib/routes/baidu/tieba/post.tsx @@ -98,7 +98,7 @@ async function handler(ctx) { {from} ), - pubDate: timezone(parseDate(time, 'YYYY-MM-DD hh:mm'), +8), + pubDate: timezone(parseDate(time, 'YYYY-MM-DD hh:mm'), 8), link: `https://tieba.baidu.com/p/${id}?pid=${content.post_id}#${content.post_id}`, }; }), diff --git a/lib/routes/baidu/tieba/search.tsx b/lib/routes/baidu/tieba/search.tsx index 537559918..9b8e5810c 100644 --- a/lib/routes/baidu/tieba/search.tsx +++ b/lib/routes/baidu/tieba/search.tsx @@ -88,7 +88,7 @@ async function handler(ctx) { ), author, - pubDate: timezone(parseDate(time, 'YYYY-MM-DD HH:mm'), +8), + pubDate: timezone(parseDate(time, 'YYYY-MM-DD HH:mm'), 8), link, }; }), diff --git a/lib/routes/baidu/tieba/user.ts b/lib/routes/baidu/tieba/user.ts index d757866eb..4a806ebb5 100644 --- a/lib/routes/baidu/tieba/user.ts +++ b/lib/routes/baidu/tieba/user.ts @@ -45,7 +45,7 @@ async function handler(ctx) { imgurl = item.find('ul.n_media.clearfix img').attr('original'); return { title: item.find('div.thread_name a').attr('title'), - pubDate: timezone(parseDate(item.parent().find('div .n_post_time').text(), ['YYYY-MM-DD', 'HH:mm']), +8), + pubDate: timezone(parseDate(item.parent().find('div .n_post_time').text(), ['YYYY-MM-DD', 'HH:mm']), 8), description: `${item.find('div.n_txt').text()}
`, link: item.find('div.thread_name a').attr('href'), }; diff --git a/lib/routes/bangumi.tv/calendar/_base.ts b/lib/routes/bangumi.tv/calendar/_base.ts index 140b9da62..a06945bba 100644 --- a/lib/routes/bangumi.tv/calendar/_base.ts +++ b/lib/routes/bangumi.tv/calendar/_base.ts @@ -1,7 +1,7 @@ import { config } from '@/config'; import got from '@/utils/got'; -const getData = (tryGet) => { +export const getData = (tryGet) => { const bgmCalendarUrl = 'https://api.bgm.tv/calendar'; const bgmDataUrl = 'https://cdn.jsdelivr.net/npm/bangumi-data/dist/data.json'; @@ -35,4 +35,3 @@ const getData = (tryGet) => { ) ); }; -export default getData; diff --git a/lib/routes/bangumi.tv/calendar/today.tsx b/lib/routes/bangumi.tv/calendar/today.tsx index f04b2f146..c33f9ec20 100644 --- a/lib/routes/bangumi.tv/calendar/today.tsx +++ b/lib/routes/bangumi.tv/calendar/today.tsx @@ -3,7 +3,7 @@ import { renderToString } from 'hono/jsx/dom/server'; import type { Route } from '@/types'; import cache from '@/utils/cache'; -import getData from './_base'; +import { getData } from './_base'; export const route: Route = { path: '/calendar/today', diff --git a/lib/routes/bangumi.tv/group/reply.ts b/lib/routes/bangumi.tv/group/reply.ts index 9e2aa1a48..3c5834102 100644 --- a/lib/routes/bangumi.tv/group/reply.ts +++ b/lib/routes/bangumi.tv/group/reply.ts @@ -63,7 +63,7 @@ async function handler(ctx) { title, description: $('.postTopic .topic_content').html(), author: $('.postTopic .inner strong a').first().text(), - pubDate: timezone(parseDate($('.postTopic .re_info small').text().trim().slice(5)), +8), + pubDate: timezone(parseDate($('.postTopic .re_info small').text().trim().slice(5)), 8), link, }; @@ -74,7 +74,7 @@ async function handler(ctx) { ...finalLatestReplies.map((c) => ({ title: `${c.author} 回复了小组话题《${title}》`, description: c.content, - pubDate: timezone(parseDate(c.date), +8), + pubDate: timezone(parseDate(c.date), 8), author: c.author, link: `${link}#${c.id}`, })), diff --git a/lib/routes/bangumi.tv/subject/comments.ts b/lib/routes/bangumi.tv/subject/comments.ts index f3d1e76d2..aa325f006 100644 --- a/lib/routes/bangumi.tv/subject/comments.ts +++ b/lib/routes/bangumi.tv/subject/comments.ts @@ -3,7 +3,7 @@ import { load } from 'cheerio'; import ofetch from '@/utils/ofetch'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; -const getComments = async (subjectID, minLength) => { +export const getComments = async (subjectID, minLength) => { // bangumi.tv未提供获取“吐槽(comments)”的API,因此仍需要通过抓取网页来获取 const link = `https://bgm.tv/subject/${subjectID}/comments`; const html = await ofetch(link); @@ -46,4 +46,3 @@ const getComments = async (subjectID, minLength) => { })), }; }; -export default getComments; diff --git a/lib/routes/bangumi.tv/subject/ep.tsx b/lib/routes/bangumi.tv/subject/ep.tsx index fe54c6f94..a70047fab 100644 --- a/lib/routes/bangumi.tv/subject/ep.tsx +++ b/lib/routes/bangumi.tv/subject/ep.tsx @@ -6,7 +6,7 @@ import { parseDate } from '@/utils/parse-date'; import { getLocalName } from './utils'; -const getEps = async (subjectID, showOriginalName) => { +export const getEps = async (subjectID, showOriginalName) => { const url = `https://api.bgm.tv/subject/${subjectID}?responseGroup=large`; const epsInfo = await ofetch(url); const activeEps = epsInfo.eps.filter((e) => e.status === 'Air'); @@ -28,4 +28,3 @@ const getEps = async (subjectID, showOriginalName) => { })), }; }; -export default getEps; diff --git a/lib/routes/bangumi.tv/subject/index.ts b/lib/routes/bangumi.tv/subject/index.ts index dbf9c7dd8..6b145a419 100644 --- a/lib/routes/bangumi.tv/subject/index.ts +++ b/lib/routes/bangumi.tv/subject/index.ts @@ -2,9 +2,9 @@ import InvalidParameterError from '@/errors/types/invalid-parameter'; import type { Route } from '@/types'; import { queryToBoolean } from '@/utils/readable-social'; -import getComments from './comments'; -import getEps from './ep'; -import getFromAPI from './offcial-subject-api'; +import { getComments } from './comments'; +import { getEps } from './ep'; +import { getFromAPI } from './offcial-subject-api'; export const route: Route = { path: '/subject/:id/:type?/:showOriginalName?', diff --git a/lib/routes/bangumi.tv/subject/offcial-subject-api.ts b/lib/routes/bangumi.tv/subject/offcial-subject-api.ts index 703beba30..6f43072d3 100644 --- a/lib/routes/bangumi.tv/subject/offcial-subject-api.ts +++ b/lib/routes/bangumi.tv/subject/offcial-subject-api.ts @@ -3,7 +3,7 @@ import { parseDate } from '@/utils/parse-date'; import { getLocalName } from './utils'; -const getFromAPI = (type) => { +export const getFromAPI = (type) => { const mapping = { blog: { en: 'reviews', @@ -32,4 +32,3 @@ const getFromAPI = (type) => { }; }; }; -export default getFromAPI; diff --git a/lib/routes/banyuetan/index.ts b/lib/routes/banyuetan/index.ts index b522e8496..b8055ebb8 100644 --- a/lib/routes/banyuetan/index.ts +++ b/lib/routes/banyuetan/index.ts @@ -99,7 +99,7 @@ export const handler = async (ctx: Context): Promise => { const processedItem: DataItem = { title, description, - pubDate: pubDateStr ? timezone(parseDate(pubDateStr), +8) : item.pubDate, + pubDate: pubDateStr ? timezone(parseDate(pubDateStr), 8) : item.pubDate, category: categories, author: authors, content: { @@ -108,7 +108,7 @@ export const handler = async (ctx: Context): Promise => { }, image, banner: image, - updated: upDatedStr ? timezone(parseDate(upDatedStr), +8) : item.updated, + updated: upDatedStr ? timezone(parseDate(upDatedStr), 8) : item.updated, language, }; diff --git a/lib/routes/baobua/article.ts b/lib/routes/baobua/article.ts index 82fe3bdf7..25cefa9db 100644 --- a/lib/routes/baobua/article.ts +++ b/lib/routes/baobua/article.ts @@ -3,7 +3,7 @@ import { load } from 'cheerio'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -async function loadArticle(link) { +export const loadArticle = async (link) => { const resp = await got(link); const article = load(resp.body); @@ -47,6 +47,4 @@ async function loadArticle(link) { pubDate, link, }; -} - -export default loadArticle; +}; diff --git a/lib/routes/baobua/category.ts b/lib/routes/baobua/category.ts index 0618fd7dc..a764c987d 100644 --- a/lib/routes/baobua/category.ts +++ b/lib/routes/baobua/category.ts @@ -4,7 +4,7 @@ import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import loadArticle from './article'; +import { loadArticle } from './article'; import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { diff --git a/lib/routes/baobua/latest.ts b/lib/routes/baobua/latest.ts index 0fc235ff7..23fed0300 100644 --- a/lib/routes/baobua/latest.ts +++ b/lib/routes/baobua/latest.ts @@ -4,7 +4,7 @@ import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import loadArticle from './article'; +import { loadArticle } from './article'; import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { diff --git a/lib/routes/baobua/search.ts b/lib/routes/baobua/search.ts index 11d62506b..29dd7ac0a 100644 --- a/lib/routes/baobua/search.ts +++ b/lib/routes/baobua/search.ts @@ -4,7 +4,7 @@ import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import loadArticle from './article'; +import { loadArticle } from './article'; import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { diff --git a/lib/routes/barronschina/index.ts b/lib/routes/barronschina/index.ts index 92f860ad5..800533227 100644 --- a/lib/routes/barronschina/index.ts +++ b/lib/routes/barronschina/index.ts @@ -68,7 +68,7 @@ async function handler(ctx) { const content = load(detailResponse.data); item.description = content('.cont_main').html(); - item.pubDate = timezone(parseDate(content('.timeTag').text()), +8); + item.pubDate = timezone(parseDate(content('.timeTag').text()), 8); return item; }) @@ -89,7 +89,7 @@ async function handler(ctx) { title, description, link: currentUrl, - pubDate: timezone(parseDate(`${item.parent().find('dt').text()} ${item.text()}`), +8), + pubDate: timezone(parseDate(`${item.parent().find('dt').text()} ${item.text()}`), 8), }; }); diff --git a/lib/routes/bast/index.ts b/lib/routes/bast/index.ts index 3b2c9e63c..ade47e473 100644 --- a/lib/routes/bast/index.ts +++ b/lib/routes/bast/index.ts @@ -66,7 +66,7 @@ async function handler(ctx) { item.title = content('meta[name="ArticleTitle"]').attr('content'); item.author = content('meta[name="contentSource"]').attr('content'); - item.pubDate = timezone(parseDate(content('meta[name="pubdate"]').attr('content')), +8); + item.pubDate = timezone(parseDate(content('meta[name="pubdate"]').attr('content')), 8); item.category = [content('meta[name="ColumnName"]').attr('content')]; item.description = content('.arccont').html(); diff --git a/lib/routes/bbc/utils.tsx b/lib/routes/bbc/utils.tsx index 54b8a277e..a298262cf 100644 --- a/lib/routes/bbc/utils.tsx +++ b/lib/routes/bbc/utils.tsx @@ -50,7 +50,8 @@ type Block = { const applyAttributes = (content: JSX.Element | string, attributes?: BlockAttribute[]): JSX.Element | string => { let result: JSX.Element | string = content; - for (const attribute of attributes ?? []) { + const attributeList = attributes ?? []; + for (const attribute of attributeList) { switch (attribute) { case 'bold': result = {result}; diff --git a/lib/routes/bdys/index.tsx b/lib/routes/bdys/index.tsx index b29f2ce2f..2e910f432 100644 --- a/lib/routes/bdys/index.tsx +++ b/lib/routes/bdys/index.tsx @@ -197,7 +197,7 @@ async function handler(ctx) { ); - item.pubDate = timezone(parseDate(content('.bg-purple-lt').text().replace('更新时间:', '')), +8); + item.pubDate = timezone(parseDate(content('.bg-purple-lt').text().replace('更新时间:', '')), 8); item.guid = `${item.link}#${content('.card h1').text()}`; item.enclosure_url = torrents.html() ? `${rootUrl}${torrents.find('a').first().attr('href')}` : downloadResponse.data.pop().url; diff --git a/lib/routes/behance/user.tsx b/lib/routes/behance/user.tsx index 0bd133fcb..b936b7a69 100644 --- a/lib/routes/behance/user.tsx +++ b/lib/routes/behance/user.tsx @@ -164,7 +164,7 @@ async function handler(ctx) { item.description = renderDescription(project.description, project.allModules); item.category = [...new Set([...(item.category || []), ...(project.tags?.map((tag) => tag.title.toLowerCase()) || [])])]; - item.pubDate = item.pubDate || (project.publishedOn ? parseDate(project.publishedOn, 'X') : undefined); + item.pubDate ||= project.publishedOn ? parseDate(project.publishedOn, 'X') : undefined; return item; }) diff --git a/lib/routes/bendibao/news.ts b/lib/routes/bendibao/news.ts index 4e863dc8c..aa0f41606 100644 --- a/lib/routes/bendibao/news.ts +++ b/lib/routes/bendibao/news.ts @@ -128,7 +128,7 @@ async function handler(ctx) { .text() .replace(/发布时间:/, '') ?? content('span.public_time').text() ), - +8 + 8 ); return item; diff --git a/lib/routes/bilibili/cache.ts b/lib/routes/bilibili/cache.ts index 6a86a7fe7..0aeaa6e92 100644 --- a/lib/routes/bilibili/cache.ts +++ b/lib/routes/bilibili/cache.ts @@ -123,7 +123,9 @@ const getWbiVerifyString = () => { const array = JSON.parse(jsResponse.match(/\[(?:\d+,){63}\d+\]/)); const o = []; for (const t of array) { - r.charAt(t) && o.push(r.charAt(t)); + if (r.charAt(t)) { + o.push(r.charAt(t)); + } } return o.join('').slice(0, 32); }); @@ -365,13 +367,11 @@ const getArticleDataFromCvid = async (cvid, uid) => { description += `

${text.word.words}

`; } } - } - if (element.para_type === 2) { + } else if (element.para_type === 2) { for (const image of element.pic.pics) { description += `

`; } - } - if (element.para_type === 3 && element.line?.pic?.url) { + } else if (element.para_type === 3 && element.line?.pic?.url) { description += `
`; } } diff --git a/lib/routes/bilibili/live-area.ts b/lib/routes/bilibili/live-area.ts index 40c356d03..dbcfaeb04 100644 --- a/lib/routes/bilibili/live-area.ts +++ b/lib/routes/bilibili/live-area.ts @@ -52,14 +52,16 @@ async function handler(ctx) { for (const parentArea of nameResponse.data.data) { for (const area of parentArea.list) { - if (area.id === areaID) { - parentTitle = parentArea.name; - const parentID: string = parentArea.id; - areaTitle = area.name; - // cateID = area.cate_id; - areaLink = `https://live.bilibili.com/p/eden/area-tags?parentAreaId=${parentID}&areaId=${areaID}`; - break; + if (area.id !== areaID) { + continue; } + + parentTitle = parentArea.name; + const parentID: string = parentArea.id; + areaTitle = area.name; + // cateID = area.cate_id; + areaLink = `https://live.bilibili.com/p/eden/area-tags?parentAreaId=${parentID}&areaId=${areaID}`; + break; } } diff --git a/lib/routes/bilibili/message-sessions.ts b/lib/routes/bilibili/message-sessions.ts index 4ed8e5877..f2299d2e4 100644 --- a/lib/routes/bilibili/message-sessions.ts +++ b/lib/routes/bilibili/message-sessions.ts @@ -50,7 +50,7 @@ interface SessionItem { ack_ts: number; session_ts: number; unread_count: number; - last_msg: null | { + last_msg: { sender_uid: number; receiver_type: number; receiver_id: number; @@ -63,7 +63,7 @@ interface SessionItem { msg_status: number; notify_code: string; msg_source: number; - }; + } | null; group_type: number; can_fold: number; status: number; diff --git a/lib/routes/bilibili/partion-ranking.ts b/lib/routes/bilibili/partion-ranking.ts index 340148244..c827368a2 100644 --- a/lib/routes/bilibili/partion-ranking.ts +++ b/lib/routes/bilibili/partion-ranking.ts @@ -13,7 +13,7 @@ function formatDate(now) { const year = now.getFullYear(); const month = now.getMonth() + 1; const date = now.getDate(); - const dateTime = year + '' + (month >= 10 ? month : '0' + month) + '' + (date >= 10 ? date : '0' + date); + const dateTime = year + '' + (month >= 10 ? month : '0' + month) + (date >= 10 ? date : '0' + date); return dateTime; } diff --git a/lib/routes/bilibili/wasm-exec.ts b/lib/routes/bilibili/wasm-exec.ts index b1104767e..6c914e9db 100644 --- a/lib/routes/bilibili/wasm-exec.ts +++ b/lib/routes/bilibili/wasm-exec.ts @@ -173,7 +173,7 @@ throw new Error('globalThis.TextDecoder is not available, polyfill required'); } - const encoder = new TextEncoder('utf-8'); + const encoder = new TextEncoder(); const decoder = new TextDecoder('utf-8'); globalThis.Go = class { diff --git a/lib/routes/binance/announcement.ts b/lib/routes/binance/announcement.ts index 7c2b0dbea..ec1a407be 100644 --- a/lib/routes/binance/announcement.ts +++ b/lib/routes/binance/announcement.ts @@ -18,9 +18,9 @@ interface CatalogItem { interface ArticleListResponse { code: string; - data: null | { + data: { catalogs: CatalogItem[]; - }; + } | null; } const TYPE_CATALOG_ID_MAP: Record = { diff --git a/lib/routes/biquge/index.ts b/lib/routes/biquge/index.ts index 4da457d8e..d2d27c128 100644 --- a/lib/routes/biquge/index.ts +++ b/lib/routes/biquge/index.ts @@ -51,7 +51,7 @@ async function handler(ctx) { const $ = load(iconv.decode(response.data, encoding)); const author = $('meta[property="og:novel:author"]').attr('content'); - const pubDate = timezone(parseDate($('meta[property="og:novel:update_time"]').attr('content')), +8); + const pubDate = timezone(parseDate($('meta[property="og:novel:update_time"]').attr('content')), 8); let items = $('dl dd a') .toArray() diff --git a/lib/routes/bjfu/it/utils.ts b/lib/routes/bjfu/it/utils.ts index ef3517502..2998f726e 100644 --- a/lib/routes/bjfu/it/utils.ts +++ b/lib/routes/bjfu/it/utils.ts @@ -50,7 +50,7 @@ const ProcessFeed = (base, list, caches) => .text() .match(/\d{4}-\d{2}-\d{2}/) ), - +8 + 8 ); // 使用tryGet方法从缓存获取内容。 diff --git a/lib/routes/bjfu/jwc/utils.ts b/lib/routes/bjfu/jwc/utils.ts index c0e633eba..526bbda34 100644 --- a/lib/routes/bjfu/jwc/utils.ts +++ b/lib/routes/bjfu/jwc/utils.ts @@ -37,7 +37,7 @@ const ProcessFeed = (base, list, caches) => .text() .match(/\d{4}-\d{2}-\d{2}/) ), - +8 + 8 ); // 使用tryGet方法从缓存获取内容。 diff --git a/lib/routes/bjfu/news/utils.ts b/lib/routes/bjfu/news/utils.ts index 3511db1b2..b13dcc30b 100644 --- a/lib/routes/bjfu/news/utils.ts +++ b/lib/routes/bjfu/news/utils.ts @@ -20,7 +20,7 @@ async function loadContent(link) { .text() .match(/\d{4}(?:\/\d{2}){2}/) ), - +8 + 8 ); // 提取内容 diff --git a/lib/routes/bjnews/column.ts b/lib/routes/bjnews/column.ts index 6529d9b3e..82723a8e5 100644 --- a/lib/routes/bjnews/column.ts +++ b/lib/routes/bjnews/column.ts @@ -29,8 +29,8 @@ async function handler(ctx) { const list = res.data.slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 15).map((e) => ({ title: e.row.title, guid: e.uuid, - pubDate: timezone(parseDate(e.row.publish_time), +8), - updated: timezone(parseDate(e.row.update_time), +8), + pubDate: timezone(parseDate(e.row.publish_time), 8), + updated: timezone(parseDate(e.row.update_time), 8), link: `https://www.bjnews.com.cn/detail/${e.uuid}.html`, })); diff --git a/lib/routes/bjnews/utils.ts b/lib/routes/bjnews/utils.ts index 86379eae1..1df79a8a2 100644 --- a/lib/routes/bjnews/utils.ts +++ b/lib/routes/bjnews/utils.ts @@ -11,7 +11,7 @@ export function fetchArticle(item) { const $d = load(responses); // $d('img').each((i, e) => $(e).attr('referrerpolicy', 'no-referrer')); - item.pubDate = timezone(parseDate($d('.left-info .timer').text()), +8); + item.pubDate = timezone(parseDate($d('.left-info .timer').text()), 8); item.author = $d('.left-info .reporter').text(); item.description = $d('#contentStr').html(); diff --git a/lib/routes/bjwxdxh/index.ts b/lib/routes/bjwxdxh/index.ts index d8060cc9a..baec7979c 100644 --- a/lib/routes/bjwxdxh/index.ts +++ b/lib/routes/bjwxdxh/index.ts @@ -61,7 +61,7 @@ async function handler(ctx) { .text() .match(/作者:(\S*)\s+发布于:(\S*\s+.*?)\s/); item.author = info[1]; - item.pubDate = timezone(parseDate(info[2], 'YYYY-MM-DD HH:mm:ss'), +8); + item.pubDate = timezone(parseDate(info[2], 'YYYY-MM-DD HH:mm:ss'), 8); item.description = content('div#con').html().trim().replaceAll('\n', ''); return item; }) diff --git a/lib/routes/bjx/huanbao.ts b/lib/routes/bjx/huanbao.ts index 509014528..33ff748fc 100644 --- a/lib/routes/bjx/huanbao.ts +++ b/lib/routes/bjx/huanbao.ts @@ -89,7 +89,7 @@ const fetchPage = (link) => const item = { title: $page('title').text(), description: pages.map(($p) => $p('.cc-article').html() ?? '').join(''), - pubDate: timezone(parseDate($page('.cc-headline .box p span').eq(0).text()), +8), + pubDate: timezone(parseDate($page('.cc-headline .box p span').eq(0).text()), 8), link, author: $page('.cc-headline .box p span').eq(1).text(), }; diff --git a/lib/routes/bmkg/earthquake.ts b/lib/routes/bmkg/earthquake.ts index d60f1dd89..18eb1bb9f 100644 --- a/lib/routes/bmkg/earthquake.ts +++ b/lib/routes/bmkg/earthquake.ts @@ -41,7 +41,7 @@ async function handler() { return { title: `${td[2].children[0].data}|${td[3].children[0].data}|${td[4].children[0].data}|${td[5].children[0].data}|${td[6].children[0].data}`, link: url, - pubDate: timezone(parseDate(`${td[1].children[0].data} ${td[1].children[2].data.slice(0, 8)}`, 'DD-MM-YY HH:mm:ss'), +7), + pubDate: timezone(parseDate(`${td[1].children[0].data} ${td[1].children[2].data.slice(0, 8)}`, 'DD-MM-YY HH:mm:ss'), 7), }; }); diff --git a/lib/routes/bnext/index.ts b/lib/routes/bnext/index.ts index 2c9848c16..e15734e4a 100644 --- a/lib/routes/bnext/index.ts +++ b/lib/routes/bnext/index.ts @@ -36,7 +36,7 @@ async function handler() { const enclosure = item.enclosure; const enclosure_url = enclosure?.url; const enclosure_type = enclosure?.type; - const enclosure_length = enclosure?.length ? Number(enclosure.length) : undefined; + const enclosure_length = enclosure?.length || undefined; return { title: item.title ?? item.link ?? 'Untitled', diff --git a/lib/routes/bntnews/index.ts b/lib/routes/bntnews/index.ts index aa117467e..eb0f25f7c 100644 --- a/lib/routes/bntnews/index.ts +++ b/lib/routes/bntnews/index.ts @@ -59,7 +59,7 @@ async function handler(ctx) { title: article.title, link, description: article.content, - pubDate: timezone(parseDate(article.firstPublishDate), +9), + pubDate: timezone(parseDate(article.firstPublishDate), 9), author: article.reporter?.[0]?.name || '', }; }); diff --git a/lib/routes/bse/index.ts b/lib/routes/bse/index.ts index 0add93200..06cc8f30a 100644 --- a/lib/routes/bse/index.ts +++ b/lib/routes/bse/index.ts @@ -194,7 +194,7 @@ async function handler(ctx) { category: item.tags, description: item.text, link: `${rootUrl}${item.htmlUrl}`, - pubDate: timezone(parseDate(item.publishDate), +8), + pubDate: timezone(parseDate(item.publishDate), 8), })); break; diff --git a/lib/routes/bsky/templates/post.tsx b/lib/routes/bsky/templates/post.tsx index 4f7cf19a3..8d03535ed 100644 --- a/lib/routes/bsky/templates/post.tsx +++ b/lib/routes/bsky/templates/post.tsx @@ -17,11 +17,11 @@ type VideoEmbed = { playlist?: string; }; -type Embed = VideoEmbed & { +type Embed = { $type?: string; images?: ImageEmbed[]; external?: ExternalEmbed; -}; +} & VideoEmbed; type PostProps = { text?: string; diff --git a/lib/routes/btzj/index.tsx b/lib/routes/btzj/index.tsx index ef9fb00d0..711c1443c 100644 --- a/lib/routes/btzj/index.tsx +++ b/lib/routes/btzj/index.tsx @@ -145,7 +145,7 @@ async function handler(ctx) { item.description = content('.post').html(); item.author = content('.purple, .grey').first().prev().text(); - item.pubDate = timezone(parseDate(content('.bg2 b').first().text()), +8); + item.pubDate = timezone(parseDate(content('.bg2 b').first().text()), 8); if (torrents.length > 0) { item.description += renderTorrents(torrents.toArray().map((t) => content(t).parent().html())); diff --git a/lib/routes/buaa/jiaowu.ts b/lib/routes/buaa/jiaowu.ts index 2bcfc4da5..21fe46e88 100644 --- a/lib/routes/buaa/jiaowu.ts +++ b/lib/routes/buaa/jiaowu.ts @@ -99,7 +99,7 @@ async function getList(url: string | URL, form: Record = {}) { return { title: $('a').text(), link, - pubDate: timezone(parseDate($('span.Floatright').text()), +8), + pubDate: timezone(parseDate($('span.Floatright').text()), 8), }; }) .filter((item) => item !== null); diff --git a/lib/routes/buaa/lib/space/newbook.tsx b/lib/routes/buaa/lib/space/newbook.tsx index f9ffebe6f..1e548dc7a 100644 --- a/lib/routes/buaa/lib/space/newbook.tsx +++ b/lib/routes/buaa/lib/space/newbook.tsx @@ -234,7 +234,7 @@ async function getItem(item: Book): Promise { return { language: item.language === 'eng' ? 'en' : 'zh-CN', title: item.title, - pubDate: item.onSelfDate ? timezone(parseDate(item.onSelfDate), +8) : undefined, + pubDate: item.onSelfDate ? timezone(parseDate(item.onSelfDate), 8) : undefined, description: content, link, }; diff --git a/lib/routes/buaa/news/index.ts b/lib/routes/buaa/news/index.ts index ad88f8572..c8499f371 100644 --- a/lib/routes/buaa/news/index.ts +++ b/lib/routes/buaa/news/index.ts @@ -44,7 +44,7 @@ async function handler(ctx: Context): Promise { return { title: title.text(), link: new URL(title.attr('href')!, baseUrl).href, - pubDate: timezone(parseDate(item.find('h2 em').text(), '[YYYY-MM-DD]'), +8), + pubDate: timezone(parseDate(item.find('h2 em').text(), '[YYYY-MM-DD]'), 8), }; }); diff --git a/lib/routes/buaa/sme.ts b/lib/routes/buaa/sme.ts index 2e370a20e..7869d8b61 100755 --- a/lib/routes/buaa/sme.ts +++ b/lib/routes/buaa/sme.ts @@ -79,7 +79,7 @@ async function getList(url) { return { title: item.find('a').text(), link: link?.startsWith('http') ? link : `${BASE_URL}/${link}`, // 有些链接是相对路径 - pubDate: timezone(parseDate(item.find('span').text()), +8), + pubDate: timezone(parseDate(item.find('span').text()), 8), }; }); return { diff --git a/lib/routes/bupt/jwc.ts b/lib/routes/bupt/jwc.ts index 9439c979e..4051dff75 100644 --- a/lib/routes/bupt/jwc.ts +++ b/lib/routes/bupt/jwc.ts @@ -116,7 +116,7 @@ async function handler(ctx: Context) { // 提取并格式化发布时间 item.description = cleanedDescription; - item.pubDate = timezone(parseDate(content('.info').text().replace('发布时间:', '').trim()), +8); + item.pubDate = timezone(parseDate(content('.info').text().replace('发布时间:', '').trim()), 8); return item; }) diff --git a/lib/routes/bupt/rczp.ts b/lib/routes/bupt/rczp.ts index acf1d795c..b3bda326c 100644 --- a/lib/routes/bupt/rczp.ts +++ b/lib/routes/bupt/rczp.ts @@ -63,7 +63,7 @@ async function handler() { const content = load(detailResponse.data); item.description = content('.v_news_content').html(); - item.pubDate = timezone(parseDate(content('.info span').first().text().replace('发布时间 : ', '')), +8); + item.pubDate = timezone(parseDate(content('.info span').first().text().replace('发布时间 : ', '')), 8); return item; }) diff --git a/lib/routes/bupt/scss.ts b/lib/routes/bupt/scss.ts index 7db560446..28113c9b1 100644 --- a/lib/routes/bupt/scss.ts +++ b/lib/routes/bupt/scss.ts @@ -84,7 +84,7 @@ async function handler() { }); item.description = newsContent.text(); - item.pubDate = timezone(parseDate(item.pubDateRaw), +8); + item.pubDate = timezone(parseDate(item.pubDateRaw), 8); return item; }) diff --git a/lib/routes/byau/xinwen/index.ts b/lib/routes/byau/xinwen/index.ts index 33a051dd5..e2208648c 100644 --- a/lib/routes/byau/xinwen/index.ts +++ b/lib/routes/byau/xinwen/index.ts @@ -48,7 +48,7 @@ async function handler(ctx) { return { title: $$('a').text(), link: itemUrl, - pubDate: timezone(parseDate($$('.news_meta').text()), +8), + pubDate: timezone(parseDate($$('.news_meta').text()), 8), }; }); diff --git a/lib/routes/c114/roll.ts b/lib/routes/c114/roll.ts index 9ed0d5187..322f59ed7 100644 --- a/lib/routes/c114/roll.ts +++ b/lib/routes/c114/roll.ts @@ -30,7 +30,7 @@ export const handler = async (ctx) => { return { title: item.find('h6 a').text(), - pubDate: timezone(parseDate(item.find('div.new_list_time').text(), ['HH:mm', 'M/D']), +8), + pubDate: timezone(parseDate(item.find('div.new_list_time').text(), ['HH:mm', 'M/D']), 8), link: new URL(item.find('h6 a').prop('href'), rootUrl).href, author: item.find('div.new_list_author').text().trim(), language, @@ -51,7 +51,7 @@ export const handler = async (ctx) => { item.title = title; item.description = description; - item.pubDate = timezone(parseDate($$('div.r_time').text(), 'YYYY/M/D HH:mm'), +8); + item.pubDate = timezone(parseDate($$('div.r_time').text(), 'YYYY/M/D HH:mm'), 8); item.author = $$('div.author').first().text().trim(); item.content = { html: description, diff --git a/lib/routes/caai/utils.tsx b/lib/routes/caai/utils.tsx index dbbee5e7a..ea339e7c6 100644 --- a/lib/routes/caai/utils.tsx +++ b/lib/routes/caai/utils.tsx @@ -28,7 +28,7 @@ const fetchAllArticles = (data) => { const r = { title: c.find('h3 a[href]').text().trim(), link: base + c.find('h3 a[href]').attr('href'), - pubDate: timezone(parseDate(c.find('h4').text().trim(), 'YYYY-MM-DD'), +8), + pubDate: timezone(parseDate(c.find('h4').text().trim(), 'YYYY-MM-DD'), 8), }; return r; }); diff --git a/lib/routes/cahkms/index.tsx b/lib/routes/cahkms/index.tsx index 62d9585ad..a28296253 100644 --- a/lib/routes/cahkms/index.tsx +++ b/lib/routes/cahkms/index.tsx @@ -68,7 +68,7 @@ async function handler(ctx) { .map((item) => ({ title: item.TITLE, description: `

${item.GJZ}

`, - pubDate: timezone(parseDate(item.JDRQ), +8), + pubDate: timezone(parseDate(item.JDRQ), 8), link: `${rootUrl}/HKMAC/indexMac/getWzxx?id=${item.ID}`, })); diff --git a/lib/routes/caijing/roll.ts b/lib/routes/caijing/roll.ts index eac82084e..fa8bd8d0f 100644 --- a/lib/routes/caijing/roll.ts +++ b/lib/routes/caijing/roll.ts @@ -42,7 +42,7 @@ async function handler() { const list = response.data.map((item) => ({ title: item.title, link: item.url.replace('http://', 'https://'), - pubDate: timezone(parseDate(item.published, 'MM-DD HH:mm'), +8), + pubDate: timezone(parseDate(item.published, 'MM-DD HH:mm'), 8), category: item.cat, })); diff --git a/lib/routes/caixin/category.ts b/lib/routes/caixin/category.ts index 9e4e7dc83..081c7b557 100644 --- a/lib/routes/caixin/category.ts +++ b/lib/routes/caixin/category.ts @@ -79,7 +79,7 @@ async function handler(ctx) { title: item.desc, description: item.summ, link: item.link.replace('http://', 'https://'), - pubDate: timezone(parseDate(item.time), +8), + pubDate: timezone(parseDate(item.time), 8), category: item.keyword.split(' '), audio: item.audioUrl, audio_image_url: item.pict.imgs[0].url, diff --git a/lib/routes/caixin/database.ts b/lib/routes/caixin/database.ts index 2c2180013..63eebef05 100644 --- a/lib/routes/caixin/database.ts +++ b/lib/routes/caixin/database.ts @@ -55,7 +55,7 @@ async function handler() { const detailResponse = await got(item.link); const content = load(detailResponse.data); - item.pubDate = timezone(parseDate(content('#pubtime_baidu').text()), +8); + item.pubDate = timezone(parseDate(content('#pubtime_baidu').text()), 8); item.description = renderArticle({ item, $: content, diff --git a/lib/routes/cankaoxiaoxi/index.tsx b/lib/routes/cankaoxiaoxi/index.tsx index 9eb373540..a2069e218 100644 --- a/lib/routes/cankaoxiaoxi/index.tsx +++ b/lib/routes/cankaoxiaoxi/index.tsx @@ -68,7 +68,7 @@ async function handler(ctx) { title: item.data.title, author: item.data.userName, category: item.data.channelName, - pubDate: timezone(parseDate(item.data.publishTime), +8), + pubDate: timezone(parseDate(item.data.publishTime), 8), link: item.data.moVideoPath ? item.data.sourceUrl : `${rootUrl}/json/content/${item.data.url.match(/\/pages\/(.*?)\.html/)[1]}.detailjson`, video: item.data.moVideoPath, cover: item.data.mCoverImg, diff --git a/lib/routes/cast/index.ts b/lib/routes/cast/index.ts index dd8e0f34f..32732e8e1 100644 --- a/lib/routes/cast/index.ts +++ b/lib/routes/cast/index.ts @@ -27,7 +27,7 @@ async function parsePage(html: string) { return cache.tryGet(articleUrl, async () => { const res = await got.get(articleUrl!); const article = load(res.data); - const pubDate = timezone(parseDate(article('meta[name=PubDate]').attr('content')!, 'YYYY-MM-DD HH:mm'), +8); + const pubDate = timezone(parseDate(article('meta[name=PubDate]').attr('content')!, 'YYYY-MM-DD HH:mm'), 8); return { title: title.text(), diff --git a/lib/routes/cbpanet/index.ts b/lib/routes/cbpanet/index.ts index 89c858084..1694fee9c 100644 --- a/lib/routes/cbpanet/index.ts +++ b/lib/routes/cbpanet/index.ts @@ -52,7 +52,7 @@ export const handler = async (ctx) => { .replace(/发布时间:/, ''), 'YYYY/M/D HH:mm:ss' ), - +8 + 8 ); item.content = { html: description, diff --git a/lib/routes/ccagm/index.ts b/lib/routes/ccagm/index.ts index 9f56e8f18..86fdb8ae1 100644 --- a/lib/routes/ccagm/index.ts +++ b/lib/routes/ccagm/index.ts @@ -34,9 +34,9 @@ export const handler = async (ctx: Context): Promise => { const processedItem: DataItem = { title, - pubDate: pubDateStr ? timezone(parseDate(pubDateStr), +8) : undefined, + pubDate: pubDateStr ? timezone(parseDate(pubDateStr), 8) : undefined, link: linkUrl, - updated: upDatedStr ? timezone(parseDate(upDatedStr), +8) : undefined, + updated: upDatedStr ? timezone(parseDate(upDatedStr), 8) : undefined, language, }; @@ -61,12 +61,12 @@ export const handler = async (ctx: Context): Promise => { const processedItem: DataItem = { title, description, - pubDate: pubDateStr ? timezone(parseDate(pubDateStr), +8) : item.pubDate, + pubDate: pubDateStr ? timezone(parseDate(pubDateStr), 8) : item.pubDate, content: { html: description, text: description, }, - updated: upDatedStr ? timezone(parseDate(upDatedStr), +8) : item.updated, + updated: upDatedStr ? timezone(parseDate(upDatedStr), 8) : item.updated, language, }; diff --git a/lib/routes/cccfna/index.ts b/lib/routes/cccfna/index.ts index 0ff78618e..dade94534 100644 --- a/lib/routes/cccfna/index.ts +++ b/lib/routes/cccfna/index.ts @@ -66,7 +66,7 @@ export const route: Route = { const content = $('.list_cont'); item.title = content.find('.title').text(); - item.pubDate = timezone(parseDate(content.find('.tip > .time').text(), '发布时间:YYYY-MM-DD'), +8); + item.pubDate = timezone(parseDate(content.find('.tip > .time').text(), '发布时间:YYYY-MM-DD'), 8); item.description = content.find('#article-content').html()!; return item; diff --git a/lib/routes/ccf/tfbd/utils.tsx b/lib/routes/ccf/tfbd/utils.tsx index bebaced5a..69666d278 100644 --- a/lib/routes/ccf/tfbd/utils.tsx +++ b/lib/routes/ccf/tfbd/utils.tsx @@ -29,7 +29,7 @@ const fetchAllArticles = (data) => { const r = { title: c.find('h3 a[href]').text().trim(), link: base + c.find('h3 a[href]').attr('href'), - pubDate: timezone(parseDate(c.find('p').text().trim(), 'YYYY-MM-DD'), +8), + pubDate: timezone(parseDate(c.find('p').text().trim(), 'YYYY-MM-DD'), 8), }; return r; }); diff --git a/lib/routes/ccmn/price-adjustment.tsx b/lib/routes/ccmn/price-adjustment.tsx index 09c2bc822..cf11a670e 100644 --- a/lib/routes/ccmn/price-adjustment.tsx +++ b/lib/routes/ccmn/price-adjustment.tsx @@ -191,7 +191,7 @@ async function handler(ctx) { description, link: `${url}/quota/${dataId}.html`, guid: dataId, // 使用 data-id 作为唯一标识 - pubDate: timezone(parseDate(dateStr, 'MM-DD'), +8), + pubDate: timezone(parseDate(dateStr, 'MM-DD'), 8), }; }); diff --git a/lib/routes/ccreports/index.ts b/lib/routes/ccreports/index.ts index 969e3e137..34ea40c58 100644 --- a/lib/routes/ccreports/index.ts +++ b/lib/routes/ccreports/index.ts @@ -53,7 +53,7 @@ async function handler() { const detailData = await got.get(item.link); const $ = load(detailData.data); item.description = $('div.pdbox').html(); - item.pubDate = timezone(parseDate($('div.newbox > div.newtit > p').text(), 'YYYY-MM-DD HH:mm:ss'), +8); + item.pubDate = timezone(parseDate($('div.newbox > div.newtit > p').text(), 'YYYY-MM-DD HH:mm:ss'), 8); return item; }) diff --git a/lib/routes/cctv/category.ts b/lib/routes/cctv/category.ts index 6b018770a..90026d7aa 100644 --- a/lib/routes/cctv/category.ts +++ b/lib/routes/cctv/category.ts @@ -1,8 +1,8 @@ import type { Route } from '@/types'; -import getMzzlbg from './utils/mzzlbg'; -import getNews from './utils/news'; -import xinwen1j1 from './utils/xinwen1j1'; +import { getMzzlbg } from './utils/mzzlbg'; +import { getNews } from './utils/news'; +import { xinwen1j1 } from './utils/xinwen1j1'; import getXWLB from './xwlb'; export const route: Route = { diff --git a/lib/routes/cctv/lm.ts b/lib/routes/cctv/lm.ts index e378927a1..556fe12b6 100644 --- a/lib/routes/cctv/lm.ts +++ b/lib/routes/cctv/lm.ts @@ -70,7 +70,7 @@ async function handler(ctx) { guid: item.guid, image: item.image, title: item.title, - pubDate: timezone(parseDate(item.time), +8), + pubDate: timezone(parseDate(item.time), 8), link: `${vdnRootUrl}/api/getHttpVideoInfo.do?pid=${item.guid}`, description: `

${item.brief.replaceAll('\r\n', '

')}

`, })); diff --git a/lib/routes/cctv/utils/mzzlbg.ts b/lib/routes/cctv/utils/mzzlbg.ts index 74a373b92..7cd0154ff 100644 --- a/lib/routes/cctv/utils/mzzlbg.ts +++ b/lib/routes/cctv/utils/mzzlbg.ts @@ -2,7 +2,7 @@ import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -const getMzzlbg = async () => { +export const getMzzlbg = async () => { const url = 'https://api.cntv.cn/video/videolistById?serviceId=cbox&vsid=C10354&em=01&p=1&n=50'; const response = await got({ @@ -19,7 +19,7 @@ const getMzzlbg = async () => { title: video.t, description: video.desc, link: video.url, - pubDate: timezone(parseDate(video.ptime), +8), + pubDate: timezone(parseDate(video.ptime), 8), }; const { data: videoDetail } = await got({ method: 'get', @@ -39,4 +39,3 @@ const getMzzlbg = async () => { item: resultItem, }; }; -export default getMzzlbg; diff --git a/lib/routes/cctv/utils/news.ts b/lib/routes/cctv/utils/news.ts index 8c1c87acf..5c5e6455c 100644 --- a/lib/routes/cctv/utils/news.ts +++ b/lib/routes/cctv/utils/news.ts @@ -6,7 +6,7 @@ import { PRESETS } from '@/utils/header-generator'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -const getNews = async (category) => { +export const getNews = async (category) => { const url = `https://news.cctv.com/2019/07/gaiban/cmsdatainterface/page/${category}_1.jsonp`; const response = await got({ @@ -26,7 +26,7 @@ const getNews = async (category) => { const item = { title, link: url, - pubDate: timezone(parseDate(focus_date), +8), + pubDate: timezone(parseDate(focus_date), 8), }; const id = path.parse(url).name; const unknownTip = '未知类型,请点击链接提交issue'; @@ -103,4 +103,3 @@ const getNews = async (category) => { item: resultItem, }; }; -export default getNews; diff --git a/lib/routes/cctv/utils/xinwen1j1.ts b/lib/routes/cctv/utils/xinwen1j1.ts index 7122269a8..aaebe3174 100644 --- a/lib/routes/cctv/utils/xinwen1j1.ts +++ b/lib/routes/cctv/utils/xinwen1j1.ts @@ -54,7 +54,7 @@ const ProcessFeed = (data) => return { ...single, ...other }; }) ); -const xinwen1j1 = async () => { +export const xinwen1j1 = async () => { const baseUrl = 'https://api.cntv.cn/NewVideo/getVideoListByColumn?id=TOPC1451559066181661&n=20&sort=desc&p=1&mode=0&serviceId=tvcctv'; // 获取要处理的页面 const res = await got({ @@ -81,4 +81,3 @@ const xinwen1j1 = async () => { item: result, }; }; -export default xinwen1j1; diff --git a/lib/routes/cctv/xwlb.ts b/lib/routes/cctv/xwlb.ts index 3c2bf56b5..b6dd266a4 100644 --- a/lib/routes/cctv/xwlb.ts +++ b/lib/routes/cctv/xwlb.ts @@ -72,7 +72,7 @@ const getXWLB = async () => { const item = { title: `新闻联播 ${newsDate.format('YYYY/MM/DD')}`, link: url, - pubDate: timezone(parseDate(newsDate.format()), +8), + pubDate: timezone(parseDate(newsDate.format()), 8), description: await cache.tryGet(url, async () => { const res = await got(url); const content = load(res.data); diff --git a/lib/routes/cdi/index.ts b/lib/routes/cdi/index.ts index f518124bf..65331910e 100644 --- a/lib/routes/cdi/index.ts +++ b/lib/routes/cdi/index.ts @@ -69,7 +69,7 @@ async function handler(ctx) { .match(/时间:(.*)/)[1] .replaceAll(/年|月/g, '-') ), - +8 + 8 ); return item; diff --git a/lib/routes/ce/district.ts b/lib/routes/ce/district.ts index 220715b56..1621eb581 100644 --- a/lib/routes/ce/district.ts +++ b/lib/routes/ce/district.ts @@ -77,7 +77,7 @@ async function handler(ctx) { const $ = load(response); const pubDateText = $('span#articleTime').text().trim(); - item.pubDate = timezone(parseDate(pubDateText, 'YYYY年MM月DD日 HH:mm'), +8); + item.pubDate = timezone(parseDate(pubDateText, 'YYYY年MM月DD日 HH:mm'), 8); item.description = $('div.TRS_Editor').html(); return item; diff --git a/lib/routes/cfachina/analygarden.ts b/lib/routes/cfachina/analygarden.ts index 07f640b2c..78d20a34a 100644 --- a/lib/routes/cfachina/analygarden.ts +++ b/lib/routes/cfachina/analygarden.ts @@ -38,7 +38,7 @@ async function handler(ctx) { pageUrl = `${baseUrl}/servicesupport/analygarden/`; if (program !== '分析师园地') { - pageUrl = `${pageUrl}${program}/`; + pageUrl += `${program}/`; const response = await got(pageUrl); const $ = load(response.data); @@ -74,7 +74,7 @@ async function handler(ctx) { title: item.docTitle, author: item.docAuthor, link, - pubDate: timezone(parseDate(item.operTime), +8), + pubDate: timezone(parseDate(item.operTime), 8), enclosure_url: link, enclosure_type: `application/${link.split('.').pop()}`, }; diff --git a/lib/routes/cffex/announcement.ts b/lib/routes/cffex/announcement.ts index ecbac0127..7a85667da 100644 --- a/lib/routes/cffex/announcement.ts +++ b/lib/routes/cffex/announcement.ts @@ -49,7 +49,7 @@ async function handler(): Promise<{ title: string; link: string; item: DataItem[ return { title: titleEle.text().trim(), link: `${baseUrl}${titleEle.attr('href')}`, - pubDate: timezone(parseDate(dateEle.text(), 'YYYY-MM-DD'), +8), + pubDate: timezone(parseDate(dateEle.text(), 'YYYY-MM-DD'), 8), }; }); diff --git a/lib/routes/cfmmc/index.ts b/lib/routes/cfmmc/index.ts index e1c5105c1..faa2a6a24 100644 --- a/lib/routes/cfmmc/index.ts +++ b/lib/routes/cfmmc/index.ts @@ -47,7 +47,7 @@ async function handler(ctx) { response.results?.[0].data.slice(0, limit).map((item) => ({ title: item.title, link: new URL(item.url, rootUrl).href, - pubDate: timezone(parseDate(item.publish_date), +8), + pubDate: timezone(parseDate(item.publish_date), 8), })) ?? []; items = await Promise.all( diff --git a/lib/routes/cgtn/podcast.ts b/lib/routes/cgtn/podcast.ts index 4a5c773f5..e32de8506 100644 --- a/lib/routes/cgtn/podcast.ts +++ b/lib/routes/cgtn/podcast.ts @@ -11,7 +11,7 @@ async function getData(category, id) { function combDate(date, time) { // combine date and time, return a Date object - return timezone(parseDate(date + ' ' + time), +8); + return timezone(parseDate(date + ' ' + time), 8); } export const route: Route = { diff --git a/lib/routes/chiculture/topic.ts b/lib/routes/chiculture/topic.ts index 8edf833f4..7c9f95ab3 100644 --- a/lib/routes/chiculture/topic.ts +++ b/lib/routes/chiculture/topic.ts @@ -58,11 +58,13 @@ async function handler(ctx) { item.pubDate = parseDate(pubDate[1]); } else if (item.title.includes('一周時事通識')) { for (const tag of item.pubDate) { - if (/^\d{4}年$/.test(tag.title)) { - const monthDayStr = item.title.split('- ', 2)[1] ?? item.title.split('-', 2)[1]; - item.pubDate = timezone(parseDate(monthDayStr, 'D/M'), +8); - break; + if (!/^\d{4}年$/.test(tag.title)) { + continue; } + + const monthDayStr = item.title.split('- ', 2)[1] ?? item.title.split('-', 2)[1]; + item.pubDate = timezone(parseDate(monthDayStr, 'D/M'), 8); + break; } } else if (/^\d{4}年新聞回顧$/.test(item.title)) { item.pubDate = parseDate(`${item.title.split('年', 1)[0]}-12-31`); diff --git a/lib/routes/china/finance/finance.ts b/lib/routes/china/finance/finance.ts index ac174799e..f4d69fc88 100644 --- a/lib/routes/china/finance/finance.ts +++ b/lib/routes/china/finance/finance.ts @@ -77,7 +77,7 @@ async function handler(ctx) { title: $d('.article_title').text(), link: item.link, description: $d('#js_article_content').html(), - pubDate: timezone(parseDate($d('.article_info>span.time').text()), +8), + pubDate: timezone(parseDate($d('.article_info>span.time').text()), 8), author: $d(' div.article_info > span.source').text(), category: listCategory, }; diff --git a/lib/routes/chinadaily/language.ts b/lib/routes/chinadaily/language.ts index 21189db52..dae3316c8 100644 --- a/lib/routes/chinadaily/language.ts +++ b/lib/routes/chinadaily/language.ts @@ -96,12 +96,12 @@ export const handler = async (ctx: Context): Promise => { let processedItem: DataItem = { title, - pubDate: pubDateStr ? timezone(parseDate(pubDateStr), +8) : item.pubDate, + pubDate: pubDateStr ? timezone(parseDate(pubDateStr), 8) : item.pubDate, category: categories, author: authors, image, banner: image, - updated: upDatedStr ? timezone(parseDate(upDatedStr), +8) : item.updated, + updated: upDatedStr ? timezone(parseDate(upDatedStr), 8) : item.updated, language, }; diff --git a/lib/routes/chinamoney/notice.ts b/lib/routes/chinamoney/notice.ts index 686f1910a..cf58a1e5f 100644 --- a/lib/routes/chinamoney/notice.ts +++ b/lib/routes/chinamoney/notice.ts @@ -74,7 +74,7 @@ async function handler(ctx) { const list = contents.records.map((item) => ({ title: item.title, link: `${baseUrl}${item.draftPath}`, - pubDate: timezone(parseDate(item.releaseDate, 'YYYY-MM-DD'), +8), + pubDate: timezone(parseDate(item.releaseDate, 'YYYY-MM-DD'), 8), contentId: item.contentId, })); @@ -101,7 +101,7 @@ async function handler(ctx) { }); item.description = article.html(); - item.pubDate = timezone(parseDate($('.AC-l span').text().trim(), 'YYYY-MM-DD HH:mm'), +8); + item.pubDate = timezone(parseDate($('.AC-l span').text().trim(), 'YYYY-MM-DD HH:mm'), 8); return item; }) diff --git a/lib/routes/chinanews/index.ts b/lib/routes/chinanews/index.ts index 2cc0f9195..883131a78 100644 --- a/lib/routes/chinanews/index.ts +++ b/lib/routes/chinanews/index.ts @@ -52,12 +52,12 @@ async function handler(ctx) { item.author = content('a.source').text(); const info = content('p', '.left').text().trim().slice(5).split(' '); item.author = info[2].trim(); - item.pubDate = timezone(parseDate(info[0] + info[1], 'YYYY年MM月DD日HH:mm'), +8); + item.pubDate = timezone(parseDate(info[0] + info[1], 'YYYY年MM月DD日HH:mm'), 8); } else if (content('div.t3').length > 0) { item.description = content('div.t3').html(); const info = content('div[style="text-align:right;font-size:12px;"]').text().slice(5).split(' '); item.author = info[2]; - item.pubDate = timezone(parseDate(info[0] + info[1], 'YYYY-MM-DDHH:mm'), +8); + item.pubDate = timezone(parseDate(info[0] + info[1], 'YYYY-MM-DDHH:mm'), 8); } else { item.description = content('div.left_zw').html(); const info = content('div.left-t') @@ -65,7 +65,7 @@ async function handler(ctx) { .filter((_, el) => el.type === 'text') .text() .split(' '); - item.pubDate = timezone(parseDate(info[0], 'YYYY年MM月DD日 HH:mm'), +8); + item.pubDate = timezone(parseDate(info[0], 'YYYY年MM月DD日 HH:mm'), 8); item.author = info[1] + content('a.source').text(); } return item; diff --git a/lib/routes/chinathinktanks/viewpoint.ts b/lib/routes/chinathinktanks/viewpoint.ts index 98115a0fe..48d069e20 100644 --- a/lib/routes/chinathinktanks/viewpoint.ts +++ b/lib/routes/chinathinktanks/viewpoint.ts @@ -105,7 +105,7 @@ async function handler(ctx) { const $ = load(response.data); const content = $('#art'); item.description = content.html(); - item.pubDate = item.pubDate.includes('-') ? timezone(parseDate(item.pubDate, 'YYYY-MM-DD'), +8) : parseRelativeDate(item.pubDate); + item.pubDate = item.pubDate.includes('-') ? timezone(parseDate(item.pubDate, 'YYYY-MM-DD'), 8) : parseRelativeDate(item.pubDate); return item; }) diff --git a/lib/routes/chinaventure/index.ts b/lib/routes/chinaventure/index.ts index af8064d73..88e84c418 100644 --- a/lib/routes/chinaventure/index.ts +++ b/lib/routes/chinaventure/index.ts @@ -77,7 +77,7 @@ async function handler(ctx) { item.title = content('h1.maintitle_pc').text(); item.description = content('div.article_slice_pc').html(); item.author = content('div.source_author').text(); - item.pubDate = timezone(parseDate(content('div.releaseTime').text()), +8); + item.pubDate = timezone(parseDate(content('div.releaseTime').text()), 8); return item; }) ) diff --git a/lib/routes/chinawriter/index.ts b/lib/routes/chinawriter/index.ts index 89a6da096..87c61b8ec 100644 --- a/lib/routes/chinawriter/index.ts +++ b/lib/routes/chinawriter/index.ts @@ -71,7 +71,7 @@ async function handler(ctx) { ].filter(Boolean) ), ]; - item.pubDate = content('div.end_info em').text() ? timezone(parseDate(content('div.end_info em').text(), 'YYYY年MM月DD日HH:mm'), +8) : parseDate(content('meta[name="publishdate"]').prop('content')); + item.pubDate = content('div.end_info em').text() ? timezone(parseDate(content('div.end_info em').text(), 'YYYY年MM月DD日HH:mm'), 8) : parseDate(content('meta[name="publishdate"]').prop('content')); } catch { // } diff --git a/lib/routes/chiphell/portal.ts b/lib/routes/chiphell/portal.ts index 1ff83542b..752de923a 100644 --- a/lib/routes/chiphell/portal.ts +++ b/lib/routes/chiphell/portal.ts @@ -24,7 +24,7 @@ const handler = async (ctx: Context) => { title: a.text(), link: `https://www.chiphell.com/${a.attr('href')}`, category: [$item.find('dd label').text()], - pubDate: timezone(parseDate($item.find('span.xg1').text()), +8), + pubDate: timezone(parseDate($item.find('span.xg1').text()), 8), }; }); diff --git a/lib/routes/chlinlearn/daily-blog.ts b/lib/routes/chlinlearn/daily-blog.ts index e0ef1a3aa..a5a35e111 100644 --- a/lib/routes/chlinlearn/daily-blog.ts +++ b/lib/routes/chlinlearn/daily-blog.ts @@ -42,7 +42,7 @@ export const route: Route = { link: item.url, author: item.author, img: item.icon, - pubDate: timezone(parseDate(item.publishTime), +8), + pubDate: timezone(parseDate(item.publishTime), 8), })); return { // 源标题 diff --git a/lib/routes/chnmuseum/xingnew.ts b/lib/routes/chnmuseum/xingnew.ts index cc234a046..85716e004 100644 --- a/lib/routes/chnmuseum/xingnew.ts +++ b/lib/routes/chnmuseum/xingnew.ts @@ -41,7 +41,7 @@ export const route: Route = { return { title: a.attr('title') || a.text(), link: new URL(a.attr('href'), 'https://www.chnmuseum.cn/zx/xingnew/').href, - pubDate: timezone(parseDate(dateText, 'YYYY/MM/DD'), +8), + pubDate: timezone(parseDate(dateText, 'YYYY/MM/DD'), 8), // description: a.attr('title') || a.text(), }; }); diff --git a/lib/routes/chnmuseum/zl.tsx b/lib/routes/chnmuseum/zl.tsx index 71c0b0d32..65e832285 100644 --- a/lib/routes/chnmuseum/zl.tsx +++ b/lib/routes/chnmuseum/zl.tsx @@ -34,8 +34,7 @@ const formatExhibitionDate = (dateStr: string | undefined): string | undefined = const normalized = dateStr .replaceAll(/年|月/g, '-') .replaceAll('日', '') - .replaceAll('/', '-') - .replaceAll('.', '-'); + .replaceAll(/[/.]/g, '-'); const parts = normalized.split('-').filter(Boolean); if (parts.length === 3) { return `${parts[0]}-${parts[1].padStart(2, '0')}-${parts[2].padStart(2, '0')}`; diff --git a/lib/routes/cih-index/report.ts b/lib/routes/cih-index/report.ts index a61197bdb..b1008c181 100644 --- a/lib/routes/cih-index/report.ts +++ b/lib/routes/cih-index/report.ts @@ -53,7 +53,7 @@ async function handler(ctx) { return { title: info.reportTitle, link: `${baseUrl}/report/detail/${info.reportId}.html`, - pubDate: timezone(parseDate(info.addTime), +8), + pubDate: timezone(parseDate(info.addTime), 8), category: [...new Set([...info.reportClassTagDtoList.map((t) => t.tag), ...(info.keywordList || [])])], description: `${info.context}
${images}`, image: `${info.coverFigureUrl}/200`, diff --git a/lib/routes/ciidbnu/index.ts b/lib/routes/ciidbnu/index.ts index f9411e84a..92605a984 100644 --- a/lib/routes/ciidbnu/index.ts +++ b/lib/routes/ciidbnu/index.ts @@ -62,7 +62,7 @@ async function handler(ctx) { const content = load(iconv.decode(detailResponse.data, 'gbk')); item.description = content('#text').html(); - item.pubDate = timezone(parseDate(content('.t8').eq(0).text(), 'YYYY/M/D H:mm:ss'), +8); + item.pubDate = timezone(parseDate(content('.t8').eq(0).text(), 'YYYY/M/D H:mm:ss'), 8); content('.t14').remove(); diff --git a/lib/routes/ciweimao/chapter.ts b/lib/routes/ciweimao/chapter.ts index 10412edba..0faa2d8ce 100644 --- a/lib/routes/ciweimao/chapter.ts +++ b/lib/routes/ciweimao/chapter.ts @@ -53,7 +53,7 @@ async function handler(ctx) { return { chapterLocked: item.find('h3 i.icon-lock').length > 0, title: item.find('h3').text(), - pubDate: timezone(parseDate(item.find('p').text().replace('发布于 ', '')), +8), + pubDate: timezone(parseDate(item.find('p').text().replace('发布于 ', '')), 8), link: item.attr('href'), }; }); diff --git a/lib/routes/cjlu/yjsy/index.ts b/lib/routes/cjlu/yjsy/index.ts index b91cd90ff..1d06a3d55 100644 --- a/lib/routes/cjlu/yjsy/index.ts +++ b/lib/routes/cjlu/yjsy/index.ts @@ -120,7 +120,7 @@ async function handler(ctx) { return { title: a.attr('title') ?? titleMap.get(cate) ?? '中量大研究生院通知', - pubDate: timezone(parseDate(timeStr, 'YYYY/MM/DD'), +8), + pubDate: timezone(parseDate(timeStr, 'YYYY/MM/DD'), 8), link: `${host}${route}`, description: '', }; diff --git a/lib/routes/cloudnative/blog.ts b/lib/routes/cloudnative/blog.ts index 4da530cc9..c286a0445 100644 --- a/lib/routes/cloudnative/blog.ts +++ b/lib/routes/cloudnative/blog.ts @@ -19,7 +19,7 @@ async function getArticles() { title: a.text(), link: a.attr('href'), description: summary.text(), - pubDate: timezone(parseDate(time, 'YYYY-MM-DD'), +8), + pubDate: timezone(parseDate(time, 'YYYY-MM-DD'), 8), author: meta.find('span').eq(0).find('a').text(), category: meta.find('.article-categories a').text(), }; diff --git a/lib/routes/cma/channel.tsx b/lib/routes/cma/channel.tsx index 7eb1fd967..abdcf0c96 100644 --- a/lib/routes/cma/channel.tsx +++ b/lib/routes/cma/channel.tsx @@ -110,7 +110,7 @@ async function handler(ctx) { ?.split(/:/) ?.pop() || author, guid: `cma${data.link}#${data.releaseTime.replaceAll(/\s/g, '-')}`, - pubDate: timezone(parseDate(data.releaseTime), +8), + pubDate: timezone(parseDate(data.releaseTime), 8), enclosure_url: new URL(data.image, rootUrl).href, enclosure_type: data.image ? `image/${data.image.split(/\./).pop()}` : undefined, }, diff --git a/lib/routes/cmde/index.ts b/lib/routes/cmde/index.ts index 6e3d8c1cf..910b5b16b 100644 --- a/lib/routes/cmde/index.ts +++ b/lib/routes/cmde/index.ts @@ -66,7 +66,7 @@ async function handler(ctx) { await page.close(); const $ = load(html); item.description = $('.text').html(); - item.pubDate = timezone(parseDate($('meta[name="PubDate"]').attr('content')), +8); + item.pubDate = timezone(parseDate($('meta[name="PubDate"]').attr('content')), 8); return item; }) ) diff --git a/lib/routes/cna/index.ts b/lib/routes/cna/index.ts index 77006e483..4b27805ae 100644 --- a/lib/routes/cna/index.ts +++ b/lib/routes/cna/index.ts @@ -52,7 +52,7 @@ async function handler(ctx) { const list = (isTopic ? resultData.Topic.NewsItems : resultData.Items).slice(0, limit).map((item) => ({ title: item.HeadLine, link: item.PageUrl, - pubDate: timezone(parseDate(item.CreateTime), +8), + pubDate: timezone(parseDate(item.CreateTime), 8), })); const items = await Promise.all(list.map((item) => cache.tryGet(item.link, async () => await getFullText(item)))); diff --git a/lib/routes/cna/web/index.ts b/lib/routes/cna/web/index.ts index b56bd7921..3c29a6fae 100644 --- a/lib/routes/cna/web/index.ts +++ b/lib/routes/cna/web/index.ts @@ -44,7 +44,7 @@ async function handler(ctx) { return { title: item.text(), link: new URL(item.parents('a').attr('href'), 'https://www.cna.com.tw').href, - pubDate: timezone(parseDate(item.next().text()), +8), + pubDate: timezone(parseDate(item.next().text()), 8), }; }); diff --git a/lib/routes/cnbeta/common.ts b/lib/routes/cnbeta/common.ts index 60f2e6123..08a261ace 100644 --- a/lib/routes/cnbeta/common.ts +++ b/lib/routes/cnbeta/common.ts @@ -26,7 +26,7 @@ export async function handler(ctx) { title: item.title, description: item.hometext, author: item.source.split('@http', 1)[0], - pubDate: timezone(parseDate(item.inputtime), +8), + pubDate: timezone(parseDate(item.inputtime), 8), link: item.url_show.startsWith('//') ? `https:${item.url_show}` : item.url_show.replace('http:', 'https:'), category: item.label.name, })) diff --git a/lib/routes/cnbeta/utils.ts b/lib/routes/cnbeta/utils.ts index a7df94b7d..96f78a1f4 100644 --- a/lib/routes/cnbeta/utils.ts +++ b/lib/routes/cnbeta/utils.ts @@ -18,7 +18,7 @@ const ProcessItems = (items, limit, tryGet) => item.description = content('.article-summary').html() + content('.article-content').html(); item.author = content('header.title div.meta span.source').text(); - item.pubDate ??= timezone(parseDate(content('.meta span').first().text(), 'YYYY年MM月DD日 HH:mm'), +8); + item.pubDate ??= timezone(parseDate(content('.meta span').first().text(), 'YYYY年MM月DD日 HH:mm'), 8); return item; }) diff --git a/lib/routes/cnblogs/common.ts b/lib/routes/cnblogs/common.ts index 3e7be2671..98c2efe61 100644 --- a/lib/routes/cnblogs/common.ts +++ b/lib/routes/cnblogs/common.ts @@ -44,7 +44,7 @@ async function handler(ctx) { return { title: item.find('.post-item-title').text(), link: item.find('.post-item-title').attr('href'), - pubDate: timezone(parseDate(item.find('.post-item-foot .post-meta-item span').text() || item.find('.editorpick-item-meta').text(), ['YYYY-MM-DD HH:mm', 'YYYY-MM-DD']), +8), + pubDate: timezone(parseDate(item.find('.post-item-foot .post-meta-item span').text() || item.find('.editorpick-item-meta').text(), ['YYYY-MM-DD HH:mm', 'YYYY-MM-DD']), 8), description: item.find('.post-item-summary').text(), author: item.find('.post-item-author span').text(), }; diff --git a/lib/routes/cncf/reports.ts b/lib/routes/cncf/reports.ts index 16785af22..52400646c 100644 --- a/lib/routes/cncf/reports.ts +++ b/lib/routes/cncf/reports.ts @@ -38,7 +38,7 @@ async function handler() { const detailResponse = await got(item.link); const content = load(detailResponse.data); - item.parseDate = parseDate(content('p.is-style-spaced-uppercase').splice(':')[1]); + item.parseDate = parseDate(content('p.is-style-spaced-uppercase').text().split(':', 2)[1]); item.description = content('article > div.has-background').html(); return item; diff --git a/lib/routes/cneb/yjxw.ts b/lib/routes/cneb/yjxw.ts index 3ec000203..341b48462 100644 --- a/lib/routes/cneb/yjxw.ts +++ b/lib/routes/cneb/yjxw.ts @@ -71,7 +71,7 @@ async function handler(ctx) { return { title: a.text(), link: a.attr('href'), - pubDate: timezone(parseDate(item.find('span').text()), +8), + pubDate: timezone(parseDate(item.find('span').text()), 8), }; }); diff --git a/lib/routes/cneb/yjxx.ts b/lib/routes/cneb/yjxx.ts index 23ea3ee59..5a56b9e57 100644 --- a/lib/routes/cneb/yjxx.ts +++ b/lib/routes/cneb/yjxx.ts @@ -54,7 +54,7 @@ async function handler(ctx) { link: item.docpuburl, author: item.chnlname, description: item.doccontent, - pubDate: timezone(parseDate(item.docpubtime), +8), + pubDate: timezone(parseDate(item.docpubtime), 8), })); return { diff --git a/lib/routes/cngal/entry.tsx b/lib/routes/cngal/entry.tsx index a9edfe536..60dca9e99 100644 --- a/lib/routes/cngal/entry.tsx +++ b/lib/routes/cngal/entry.tsx @@ -42,7 +42,7 @@ async function handler(ctx) { item: data.newsOfEntry.map((item) => ({ title: item.title, description: renderDescription(item), - pubDate: timezone(parseDate(item.happenedTime), +8), + pubDate: timezone(parseDate(item.happenedTime), 8), link: item.link, })), }; diff --git a/lib/routes/coomer/index.tsx b/lib/routes/coomer/index.tsx index d591a5e53..81fc21ac9 100644 --- a/lib/routes/coomer/index.tsx +++ b/lib/routes/coomer/index.tsx @@ -103,7 +103,8 @@ async function handler(ctx) { } }); desc = (coomerFiles.length > 0 ? coomerFiles[0] : '') + $.html(); - for (const coomerFile of coomerFiles.slice(count + 1)) { + const remainingCoomerFiles = coomerFiles.slice(count + 1); + for (const coomerFile of remainingCoomerFiles) { desc += coomerFile; } diff --git a/lib/routes/cosplaytele/article.ts b/lib/routes/cosplaytele/article.ts index 2089557dc..a6d370843 100644 --- a/lib/routes/cosplaytele/article.ts +++ b/lib/routes/cosplaytele/article.ts @@ -3,7 +3,7 @@ import { load } from 'cheerio'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -async function loadArticle(link) { +export const loadArticle = async (link) => { const resp = await got(link); const article = load(resp.body); @@ -17,6 +17,4 @@ async function loadArticle(link) { pubDate, link, }; -} - -export default loadArticle; +}; diff --git a/lib/routes/cosplaytele/category.ts b/lib/routes/cosplaytele/category.ts index 0111e614c..e18aa7705 100644 --- a/lib/routes/cosplaytele/category.ts +++ b/lib/routes/cosplaytele/category.ts @@ -4,7 +4,7 @@ import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import loadArticle from './article'; +import { loadArticle } from './article'; import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { diff --git a/lib/routes/cosplaytele/latest.ts b/lib/routes/cosplaytele/latest.ts index 50ccbb11a..38ab47d80 100644 --- a/lib/routes/cosplaytele/latest.ts +++ b/lib/routes/cosplaytele/latest.ts @@ -4,7 +4,7 @@ import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import loadArticle from './article'; +import { loadArticle } from './article'; import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { diff --git a/lib/routes/cosplaytele/popular.ts b/lib/routes/cosplaytele/popular.ts index 82b9333bf..279af76ce 100644 --- a/lib/routes/cosplaytele/popular.ts +++ b/lib/routes/cosplaytele/popular.ts @@ -4,7 +4,7 @@ import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import loadArticle from './article'; +import { loadArticle } from './article'; import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { diff --git a/lib/routes/cosplaytele/tag.ts b/lib/routes/cosplaytele/tag.ts index db3639c03..c77583a6c 100644 --- a/lib/routes/cosplaytele/tag.ts +++ b/lib/routes/cosplaytele/tag.ts @@ -4,7 +4,7 @@ import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import loadArticle from './article'; +import { loadArticle } from './article'; import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { diff --git a/lib/routes/cpcaauto/index.ts b/lib/routes/cpcaauto/index.ts index ce17214d1..824611ddc 100644 --- a/lib/routes/cpcaauto/index.ts +++ b/lib/routes/cpcaauto/index.ts @@ -44,7 +44,7 @@ export const handler = async (ctx) => { item.title = title; item.description = description; - item.pubDate = timezone(parseDate($$('div.view span').first().text().split(/:/).pop()), +8); + item.pubDate = timezone(parseDate($$('div.view span').first().text().split(/:/).pop()), 8); item.content = { html: description, text: $$('div.text').text(), diff --git a/lib/routes/cs/index.ts b/lib/routes/cs/index.ts index 22eba286b..85b4e998d 100644 --- a/lib/routes/cs/index.ts +++ b/lib/routes/cs/index.ts @@ -92,7 +92,7 @@ async function handler(ctx) { return { title: item.find('h3').text().trim(), link: new URL(item.prop('href'), currentUrl).href, - pubDate: timezone(parseDate(item.find('em').text()), +8), + pubDate: timezone(parseDate(item.find('em').text()), 8), }; }); @@ -113,7 +113,7 @@ async function handler(ctx) { .slice(1) .toArray() .map((c) => content(c).prop('title') ?? content(c).text()); - item.pubDate = timezone(parseDate(content('.time').prop('datetime')), +8); + item.pubDate = timezone(parseDate(content('.time').prop('datetime')), 8); } catch { // no-empty } diff --git a/lib/routes/cs/video.ts b/lib/routes/cs/video.ts index e298ca23c..3475e4551 100644 --- a/lib/routes/cs/video.ts +++ b/lib/routes/cs/video.ts @@ -64,8 +64,8 @@ async function handler(ctx) { link: new URL(item.contentUrl, rootUrl).href, description: item.contentDetails, author: item.contentSource, - pubDate: timezone(parseDate(item.contentDatetime), +8), - updated: timezone(parseDate(item.updateDate), +8), + pubDate: timezone(parseDate(item.contentDatetime), 8), + updated: timezone(parseDate(item.updateDate), 8), })); const { data: currentResponse } = await got(currentUrl); diff --git a/lib/routes/cztv/daily.tsx b/lib/routes/cztv/daily.tsx index 61c820a86..dc96588c6 100644 --- a/lib/routes/cztv/daily.tsx +++ b/lib/routes/cztv/daily.tsx @@ -57,7 +57,7 @@ async function handler() { return { title, link, - pubDate: timezone(parseDate(item.find('span.t2').text() + ' 16:30', 'YYYY-MM-DD hh:mm'), +8), + pubDate: timezone(parseDate(item.find('span.t2').text() + ' 16:30', 'YYYY-MM-DD hh:mm'), 8), }; }); diff --git a/lib/routes/cztv/zjxwlb.tsx b/lib/routes/cztv/zjxwlb.tsx index 989e46d2d..b2a777b29 100644 --- a/lib/routes/cztv/zjxwlb.tsx +++ b/lib/routes/cztv/zjxwlb.tsx @@ -55,7 +55,7 @@ async function handler() { return { title, link, - pubDate: timezone(parseDate(item.find('span.t2').text() + ' 16:30', 'YYYY-MM-DD hh:mm'), +8), + pubDate: timezone(parseDate(item.find('span.t2').text() + ' 16:30', 'YYYY-MM-DD hh:mm'), 8), description: renderDesc({ title, videoUrl, posterUrl }), }; }); diff --git a/lib/routes/dangdang/notice.ts b/lib/routes/dangdang/notice.ts index 1de1063b2..e68baf115 100644 --- a/lib/routes/dangdang/notice.ts +++ b/lib/routes/dangdang/notice.ts @@ -48,7 +48,7 @@ async function handler(ctx) { documentId: item.documentId, source: `https://open.dangdang.com/op-api/developer-platform/document/info/get?document_id=${item.documentId}`, link: `https://open.dangdang.com/home/notice/message/1/${item.documentId}`, - pubDate: timezone(parseDate(item.modifyTime), +8), + pubDate: timezone(parseDate(item.modifyTime), 8), })); const result = await Promise.all( diff --git a/lib/routes/dapenti/utils.ts b/lib/routes/dapenti/utils.ts index 0b69eefb1..9cbc28a5f 100644 --- a/lib/routes/dapenti/utils.ts +++ b/lib/routes/dapenti/utils.ts @@ -60,7 +60,7 @@ export default { title: el.text(), author: pubInfo[0].trim(), description: description.html(), - pubDate: timezone(parseDate(pubInfo[1]?.trim()), +8), + pubDate: timezone(parseDate(pubInfo[1]?.trim()), 8), link: url, }; return single; diff --git a/lib/routes/dayanzai/index.ts b/lib/routes/dayanzai/index.ts index 11db2149f..dfd56492f 100644 --- a/lib/routes/dayanzai/index.ts +++ b/lib/routes/dayanzai/index.ts @@ -56,7 +56,7 @@ async function handler(ctx) { } return { title: item.find('div.r > p.r-top > span > a').text(), - pubDate: timezone(date, +8), + pubDate: timezone(date, 8), description: item.find('div.r > p.desc').text(), link: item.find('div.r > p.r-top > span > a').attr('href'), }; diff --git a/lib/routes/dbaplus/new.ts b/lib/routes/dbaplus/new.ts index c7c4352f3..5d6d5379c 100644 --- a/lib/routes/dbaplus/new.ts +++ b/lib/routes/dbaplus/new.ts @@ -113,14 +113,14 @@ export const handler = async (ctx: Context): Promise => { const processedItem: DataItem = { title, description, - pubDate: pubDateStr ? timezone(parseDate(pubDateStr), +8) : item.pubDate, + pubDate: pubDateStr ? timezone(parseDate(pubDateStr), 8) : item.pubDate, category: categories, author: authors, content: { html: description, text: description, }, - updated: upDatedStr ? timezone(parseDate(upDatedStr), +8) : item.updated, + updated: upDatedStr ? timezone(parseDate(upDatedStr), 8) : item.updated, language, }; diff --git a/lib/routes/ddosi/index.ts b/lib/routes/ddosi/index.ts index 7035be4d5..e1e20c0a1 100644 --- a/lib/routes/ddosi/index.ts +++ b/lib/routes/ddosi/index.ts @@ -24,7 +24,7 @@ async function handler() { const url = 'https://www.ddosi.org/'; const response = await got({ method: 'get', - url: String(url), + url, headers: { Referer: url, }, @@ -51,7 +51,7 @@ async function handler() { return { title: '雨苁', - link: String(url), + link: url, item: items, }; } diff --git a/lib/routes/decrypt/index.ts b/lib/routes/decrypt/index.ts index e54e29fd0..78fef7c0e 100644 --- a/lib/routes/decrypt/index.ts +++ b/lib/routes/decrypt/index.ts @@ -89,7 +89,7 @@ async function handler(ctx): Promise { } as Data; } -async function extractFullText(url: string): Promise { +async function extractFullText(url: string): Promise<{ fullText: string; featuredImage: string; tags: string[] } | null> { try { const response = await ofetch(url); diff --git a/lib/routes/dedao/knowledge.tsx b/lib/routes/dedao/knowledge.tsx index d5eb7c28c..6651fc48b 100644 --- a/lib/routes/dedao/knowledge.tsx +++ b/lib/routes/dedao/knowledge.tsx @@ -5,7 +5,7 @@ import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -const mentionPattern = /<\u2267\u2746>\{"name":"(.*?)","uid":"\d+","at":"1"\}<\/\u2266\u2746>/g; +const mentionPattern = /<\u{2267}\u{2746}>\{"name":"(.*?)","uid":"\d+","at":"1"\}<\/\u{2266}\u{2746}>/gu; const formatNoteText = (text = '') => text.replaceAll('\n\n', '

').replaceAll(mentionPattern, ' @$1'); diff --git a/lib/routes/dedao/user.tsx b/lib/routes/dedao/user.tsx index 39ebb3772..5a27fd7ab 100644 --- a/lib/routes/dedao/user.tsx +++ b/lib/routes/dedao/user.tsx @@ -11,7 +11,7 @@ const types = { 12: '视频', }; -const mentionPattern = /<\u2267\u2746>\{"name":"(.*?)","uid":"\d+","at":"1"\}<\/\u2266\u2746>/g; +const mentionPattern = /<\u{2267}\u{2746}>\{"name":"(.*?)","uid":"\d+","at":"1"\}<\/\u{2266}\u{2746}>/gu; const formatNoteText = (text = '') => text.replaceAll('\n\n', '

').replaceAll(mentionPattern, ' @$1'); diff --git a/lib/routes/denonbu/news.ts b/lib/routes/denonbu/news.ts index deadcf2e3..01baaefbe 100644 --- a/lib/routes/denonbu/news.ts +++ b/lib/routes/denonbu/news.ts @@ -176,7 +176,7 @@ async function handler(ctx: Context): Promise { const result: DataItem = { title: title ?? body.split('\n', 1)[0], description: body, - pubDate: timezone(parseDate(post_date), +9), + pubDate: timezone(parseDate(post_date), 9), category: category.map((x) => x.name), }; diff --git a/lib/routes/dewu/declaration.ts b/lib/routes/dewu/declaration.ts index 0ab73bc25..c73d5cbc3 100644 --- a/lib/routes/dewu/declaration.ts +++ b/lib/routes/dewu/declaration.ts @@ -56,7 +56,7 @@ async function handler(ctx) { title: item.title, id: item.id, link: `https://open.dewu.com/#/declaration/read?articleId=${item.id}`, - pubDate: timezone(parseDate(item.publishTime), +8), + pubDate: timezone(parseDate(item.publishTime), 8), })); const result = await Promise.all( diff --git a/lib/routes/dgjyw/index.ts b/lib/routes/dgjyw/index.ts index b4633b706..57b3c5c0b 100644 --- a/lib/routes/dgjyw/index.ts +++ b/lib/routes/dgjyw/index.ts @@ -49,7 +49,7 @@ async function handler(ctx) { content('.cont-tit').remove(); content('.art-body').html(content('.v_news_content').html()); - item.pubDate = timezone(parseDate(content('meta[name="PubDate"]').attr('content')), +8); + item.pubDate = timezone(parseDate(content('meta[name="PubDate"]').attr('content')), 8); item.description = content('form[name="_newscontent_fromname"]').html(); } diff --git a/lib/routes/dgtle/video.ts b/lib/routes/dgtle/video.ts index 273f4c3c6..a88fe00b8 100644 --- a/lib/routes/dgtle/video.ts +++ b/lib/routes/dgtle/video.ts @@ -117,7 +117,7 @@ export const handler = async (ctx: Context): Promise => { let processedItem: DataItem = { title, description, - pubDate: pubDateStr ? timezone(parseRelativeDate(pubDateStr), +8) : item.pubDate, + pubDate: pubDateStr ? timezone(parseRelativeDate(pubDateStr), 8) : item.pubDate, link: linkUrl ? new URL(linkUrl, baseUrl).href : item.link, category: categories, author: authors, @@ -130,7 +130,7 @@ export const handler = async (ctx: Context): Promise => { }, image, banner: image, - updated: upDatedStr ? timezone(parseRelativeDate(upDatedStr), +8) : item.updated, + updated: upDatedStr ? timezone(parseRelativeDate(upDatedStr), 8) : item.updated, language, }; diff --git a/lib/routes/dlsite/ci-en/article.ts b/lib/routes/dlsite/ci-en/article.ts index b05eb3dc6..ee8642c82 100644 --- a/lib/routes/dlsite/ci-en/article.ts +++ b/lib/routes/dlsite/ci-en/article.ts @@ -75,7 +75,7 @@ async function handler(ctx) { }); item.description = content('article').html(); - item.pubDate = timezone(parseDate(content('.e-date').first().text()), +9); + item.pubDate = timezone(parseDate(content('.e-date').first().text()), 9); item.category = content('.c-hashTagList-item') .toArray() .map((t) => content(t).text().split('#').pop().trim()); diff --git a/lib/routes/dlsite/utils.ts b/lib/routes/dlsite/utils.ts index b13e050f0..115743fe8 100644 --- a/lib/routes/dlsite/utils.ts +++ b/lib/routes/dlsite/utils.ts @@ -127,9 +127,9 @@ const ProcessItems = async (ctx) => { const detail = details[guid]; - const pubDate = timezone(parseDate(detail.regist_date), +9); + const pubDate = timezone(parseDate(detail.regist_date), 9); const discountRate = detail.discount_rate; - const discountEndDate = detail.discount_end_date ? timezone(parseDate(detail.discount_end_date, 'MM/DD HH:mm'), +9) : undefined; + const discountEndDate = detail.discount_end_date ? timezone(parseDate(detail.discount_end_date, 'MM/DD HH:mm'), 9) : undefined; images = images.length === 0 ? [detail.work_image] : images; return { diff --git a/lib/routes/dmzj/news.ts b/lib/routes/dmzj/news.ts index 90fce6d40..03f72e609 100644 --- a/lib/routes/dmzj/news.ts +++ b/lib/routes/dmzj/news.ts @@ -46,7 +46,7 @@ async function handler(ctx) { title: $(item).find('h3 a').text(), link: $(item).find('h3 a').attr('href'), author: $(item).find('.head_con_p_o span:nth-child(3)').text().split(':', 2)[1], - pubDate: timezone(parseDate($(item).find('.head_con_p_o span').first().text(), 'YYYY-MM-DD HH:mm'), +8), + pubDate: timezone(parseDate($(item).find('.head_con_p_o span').first().text(), 'YYYY-MM-DD HH:mm'), 8), description: $(item).find('p.com_about').text(), category: $(item) .find('.u_comfoot a .bqwarp') diff --git a/lib/routes/dn/news.ts b/lib/routes/dn/news.ts index fd20461d6..d20e9a91f 100644 --- a/lib/routes/dn/news.ts +++ b/lib/routes/dn/news.ts @@ -75,7 +75,7 @@ async function handler(ctx) { .find('span.cat') .toArray() .map((c) => $(c).text()), - pubDate: timezone(parseDate(item.find('span.time').text()), +8), + pubDate: timezone(parseDate(item.find('span.time').text()), 8), }; }); @@ -100,7 +100,7 @@ async function handler(ctx) { .toArray() .map((c) => content(c).text()), ]; - item.pubDate = timezone(parseDate(content('span.date').text()), +8); + item.pubDate = timezone(parseDate(content('span.date').text()), 8); return item; }) diff --git a/lib/routes/dnaindia/common.ts b/lib/routes/dnaindia/common.ts index 180919d42..045efc462 100644 --- a/lib/routes/dnaindia/common.ts +++ b/lib/routes/dnaindia/common.ts @@ -47,7 +47,7 @@ export async function handler(ctx) { const dateMatch = timeText.match(/Updated\s*:([\w\s,:]+)/); let time = dateMatch ? dateMatch[1].trim() : ''; time = time.replace(/\s+IST$/, ''); - const pubDate = timezone(parseDate(time), +5.5); + const pubDate = timezone(parseDate(time), 5.5); // Get author information const authorMeta = $('meta[name="author"]').attr('content'); const author = authorMeta || 'DNA Web Team'; diff --git a/lib/routes/dol/announce.ts b/lib/routes/dol/announce.ts index a76e5f44d..40f0f9f09 100644 --- a/lib/routes/dol/announce.ts +++ b/lib/routes/dol/announce.ts @@ -95,7 +95,7 @@ async function handler(ctx) { Number.parseInt(dateList[1]) - 1, Number.parseInt(dateList[0]) ), - +7 + 7 ), author: officeName.text(), category: [reqType.text()], diff --git a/lib/routes/domp4/utils.ts b/lib/routes/domp4/utils.ts index 7e446b8b8..04ec09a53 100644 --- a/lib/routes/domp4/utils.ts +++ b/lib/routes/domp4/utils.ts @@ -61,6 +61,7 @@ function getUrlType(url) { */ function decodeCipherText(p, a, c, k, e, d) { e = function (c) { + // oxlint-disable-next-line unicorn-js/operator-assignment return (c < a ? '' : e(Number.parseInt((c / a).toString()))) + ((c = c % a) > 35 ? String.fromCodePoint(c + 29) : c.toString(36)); }; if (!''.replace(/^/, () => '')) { diff --git a/lib/routes/dora-world/article.ts b/lib/routes/dora-world/article.ts index dbf80b6a0..96db87406 100644 --- a/lib/routes/dora-world/article.ts +++ b/lib/routes/dora-world/article.ts @@ -51,7 +51,7 @@ async function handler(ctx): Promise { title: item.title, link: item.page_url.startsWith('http') ? item.page_url : `${baseUrl}${item.page_url}`, description: item.page_url.startsWith('/contents/') ? '' : `

${item.title}

`, - pubDate: timezone(parseDate(item.publish_at), +9), + pubDate: timezone(parseDate(item.publish_at), 9), category: item.tags.map((tag) => tag.name), guid: item.id, })); @@ -85,6 +85,6 @@ async function getContent(nextBuildId: string, contentId: string) { content .html() ?.replaceAll(rubyRegex, '$1($2)') - ?.replaceAll(/[^\t\n\r\u0020-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/g, '') ?? ''; + ?.replaceAll(/[^\t\n\r\u{0020}-\u{D7FF}\u{E000}-\u{FDCF}\u{FDE0}-\u{FFFD}]/gu, '') ?? ''; return description; } diff --git a/lib/routes/douban/other/replied.ts b/lib/routes/douban/other/replied.ts index c231d97ee..bf28f17fb 100644 --- a/lib/routes/douban/other/replied.ts +++ b/lib/routes/douban/other/replied.ts @@ -69,7 +69,8 @@ async function handler(ctx) { pubDate, author; - for (const c of comments) { + while (comments.length > 0) { + const c = comments.shift(); if (c.author.uid === ctx.req.param('uid') && new Date(c.create_time) > new Date(latest)) { latest = new Date(c.create_time + ' GMT+8'); pubDate = latest.toUTCString(); diff --git a/lib/routes/douban/other/replies.ts b/lib/routes/douban/other/replies.ts index 098f5509e..a330635f2 100644 --- a/lib/routes/douban/other/replies.ts +++ b/lib/routes/douban/other/replies.ts @@ -57,7 +57,8 @@ async function handler(ctx) { const comments = JSON.parse(detailResponse.data.match(/'comments':(.*)\}\],/)[1] + '}]'); - for (const c of comments) { + while (comments.length > 0) { + const c = comments.shift(); if (c.id === item.link.split('#', 2)[1]) { return { link: item.link, diff --git a/lib/routes/douyin/hashtag.ts b/lib/routes/douyin/hashtag.ts index 77541e05e..f1ef14cb9 100644 --- a/lib/routes/douyin/hashtag.ts +++ b/lib/routes/douyin/hashtag.ts @@ -88,13 +88,13 @@ async function handler(ctx) { videoList = videoList.map((item) => proxyVideo(item, relay)); } let duration = post.video && post.video.duration; - duration = duration && duration / 1000; + duration &&= duration / 1000; let img; // if (!embed) { // img = post.video && post.video.dynamic_cover && post.video.dynamic_cover.url_list[post.video.dynamic_cover.url_list.length - 1]; // dynamic cover (webp) // } - img = img || (post.video && post.video.origin_cover && post.video.origin_cover.url_list.at(-1)); - img = img && resolveUrl(img); + img ||= post.video && post.video.origin_cover && post.video.origin_cover.url_list.at(-1); + img &&= resolveUrl(img); // render description const desc = post.desc && post.desc.replaceAll('\n', '
'); diff --git a/lib/routes/douyin/user.ts b/lib/routes/douyin/user.ts index ca0a020e8..f4421eb00 100644 --- a/lib/routes/douyin/user.ts +++ b/lib/routes/douyin/user.ts @@ -95,16 +95,15 @@ async function handler(ctx) { videoList = videoList.map((item) => proxyVideo(item, relay)); } let duration = post.video?.duration; - duration = duration && duration / 1000; + duration &&= duration / 1000; let img; // if (!embed) { // img = post.video && post.video.dynamicCover; // dynamic cover (webp) // } - img = - img || + img ||= post.video?.cover?.url_list.at(-1) || // HD post.video?.origin_cover?.url_list.at(-1); // LD - img = img && resolveUrl(img); + img &&= resolveUrl(img); // render description const desc = post.desc?.replaceAll('\n', '
'); diff --git a/lib/routes/douyu/group.ts b/lib/routes/douyu/group.ts index 93893ebff..631a4e53b 100644 --- a/lib/routes/douyu/group.ts +++ b/lib/routes/douyu/group.ts @@ -54,7 +54,7 @@ async function handler(ctx) { const items = response.data.data.map((item) => ({ title: item.title, link: `${rootUrl}/p/${item.post_id}`, - pubDate: timezone(parseDate(item.created_at_std), +8), + pubDate: timezone(parseDate(item.created_at_std), 8), description: renderDescription({ content: item.describe, images: item.imglist.map((i) => ({ diff --git a/lib/routes/dpm/exhibitions.tsx b/lib/routes/dpm/exhibitions.tsx index 5aa2a3de4..dd9053744 100644 --- a/lib/routes/dpm/exhibitions.tsx +++ b/lib/routes/dpm/exhibitions.tsx @@ -126,7 +126,7 @@ export const route: Route = { fullDuration = '未定/常设'; } - const cleanDuration = fullDuration.replaceAll('.', '-').replaceAll('/', '-'); + const cleanDuration = fullDuration.replaceAll(/[./]/g, '-'); // use YYYY-MM-DD for date format const dateMatches = cleanDuration.match(/\d{4}-\d{2}-\d{2}/g); diff --git a/lib/routes/duozhi/index.ts b/lib/routes/duozhi/index.ts index 1e873ea0c..39688307b 100644 --- a/lib/routes/duozhi/index.ts +++ b/lib/routes/duozhi/index.ts @@ -135,7 +135,7 @@ export const handler = async (ctx: Context): Promise => { const processedItem: DataItem = { title, description, - pubDate: pubDateStr ? timezone(parseDate(pubDateStr), +8) : item.pubDate, + pubDate: pubDateStr ? timezone(parseDate(pubDateStr), 8) : item.pubDate, category: categories, author: authors, content: { @@ -144,7 +144,7 @@ export const handler = async (ctx: Context): Promise => { }, image, banner: image, - updated: upDatedStr ? timezone(parseDate(upDatedStr), +8) : item.updated, + updated: upDatedStr ? timezone(parseDate(upDatedStr), 8) : item.updated, language, }; diff --git a/lib/routes/dykszx/news.ts b/lib/routes/dykszx/news.ts index d9f2273e3..2199dfe86 100644 --- a/lib/routes/dykszx/news.ts +++ b/lib/routes/dykszx/news.ts @@ -47,7 +47,7 @@ async function handler(ctx) { title: item.children[0].children[0].data, description: newsContent.content, link: newsContent.newsPage, - pubDate: timezone(parseDate(newsContent.newsTime, '时间:YYYY-MM-DD HH:mm:ss'), +8), + pubDate: timezone(parseDate(newsContent.newsTime, '时间:YYYY-MM-DD HH:mm:ss'), 8), }; }); }) diff --git a/lib/routes/dytt/index.ts b/lib/routes/dytt/index.ts index 882d20c27..0801008da 100644 --- a/lib/routes/dytt/index.ts +++ b/lib/routes/dytt/index.ts @@ -43,14 +43,14 @@ export const handler = async (ctx: Context): Promise => { const processedItem: DataItem = { title, description, - pubDate: pubDateStr ? timezone(parseDate(pubDateStr), +8) : undefined, + pubDate: pubDateStr ? timezone(parseDate(pubDateStr), 8) : undefined, link: linkUrl ? new URL(linkUrl, baseUrl).href : undefined, doi: $el.find('meta[name="citation_doi"]').attr('content'), content: { html: description, text: description, }, - updated: upDatedStr ? timezone(parseDate(upDatedStr), +8) : undefined, + updated: upDatedStr ? timezone(parseDate(upDatedStr), 8) : undefined, language, }; diff --git a/lib/routes/eagle/changelog.ts b/lib/routes/eagle/changelog.ts index be577c12c..a132e2e56 100644 --- a/lib/routes/eagle/changelog.ts +++ b/lib/routes/eagle/changelog.ts @@ -38,8 +38,7 @@ async function handler(ctx) { } if (language === 'tw') { changelog = '更新日誌'; - } - if (language === 'en') { + } else if (language === 'en') { changelog = 'Release Notes'; } diff --git a/lib/routes/earthquake/ceic.ts b/lib/routes/earthquake/ceic.ts index ff980d1e9..51f6acbbf 100644 --- a/lib/routes/earthquake/ceic.ts +++ b/lib/routes/earthquake/ceic.ts @@ -41,7 +41,7 @@ export const route: Route = { async function handler(ctx) { let type = Number(ctx.req.param('type')); - type = type ?? 1; + type ??= 1; const baseUrl = 'http://www.ceic.ac.cn'; const api = `${baseUrl}/ajax/speedsearch?num=${type}`; const mappings = { @@ -96,7 +96,7 @@ async function handler(ctx) { return { title: `${LOCATION_C}发生${M}级地震`, link: `${baseUrl}/${NEW_DID}.html`, - pubDate: timezone(parseDate(O_TIME, 'YYYY-MM-DD HH:mm:ss'), +8), + pubDate: timezone(parseDate(O_TIME, 'YYYY-MM-DD HH:mm:ss'), 8), description: contentBuilder.join('
'), guid: NEW_DID, }; diff --git a/lib/routes/earthquake/index.ts b/lib/routes/earthquake/index.ts index 3dfc0b7df..a13c841dd 100644 --- a/lib/routes/earthquake/index.ts +++ b/lib/routes/earthquake/index.ts @@ -54,7 +54,7 @@ async function handler(ctx) { return { title: `${epicenter}发生${num}级地震`, link: `https://www.cea.gov.cn/eportal/ui?struts.portlet.mode=view&struts.portlet.action=/portlet/expressEarthquake!toNewInfoView.action&pageId=366521&id=${id}`, - pubDate: timezone(parseDate(date, 'YYYY-MM-DD HH:mm:ss'), +8), + pubDate: timezone(parseDate(date, 'YYYY-MM-DD HH:mm:ss'), 8), description, }; }); diff --git a/lib/routes/eastday/24.ts b/lib/routes/eastday/24.ts index 087f48ff9..3d89b9aa9 100644 --- a/lib/routes/eastday/24.ts +++ b/lib/routes/eastday/24.ts @@ -86,7 +86,7 @@ async function handler(ctx) { const pageNumber = Number.parseInt(detailResponse.data.match(/var page_num = '(\d+)'/)[1]); item.description = content('#J-contain_detail_cnt').html(); - item.pubDate = timezone(parseDate(content('meta[property="og:release_date"]').attr('content')), +8); + item.pubDate = timezone(parseDate(content('meta[property="og:release_date"]').attr('content')), 8); if (pageNumber > 1) { const links = []; diff --git a/lib/routes/eastday/portrait.ts b/lib/routes/eastday/portrait.ts index d68172890..ae9dc2768 100644 --- a/lib/routes/eastday/portrait.ts +++ b/lib/routes/eastday/portrait.ts @@ -46,7 +46,7 @@ async function handler() { const list = response.data.list.map((item) => ({ link: item.url, title: item.title, - pubDate: timezone(parseDate(item.time), +8), + pubDate: timezone(parseDate(item.time), 8), })); const items = await Promise.all( diff --git a/lib/routes/eastday/sh.ts b/lib/routes/eastday/sh.ts index 7c875f2dd..115be82e6 100644 --- a/lib/routes/eastday/sh.ts +++ b/lib/routes/eastday/sh.ts @@ -45,7 +45,7 @@ async function handler() { const entity = { title: item.title, description: item.abstracts, - pubDate: timezone(parseDate(item.time), +8), + pubDate: timezone(parseDate(item.time), 8), link, }; diff --git a/lib/routes/eastmoney/ttjj/user.ts b/lib/routes/eastmoney/ttjj/user.ts index 35d650993..37e7728b8 100644 --- a/lib/routes/eastmoney/ttjj/user.ts +++ b/lib/routes/eastmoney/ttjj/user.ts @@ -71,7 +71,7 @@ async function handler(ctx) { const single = { title: item.post_title, description, - pubDate: timezone(parseDate(item.post_display_time, 'YYYY-MM-DD HH:mm:ss'), +8), + pubDate: timezone(parseDate(item.post_display_time, 'YYYY-MM-DD HH:mm:ss'), 8), link: `https://fundbarmob.eastmoney.com/index.html?goPage=articleView&lastPage=personDetailView&aid=${item.post_id}`, }; return single; diff --git a/lib/routes/ecnu/art.ts b/lib/routes/ecnu/art.ts index c4afb5bd0..d4069f729 100644 --- a/lib/routes/ecnu/art.ts +++ b/lib/routes/ecnu/art.ts @@ -28,7 +28,7 @@ export const route: Route = { const links = $('ul.data-list > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('span').text()), +8), + pubDate: timezone(parseDate($(el).find('span').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/bksy.ts b/lib/routes/ecnu/bksy.ts index e08af2e14..71f45cc62 100644 --- a/lib/routes/ecnu/bksy.ts +++ b/lib/routes/ecnu/bksy.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.news_list.list2 > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.news_date').text()), +8), + pubDate: timezone(parseDate($(el).find('.news_date').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('.news_title').text(), })); diff --git a/lib/routes/ecnu/cee.ts b/lib/routes/ecnu/cee.ts index f1b4530f3..72910d18e 100644 --- a/lib/routes/ecnu/cee.ts +++ b/lib/routes/ecnu/cee.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.news_list.list2 > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.news_meta').text()), +8), + pubDate: timezone(parseDate($(el).find('.news_meta').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/chem.ts b/lib/routes/ecnu/chem.ts index 53405feb8..fe255e7b5 100644 --- a/lib/routes/ecnu/chem.ts +++ b/lib/routes/ecnu/chem.ts @@ -28,7 +28,7 @@ export const route: Route = { const links = $('ul.cols_list.clearfix > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.cols_meta').text()), +8), + pubDate: timezone(parseDate($(el).find('.cols_meta').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/chinese.ts b/lib/routes/ecnu/chinese.ts index 36c379fe8..c3d64dc91 100644 --- a/lib/routes/ecnu/chinese.ts +++ b/lib/routes/ecnu/chinese.ts @@ -28,7 +28,7 @@ export const route: Route = { const links = $('ul.news_list.list2 > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.news_meta').text()), +8), + pubDate: timezone(parseDate($(el).find('.news_meta').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').attr('title'), })); diff --git a/lib/routes/ecnu/comm.ts b/lib/routes/ecnu/comm.ts index 3785a6c98..2a077c302 100644 --- a/lib/routes/ecnu/comm.ts +++ b/lib/routes/ecnu/comm.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.news_list.list2 > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.news_meta').text()), +8), + pubDate: timezone(parseDate($(el).find('.news_meta').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/cs.ts b/lib/routes/ecnu/cs.ts index e4cbabdb5..65604f2d9 100644 --- a/lib/routes/ecnu/cs.ts +++ b/lib/routes/ecnu/cs.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('div#wp_news_w6 ul.data-list > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('span').text()), +8), + pubDate: timezone(parseDate($(el).find('span').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/cxcy.ts b/lib/routes/ecnu/cxcy.ts index decc0f497..b1fc8c20d 100644 --- a/lib/routes/ecnu/cxcy.ts +++ b/lib/routes/ecnu/cxcy.ts @@ -49,7 +49,7 @@ export const route: Route = { const filteredEls = $(`div.limit_style1[frag="${fragList[type].frag}"]`).find('table > tbody > tr > td').toArray(); const links = filteredEls.map((el) => ({ - pubDate: timezone(parseDate($(el).find('.data').text()), +8), + pubDate: timezone(parseDate($(el).find('.data').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('.news_title').text(), })); diff --git a/lib/routes/ecnu/dase.ts b/lib/routes/ecnu/dase.ts index 6bb77f0ff..ffd5f6ecb 100644 --- a/lib/routes/ecnu/dase.ts +++ b/lib/routes/ecnu/dase.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.news_list.list2 > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.news_meta').text()), +8), + pubDate: timezone(parseDate($(el).find('.news_meta').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/dx.ts b/lib/routes/ecnu/dx.ts index 8c6fe80bf..19c359650 100644 --- a/lib/routes/ecnu/dx.ts +++ b/lib/routes/ecnu/dx.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.news_list.list2 > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.news_meta').text()), +8), + pubDate: timezone(parseDate($(el).find('.news_meta').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/dxb.ts b/lib/routes/ecnu/dxb.ts index 3bbf32368..b924a5a77 100644 --- a/lib/routes/ecnu/dxb.ts +++ b/lib/routes/ecnu/dxb.ts @@ -28,7 +28,7 @@ export const route: Route = { const links = $('ul.news_list > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.news_meta').text()), +8), + pubDate: timezone(parseDate($(el).find('.news_meta').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/ed.ts b/lib/routes/ecnu/ed.ts index 0312caf9f..510088a06 100644 --- a/lib/routes/ecnu/ed.ts +++ b/lib/routes/ecnu/ed.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.news_list.list2 > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.news_meta').text()), +8), + pubDate: timezone(parseDate($(el).find('.news_meta').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/geoai.ts b/lib/routes/ecnu/geoai.ts index c67e30bb9..16a447e44 100644 --- a/lib/routes/ecnu/geoai.ts +++ b/lib/routes/ecnu/geoai.ts @@ -28,7 +28,7 @@ export const route: Route = { const links = $('ul.news_list > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.news_meta').text()), +8), + pubDate: timezone(parseDate($(el).find('.news_meta').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/ghcollege.ts b/lib/routes/ecnu/ghcollege.ts index 2271399b1..417bf1ab3 100644 --- a/lib/routes/ecnu/ghcollege.ts +++ b/lib/routes/ecnu/ghcollege.ts @@ -28,7 +28,7 @@ export const route: Route = { const links = $('ul.wp_article_list > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.Article_PublishDate').text()), +8), + pubDate: timezone(parseDate($(el).find('.Article_PublishDate').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/history.ts b/lib/routes/ecnu/history.ts index a48695bbc..7af7d5a64 100644 --- a/lib/routes/ecnu/history.ts +++ b/lib/routes/ecnu/history.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.data-list2 > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('span').text()), +8), + pubDate: timezone(parseDate($(el).find('span').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/jiaoliu.ts b/lib/routes/ecnu/jiaoliu.ts index 2b3bd4512..b35ecccc2 100644 --- a/lib/routes/ecnu/jiaoliu.ts +++ b/lib/routes/ecnu/jiaoliu.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('#wp_news_w3 > table > tbody > tr') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('div[style="white-space:nowrap"]').text()), +8), + pubDate: timezone(parseDate($(el).find('div[style="white-space:nowrap"]').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/jwc.ts b/lib/routes/ecnu/jwc.ts index 9b11ae342..05602979a 100644 --- a/lib/routes/ecnu/jwc.ts +++ b/lib/routes/ecnu/jwc.ts @@ -54,11 +54,10 @@ export const route: Route = { item.description = '请进行统一身份认证之后再访问'; return item; } - } else { - // file to download - item.description = '点击认证后访问内容'; - return item; } + // file to download + item.description = '点击认证后访问内容'; + return item; }) ) ); diff --git a/lib/routes/ecnu/mks.ts b/lib/routes/ecnu/mks.ts index 52226a2b1..3d56dec35 100644 --- a/lib/routes/ecnu/mks.ts +++ b/lib/routes/ecnu/mks.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.news_list.list2 > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.news_date').text()), +8), + pubDate: timezone(parseDate($(el).find('.news_date').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('.news_title').text(), })); diff --git a/lib/routes/ecnu/mxcsy.ts b/lib/routes/ecnu/mxcsy.ts index 14bb6fd34..5f7c0d972 100644 --- a/lib/routes/ecnu/mxcsy.ts +++ b/lib/routes/ecnu/mxcsy.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.wp_article_list > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.Article_PublishDate').text()), +8), + pubDate: timezone(parseDate($(el).find('.Article_PublishDate').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/pharm.ts b/lib/routes/ecnu/pharm.ts index b39c14f6d..bc8fa1cb3 100644 --- a/lib/routes/ecnu/pharm.ts +++ b/lib/routes/ecnu/pharm.ts @@ -28,7 +28,7 @@ export const route: Route = { const links = $('ul.news_list.list2 > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.news_meta').text()), +8), + pubDate: timezone(parseDate($(el).find('.news_meta').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/philo.ts b/lib/routes/ecnu/philo.ts index a567c9590..1fbc8d57c 100644 --- a/lib/routes/ecnu/philo.ts +++ b/lib/routes/ecnu/philo.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.data-list2 > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('span').text()), +8), + pubDate: timezone(parseDate($(el).find('span').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/phy.ts b/lib/routes/ecnu/phy.ts index e070a50b4..528b483aa 100644 --- a/lib/routes/ecnu/phy.ts +++ b/lib/routes/ecnu/phy.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.data-list > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('span').text()), +8), + pubDate: timezone(parseDate($(el).find('span').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').attr('title'), })); diff --git a/lib/routes/ecnu/psy.ts b/lib/routes/ecnu/psy.ts index 2fed52f9c..07b056125 100644 --- a/lib/routes/ecnu/psy.ts +++ b/lib/routes/ecnu/psy.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.wp_article_list > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.Article_PublishDate').text()), +8), + pubDate: timezone(parseDate($(el).find('.Article_PublishDate').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').attr('title'), })); diff --git a/lib/routes/ecnu/sees.ts b/lib/routes/ecnu/sees.ts index 429c71dec..fce7194d2 100644 --- a/lib/routes/ecnu/sees.ts +++ b/lib/routes/ecnu/sees.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.news_list.list2 > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.news_meta').text()), +8), + pubDate: timezone(parseDate($(el).find('.news_meta').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/sei.ts b/lib/routes/ecnu/sei.ts index 26973570a..5f5d367c1 100644 --- a/lib/routes/ecnu/sei.ts +++ b/lib/routes/ecnu/sei.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.data-list > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.data-list-time').text()), +8), + pubDate: timezone(parseDate($(el).find('.data-list-time').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/spm.ts b/lib/routes/ecnu/spm.ts index 8e1e7f73d..6ec3bcb6e 100644 --- a/lib/routes/ecnu/spm.ts +++ b/lib/routes/ecnu/spm.ts @@ -28,7 +28,7 @@ export const route: Route = { const links = $('ul.news_list.list2 > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.news_meta').text()), +8), + pubDate: timezone(parseDate($(el).find('.news_meta').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecnu/stat.ts b/lib/routes/ecnu/stat.ts index 15f0e7090..f23ef39a7 100644 --- a/lib/routes/ecnu/stat.ts +++ b/lib/routes/ecnu/stat.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.news_list.list2 > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.news_meta').text()), +8), + pubDate: timezone(parseDate($(el).find('.news_meta').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').attr('title'), })); diff --git a/lib/routes/ecnu/tyxx.ts b/lib/routes/ecnu/tyxx.ts index a257b7ada..7b7a16d68 100644 --- a/lib/routes/ecnu/tyxx.ts +++ b/lib/routes/ecnu/tyxx.ts @@ -26,7 +26,7 @@ export const route: Route = { const links = $('ul.news_list.list2 > li') .toArray() .map((el) => ({ - pubDate: timezone(parseDate($(el).find('.news_meta').text()), +8), + pubDate: timezone(parseDate($(el).find('.news_meta').text()), 8), link: new URL($(el).find('a').attr('href'), baseUrl).href, title: $(el).find('a').text(), })); diff --git a/lib/routes/ecust/e/news.ts b/lib/routes/ecust/e/news.ts index 2b982158f..ef4c0bd80 100644 --- a/lib/routes/ecust/e/news.ts +++ b/lib/routes/ecust/e/news.ts @@ -45,7 +45,7 @@ async function handler() { const list = response.data.datas.datas.map((item) => ({ title: item['1'].value, link: item.url.startsWith('http') ? item.url : `${baseUrl}/engine2/d/${item.id}/${item.engineInstanceId}/0`, - pubDate: timezone(parseDate(item['6'].value), +8), + pubDate: timezone(parseDate(item['6'].value), 8), })); const items = await Promise.all( diff --git a/lib/routes/eeo/kuaixun.ts b/lib/routes/eeo/kuaixun.ts index 620a3e970..e1e235caa 100644 --- a/lib/routes/eeo/kuaixun.ts +++ b/lib/routes/eeo/kuaixun.ts @@ -51,7 +51,7 @@ export const handler = async (ctx: Context): Promise => { const processedItem: DataItem = { title, description, - pubDate: pubDate ? timezone(parseDate(pubDate), +8) : undefined, + pubDate: pubDate ? timezone(parseDate(pubDate), 8) : undefined, link: linkUrl, category: categories, author: authors, @@ -63,7 +63,7 @@ export const handler = async (ctx: Context): Promise => { }, image, banner: image, - updated: updated ? timezone(parseDate(updated), +8) : undefined, + updated: updated ? timezone(parseDate(updated), 8) : undefined, language, }; @@ -93,13 +93,13 @@ export const handler = async (ctx: Context): Promise => { const processedItem: DataItem = { title, description, - pubDate: pubDateStr ? timezone(parseDate(pubDateStr), +8) : item.pubDate, + pubDate: pubDateStr ? timezone(parseDate(pubDateStr), 8) : item.pubDate, author: authors, content: { html: description, text: description, }, - updated: upDatedStr ? timezone(parseDate(upDatedStr), +8) : item.updated, + updated: upDatedStr ? timezone(parseDate(upDatedStr), 8) : item.updated, language, }; diff --git a/lib/routes/ehentai/ehapi.ts b/lib/routes/ehentai/ehapi.ts index add470854..2909546fb 100644 --- a/lib/routes/ehentai/ehapi.ts +++ b/lib/routes/ehentai/ehapi.ts @@ -178,10 +178,12 @@ function getBittorrent(cache, bittorrent_page_url) { function updateBittorrent_url(cache, items) { // 下种子文件需要动态密码,密码每几次请求就更新一次 for (const item of items) { - if (item.enclosure_url) { - item.enclosure_url = item.enclosure_url.replace(/torrent\?p=.*$/, () => `torrent?p=${p}`); - cache.set(item.bittorrent_page_url, item.enclosure_url); + if (!item.enclosure_url) { + continue; } + + item.enclosure_url = item.enclosure_url.replace(/torrent\?p=.*$/, () => `torrent?p=${p}`); + cache.set(item.bittorrent_page_url, item.enclosure_url); } return items; } diff --git a/lib/routes/elasticsearch-cn/index.ts b/lib/routes/elasticsearch-cn/index.ts index 574c841d9..4860663ec 100644 --- a/lib/routes/elasticsearch-cn/index.ts +++ b/lib/routes/elasticsearch-cn/index.ts @@ -58,7 +58,7 @@ async function handler(ctx) { title: a.text(), link: a.attr('href'), author: item.find('.aw-user-name').text(), - pubDate: timezone(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}/.test(pubDate) ? parseDate(pubDate) : parseRelativeDate(pubDate), +8), + pubDate: timezone(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}/.test(pubDate) ? parseDate(pubDate) : parseRelativeDate(pubDate), 8), }; }); diff --git a/lib/routes/eshukan/academic.ts b/lib/routes/eshukan/academic.ts index d88be34fc..2fab9c680 100644 --- a/lib/routes/eshukan/academic.ts +++ b/lib/routes/eshukan/academic.ts @@ -42,7 +42,7 @@ export const handler = async (ctx) => { return { title, description, - pubDate: pubDate ? timezone(parseDate(pubDate), +8) : undefined, + pubDate: pubDate ? timezone(parseDate(pubDate), 8) : undefined, link: new URL(a.prop('href'), currentUrl).href, content: { html: description, @@ -69,7 +69,7 @@ export const handler = async (ctx) => { item.title = title; item.description = description; - item.pubDate = pubDate ? timezone(parseDate(pubDate), +8) : item.pubDate; + item.pubDate = pubDate ? timezone(parseDate(pubDate), 8) : item.pubDate; item.author = $$('div.author a').text(); item.content = { html: description, diff --git a/lib/routes/everia/article.ts b/lib/routes/everia/article.ts index eab88176f..25a1d0767 100644 --- a/lib/routes/everia/article.ts +++ b/lib/routes/everia/article.ts @@ -2,7 +2,7 @@ import { load } from 'cheerio'; import got from '@/utils/got'; -async function loadArticle(link) { +export const loadArticle = async (link) => { const resp = await got(link); const article = load(resp.body); @@ -17,6 +17,4 @@ async function loadArticle(link) { description, link, }; -} - -export default loadArticle; +}; diff --git a/lib/routes/everia/category.ts b/lib/routes/everia/category.ts index f4e6182e4..7b4ffb3ee 100644 --- a/lib/routes/everia/category.ts +++ b/lib/routes/everia/category.ts @@ -4,7 +4,7 @@ import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import loadArticle from './article'; +import { loadArticle } from './article'; import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { diff --git a/lib/routes/everia/latest.ts b/lib/routes/everia/latest.ts index 48c8898ab..f6469292b 100644 --- a/lib/routes/everia/latest.ts +++ b/lib/routes/everia/latest.ts @@ -4,7 +4,7 @@ import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import loadArticle from './article'; +import { loadArticle } from './article'; import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { diff --git a/lib/routes/everia/search.ts b/lib/routes/everia/search.ts index 5e8750031..b58afcc16 100644 --- a/lib/routes/everia/search.ts +++ b/lib/routes/everia/search.ts @@ -4,7 +4,7 @@ import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import loadArticle from './article'; +import { loadArticle } from './article'; import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { diff --git a/lib/routes/everia/tag.ts b/lib/routes/everia/tag.ts index a3d008b5b..b6d92a1da 100644 --- a/lib/routes/everia/tag.ts +++ b/lib/routes/everia/tag.ts @@ -4,7 +4,7 @@ import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import loadArticle from './article'; +import { loadArticle } from './article'; import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { diff --git a/lib/routes/f95zone/post.ts b/lib/routes/f95zone/post.ts index adb27a649..adc79a6b0 100644 --- a/lib/routes/f95zone/post.ts +++ b/lib/routes/f95zone/post.ts @@ -48,7 +48,7 @@ Note: This route does not support Radar auto-detection because the post ID is in const response = await ofetch(link, { headers: { referer: baseUrl, - ...(config.f95zone.cookie ? { cookie: config.f95zone.cookie } : {}), + ...(config.f95zone.cookie && { cookie: config.f95zone.cookie }), }, }); diff --git a/lib/routes/f95zone/thread.ts b/lib/routes/f95zone/thread.ts index 99446742b..97c3b3963 100644 --- a/lib/routes/f95zone/thread.ts +++ b/lib/routes/f95zone/thread.ts @@ -51,7 +51,7 @@ Note: If you want to track a specific post's content changes (e.g., first post w const headers = { referer: baseUrl, - ...(config.f95zone.cookie ? { cookie: config.f95zone.cookie } : {}), + ...(config.f95zone.cookie && { cookie: config.f95zone.cookie }), }; const firstPageResponse = await ofetch(threadLink, { headers }); diff --git a/lib/routes/f95zone/utils.ts b/lib/routes/f95zone/utils.ts index b2bc99351..8b96600a4 100644 --- a/lib/routes/f95zone/utils.ts +++ b/lib/routes/f95zone/utils.ts @@ -54,7 +54,8 @@ export const processContent = (html: string): string => { return; } const allowed = new Set(ALLOWED_ATTRS[el.name] || []); - for (const attr of Object.keys(el.attribs || {})) { + const attrKeys = Object.keys(el.attribs || {}); + for (const attr of attrKeys) { if (!allowed.has(attr)) { $(el).removeAttr(attr); } diff --git a/lib/routes/fangchan/list.tsx b/lib/routes/fangchan/list.tsx index 985149772..a240cd1a5 100644 --- a/lib/routes/fangchan/list.tsx +++ b/lib/routes/fangchan/list.tsx @@ -90,14 +90,14 @@ export const handler = async (ctx: Context): Promise => { let processedItem: DataItem = { title, description, - pubDate: pubDateStr ? timezone(parseDate(pubDateStr), +8) : item.pubDate, + pubDate: pubDateStr ? timezone(parseDate(pubDateStr), 8) : item.pubDate, id: categories, author: authors, content: { html: description, text: description, }, - updated: upDatedStr ? timezone(parseDate(upDatedStr), +8) : item.updated, + updated: upDatedStr ? timezone(parseDate(upDatedStr), 8) : item.updated, language, }; diff --git a/lib/routes/fansly/utils.tsx b/lib/routes/fansly/utils.tsx index 2a0daa5cc..3a0ca3d63 100644 --- a/lib/routes/fansly/utils.tsx +++ b/lib/routes/fansly/utils.tsx @@ -150,7 +150,7 @@ const renderTipGoal = (tipGoalId, tipGoals) => { export { baseUrl, findAccountById, getAccountByUsername, getTagId, getTagSuggestion, getTimelineByAccountId, icon, parseAttachments, parseDescription, parseMedia, renderMedia, renderPoll, renderTipGoal }; -const FanslyMedia = ({ poster, src }: { poster?: null | { location?: string }; src?: { location?: string } }) => ( +const FanslyMedia = ({ poster, src }: { poster?: { location?: string } | null; src?: { location?: string } }) => ( <> {poster && src ? (