From a28890a1354df6a6a535b02afeabc8a3a1693fed Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 27 Nov 2025 02:55:46 +0000 Subject: [PATCH] style: auto format --- lib/api/category/one.ts | 6 ++-- lib/api/follow/config.ts | 8 ++++-- lib/api/index.ts | 13 +++++---- lib/api/namespace/all.ts | 6 ++-- lib/api/namespace/one.ts | 6 ++-- lib/api/radar/rules/all.ts | 10 ++++--- lib/api/radar/rules/one.ts | 10 ++++--- lib/app-bootstrap.tsx | 28 +++++++++---------- lib/app.test.ts | 2 +- lib/config.test.ts | 2 +- lib/config.ts | 1 + lib/errors/index.test.ts | 7 +++-- lib/errors/index.tsx | 12 ++++---- lib/index.ts | 14 ++++++---- lib/middleware/access-control.test.ts | 3 +- lib/middleware/access-control.ts | 3 +- lib/middleware/anti-hotlink.test.ts | 2 +- lib/middleware/anti-hotlink.ts | 9 +++--- lib/middleware/cache.test.ts | 3 +- lib/middleware/cache.ts | 4 +-- lib/middleware/debug.test.ts | 5 ++-- lib/middleware/debug.ts | 3 +- lib/middleware/filter-engine.test.ts | 2 +- lib/middleware/header.test.ts | 2 +- lib/middleware/header.ts | 7 +++-- lib/middleware/logger.ts | 7 +++-- lib/middleware/parameter.test.ts | 2 +- lib/middleware/parameter.ts | 27 +++++++++--------- lib/middleware/sentry.ts | 7 +++-- lib/middleware/template.test.ts | 5 ++-- lib/middleware/template.tsx | 8 +++--- lib/middleware/trace.ts | 5 ++-- lib/pkg.test.ts | 1 + lib/pkg.ts | 8 ++++-- lib/registry.test.ts | 1 + lib/registry.ts | 17 +++++------ lib/routes.test.ts | 8 ++++-- lib/routes/005/index.ts | 9 +++--- lib/routes/0818tuan/index.ts | 5 ++-- lib/routes/0x80/index.ts | 4 +-- lib/routes/0xxx/index.ts | 14 +++++----- lib/routes/10000link/info.ts | 14 +++++----- lib/routes/10jqka/realtimenews.ts | 6 ++-- lib/routes/121/weather-live.ts | 12 ++++---- lib/routes/12306/index.ts | 8 +++--- lib/routes/12306/zxdt.ts | 5 ++-- lib/routes/12371/zxfb.ts | 8 +++--- lib/routes/141jav/index.ts | 7 +++-- lib/routes/141ppv/index.ts | 7 +++-- lib/routes/163/ds.ts | 4 +-- lib/routes/163/dy.ts | 3 +- lib/routes/163/dy2.ts | 6 ++-- lib/routes/163/exclusive.ts | 9 +++--- lib/routes/163/music/artist-songs.ts | 4 +-- lib/routes/163/music/artist.ts | 4 +-- lib/routes/163/music/djradio.ts | 8 +++--- lib/routes/163/music/playlist.ts | 10 +++---- lib/routes/163/music/userevents.ts | 5 ++-- lib/routes/163/music/userplaylist.ts | 4 +-- lib/routes/163/music/userplayrecords.ts | 10 +++---- lib/routes/163/news/rank.ts | 9 +++--- lib/routes/163/news/special.ts | 6 ++-- lib/routes/163/open/vip.ts | 7 +++-- lib/routes/163/renjian.ts | 7 +++-- lib/routes/163/today.ts | 7 +++-- lib/routes/163/utils.ts | 8 ++++-- lib/routes/18comic/album.ts | 8 ++++-- lib/routes/18comic/blogs.ts | 5 ++-- lib/routes/18comic/index.ts | 3 +- lib/routes/18comic/search.ts | 10 ++++--- lib/routes/18comic/utils.ts | 16 ++++++----- lib/routes/199it/index.ts | 14 +++++----- lib/routes/19lou/index.ts | 11 ++++---- lib/routes/1lou/index.ts | 6 ++-- lib/routes/1point3acres/blog.ts | 5 ++-- lib/routes/1point3acres/category.ts | 5 ++-- lib/routes/1point3acres/offer.ts | 10 +++---- lib/routes/1point3acres/section.ts | 5 ++-- lib/routes/1point3acres/thread.ts | 5 ++-- lib/routes/1point3acres/user/post.ts | 2 +- lib/routes/1point3acres/user/thread.ts | 2 +- lib/routes/1point3acres/utils.ts | 12 ++++---- lib/routes/1x/index.ts | 11 ++++---- lib/routes/2023game/index.ts | 7 +++-- lib/routes/2048/index.ts | 9 +++--- lib/routes/21caijing/channel.ts | 5 ++-- lib/routes/2cycd/index.ts | 7 +++-- lib/routes/30secondsofcode/category.ts | 5 +++- lib/routes/30secondsofcode/new-and-popular.ts | 6 ++-- lib/routes/30secondsofcode/utils.ts | 5 ++-- lib/routes/36kr/hot-list.ts | 6 ++-- lib/routes/36kr/index.ts | 11 ++++---- lib/routes/36kr/utils.ts | 5 ++-- lib/routes/3dmgame/game.ts | 6 ++-- lib/routes/3dmgame/news-center.ts | 6 ++-- lib/routes/3dmgame/utils.ts | 3 +- lib/routes/3kns/index.ts | 10 ++++--- lib/routes/423down/index.ts | 7 +++-- lib/routes/4gamers/category.ts | 5 ++-- lib/routes/4gamers/tag.ts | 5 ++-- lib/routes/4gamers/topic.ts | 5 ++-- lib/routes/4gamers/utils.ts | 9 +++--- lib/routes/4khd/article.ts | 4 ++- lib/routes/4khd/category.ts | 7 +++-- lib/routes/4khd/latest.ts | 7 +++-- lib/routes/4ksj/forum.ts | 13 +++++---- lib/routes/4kup/article.ts | 4 ++- lib/routes/4kup/category.ts | 7 +++-- lib/routes/4kup/latest.ts | 7 +++-- lib/routes/4kup/popular.ts | 10 ++++--- lib/routes/4kup/tag.ts | 7 +++-- lib/routes/500px/tribe-set.ts | 5 ++-- lib/routes/500px/utils.ts | 7 +++-- lib/routes/50forum/zhuanjia.ts | 5 ++-- lib/routes/51cto/recommend.ts | 12 ++++---- lib/routes/51cto/utils.ts | 2 +- lib/routes/51read/article.ts | 3 +- lib/routes/52hrtt/index.ts | 7 +++-- lib/routes/52hrtt/symposium.ts | 7 +++-- lib/routes/56kog/class.ts | 5 ++-- lib/routes/56kog/top.ts | 5 ++-- lib/routes/56kog/util.ts | 10 ++++--- lib/routes/591/list.ts | 7 ++--- lib/routes/5eplay/index.ts | 5 ++-- lib/routes/5music/index.ts | 5 ++-- lib/routes/69shu/article.ts | 3 +- lib/routes/6park/index.ts | 7 +++-- lib/routes/6park/news.ts | 7 +++-- lib/routes/6v123/index.ts | 13 ++++----- lib/routes/6v123/latest-movies.ts | 3 +- lib/routes/6v123/latest-tvseries.ts | 3 +- lib/routes/6v123/utils.ts | 7 +++-- lib/routes/78dm/index.ts | 9 +++--- lib/routes/7mmtv/index.ts | 7 +++-- lib/routes/81/81rc/index.ts | 6 ++-- lib/routes/8264/list.ts | 11 ++++---- lib/routes/8kcos/article.ts | 1 + lib/routes/8kcos/cat.ts | 9 ++++-- lib/routes/8kcos/latest.ts | 9 ++++-- lib/routes/8kcos/tag.ts | 9 ++++-- lib/routes/8world/index.ts | 9 +++--- lib/routes/91porn/author.ts | 8 ++++-- lib/routes/91porn/index.ts | 8 ++++-- lib/routes/91porn/utils.ts | 1 + lib/routes/95mm/category.ts | 5 ++-- lib/routes/95mm/tab.ts | 5 ++-- lib/routes/95mm/tag.ts | 5 ++-- lib/routes/95mm/utils.ts | 8 ++++-- lib/routes/9to5/subsite.ts | 3 +- lib/routes/a9vg/index.ts | 9 +++--- lib/routes/aa1/60s.ts | 9 +++--- lib/routes/aamacau/index.ts | 5 ++-- lib/routes/abc/index.ts | 7 +++-- lib/routes/abmedia/category.ts | 2 +- lib/routes/abmedia/index.ts | 2 +- lib/routes/abskoop/index.ts | 5 ++-- lib/routes/abskoop/nsfw.ts | 2 +- lib/routes/academia/topics.ts | 5 ++-- lib/routes/accessbriefing/index.ts | 7 +++-- lib/routes/acfun/article.ts | 8 ++++-- lib/routes/acfun/bangumi.ts | 3 +- lib/routes/acfun/video.ts | 6 ++-- lib/routes/acg17/post.ts | 2 +- lib/routes/acgvinyl/news.ts | 5 ++-- lib/routes/acpaa/index.ts | 7 +++-- lib/routes/acs/journal.ts | 13 +++++---- lib/routes/adquan/case-library.ts | 14 +++++----- lib/routes/adquan/index.ts | 14 +++++----- lib/routes/aeaweb/index.ts | 7 +++-- lib/routes/aeon/category.ts | 5 ++-- lib/routes/aeon/type.ts | 5 ++-- lib/routes/aeon/utils.ts | 10 ++++--- lib/routes/afdian/dynamic.ts | 2 +- lib/routes/aflcio/blog.ts | 9 +++--- lib/routes/afr/latest.ts | 3 +- lib/routes/afr/navigation.ts | 3 +- lib/routes/afr/utils.ts | 1 + lib/routes/agefans/detail.ts | 6 ++-- lib/routes/agefans/update.ts | 8 ++++-- lib/routes/agirls/topic-list.ts | 6 ++-- lib/routes/agirls/topic.ts | 6 ++-- lib/routes/agirls/utils.ts | 3 +- lib/routes/agirls/z-index.ts | 6 ++-- lib/routes/agora0/index.ts | 5 ++-- lib/routes/agora0/pen0.ts | 5 ++-- lib/routes/agri/index.ts | 9 +++--- lib/routes/ahjzu/news.ts | 7 +++-- lib/routes/aiaa/journal.ts | 5 ++-- lib/routes/aibase/daily.ts | 10 ++++--- lib/routes/aibase/discover.ts | 8 +++--- lib/routes/aibase/news.ts | 8 ++++-- lib/routes/aibase/topic.ts | 8 +++--- lib/routes/aibase/util.ts | 10 ++++--- lib/routes/aiblog-2xv/archives.ts | 5 ++-- lib/routes/aicaijing/index.ts | 4 +-- lib/routes/aiea/index.ts | 2 +- lib/routes/aijishu/index.ts | 8 ++++-- lib/routes/aijishu/utils.ts | 5 ++-- lib/routes/ainvest/article.ts | 5 ++-- lib/routes/ainvest/news.ts | 6 ++-- lib/routes/ainvest/utils.ts | 5 ++-- lib/routes/aip/journal-pupp.ts | 10 ++++--- lib/routes/aip/journal.ts | 6 ++-- lib/routes/aip/utils.ts | 1 + lib/routes/air-level/index.ts | 5 ++-- lib/routes/air-level/levelrank.ts | 5 ++-- lib/routes/airchina/index.ts | 8 ++++-- lib/routes/aisixiang/column.ts | 9 +++--- lib/routes/aisixiang/thinktank.ts | 9 +++--- lib/routes/aisixiang/toplist.ts | 7 +++-- lib/routes/aisixiang/utils.ts | 7 +++-- lib/routes/aisixiang/zhuanti.ts | 9 +++--- lib/routes/ajcass/shxyj.ts | 5 ++-- lib/routes/ajmide/index.ts | 3 +- lib/routes/ali213/news.ts | 7 ++--- lib/routes/ali213/zl.ts | 7 ++--- lib/routes/alicesoft/infomation.ts | 7 +++-- lib/routes/alipan/files.ts | 5 ++-- lib/routes/aliresearch/information.ts | 4 +-- lib/routes/alistapart/index.ts | 3 +- lib/routes/alistapart/topic.ts | 3 +- lib/routes/aliyun/database-month.ts | 5 ++-- lib/routes/aliyun/developer/group.ts | 5 ++-- lib/routes/aliyun/notice.ts | 5 ++-- lib/routes/aljazeera/index.ts | 13 +++++---- lib/routes/ally/rail.ts | 5 ++-- lib/routes/alpinelinux/pkgs.ts | 7 +++-- lib/routes/alternativeto/platform.ts | 8 ++++-- lib/routes/alternativeto/software.ts | 8 ++++-- lib/routes/altotrain/news.ts | 14 ++++++---- lib/routes/amazfitwatchfaces/index.ts | 14 +++++----- lib/routes/amazon/awsblogs.ts | 2 +- lib/routes/amazon/kindle-software-updates.ts | 8 ++++-- lib/routes/amz123/kx.ts | 3 +- lib/routes/android/platform-tools-releases.ts | 5 ++-- lib/routes/android/security-bulletin.ts | 6 ++-- lib/routes/anime1/anime.ts | 7 +++-- lib/routes/anime1/search.ts | 7 +++-- lib/routes/annualreviews/index.ts | 5 ++-- lib/routes/anquanke/category.ts | 5 ++-- lib/routes/anquanke/vul.ts | 3 +- lib/routes/anthropic/engineering.ts | 7 +++-- lib/routes/anthropic/news.ts | 7 +++-- lib/routes/anthropic/research.ts | 7 +++-- lib/routes/anytxt/release-notes.ts | 11 ++++---- lib/routes/apache/apisix/blog.ts | 5 ++-- lib/routes/apiseven/blog.ts | 7 +++-- lib/routes/apkpure/versions.ts | 3 +- lib/routes/apnews/mobile-api.ts | 7 +++-- lib/routes/apnews/rss.ts | 5 +++- lib/routes/apnews/sitemap.ts | 12 +++++--- lib/routes/apnews/topics.ts | 10 +++++-- lib/routes/apnews/utils.ts | 3 +- lib/routes/apnic/index.ts | 4 +-- lib/routes/app-center/release.ts | 7 +++-- lib/routes/app-sales/index.ts | 7 ++--- lib/routes/app-sales/mostwanted.ts | 7 ++--- lib/routes/app-sales/util.ts | 14 +++++----- lib/routes/apple/apps.ts | 4 ++- lib/routes/apple/design.ts | 9 +++--- lib/routes/apple/exchange-repair.ts | 6 ++-- lib/routes/apple/podcast.ts | 9 +++--- lib/routes/apple/security-releases.ts | 14 +++++----- lib/routes/apple/utils.ts | 5 ++-- lib/routes/appleinsider/index.ts | 5 ++-- lib/routes/appstare/comments.ts | 2 +- lib/routes/appstore/in-app-purchase.ts | 5 ++-- lib/routes/appstore/price.ts | 6 ++-- lib/routes/appstore/xianmian.ts | 2 +- lib/routes/appstorrent/programs.ts | 17 ++++++----- lib/routes/aqara/community.ts | 2 +- lib/routes/aqara/news.ts | 5 ++-- lib/routes/aqara/post.ts | 7 +++-- lib/routes/aqara/region.ts | 3 +- lib/routes/aqicn/aqi.ts | 2 +- lib/routes/arcteryx/new-arrivals.ts | 5 ++-- lib/routes/arcteryx/outlet.ts | 5 ++-- lib/routes/arcteryx/regear-new-arrivals.ts | 11 ++++---- lib/routes/artstation/user.ts | 6 ++-- lib/routes/asiafruitchina/categories.ts | 14 +++++----- lib/routes/asiafruitchina/news.ts | 14 +++++----- lib/routes/asianfanfics/tag.ts | 4 +-- lib/routes/asianfanfics/text-search.ts | 5 ++-- lib/routes/asiantolick/index.ts | 7 +++-- lib/routes/asmr-200/index.ts | 7 +++-- lib/routes/asus/bios.ts | 6 ++-- lib/routes/asus/gpu-tweak.ts | 6 ++-- lib/routes/atcoder/contest.ts | 5 ++-- lib/routes/atcoder/post.ts | 7 +++-- lib/routes/atptour/news.ts | 6 ++-- lib/routes/augmentcode/blog.ts | 14 +++++----- lib/routes/auto-stats/index.ts | 9 +++--- lib/routes/autocentre/index.ts | 2 +- lib/routes/azul/packages.ts | 7 ++--- lib/routes/baai/events.ts | 4 +-- lib/routes/baai/hub.ts | 9 +++--- lib/routes/baai/utils.ts | 7 +++-- lib/routes/backlinko/blog.ts | 5 ++-- lib/routes/bad/index.ts | 7 +++-- lib/routes/baidu/gushitong/index.ts | 5 ++-- lib/routes/baidu/search.ts | 10 ++++--- lib/routes/baidu/tieba/forum.ts | 7 +++-- lib/routes/baidu/tieba/post.ts | 7 +++-- lib/routes/baidu/tieba/search.ts | 9 +++--- lib/routes/baidu/tieba/user.ts | 5 ++-- lib/routes/baidu/top.ts | 11 ++++---- lib/routes/baijing/index.ts | 7 +++-- lib/routes/bakamh/manga.ts | 5 ++-- lib/routes/bandcamp/live.ts | 5 ++-- lib/routes/bandcamp/tag.ts | 5 ++-- lib/routes/bandcamp/weekly.ts | 4 +-- lib/routes/bandisoft/history.ts | 11 ++++---- lib/routes/bangumi.moe/index.ts | 4 +-- lib/routes/bangumi.online/online.ts | 10 +++---- lib/routes/bangumi.tv/calendar/_base.ts | 2 +- lib/routes/bangumi.tv/calendar/today.ts | 11 ++++---- lib/routes/bangumi.tv/group/reply.ts | 5 ++-- lib/routes/bangumi.tv/group/topic.ts | 6 ++-- lib/routes/bangumi.tv/other/followrank.ts | 3 +- lib/routes/bangumi.tv/person/index.ts | 5 ++-- lib/routes/bangumi.tv/subject/comments.ts | 3 +- lib/routes/bangumi.tv/subject/ep.ts | 4 ++- lib/routes/bangumi.tv/subject/index.ts | 11 ++++---- .../bangumi.tv/subject/offcial-subject-api.ts | 1 + lib/routes/bangumi.tv/user/blog.ts | 5 ++-- lib/routes/bangumi.tv/user/collections.ts | 13 +++++---- lib/routes/banshujiang/index.ts | 14 +++++----- lib/routes/banyuetan/index.ts | 14 +++++----- lib/routes/baobua/article.ts | 1 + lib/routes/baobua/category.ts | 8 ++++-- lib/routes/baobua/latest.ts | 8 ++++-- lib/routes/baobua/search.ts | 8 ++++-- lib/routes/baoyu/index.ts | 7 +++-- lib/routes/baozimh/index.ts | 7 +++-- lib/routes/barronschina/index.ts | 7 +++-- lib/routes/baselang/index.ts | 9 +++--- lib/routes/bast/index.ts | 11 ++++---- lib/routes/bbc/index.ts | 11 +++++--- lib/routes/bbc/learningenglish.ts | 5 ++-- lib/routes/bbcnewslabs/news.ts | 5 ++-- lib/routes/bc3ts/list.ts | 9 +++--- lib/routes/bdys/index.ts | 17 +++++------ lib/routes/behance/user.ts | 9 ++++-- lib/routes/beijingprice/index.ts | 4 +-- lib/routes/bellroy/new-releases.ts | 2 +- lib/routes/bendibao/news.ts | 9 +++--- lib/routes/bestblogs/feeds.ts | 2 +- lib/routes/bestofjs/monthly.ts | 7 +++-- lib/routes/bfl/announcements.ts | 7 +++-- lib/routes/bgmlist/onair.ts | 6 ++-- lib/routes/bigquant/collections.ts | 7 +++-- lib/routes/bilibili/app.ts | 2 +- lib/routes/bilibili/article.ts | 10 ++++--- lib/routes/bilibili/audio.ts | 2 +- lib/routes/bilibili/bangumi.ts | 6 ++-- lib/routes/bilibili/bilibili-recommend.ts | 3 +- lib/routes/bilibili/cache.ts | 14 ++++++---- lib/routes/bilibili/check-cookie.ts | 5 ++-- lib/routes/bilibili/coin.ts | 5 ++-- lib/routes/bilibili/danmaku.ts | 11 +++++--- lib/routes/bilibili/dynamic.ts | 21 ++++++++------ lib/routes/bilibili/fav.ts | 9 +++--- lib/routes/bilibili/followers.ts | 7 +++-- lib/routes/bilibili/followings-article.ts | 7 +++-- lib/routes/bilibili/followings-dynamic.ts | 17 ++++++----- lib/routes/bilibili/followings-video.ts | 9 +++--- lib/routes/bilibili/followings.ts | 7 +++-- lib/routes/bilibili/hot-search.ts | 3 +- lib/routes/bilibili/like.ts | 5 ++-- lib/routes/bilibili/link-news.ts | 2 +- lib/routes/bilibili/live-area.ts | 2 +- lib/routes/bilibili/live-room.ts | 8 ++++-- lib/routes/bilibili/live-search.ts | 5 ++-- lib/routes/bilibili/mall-ip.ts | 2 +- lib/routes/bilibili/mall-new.ts | 2 +- lib/routes/bilibili/manga-followings.ts | 7 +++-- lib/routes/bilibili/manga-update.ts | 2 +- lib/routes/bilibili/page.ts | 3 +- lib/routes/bilibili/partion-ranking.ts | 4 ++- lib/routes/bilibili/partion.ts | 3 +- lib/routes/bilibili/platform.ts | 4 +-- lib/routes/bilibili/popular.ts | 3 +- lib/routes/bilibili/ranking.ts | 10 ++++--- lib/routes/bilibili/readlist.ts | 3 +- lib/routes/bilibili/reply.ts | 3 +- lib/routes/bilibili/user-bangumi.ts | 3 +- lib/routes/bilibili/user-channel.ts | 3 +- lib/routes/bilibili/user-collection.ts | 7 +++-- lib/routes/bilibili/user-fav.ts | 5 ++-- lib/routes/bilibili/utils.ts | 9 ++++-- lib/routes/bilibili/video-all.ts | 5 ++-- lib/routes/bilibili/video.ts | 9 ++++-- lib/routes/bilibili/vsearch.ts | 5 ++-- lib/routes/bilibili/watchlater.ts | 11 ++++---- lib/routes/bilibili/weekly-recommend.ts | 9 +++--- lib/routes/binance/announcement.ts | 9 ++++-- lib/routes/binance/launchpool.ts | 5 ++-- lib/routes/bing/daily-wallpaper.ts | 2 +- lib/routes/bing/search.ts | 11 +++++--- lib/routes/biodiscover/index.ts | 5 ++-- lib/routes/bioone/featured.ts | 5 ++-- lib/routes/bioone/journal.ts | 5 ++-- lib/routes/biquge/index.ts | 14 ++++++---- lib/routes/bit/cs/cs.ts | 6 ++-- lib/routes/bit/cs/utils.ts | 3 +- lib/routes/bit/jwc/jwc.ts | 6 ++-- lib/routes/bit/jwc/utils.ts | 3 +- lib/routes/bit/rszhaopin.ts | 2 +- lib/routes/bit/yjs.ts | 5 ++-- lib/routes/bitbucket/commits.ts | 7 +++-- lib/routes/bitbucket/tags.ts | 7 +++-- lib/routes/bitget/announcement.ts | 13 +++++---- lib/routes/bitmovin/blog.ts | 2 +- lib/routes/bjfu/grs.ts | 5 ++-- lib/routes/bjfu/it/index.ts | 8 ++++-- lib/routes/bjfu/it/utils.ts | 3 +- lib/routes/bjfu/jwc/index.ts | 6 ++-- lib/routes/bjfu/jwc/utils.ts | 3 +- lib/routes/bjfu/kjc.ts | 5 ++-- lib/routes/bjfu/news/index.ts | 8 ++++-- lib/routes/bjfu/news/utils.ts | 3 +- lib/routes/bjnews/cat.ts | 5 ++-- lib/routes/bjnews/column.ts | 2 +- lib/routes/bjnews/utils.ts | 5 ++-- lib/routes/bjp/apod.ts | 6 ++-- lib/routes/bjsk/index.ts | 5 ++-- lib/routes/bjsk/keti.ts | 5 ++-- lib/routes/bjtu/gs.ts | 5 ++-- lib/routes/bjtu/namespace.ts | 1 + lib/routes/bjwxdxh/index.ts | 7 +++-- lib/routes/bjx/fd.ts | 7 +++-- lib/routes/bjx/huanbao.ts | 7 +++-- lib/routes/bjx/types.ts | 5 ++-- lib/routes/blizzard/news-cn.ts | 3 +- lib/routes/blizzard/news.ts | 5 ++-- lib/routes/blockworks/index.ts | 9 +++--- lib/routes/blogread/index.ts | 5 ++-- lib/routes/bloomberg/authors.ts | 7 +++-- lib/routes/bloomberg/index.ts | 8 ++++-- lib/routes/bloomberg/utils.ts | 9 +++--- lib/routes/bluestacks/release.ts | 5 ++-- lib/routes/bmkg/earthquake.ts | 5 ++-- lib/routes/bmkg/news.ts | 5 ++-- lib/routes/bnext/index.ts | 5 ++-- lib/routes/bnu/bs.ts | 5 ++-- lib/routes/bnu/dwxgb.ts | 5 ++-- lib/routes/bnu/fdy.ts | 5 ++-- lib/routes/bnu/fe.ts | 7 +++-- lib/routes/bnu/jwb.ts | 7 +++-- lib/routes/bnu/lib.ts | 5 ++-- lib/routes/bnu/mba.ts | 4 +-- lib/routes/boc/whpj.ts | 5 ++-- lib/routes/bookfere/category.ts | 6 ++-- lib/routes/bookwalker/search.ts | 12 ++++---- lib/routes/booru/mmda.ts | 17 +++++------ lib/routes/bossdesign/index.ts | 2 +- lib/routes/brave/latest.ts | 5 ++-- lib/routes/brooklynmuseum/exhibitions.ts | 2 +- lib/routes/bse/index.ts | 4 +-- lib/routes/bsky/feeds.ts | 8 ++++-- lib/routes/bsky/keyword.ts | 2 +- lib/routes/bsky/posts.ts | 14 ++++++---- lib/routes/bsky/utils.ts | 4 +-- lib/routes/bt0/mv.ts | 3 +- lib/routes/bt0/tlist.ts | 5 ++-- lib/routes/bt0/util.ts | 2 ++ lib/routes/btzj/index.ts | 18 ++++++------ lib/routes/buaa/jiaowu.ts | 7 +++-- lib/routes/buaa/lib/space/newbook.ts | 12 ++++---- lib/routes/buaa/news/index.ts | 7 +++-- lib/routes/buaa/sme.ts | 5 ++-- lib/routes/buct/cist.ts | 5 ++-- lib/routes/buct/gr.ts | 7 +++-- lib/routes/buct/jwc.ts | 5 ++-- lib/routes/bugzilla/bug.ts | 5 ++-- lib/routes/bulianglin/rss.ts | 7 +++-- lib/routes/bullionvault/gold-news.ts | 9 +++--- lib/routes/bupt/jwc.ts | 9 +++--- lib/routes/bupt/rczp.ts | 7 +++-- lib/routes/bupt/scss.ts | 7 +++-- lib/routes/byau/xinwen/index.ts | 5 ++-- lib/routes/byteclicks/index.ts | 4 ++- lib/routes/byteclicks/tag.ts | 4 ++- lib/routes/bytes/bytes.ts | 8 ++++-- lib/routes/c114/roll.ts | 8 +++--- lib/routes/caai/index.ts | 10 ++++--- lib/routes/caai/utils.ts | 8 ++++-- lib/routes/caam/index.ts | 5 ++-- lib/routes/caareviews/book.ts | 5 ++-- lib/routes/caareviews/essay.ts | 5 ++-- lib/routes/caareviews/exhibition.ts | 5 ++-- lib/routes/caareviews/utils.ts | 8 ++++-- lib/routes/cags/edu/index.ts | 2 +- lib/routes/cahkms/index.ts | 6 ++-- lib/routes/caijing/roll.ts | 5 ++-- lib/routes/caixin/article.ts | 3 +- lib/routes/caixin/blog.ts | 10 ++++--- lib/routes/caixin/category.ts | 10 ++++--- lib/routes/caixin/database.ts | 9 +++--- lib/routes/caixin/k.ts | 2 +- lib/routes/caixin/latest.ts | 7 +++-- lib/routes/caixin/utils-fulltext.ts | 4 ++- lib/routes/caixin/utils.ts | 8 ++++-- lib/routes/caixin/weekly.ts | 5 ++-- lib/routes/caixinglobal/latest.ts | 5 ++-- lib/routes/camchina/index.ts | 5 ++-- lib/routes/cankaoxiaoxi/index.ts | 6 ++-- lib/routes/capitalmind/insights.ts | 3 +- lib/routes/capitalmind/podcasts.ts | 3 +- lib/routes/capitalmind/utils.ts | 5 ++-- lib/routes/cara/likes.ts | 10 ++++--- lib/routes/cara/portfolio.ts | 5 ++-- lib/routes/cara/timeline.ts | 10 ++++--- lib/routes/cara/utils.ts | 16 ++++++----- lib/routes/cartoonmad/comic.ts | 15 +++++----- lib/routes/cas/cg/index.ts | 5 ++-- lib/routes/cas/genetics/index.ts | 5 ++-- lib/routes/cas/ia/yjs.ts | 5 ++-- lib/routes/cas/iee/kydt.ts | 5 ++-- lib/routes/cas/is/index.ts | 5 ++-- lib/routes/cas/mesalab/kb.ts | 5 ++-- lib/routes/cas/sim/kyjz.ts | 5 ++-- lib/routes/casssp/news.ts | 5 ++-- lib/routes/cast/index.ts | 6 ++-- lib/routes/catti/news.ts | 5 ++-- lib/routes/cau/ele.ts | 5 ++-- lib/routes/cau/yjs.ts | 5 ++-- lib/routes/caus/index.ts | 2 +- lib/routes/cbaigui/index.ts | 17 +++++------ lib/routes/cbaigui/utils.ts | 2 +- lib/routes/cbc/topics.ts | 5 ++-- lib/routes/cbirc/index.ts | 2 +- lib/routes/cbndata/information.ts | 14 +++++----- lib/routes/cbnweek/index.ts | 2 +- lib/routes/cbpanet/index.ts | 6 ++-- lib/routes/ccac/news.ts | 12 ++++---- lib/routes/ccagm/index.ts | 9 +++--- lib/routes/cccfna/index.ts | 7 +++-- lib/routes/cccmc/index.ts | 9 +++--- lib/routes/ccf/ccfcv/index.ts | 7 +++-- lib/routes/ccf/news.ts | 5 ++-- lib/routes/ccf/tfbd/index.ts | 10 ++++--- lib/routes/ccf/tfbd/utils.ts | 8 ++++-- lib/routes/ccfa/index.ts | 7 +++-- lib/routes/ccg/index.ts | 14 +++++----- lib/routes/ccnu/career.ts | 5 ++-- lib/routes/ccnu/cs.ts | 5 ++-- lib/routes/ccnu/wu.ts | 5 ++-- lib/routes/ccnu/yjs.ts | 5 ++-- lib/routes/ccreports/index.ts | 5 ++-- lib/routes/cctv/category.ts | 5 ++-- lib/routes/cctv/jx.ts | 5 ++-- lib/routes/cctv/lm.ts | 7 +++-- lib/routes/cctv/utils/news.ts | 5 ++-- lib/routes/cctv/utils/xinwen1j1.ts | 3 +- lib/routes/cctv/xwlb.ts | 10 ++++--- lib/routes/cde/index.ts | 10 ++++--- lib/routes/cde/xxgk.ts | 5 ++-- lib/routes/cde/zdyz.ts | 6 ++-- lib/routes/cdi/index.ts | 7 +++-- lib/routes/cdu/cdrw.ts | 5 ++-- lib/routes/cdu/jwgg.ts | 5 ++-- lib/routes/cdu/tzggcdunews.ts | 5 ++-- lib/routes/cdzjryb/project-list.ts | 9 +++--- lib/routes/ce/district.ts | 8 ++++-- lib/routes/cebbank/all.ts | 13 +++++---- lib/routes/cebbank/history.ts | 10 ++++--- lib/routes/ceph/blog.ts | 7 +++-- lib/routes/cfachina/analygarden.ts | 5 ++-- lib/routes/cffex/announcement.ts | 7 +++-- lib/routes/cfmmc/index.ts | 7 +++-- lib/routes/cfr/index.ts | 10 ++++--- lib/routes/cfr/namespace.ts | 2 +- lib/routes/cfr/utils.ts | 6 ++-- lib/routes/cgtn/podcast.ts | 4 +-- lib/routes/chaincatcher/home.ts | 7 +++-- lib/routes/chaincatcher/news.ts | 5 ++-- lib/routes/changba/user.ts | 9 ++++-- lib/routes/chaoxing/qk.ts | 7 +++-- lib/routes/chaping/banner.ts | 2 +- lib/routes/chaping/news.ts | 2 +- lib/routes/chaping/newsflash.ts | 2 +- lib/routes/cherrytimes/market.ts | 5 ++-- lib/routes/chiculture/topic.ts | 7 +++-- lib/routes/chikubi/category.ts | 3 +- lib/routes/chikubi/index.ts | 3 +- lib/routes/chikubi/navigation.ts | 5 ++-- lib/routes/chikubi/nipple-video-category.ts | 5 ++-- lib/routes/chikubi/nipple-video-maker.ts | 5 ++-- lib/routes/chikubi/search.ts | 5 ++-- lib/routes/chikubi/tag.ts | 3 +- lib/routes/chikubi/utils.ts | 5 ++-- lib/routes/china/finance/finance.ts | 5 ++-- lib/routes/china/news/highlights/news.ts | 3 +- lib/routes/china/news/military/news.ts | 3 +- lib/routes/chinacdc/index.ts | 7 ++--- lib/routes/chinadaily/language.ts | 14 +++++----- lib/routes/chinadegrees/province.ts | 14 ++++++---- lib/routes/chinafactcheck/index.ts | 8 ++++-- lib/routes/chinafactcheck/utils.ts | 3 +- lib/routes/chinaisa/index.ts | 5 ++-- lib/routes/chinamoney/notice.ts | 6 ++-- lib/routes/chinanews/index.ts | 7 +++-- lib/routes/chinania/index.ts | 4 +-- lib/routes/chinaratings/credit-research.ts | 9 +++--- lib/routes/chinathinktanks/viewpoint.ts | 7 +++-- lib/routes/chinatimes/index.ts | 13 +++++---- lib/routes/chinaventure/index.ts | 5 ++-- lib/routes/chinawriter/index.ts | 7 +++-- lib/routes/chiphell/portal.ts | 4 +-- lib/routes/chlinlearn/daily-blog.ts | 5 ++-- lib/routes/chnmuseum/xingnew.ts | 7 +++-- lib/routes/chnmuseum/xwzt.ts | 5 ++-- lib/routes/chocolatey/packages.ts | 11 ++++---- lib/routes/chongbuluo/index.ts | 7 +++-- lib/routes/chongdiantou/index.ts | 8 ++++-- lib/routes/chsi/hotnews.ts | 5 ++-- lib/routes/chsi/kydt.ts | 7 +++-- lib/routes/chsi/kyzx.ts | 7 +++-- lib/routes/chuanliu/nice.ts | 10 ++++--- lib/routes/chuapp/chuapp.ts | 7 +++-- lib/routes/chub/characters.ts | 2 +- lib/routes/cib/whpj.ts | 12 ++++---- lib/routes/cih-index/report.ts | 5 ++-- lib/routes/ciidbnu/index.ts | 7 +++-- lib/routes/cisia/index.ts | 4 +-- lib/routes/civitai/discussions.ts | 7 +++-- lib/routes/civitai/models.ts | 2 +- lib/routes/civitai/user.ts | 2 +- lib/routes/ciweimao/chapter.ts | 5 ++-- lib/routes/cjlu/yjsy/index.ts | 9 +++--- lib/routes/clickme/index.ts | 5 ++-- lib/routes/cline/blog.ts | 5 ++-- lib/routes/cloudflarestatus/index.ts | 14 +++++----- lib/routes/cloudnative/blog.ts | 5 ++-- lib/routes/cls/depth.ts | 17 +++++------ lib/routes/cls/hot.ts | 17 +++++------ lib/routes/cls/subject.ts | 17 +++++------ lib/routes/cls/telegraph.ts | 6 ++-- lib/routes/cls/utils.ts | 2 +- lib/routes/cma/channel.ts | 9 +++--- lib/routes/cmde/index.ts | 7 +++-- lib/routes/cmpxchg8b/articles.ts | 5 ++-- lib/routes/cmu/andypavlo/blog.ts | 5 ++-- lib/routes/cn-healthcare/index.ts | 2 +- lib/routes/cna/index.ts | 3 +- lib/routes/cna/utils.ts | 3 +- lib/routes/cna/web/index.ts | 6 ++-- lib/routes/cnbc/rss.ts | 5 ++-- lib/routes/cnbeta/category.ts | 3 +- lib/routes/cnbeta/common.ts | 7 +++-- lib/routes/cnbeta/index.ts | 3 +- lib/routes/cnbeta/topics.ts | 3 +- lib/routes/cnbeta/utils.ts | 7 +++-- lib/routes/cnblogs/common.ts | 5 ++-- lib/routes/cncf/index.ts | 5 ++-- lib/routes/cncf/reports.ts | 5 ++-- lib/routes/cneb/yjxw.ts | 7 +++-- lib/routes/cneb/yjxx.ts | 4 +-- lib/routes/cngal/entry.ts | 8 +++--- lib/routes/cngal/weekly.ts | 9 +++--- lib/routes/cngold/index.ts | 4 +-- lib/routes/cnjxol/index.ts | 9 +++--- lib/routes/cnki/author.ts | 6 ++-- lib/routes/cnki/debut.ts | 7 +++-- lib/routes/cnki/journals.ts | 12 ++++---- lib/routes/cnki/utils.ts | 8 ++++-- lib/routes/cnljxh/index.ts | 9 +++--- lib/routes/cntheory/paper.ts | 7 +++-- lib/routes/cntv/column.ts | 8 +++--- lib/routes/cnu/iec.ts | 5 ++-- lib/routes/cnu/jdxw.ts | 5 ++-- lib/routes/cnu/jwc.ts | 5 ++-- lib/routes/cnu/physics.ts | 5 ++-- lib/routes/cnu/smkxxy.ts | 5 ++-- lib/routes/cockroachlabs/blog.ts | 5 ++-- lib/routes/codeforces/contests.ts | 11 ++++---- lib/routes/codeforces/recent-actions.ts | 5 ++-- lib/routes/cognition/blog.ts | 3 +- lib/routes/cohere/index.ts | 2 +- lib/routes/coindesk/consensus-magazine.ts | 9 ++++-- lib/routes/coindesk/news.ts | 3 +- lib/routes/coindesk/utils.ts | 3 +- lib/routes/cointelegraph/index.ts | 7 +++-- lib/routes/colamanga/manga.ts | 12 ++++---- lib/routes/collabo-cafe/category.ts | 8 ++++-- lib/routes/collabo-cafe/index.ts | 6 ++-- lib/routes/collabo-cafe/parser.ts | 3 +- lib/routes/collabo-cafe/tag.ts | 8 ++++-- lib/routes/comicat/search.ts | 5 ++-- lib/routes/comicskingdom/index.ts | 9 +++--- lib/routes/commonhealth/index.ts | 5 ++-- lib/routes/consumer/index.ts | 5 ++-- lib/routes/consumer/shopping-guide.ts | 5 ++-- lib/routes/cool18/index.ts | 7 +++-- lib/routes/coolapk/dyh.ts | 7 +++-- lib/routes/coolapk/hot.ts | 4 ++- lib/routes/coolapk/huati.ts | 7 +++-- lib/routes/coolapk/toutiao.ts | 3 +- lib/routes/coolapk/tuwen.ts | 3 +- lib/routes/coolapk/user-dynamic.ts | 7 +++-- lib/routes/coolapk/utils.ts | 5 ++-- lib/routes/coolbuy/index.ts | 10 +++---- lib/routes/coolidge/film-guide.ts | 6 ++-- lib/routes/coolidge/news.ts | 6 ++-- lib/routes/coolpc/news.ts | 5 ++-- lib/routes/coomer/index.ts | 7 +++-- lib/routes/copymanga/comic.ts | 11 ++++---- lib/routes/cosplaytele/article.ts | 1 + lib/routes/cosplaytele/category.ts | 8 ++++-- lib/routes/cosplaytele/latest.ts | 8 ++++-- lib/routes/cosplaytele/popular.ts | 8 ++++-- lib/routes/cosplaytele/tag.ts | 8 ++++-- lib/routes/counter-strike/news.ts | 10 +++---- lib/routes/cpcaauto/index.ts | 6 ++-- lib/routes/cpcey/index.ts | 5 ++-- lib/routes/cpta/handler.ts | 7 +++-- lib/routes/cpuid/news.ts | 6 ++-- lib/routes/cqgas/tqtz.ts | 6 ++-- lib/routes/cqu/index.ts | 7 +++-- lib/routes/cqwu/index.ts | 5 ++-- lib/routes/crac/exam.ts | 5 ++-- lib/routes/crac/index.ts | 5 ++-- lib/routes/creative-comic/book.ts | 7 +++-- lib/routes/creative-comic/utils.ts | 5 ++-- lib/routes/crossbell/feeds/following.ts | 2 +- lib/routes/crossbell/notes/character.ts | 3 +- lib/routes/crossbell/notes/index.ts | 3 +- lib/routes/crossbell/notes/source.ts | 3 +- lib/routes/crush/index.ts | 5 ++-- lib/routes/cryptoslate/index.ts | 9 +++--- lib/routes/cs/index.ts | 9 +++--- lib/routes/cs/video.ts | 7 +++-- lib/routes/cs/zzkx.ts | 3 +- lib/routes/csdn/blog.ts | 5 ++-- lib/routes/css-tricks/articles.ts | 6 +++- lib/routes/css-tricks/collections.ts | 5 +++- lib/routes/css-tricks/popular.ts | 5 +++- lib/routes/css-tricks/utils.ts | 3 +- lib/routes/cssn/iolaw.ts | 5 ++-- lib/routes/cste/index.ts | 5 ++-- lib/routes/csu/career.ts | 6 ++-- lib/routes/csu/cse.ts | 5 ++-- lib/routes/csu/mail.ts | 5 ++-- lib/routes/csust/tggs.ts | 3 +- lib/routes/csust/utils.ts | 5 ++-- lib/routes/csust/xkxs.ts | 3 +- lib/routes/ctbu/xxgg.ts | 6 ++-- lib/routes/ctinews/topic.ts | 7 +++-- lib/routes/cts/news.ts | 7 +++-- lib/routes/cuc/yz.ts | 5 ++-- lib/routes/cuilingmag/index.ts | 7 +++-- lib/routes/cupl/jwc.ts | 5 ++-- lib/routes/curiouscat/user.ts | 2 +- lib/routes/curius/links.ts | 4 +-- lib/routes/cursor/blog.ts | 5 ++-- lib/routes/cursor/changelog.ts | 11 ++++---- lib/routes/cw/author.ts | 5 ++-- lib/routes/cw/master.ts | 5 ++-- lib/routes/cw/sub.ts | 5 ++-- lib/routes/cw/today.ts | 5 ++-- lib/routes/cw/utils.ts | 10 ++++--- lib/routes/cybersecurityventures/news.ts | 8 ++++-- lib/routes/cyzone/author.ts | 5 ++-- lib/routes/cyzone/index.ts | 5 ++-- lib/routes/cyzone/label.ts | 5 ++-- lib/routes/cyzone/util.ts | 5 ++-- lib/routes/cztv/daily.ts | 7 +++-- lib/routes/cztv/zjxwlb.ts | 7 +++-- lib/routes/dahecube/index.ts | 4 ++- lib/routes/daily/discussed.ts | 4 ++- lib/routes/daily/popular.ts | 4 ++- lib/routes/daily/source.ts | 9 +++--- lib/routes/daily/squads.ts | 4 ++- lib/routes/daily/upvoted.ts | 4 ++- lib/routes/daily/user.ts | 9 +++--- lib/routes/daily/utils.ts | 13 +++++---- lib/routes/damai/activity.ts | 11 ++++---- lib/routes/dangdang/notice.ts | 2 +- lib/routes/daoxuan/rss.ts | 5 ++-- lib/routes/dapenti/subject.ts | 3 +- lib/routes/dapenti/tugua.ts | 3 +- lib/routes/dapenti/utils.ts | 5 ++-- lib/routes/darwinawards/index.ts | 5 ++-- lib/routes/dataguidance/index.ts | 3 +- lib/routes/daum/potplayer.ts | 4 +-- lib/routes/dayanzai/index.ts | 5 ++-- lib/routes/dbaplus/new.ts | 14 +++++----- lib/routes/dbaplus/rss.ts | 7 +++-- lib/routes/dblp/publication.ts | 2 +- lib/routes/dcard/section.ts | 5 ++-- lib/routes/dcfever/news.ts | 6 ++-- lib/routes/dcfever/reviews.ts | 6 ++-- lib/routes/dcfever/trading-search.ts | 6 ++-- lib/routes/dcfever/trading.ts | 6 ++-- lib/routes/dcfever/utils.ts | 8 ++++-- lib/routes/ddosi/category.ts | 7 +++-- lib/routes/ddosi/index.ts | 7 +++-- lib/routes/deadbydaylight/index.ts | 6 ++-- lib/routes/deadline/posts.ts | 7 +++-- lib/routes/dealstreetasia/home.ts | 5 ++-- lib/routes/dealstreetasia/section.ts | 5 ++-- lib/routes/decrypt/index.ts | 7 +++-- lib/routes/dedao/articles.ts | 5 ++-- lib/routes/dedao/index.ts | 5 ++-- lib/routes/dedao/knowledge.ts | 4 +-- lib/routes/dedao/list.ts | 5 ++-- lib/routes/dedao/user.ts | 4 +-- lib/routes/deepin/homepage.ts | 2 +- lib/routes/deepin/thread.ts | 4 +-- lib/routes/deepl/blog.ts | 14 +++++----- lib/routes/deeplearning/the-batch.ts | 7 +++-- lib/routes/deepmind/blog.ts | 5 ++-- lib/routes/deepseek/news.ts | 5 ++-- lib/routes/dehenglaw/index.ts | 7 +++-- lib/routes/deltaio/blog.ts | 4 +-- lib/routes/dev.to/guides.ts | 7 +++-- lib/routes/dev.to/top.ts | 7 +++-- lib/routes/devolverdigital/blog.ts | 3 +- lib/routes/devtrium/posts.ts | 3 +- lib/routes/dewu/declaration.ts | 2 +- lib/routes/dgjyw/index.ts | 11 ++++---- lib/routes/dgtle/article.ts | 7 ++--- lib/routes/dgtle/news.ts | 7 ++--- lib/routes/dgtle/util.ts | 10 +++---- lib/routes/dgtle/video.ts | 14 +++++----- lib/routes/dgut/jwb.ts | 5 ++-- lib/routes/dhu/jiaowu/news.ts | 7 +++-- lib/routes/dhu/news/xsxx.ts | 5 ++-- lib/routes/dhu/xxgk/news.ts | 7 +++-- lib/routes/dhu/yjs/news.ts | 5 ++-- lib/routes/dhu/yjs/zs.ts | 5 ++-- lib/routes/diandong/news.ts | 5 ++-- lib/routes/dianping/user.ts | 4 +-- lib/routes/diariofruticola/filtro.ts | 9 +++--- lib/routes/diershoubing/news.ts | 5 ++-- lib/routes/digitalcameraworld/news.ts | 4 ++- .../digitalpolicyalert/activity-tracker.ts | 9 +++--- lib/routes/dingshao/share.ts | 8 ++++-- lib/routes/discord/channel.ts | 7 +++-- lib/routes/discord/discord-api.ts | 4 +-- lib/routes/discord/search.ts | 11 ++++---- lib/routes/discourse/notifications.ts | 9 +++--- lib/routes/discourse/official.ts | 5 ++-- lib/routes/discourse/posts.ts | 5 ++-- lib/routes/discuz/discuz.ts | 9 +++--- lib/routes/disinfo/publications.ts | 5 ++-- lib/routes/diskanalyzer/whats-new.ts | 5 ++-- lib/routes/distill/index.ts | 5 ++-- lib/routes/dlnews/category.ts | 16 ++++++----- lib/routes/dlsite/campaign.ts | 7 +++-- lib/routes/dlsite/ci-en/article.ts | 8 ++++-- lib/routes/dlsite/new.ts | 8 ++++-- lib/routes/dlsite/utils.ts | 10 ++++--- lib/routes/dlsite/z-index/index.ts | 3 +- lib/routes/dmzj/news.ts | 5 ++-- lib/routes/dn/news.ts | 9 +++--- lib/routes/dnaindia/common.ts | 5 ++-- lib/routes/dnaindia/news.ts | 3 +- lib/routes/dnaindia/topic.ts | 3 +- lib/routes/dockerhub/build.ts | 4 ++- lib/routes/dockerhub/repositories.ts | 6 ++-- lib/routes/dockerhub/tag.ts | 3 +- lib/routes/docschina/weekly.ts | 7 +++-- lib/routes/dol/announce.ts | 5 ++-- lib/routes/domp4/detail.ts | 5 ++-- lib/routes/domp4/latest-movie-bt.ts | 9 +++--- lib/routes/domp4/latest.ts | 5 ++-- lib/routes/domp4/utils.ts | 2 +- lib/routes/dongqiudi/daily.ts | 3 +- lib/routes/dongqiudi/player-news.ts | 3 +- lib/routes/dongqiudi/result.ts | 5 ++-- lib/routes/dongqiudi/special.ts | 5 ++-- lib/routes/dongqiudi/team-news.ts | 3 +- lib/routes/dongqiudi/top-news.ts | 5 ++-- lib/routes/dongqiudi/utils.ts | 5 ++-- lib/routes/dora-world/article.ts | 6 ++-- lib/routes/dorohedoro/news.ts | 5 ++-- lib/routes/douban/book/latest.ts | 2 +- lib/routes/douban/book/rank.ts | 2 +- lib/routes/douban/channel/subject.ts | 2 +- lib/routes/douban/channel/topic.ts | 2 +- lib/routes/douban/commercialpress/latest.ts | 5 ++-- lib/routes/douban/event/hot.ts | 2 +- lib/routes/douban/movie/coming.ts | 5 ++-- lib/routes/douban/other/bookstore.ts | 2 +- lib/routes/douban/other/celebrity.ts | 5 ++-- lib/routes/douban/other/classification.ts | 2 +- lib/routes/douban/other/discussion.ts | 5 ++-- lib/routes/douban/other/doulist.ts | 5 ++-- lib/routes/douban/other/explore-column.ts | 8 ++++-- lib/routes/douban/other/explore.ts | 11 ++++---- lib/routes/douban/other/group.ts | 6 ++-- lib/routes/douban/other/jobs.ts | 5 ++-- lib/routes/douban/other/later.ts | 5 ++-- lib/routes/douban/other/latest-music.ts | 5 ++-- lib/routes/douban/other/list.ts | 8 +++--- lib/routes/douban/other/playing.ts | 5 ++-- lib/routes/douban/other/recommended.ts | 8 +++--- lib/routes/douban/other/replied.ts | 5 ++-- lib/routes/douban/other/replies.ts | 5 ++-- lib/routes/douban/other/topic.ts | 2 +- lib/routes/douban/other/ustop.ts | 2 +- lib/routes/douban/other/weekly-best.ts | 4 +-- lib/routes/douban/people/status.ts | 9 ++++-- lib/routes/douban/people/wish.ts | 9 ++++-- lib/routes/douyin/hashtag.ts | 13 +++++---- lib/routes/douyin/live.ts | 9 +++--- lib/routes/douyin/user.ts | 17 +++++------ lib/routes/douyin/utils.ts | 2 +- lib/routes/douyu/group.ts | 6 ++-- lib/routes/douyu/post.ts | 4 +-- lib/routes/douyu/room.ts | 2 +- lib/routes/dribbble/keyword.ts | 3 +- lib/routes/dribbble/popular.ts | 3 +- lib/routes/dribbble/user.ts | 3 +- lib/routes/dribbble/utils.ts | 6 ++-- lib/routes/dtcj/datahero.ts | 5 ++-- lib/routes/dtcj/datainsight.ts | 5 ++-- lib/routes/duckdb/news.ts | 7 +++-- lib/routes/duozhuayu/search.ts | 11 ++++---- lib/routes/dushu/fuzhou/index.ts | 4 +-- lib/routes/dut/index.ts | 10 ++++--- lib/routes/dw/news.ts | 9 +++--- lib/routes/dw/rss.ts | 6 ++-- lib/routes/dw/utils.ts | 6 ++-- lib/routes/dx2025/index.ts | 5 ++-- lib/routes/dxy/board.ts | 9 +++--- lib/routes/dxy/profile/thread.ts | 7 +++-- lib/routes/dxy/special.ts | 9 +++--- lib/routes/dxy/utils.ts | 10 ++++--- lib/routes/dykszx/news.ts | 7 +++-- lib/routes/dytt/index.ts | 13 ++++----- lib/routes/e-hentai/index.ts | 9 +++--- lib/routes/ea/apex-news.ts | 7 +++-- lib/routes/eagle/blog.ts | 8 ++++-- lib/routes/eagle/changelog.ts | 5 ++-- lib/routes/earthquake/ceic.ts | 2 +- lib/routes/earthquake/index.ts | 2 +- lib/routes/eastday/24.ts | 7 +++-- lib/routes/eastday/portrait.ts | 7 +++-- lib/routes/eastday/sh.ts | 5 ++-- lib/routes/eastmoney/gerenzhongxin/cfh.ts | 5 ++-- lib/routes/eastmoney/gerenzhongxin/gather.ts | 1 + lib/routes/eastmoney/gerenzhongxin/guba.ts | 5 ++-- lib/routes/eastmoney/gerenzhongxin/trpl.ts | 7 +++-- lib/routes/eastmoney/report/index.ts | 12 +++++--- lib/routes/eastmoney/search/index.ts | 5 ++-- lib/routes/eastmoney/ttjj/user.ts | 3 +- lib/routes/eastmoney/utils.ts | 2 +- lib/routes/easynomad/joblist.ts | 9 ++++-- lib/routes/ebc/realtime.ts | 5 ++-- lib/routes/ecnu/bksy.ts | 5 ++-- lib/routes/ecnu/cee.ts | 5 ++-- lib/routes/ecnu/contest.ts | 11 ++++---- lib/routes/ecnu/cs.ts | 5 ++-- lib/routes/ecnu/dase.ts | 5 ++-- lib/routes/ecnu/dx.ts | 5 ++-- lib/routes/ecnu/dxb.ts | 5 ++-- lib/routes/ecnu/ed.ts | 5 ++-- lib/routes/ecnu/geoai.ts | 5 ++-- lib/routes/ecnu/ghcollege.ts | 5 ++-- lib/routes/ecnu/history.ts | 5 ++-- lib/routes/ecnu/jwc.ts | 5 ++-- lib/routes/ecnu/mxcsy.ts | 5 ++-- lib/routes/ecnu/philo.ts | 5 ++-- lib/routes/ecnu/sei.ts | 5 ++-- lib/routes/ecnu/yjs.ts | 5 ++-- lib/routes/economist/espresso.ts | 12 ++++---- lib/routes/economist/full.ts | 10 ++++--- .../economist/global-business-review.ts | 2 +- lib/routes/ecust/e/news.ts | 4 +-- lib/routes/ecust/gschool/yjs.ts | 5 ++-- lib/routes/ecust/jwc/notice.ts | 5 ++-- lib/routes/eeo/kuaixun.ts | 16 +++++------ lib/routes/egsea/flash.ts | 2 +- lib/routes/ehentai/ehapi.ts | 8 ++++-- lib/routes/ehentai/favorites.ts | 7 +++-- lib/routes/ehentai/search.ts | 3 +- lib/routes/ehentai/tag.ts | 3 +- lib/routes/ekantipur/issue.ts | 5 ++-- lib/routes/elasticsearch-cn/index.ts | 7 +++-- lib/routes/elecfans/article.ts | 7 +++-- lib/routes/elecfans/soft.ts | 7 +++-- lib/routes/eleduck/jobs.ts | 2 +- lib/routes/eleduck/posts.ts | 2 +- lib/routes/elsevier/issue.ts | 9 +++--- lib/routes/elsevier/journal.ts | 9 +++--- lib/routes/embassy/index.ts | 5 ++-- lib/routes/engineering/tag.ts | 5 ++-- lib/routes/englishhome/index.ts | 2 +- lib/routes/enterprisecraftsmanship/index.ts | 7 +++-- lib/routes/epicgames/index.ts | 8 ++++-- lib/routes/eprice/rss.ts | 12 ++++---- lib/routes/eshukan/academic.ts | 9 +++--- lib/routes/espn/news.ts | 8 ++++-- lib/routes/esquirehk/tag.ts | 9 +++--- lib/routes/europechinese/latest.ts | 3 +- lib/routes/eventbrite/events.ts | 5 ++-- lib/routes/eventernote/actors.ts | 7 +++-- lib/routes/everia/article.ts | 1 + lib/routes/everia/category.ts | 8 ++++-- lib/routes/everia/latest.ts | 8 ++++-- lib/routes/everia/search.ts | 8 ++++-- lib/routes/everia/tag.ts | 8 ++++-- lib/routes/expats/czech-news.ts | 9 +++--- lib/routes/f-droid/apprelease.ts | 5 ++-- lib/routes/famitsu/category.ts | 13 +++++---- lib/routes/fanbox/index.ts | 10 ++++--- lib/routes/fanbox/utils.ts | 10 ++++--- lib/routes/fangchan/list.ts | 14 +++++----- lib/routes/fanqienovel/page.ts | 7 +++-- lib/routes/fansly/post.ts | 5 ++-- lib/routes/fansly/tag.ts | 5 ++-- lib/routes/fansly/utils.ts | 7 +++-- lib/routes/fantia/search.ts | 5 ++-- lib/routes/fantia/user.ts | 5 ++-- lib/routes/fantube/creator.ts | 8 ++++-- lib/routes/fantube/utils.ts | 6 ++-- lib/routes/fanxinzhui/index.ts | 10 ++++--- lib/routes/farcaster/user.ts | 2 +- lib/routes/farmatters/index.ts | 12 ++++---- lib/routes/fashionnetwork/index.ts | 9 +++--- lib/routes/fastbull/express-news.ts | 6 ++-- lib/routes/fastbull/news.ts | 8 ++++-- lib/routes/fda/cdrh.ts | 5 ++-- lib/routes/fediverse/timeline.ts | 10 +++---- lib/routes/feng/forum.ts | 11 ++++---- lib/routes/feng/utils.ts | 8 ++++-- lib/routes/ff14/ff14-global.ts | 6 ++-- lib/routes/ff14/ff14-zh.ts | 6 ++-- lib/routes/fffdm/manhua/manhua.ts | 9 +++--- lib/routes/finology/bullets.ts | 6 ++-- lib/routes/finology/category.ts | 6 ++-- lib/routes/finology/most-viewed.ts | 3 +- lib/routes/finology/tag.ts | 6 ++-- lib/routes/finology/utils.ts | 7 +++-- lib/routes/finviz/news.ts | 10 ++++--- lib/routes/finviz/quote.ts | 5 ++-- lib/routes/firecore/index.ts | 5 ++-- lib/routes/firefox/addons.ts | 5 ++-- lib/routes/firefox/breaches.ts | 5 ++-- lib/routes/firefox/release.ts | 5 ++-- lib/routes/fisher-spb/news.ts | 7 +++-- lib/routes/fishshell/index.ts | 7 +++-- lib/routes/fjksbm/index.ts | 5 ++-- lib/routes/flashcat/blog.ts | 5 ++-- lib/routes/flyert/creditcard.ts | 8 ++++-- lib/routes/flyert/forum.ts | 9 +++--- lib/routes/flyert/preferential.ts | 7 +++-- lib/routes/flyert/util.ts | 10 ++++--- lib/routes/flyert/utils.ts | 3 +- lib/routes/focustaiwan/index.ts | 9 +++--- lib/routes/follow/profile.ts | 8 ++++-- lib/routes/followin/index.ts | 6 ++-- lib/routes/followin/kol.ts | 5 ++-- lib/routes/followin/news.ts | 6 ++-- lib/routes/followin/tag.ts | 5 ++-- lib/routes/followin/topic.ts | 5 ++-- lib/routes/followin/utils.ts | 14 ++++++---- lib/routes/foodtalks/index.ts | 7 +++-- lib/routes/foreignaffairs/rss.ts | 5 ++-- lib/routes/foresightnews/article.ts | 5 ++-- lib/routes/foresightnews/column.ts | 5 ++-- lib/routes/foresightnews/index.ts | 5 ++-- lib/routes/foresightnews/news.ts | 5 ++-- lib/routes/foresightnews/util.ts | 7 +++-- lib/routes/foreverblog/feeds.ts | 5 ++-- lib/routes/forklog/index.ts | 4 +-- lib/routes/fortnite/news.ts | 4 +-- lib/routes/fortunechina/index.ts | 9 +++--- lib/routes/fosshub/index.ts | 7 +++-- lib/routes/free/rss.ts | 4 +-- lib/routes/freebuf/index.ts | 2 +- lib/routes/freecomputerbooks/index.ts | 8 +++--- lib/routes/freewechat/profile.ts | 8 ++++-- lib/routes/freexcomic/book.ts | 5 ++-- lib/routes/ft/myft.ts | 5 ++-- lib/routes/ftchinese/channel.ts | 3 +- lib/routes/ftchinese/utils.ts | 3 +- lib/routes/ftm/index.ts | 6 ++-- lib/routes/fuliba/latest.ts | 2 +- lib/routes/furaffinity/art.ts | 2 +- lib/routes/furaffinity/browse.ts | 2 +- lib/routes/furaffinity/commissions.ts | 2 +- lib/routes/furaffinity/home.ts | 2 +- lib/routes/furaffinity/journal-comments.ts | 2 +- lib/routes/furaffinity/journals.ts | 2 +- lib/routes/furaffinity/search.ts | 2 +- lib/routes/furaffinity/shouts.ts | 2 +- lib/routes/furaffinity/status.ts | 2 +- lib/routes/furaffinity/submission-comments.ts | 2 +- lib/routes/furaffinity/user.ts | 2 +- lib/routes/furaffinity/watchers.ts | 2 +- lib/routes/furaffinity/watching.ts | 2 +- lib/routes/furstar/archive.ts | 5 ++-- lib/routes/furstar/artists.ts | 6 ++-- lib/routes/furstar/index.ts | 5 ++-- lib/routes/furstar/utils.ts | 4 ++- lib/routes/futunn/live.ts | 3 +- lib/routes/futunn/main.ts | 7 +++-- lib/routes/futunn/topic.ts | 7 +++-- lib/routes/futunn/video.ts | 4 +-- lib/routes/fx-markets/channel.ts | 5 ++-- lib/routes/fx678/kx.ts | 6 ++-- lib/routes/fxiaoke/crm.ts | 6 ++-- lib/routes/fzmtr/announcements.ts | 5 ++-- lib/routes/galxe/index.ts | 4 +-- lib/routes/gameapps/index.ts | 9 +++--- lib/routes/gamebase/news.ts | 18 ++++++------ lib/routes/gamegene/news.ts | 5 ++-- lib/routes/gamekee/news.ts | 9 +++--- lib/routes/gamer/ani/anime.ts | 3 +- lib/routes/gamer/ani/new-anime.ts | 3 +- lib/routes/gamer/gnn-index.ts | 8 ++++-- lib/routes/gamer/hot.ts | 6 ++-- lib/routes/gamer520/index.ts | 5 ++-- lib/routes/gamersecret/index.ts | 7 +++-- lib/routes/gamersky/ent.ts | 6 ++-- lib/routes/gamersky/news.ts | 6 ++-- lib/routes/gamersky/review.ts | 7 +++-- lib/routes/gamersky/utils.ts | 6 ++-- lib/routes/gamme/category.ts | 7 +++-- lib/routes/gamme/tag.ts | 7 +++-- lib/routes/gaoyu/blog.ts | 14 +++++----- lib/routes/gc.ca/pm-news.ts | 5 ++-- lib/routes/gcores/articles.ts | 4 +-- lib/routes/gcores/categories.ts | 4 +-- lib/routes/gcores/collections.ts | 4 +-- lib/routes/gcores/news.ts | 4 +-- lib/routes/gcores/parser.ts | 4 +-- lib/routes/gcores/program-previews.ts | 4 +-- lib/routes/gcores/radio.ts | 9 +++--- lib/routes/gcores/tags.ts | 4 +-- lib/routes/gcores/topics.ts | 4 +-- lib/routes/gcores/util.ts | 14 +++++----- lib/routes/gcores/videos.ts | 4 +-- lib/routes/gdsrx/index.ts | 5 ++-- lib/routes/gdufs/news.ts | 3 +- lib/routes/gdufs/xwxy/index.ts | 3 +- lib/routes/gdut/oa-news.ts | 9 +++--- lib/routes/geekpark/index.ts | 7 +++-- lib/routes/gelbooru/post.ts | 14 ++++++---- lib/routes/gelbooru/utils.ts | 3 +- lib/routes/gelonghui/home.ts | 4 ++- lib/routes/gelonghui/hot-article.ts | 7 +++-- lib/routes/gelonghui/keyword.ts | 4 ++- lib/routes/gelonghui/live.ts | 5 ++-- lib/routes/gelonghui/subject.ts | 7 +++-- lib/routes/gelonghui/user.ts | 4 ++- lib/routes/gelonghui/utils.ts | 3 +- lib/routes/genossenschaften/index.ts | 3 +- lib/routes/geocaching/blogs.ts | 2 +- lib/routes/gesiba/index.ts | 3 +- lib/routes/gesiba/namespace.ts | 2 +- lib/routes/getdr/index.ts | 5 ++-- lib/routes/getitfree/index.ts | 7 +++-- lib/routes/getitfree/util.ts | 5 ++-- lib/routes/gettr/user.ts | 5 ++-- lib/routes/gf-cn/news.ts | 4 +-- lib/routes/gihyo/group.ts | 5 ++-- lib/routes/gisreportsonline/index.ts | 6 ++-- lib/routes/gitcode/repos/commits.ts | 5 ++-- lib/routes/gitee/repos/commits.ts | 8 ++++-- lib/routes/gitee/repos/events.ts | 8 ++++-- lib/routes/gitee/repos/releases.ts | 8 ++++-- lib/routes/gitee/users/events.ts | 8 ++++-- lib/routes/github/activity.ts | 8 ++++-- lib/routes/github/advisor.ts | 9 +++--- lib/routes/github/branches.ts | 4 +-- lib/routes/github/comments.ts | 9 ++++-- lib/routes/github/contributors.ts | 4 +-- lib/routes/github/discussions.ts | 10 ++++--- lib/routes/github/file.ts | 7 +++-- lib/routes/github/follower.ts | 4 +-- lib/routes/github/gist.ts | 4 +-- lib/routes/github/issue.ts | 13 +++++---- lib/routes/github/notifications.ts | 6 ++-- lib/routes/github/org-event.ts | 6 ++-- lib/routes/github/private-feed.ts | 6 ++-- lib/routes/github/pulls.ts | 10 ++++--- lib/routes/github/pulse.ts | 5 ++-- lib/routes/github/repo-event.ts | 6 ++-- lib/routes/github/repos.ts | 4 +-- lib/routes/github/search.ts | 5 ++-- lib/routes/github/star.ts | 5 ++-- lib/routes/github/starred-repos.ts | 4 +-- lib/routes/github/topic.ts | 3 +- lib/routes/github/trending.ts | 10 ++++--- lib/routes/github/user-event.ts | 6 ++-- lib/routes/github/wiki.ts | 5 ++-- lib/routes/gitpod/blog.ts | 10 ++++--- lib/routes/gitpod/changelog.ts | 6 ++-- lib/routes/gitstar-ranking/index.ts | 12 ++++---- lib/routes/globallawreview/index.ts | 5 ++-- lib/routes/gmcmonline/chinacustoms.ts | 4 +-- lib/routes/gmu/news.ts | 5 ++-- lib/routes/gmu/yjs.ts | 7 +++-- lib/routes/go/jihs/idwr.ts | 11 ++++---- lib/routes/go/mhlw/pdf.ts | 6 ++-- lib/routes/gocn/jobs.ts | 3 +- lib/routes/gocn/news.ts | 3 +- lib/routes/gocn/topics.ts | 3 +- lib/routes/gofans/index.ts | 4 +-- lib/routes/gogoanimehd/recent-releases.ts | 5 ++-- lib/routes/google/album.ts | 2 +- lib/routes/google/alerts.ts | 5 ++-- lib/routes/google/citations.ts | 5 ++-- lib/routes/google/developers.ts | 7 +++-- lib/routes/google/doodles.ts | 3 +- lib/routes/google/extension.ts | 5 ++-- lib/routes/google/fonts.ts | 12 ++++---- lib/routes/google/jules.ts | 5 ++-- lib/routes/google/news.ts | 7 +++-- lib/routes/google/play.ts | 5 ++-- lib/routes/google/research.ts | 7 +++-- lib/routes/google/scholar.ts | 5 ++-- lib/routes/google/search.ts | 6 ++-- lib/routes/gov/ah/kjt.ts | 6 ++-- lib/routes/gov/beijing/bjedu/gh.ts | 5 ++-- lib/routes/gov/beijing/bphc/index.ts | 4 +-- lib/routes/gov/beijing/jw/tzgg.ts | 7 +++-- lib/routes/gov/beijing/kw/index.ts | 5 ++-- lib/routes/gov/caac/cjwt.ts | 6 ++-- lib/routes/gov/cac/index.ts | 7 +++-- lib/routes/gov/cbirc/index.ts | 6 ++-- lib/routes/gov/ccdi/index.ts | 5 ++-- lib/routes/gov/ccdi/utils.ts | 9 +++--- lib/routes/gov/chinamine-safety/util.ts | 7 +++-- lib/routes/gov/chinamine-safety/xw.ts | 9 +++--- lib/routes/gov/chinamine-safety/zfxxgk.ts | 7 +++-- lib/routes/gov/chinatax/latest.ts | 5 ++-- lib/routes/gov/chongqing/gzw.ts | 7 +++-- lib/routes/gov/chongqing/rsks.ts | 6 ++-- lib/routes/gov/chongqing/sydwgkzp.ts | 7 +++-- lib/routes/gov/cmse/fxrw.ts | 9 +++--- lib/routes/gov/cmse/index.ts | 12 ++++---- lib/routes/gov/cn/news/index.ts | 5 ++-- lib/routes/gov/cnnic/index.ts | 11 ++++---- lib/routes/gov/csrc/auditstatus.ts | 5 ++-- lib/routes/gov/csrc/csrc.ts | 8 +++--- lib/routes/gov/csrc/news.ts | 9 +++--- lib/routes/gov/customs/list.ts | 10 ++++--- lib/routes/gov/dianbai/dianbai.ts | 3 +- lib/routes/gov/forestry/gjlckjdjt.ts | 7 +++-- lib/routes/gov/gaozhou/gaozhou.ts | 3 +- lib/routes/gov/general/general.ts | 9 +++--- lib/routes/gov/guangdong/tqyb/sncsyjxh.ts | 8 +++--- lib/routes/gov/guangdong/tqyb/tfxtq.ts | 8 +++--- lib/routes/gov/gz/index.ts | 5 ++-- lib/routes/gov/hainan/iitb/tzgg.ts | 4 +-- lib/routes/gov/hangzhou/zwfw.ts | 14 ++++++---- lib/routes/gov/hebei/czt.ts | 5 ++-- lib/routes/gov/huazhou/huazhou.ts | 3 +- lib/routes/gov/huizhou/zwgk/index.ts | 5 ++-- lib/routes/gov/hunan/changsha/major-email.ts | 8 ++++-- lib/routes/gov/immiau/news.ts | 2 +- lib/routes/gov/jgjcndrc/index.ts | 6 ++-- lib/routes/gov/jiangsu/wlt/index.ts | 7 +++-- .../healthcommission/medical-exam-notice.ts | 7 +++-- lib/routes/gov/lswz/index.ts | 6 ++-- lib/routes/gov/maoming/maoming.ts | 3 +- lib/routes/gov/maonan/maonan.ts | 5 ++-- lib/routes/gov/mee/nnsa.ts | 9 +++--- lib/routes/gov/mee/ywdt.ts | 5 ++-- lib/routes/gov/mem/sgcc.ts | 5 ++-- lib/routes/gov/mem/zfxxgkpt.ts | 5 ++-- lib/routes/gov/mfa/wjdt.ts | 7 +++-- lib/routes/gov/mgs/mgs.ts | 3 +- lib/routes/gov/miit/wjfb.ts | 5 ++-- lib/routes/gov/miit/wjgs.ts | 6 ++-- lib/routes/gov/miit/yjzj.ts | 5 ++-- lib/routes/gov/miit/zcjd.ts | 6 ++-- lib/routes/gov/miit/zcwj.ts | 5 ++-- lib/routes/gov/mmht/mmht.ts | 3 +- lib/routes/gov/moa/gjs.ts | 9 +++--- lib/routes/gov/moa/moa.ts | 5 ++-- lib/routes/gov/moa/szcpxx.ts | 6 ++-- lib/routes/gov/moa/zdscxx.ts | 4 +-- lib/routes/gov/moe/moe.ts | 5 ++-- lib/routes/gov/moe/s78.ts | 5 ++-- lib/routes/gov/mof/bond.ts | 7 +++-- lib/routes/gov/mof/gss.ts | 9 +++--- lib/routes/gov/mofcom/article.ts | 5 ++-- lib/routes/gov/moj/aac/news.ts | 6 ++-- lib/routes/gov/moj/lfyjzj.ts | 7 +++-- lib/routes/gov/mot/index.ts | 9 +++--- lib/routes/gov/ndrc/fggz.ts | 7 +++-- lib/routes/gov/ndrc/xwdt.ts | 5 ++-- lib/routes/gov/ndrc/zfxxgk.ts | 4 +-- lib/routes/gov/nea/ghs.ts | 8 ++++-- lib/routes/gov/nifdc/index.ts | 7 +++-- lib/routes/gov/nmpa/generic.ts | 14 ++++++---- lib/routes/gov/nopss/index.ts | 11 ++++---- lib/routes/gov/npc/index.ts | 5 ++-- lib/routes/gov/nrta/dsj.ts | 7 +++-- lib/routes/gov/nrta/news.ts | 5 ++-- lib/routes/gov/nsfc/index.ts | 9 +++--- lib/routes/gov/pbc/goutongjiaoliu.ts | 7 +++-- lib/routes/gov/pbc/gzlw.ts | 8 ++++-- lib/routes/gov/pbc/trade-announcement.ts | 7 +++-- lib/routes/gov/pbc/utils.ts | 3 +- lib/routes/gov/pbc/zcyj.ts | 8 ++++-- lib/routes/gov/pudong/zwgk.ts | 7 +++-- lib/routes/gov/safe/business.ts | 3 +- lib/routes/gov/safe/complaint.ts | 3 +- lib/routes/gov/safe/util.ts | 6 ++-- lib/routes/gov/samr/xgzlyhd.ts | 7 +++-- lib/routes/gov/sasac/generic.ts | 5 ++-- lib/routes/gov/sdb/sdb.ts | 3 +- lib/routes/gov/sh/fgw/index.ts | 9 +++--- lib/routes/gov/sh/rsj/ksxm.ts | 7 +++-- lib/routes/gov/sh/wgj/wgj.ts | 7 +++-- lib/routes/gov/sh/wsjkw/yqtb/index.ts | 3 +- lib/routes/gov/sh/yjj/index.ts | 11 ++++---- lib/routes/gov/shaanxi/kjt.ts | 7 +++-- lib/routes/gov/shenzhen/hrss/szksy/index.ts | 5 ++-- lib/routes/gov/shenzhen/szlh/index.ts | 7 +++-- lib/routes/gov/shenzhen/xxgk/zfxxgj.ts | 8 ++++-- lib/routes/gov/shenzhen/zjj/index.ts | 7 +++-- lib/routes/gov/shenzhen/zzb/index.ts | 5 ++-- .../gov/sichuan/deyang/govpublicinfo.ts | 7 +++-- lib/routes/gov/sichuan/deyang/mztoday.ts | 7 +++-- lib/routes/gov/stats/index.ts | 13 +++++---- lib/routes/gov/suzhou/doc.ts | 5 ++-- lib/routes/gov/suzhou/fg.ts | 7 +++-- lib/routes/gov/suzhou/news.ts | 7 +++-- lib/routes/gov/taiyuan/rsj.ts | 5 ++-- lib/routes/gov/tianjin/tjftz.ts | 5 ++-- lib/routes/gov/tianjin/tjrcgzw.ts | 6 ++-- lib/routes/gov/wuhan/whyw.ts | 5 ++-- lib/routes/gov/xinyi/xinyi.ts | 3 +- lib/routes/gov/xuzhou/hrss.ts | 7 +++-- lib/routes/gov/zhejiang/gwy.ts | 5 ++-- lib/routes/gov/zhengce/govall.ts | 5 ++-- lib/routes/gov/zhengce/index.ts | 7 +++-- lib/routes/gov/zhengce/wenjian.ts | 5 ++-- lib/routes/gov/zhengce/zhengceku.ts | 2 +- lib/routes/gov/zj/ningbogzw-notice.ts | 5 ++-- lib/routes/gov/zj/ningborsjnotice.ts | 5 ++-- lib/routes/gov/zj/search.ts | 8 ++++-- lib/routes/gq/news.ts | 9 ++++-- lib/routes/grainoil/category.ts | 9 +++--- lib/routes/greasyfork/feedback.ts | 5 ++-- lib/routes/greasyfork/scripts.ts | 5 ++-- lib/routes/greasyfork/versions.ts | 5 ++-- lib/routes/grist/featured.ts | 10 ++++--- lib/routes/grist/index.ts | 3 +- lib/routes/grist/series.ts | 3 +- lib/routes/grist/topic.ts | 3 +- lib/routes/grubstreet/index.ts | 3 +- lib/routes/grubstreet/utils.ts | 3 +- lib/routes/gs/developer/blog.ts | 5 ++-- lib/routes/guancha/headline.ts | 7 +++-- lib/routes/guancha/index.ts | 7 +++-- lib/routes/guancha/member.ts | 4 +-- lib/routes/guancha/personalpage.ts | 2 +- lib/routes/guancha/topic.ts | 5 ++-- lib/routes/guangdiu/cheaps.ts | 5 ++-- lib/routes/guangdiu/index.ts | 5 ++-- lib/routes/guangdiu/rank.ts | 5 ++-- lib/routes/guangdiu/search.ts | 5 ++-- lib/routes/guangzhoumetro/news.ts | 5 ++-- lib/routes/guanhai/index.ts | 5 ++-- lib/routes/guduodata/daily.ts | 7 +++-- lib/routes/gumroad/index.ts | 13 +++++---- lib/routes/guokr/channel.ts | 7 +++-- lib/routes/guokr/scientific.ts | 5 ++-- lib/routes/guokr/utils.ts | 5 ++-- lib/routes/guozaoke/index.ts | 11 ++++---- lib/routes/gxmzu/ai.ts | 3 +- lib/routes/gxmzu/lib.ts | 5 ++-- lib/routes/gxmzu/utils/index.ts | 3 +- lib/routes/gxmzu/yjs.ts | 3 +- lib/routes/gzdaily/app.ts | 9 +++--- lib/routes/gzhu/yjs.ts | 5 ++-- lib/routes/hackernews/index.ts | 6 ++-- lib/routes/hackertalk/index.ts | 6 ++-- lib/routes/hacking8/index.ts | 7 +++-- lib/routes/hacking8/search.ts | 7 +++-- lib/routes/hackmd/profile.ts | 2 +- lib/routes/hackyournews/index.ts | 5 ++-- lib/routes/hafu/news.ts | 3 +- lib/routes/hafu/utils.ts | 8 ++++-- lib/routes/hakkatv/type.ts | 2 +- lib/routes/hamel/index.ts | 7 +++-- lib/routes/hameln/chapter.ts | 7 +++-- lib/routes/hanime1/previews.ts | 7 +++-- lib/routes/hanime1/search.ts | 7 +++-- lib/routes/harvard/health/blog.ts | 5 ++-- lib/routes/hashnode/blog.ts | 8 +++--- lib/routes/hbooker/chapter.ts | 5 ++-- lib/routes/hbr/topic.ts | 5 ++-- lib/routes/hdu/auto/notice.ts | 5 ++-- lib/routes/hdu/auto/utils.ts | 5 ++-- lib/routes/hdu/cs/notice.ts | 5 ++-- lib/routes/hdu/cs/pg.ts | 5 ++-- lib/routes/hebtv/nong-bo-shi-zai-xing-dong.ts | 9 +++--- lib/routes/hedwig/posts.ts | 10 ++++--- lib/routes/hellobtc/information.ts | 5 ++-- lib/routes/hellobtc/kepu.ts | 5 ++-- lib/routes/hellobtc/news.ts | 5 ++-- lib/routes/hellogithub/article.ts | 3 +- lib/routes/hellogithub/index.ts | 6 ++-- lib/routes/hellogithub/report.ts | 4 +-- lib/routes/hellogithub/volume.ts | 18 ++++++------ lib/routes/hex-rays/index.ts | 3 +- lib/routes/hexun/index.ts | 4 +-- lib/routes/hfut/hf/notice.ts | 3 +- lib/routes/hfut/hf/utils.ts | 3 +- lib/routes/hfut/xc/notice.ts | 3 +- lib/routes/hfut/xc/utils.ts | 3 +- lib/routes/hicairo/rss.ts | 5 ++-- lib/routes/hinatazaka46/blog.ts | 5 ++-- lib/routes/hinatazaka46/news.ts | 5 ++-- lib/routes/hiring.cafe/jobs.ts | 8 ++++-- lib/routes/hit/hitgs.ts | 14 +++++----- lib/routes/hit/today.ts | 5 ++-- lib/routes/hitcon/zeroday.ts | 14 ++++++---- lib/routes/hitsz/article.ts | 5 ++-- lib/routes/hitsz/due-tzgg.ts | 5 ++-- lib/routes/hitsz/due.ts | 5 ++-- lib/routes/hitwh/today.ts | 5 ++-- lib/routes/hizu/index.ts | 5 ++-- lib/routes/hk01/channel.ts | 5 ++-- lib/routes/hk01/hot.ts | 5 ++-- lib/routes/hk01/issue.ts | 5 ++-- lib/routes/hk01/latest.ts | 5 ++-- lib/routes/hk01/tag.ts | 5 ++-- lib/routes/hk01/utils.ts | 5 ++-- lib/routes/hk01/zone.ts | 5 ++-- lib/routes/hkej/index.ts | 11 ++++---- lib/routes/hkepc/index.ts | 6 ++-- lib/routes/hket/index.ts | 9 +++--- lib/routes/hkjunkcall/index.ts | 5 ++-- lib/routes/hko/earthquake.ts | 5 ++-- lib/routes/hko/weather.ts | 3 +- lib/routes/hkushop/vinyl-or-picture-lp.ts | 5 ++-- lib/routes/hlju/news.ts | 5 ++-- lib/routes/hljucm/yjsy.ts | 7 +++-- lib/routes/hnrb/index.ts | 7 +++-- lib/routes/hnu/careers.ts | 2 +- lib/routes/home-assistant/hacs.ts | 3 +- lib/routes/hongkong/chp.ts | 5 ++-- lib/routes/hongkong/dh.ts | 5 ++-- lib/routes/hostmonit/cloudflareyes.ts | 9 +++--- lib/routes/hostmonit/cloudflareyesv6.ts | 3 +- lib/routes/hottoys/index.ts | 3 +- lib/routes/hotukdeals/hottest.ts | 5 ++-- lib/routes/hotukdeals/index.ts | 5 ++-- lib/routes/houxu/events.ts | 4 +-- lib/routes/houxu/index.ts | 4 +-- lib/routes/houxu/lives.ts | 2 +- lib/routes/houxu/memory.ts | 4 +-- lib/routes/howtoforge/rss.ts | 5 ++-- lib/routes/hoyolab/constant.ts | 2 +- lib/routes/hoyolab/news.ts | 7 +++-- lib/routes/hpoi/all.ts | 4 ++- lib/routes/hpoi/banner-item.ts | 5 ++-- lib/routes/hpoi/character.ts | 4 ++- lib/routes/hpoi/info.ts | 5 ++-- lib/routes/hpoi/user.ts | 5 ++-- lib/routes/hpoi/utils.ts | 3 +- lib/routes/hpoi/work.ts | 4 ++- lib/routes/hrbeu/cec/list.ts | 6 ++-- lib/routes/hrbeu/gx/card.ts | 6 ++-- lib/routes/hrbeu/gx/list.ts | 6 ++-- lib/routes/hrbeu/job/bigemploy.ts | 5 ++-- lib/routes/hrbeu/job/calendar.ts | 5 ++-- lib/routes/hrbeu/job/list.ts | 6 ++-- lib/routes/hrbeu/sec/list.ts | 6 ++-- lib/routes/hrbeu/uae/news.ts | 5 ++-- lib/routes/hrbeu/ugs/news.ts | 5 ++-- lib/routes/hrbeu/yjsy/list.ts | 6 ++-- lib/routes/hrbust/cs.ts | 8 ++++-- lib/routes/hrbust/gzc.ts | 8 ++++-- lib/routes/hrbust/jwzx.ts | 8 ++++-- lib/routes/hrbust/lib.ts | 8 ++++-- lib/routes/hrbust/news.ts | 8 ++++-- lib/routes/hrbust/nic.ts | 6 ++-- lib/routes/huanqiu/index.ts | 7 +++-- .../huawei/developer/harmonyos/samplecode.ts | 5 ++-- lib/routes/hubu/index.ts | 4 +-- lib/routes/hubu/zhxy.ts | 4 +-- lib/routes/hudsonrivertrading/index.ts | 4 +-- lib/routes/huggingface/blog-community.ts | 7 +++-- lib/routes/huggingface/blog-zh.ts | 5 ++-- lib/routes/huggingface/blog.ts | 5 ++-- lib/routes/huggingface/daily-papers.ts | 5 ++-- lib/routes/huijin-inv/news.ts | 5 ++-- lib/routes/hunanpea/rsks.ts | 5 ++-- lib/routes/hunau/gfxy/index.ts | 3 +- lib/routes/hunau/ied.ts | 3 +- lib/routes/hunau/jwc.ts | 3 +- lib/routes/hunau/utils/common.ts | 6 ++-- lib/routes/hunau/utils/news-content.ts | 3 +- lib/routes/hunau/xky/index.ts | 3 +- lib/routes/huoxian/zone.ts | 2 +- lib/routes/hupu/all.ts | 9 +++--- lib/routes/hupu/bbs.ts | 9 +++--- lib/routes/hupu/index.ts | 10 ++++--- lib/routes/hupu/types.ts | 2 +- lib/routes/hust/aia/news.ts | 5 ++-- lib/routes/hust/aia/notice.ts | 5 ++-- lib/routes/hust/gs.ts | 4 +-- lib/routes/hust/mse.ts | 4 +-- lib/routes/hust/yjs.ts | 5 ++-- lib/routes/huxiu/brief-column.ts | 4 +-- lib/routes/huxiu/channel.ts | 4 +-- lib/routes/huxiu/club.ts | 4 +-- lib/routes/huxiu/collection.ts | 4 +-- lib/routes/huxiu/member.ts | 4 +-- lib/routes/huxiu/moment.ts | 4 +-- lib/routes/huxiu/search.ts | 4 +-- lib/routes/huxiu/tag.ts | 4 +-- lib/routes/huxiu/util.ts | 10 ++++--- lib/routes/hyperdash/top-traders.ts | 10 ++++--- lib/routes/hypergryph/arknights/announce.ts | 7 +++-- lib/routes/hypergryph/arknights/arktca.ts | 7 +++-- lib/routes/hypergryph/arknights/japan.ts | 5 ++-- lib/routes/hypergryph/arknights/news.ts | 7 +++-- lib/routes/i-cable/news.ts | 9 +++--- lib/routes/ianspriggs/index.ts | 7 +++-- lib/routes/icac/news.ts | 8 ++++-- lib/routes/icbc/whpj.ts | 2 +- lib/routes/idaily/index.ts | 8 ++++-- lib/routes/idolmaster/news.ts | 14 ++++++---- lib/routes/idolypride/news.ts | 3 +- lib/routes/ieee-security/sp.ts | 6 ++-- lib/routes/ieee/author.ts | 8 ++++-- lib/routes/ieee/journal.ts | 7 +++-- lib/routes/iehou/index.ts | 6 ++-- lib/routes/ielts/index.ts | 14 ++++++---- lib/routes/ifanr/category.ts | 2 +- lib/routes/ifanr/digest.ts | 3 +- lib/routes/ifanr/index.ts | 3 +- lib/routes/ifeng/feng.ts | 8 ++++-- lib/routes/ifeng/news.ts | 13 +++++---- lib/routes/ifeng/utils.ts | 3 +- lib/routes/ifi-audio/download.ts | 5 ++-- lib/routes/ifun/n/category.ts | 5 ++-- lib/routes/ifun/n/search.ts | 5 ++-- lib/routes/ifun/n/tag.ts | 5 ++-- lib/routes/ifun/n/util.ts | 3 +- lib/routes/iguoguo/index.ts | 10 ++++--- lib/routes/iheima/index.ts | 2 +- lib/routes/iiilab/index.ts | 3 +- lib/routes/ikea/cn/family-offers.ts | 3 +- lib/routes/ikea/cn/low-price.ts | 5 ++-- lib/routes/ikea/cn/new.ts | 5 ++-- lib/routes/ikea/cn/utils.ts | 7 +++-- lib/routes/ikea/gb/new.ts | 4 +-- lib/routes/ikea/gb/offer.ts | 11 ++++---- lib/routes/iknowwhatyoudownload/daily.ts | 8 ++++-- lib/routes/imagemagick/changelog.ts | 8 ++++-- lib/routes/imdb/chart.ts | 12 +++++--- lib/routes/imhcg/blog.ts | 6 ++-- lib/routes/imiker/jinghua.ts | 7 +++-- lib/routes/immich/cursed-knowledge.ts | 3 +- lib/routes/imop/tianshu.ts | 5 ++-- lib/routes/index.tsx | 1 + lib/routes/indianexpress/section.ts | 9 +++--- lib/routes/indiansinkuwait/latest.ts | 5 ++-- lib/routes/indienova/article.ts | 8 ++++-- lib/routes/indienova/column.ts | 8 ++++-- lib/routes/indienova/gamedb.ts | 5 ++-- lib/routes/indienova/usergames.ts | 5 ++-- lib/routes/indienova/utils.ts | 5 ++-- lib/routes/inewsweek/index.ts | 7 +++-- lib/routes/infoq/presentations.ts | 7 +++-- lib/routes/infoq/recommend.ts | 3 +- lib/routes/infoq/topic.ts | 3 +- lib/routes/informedainews/docs.ts | 7 +++-- lib/routes/informs/index.ts | 15 +++++----- lib/routes/infzm/hot.ts | 3 +- lib/routes/infzm/index.ts | 3 +- lib/routes/infzm/utils.ts | 4 ++- lib/routes/inoreader/index.ts | 6 ++-- lib/routes/inoreader/rss.ts | 6 ++-- lib/routes/inspirehep/author.ts | 6 ++-- lib/routes/inspirehep/literature.ts | 4 +-- lib/routes/inspirehep/utils.ts | 3 +- lib/routes/instagram/common-utils.ts | 3 +- lib/routes/instagram/private-api/index.ts | 12 ++++---- lib/routes/instagram/private-api/utils.ts | 3 +- lib/routes/instagram/web-api/index.ts | 12 ++++---- lib/routes/instagram/web-api/utils.ts | 13 +++++---- lib/routes/instructables/projects.ts | 5 ++-- lib/routes/investor/index.ts | 9 +++--- lib/routes/iplaysoft/category.ts | 6 ++-- lib/routes/iplaysoft/index.ts | 8 ++++-- lib/routes/iplaysoft/tag.ts | 4 ++- lib/routes/iplaysoft/utils.ts | 4 +-- lib/routes/ippa/rss.ts | 4 +-- lib/routes/ipsw.dev/index.ts | 10 ++++--- lib/routes/ipsw.dev/namespace.ts | 2 +- lib/routes/ipsw/index.ts | 5 ++-- lib/routes/iqilu/program.ts | 7 +++-- lib/routes/iqiyi/album.ts | 9 +++--- lib/routes/iqiyi/video.ts | 7 +++-- lib/routes/iqnew/latest.ts | 7 +++-- lib/routes/iresearch/report.ts | 10 +++---- lib/routes/iresearch/weekly.ts | 4 +-- lib/routes/isct/news.ts | 5 ++-- lib/routes/issuehunt/funded.ts | 5 ++-- lib/routes/itc/collection.ts | 5 ++-- lib/routes/itch/devlog.ts | 11 ++++---- lib/routes/itch/index.ts | 15 +++++----- lib/routes/itch/posts.ts | 5 ++-- lib/routes/ithome/index.ts | 5 ++-- lib/routes/ithome/ranking.ts | 5 ++-- lib/routes/ithome/tag.ts | 7 +++-- lib/routes/ithome/tw/feeds.ts | 5 ++-- lib/routes/ithome/zt.ts | 9 +++--- lib/routes/iwara/index.ts | 4 +-- lib/routes/iwara/subscriptions.ts | 14 ++++++---- lib/routes/ixigua/user-video.ts | 11 ++++---- lib/routes/j-test/news.ts | 5 ++-- lib/routes/jamesclear/book-summaries.ts | 6 ++-- lib/routes/jamesclear/great-speeches.ts | 6 ++-- lib/routes/jamesclear/quotes.ts | 6 ++-- lib/routes/jamesclear/three-two-one.ts | 6 ++-- lib/routes/jamesclear/utils.ts | 2 +- lib/routes/jandan/index.ts | 5 ++-- lib/routes/jandan/section.ts | 5 ++-- lib/routes/jandan/utils.ts | 5 ++-- lib/routes/japanpost/router.ts | 3 +- lib/routes/japanpost/track.ts | 7 +++-- lib/routes/japanpost/utils.ts | 3 +- lib/routes/javbus/index.ts | 18 ++++++------ lib/routes/javdb/actors.ts | 3 +- lib/routes/javdb/index.ts | 3 +- lib/routes/javdb/lists.ts | 3 +- lib/routes/javdb/makers.ts | 3 +- lib/routes/javdb/rankings.ts | 3 +- lib/routes/javdb/search.ts | 3 +- lib/routes/javdb/series.ts | 3 +- lib/routes/javdb/tags.ts | 3 +- lib/routes/javdb/utils.ts | 9 +++--- lib/routes/javdb/videocodes.ts | 3 +- lib/routes/javlibrary/bestrated.ts | 5 ++-- lib/routes/javlibrary/bestreviews.ts | 5 ++-- lib/routes/javlibrary/genre.ts | 5 ++-- lib/routes/javlibrary/maker.ts | 5 ++-- lib/routes/javlibrary/mostwanted.ts | 5 ++-- lib/routes/javlibrary/newentries.ts | 5 ++-- lib/routes/javlibrary/newrelease.ts | 5 ++-- lib/routes/javlibrary/star.ts | 5 ++-- lib/routes/javlibrary/update.ts | 5 ++-- lib/routes/javlibrary/user.ts | 5 ++-- lib/routes/javlibrary/utils.ts | 8 ++++-- lib/routes/javtiful/actress.ts | 6 ++-- lib/routes/javtiful/channel.ts | 6 ++-- lib/routes/javtiful/utils.ts | 3 +- lib/routes/javtrailers/casts.ts | 6 ++-- lib/routes/javtrailers/categories.ts | 6 ++-- lib/routes/javtrailers/studios.ts | 6 ++-- lib/routes/javtrailers/utils.ts | 5 ++-- lib/routes/jbma/report.ts | 9 +++--- lib/routes/jd/price.ts | 4 +-- lib/routes/jetbrains/comments.ts | 5 ++-- lib/routes/jewishmuseum/exhibitions.ts | 2 +- lib/routes/jianshu/collection.ts | 7 +++-- lib/routes/jianshu/home.ts | 7 +++-- lib/routes/jianshu/user.ts | 7 +++-- lib/routes/jianshu/utils.ts | 3 +- lib/routes/jiaoliudao/index.ts | 2 +- lib/routes/jiemian/account.ts | 2 +- lib/routes/jiemian/common.ts | 7 +++-- lib/routes/jiemian/lists.ts | 2 +- lib/routes/jiemian/special.ts | 2 +- lib/routes/jiemian/video.ts | 2 +- lib/routes/jiemian/vip.ts | 2 +- lib/routes/jike/topic-text.ts | 4 ++- lib/routes/jike/topic.ts | 11 +++++--- lib/routes/jike/user.ts | 6 ++-- lib/routes/jike/utils.ts | 9 +++--- lib/routes/jimmyspa/books.ts | 15 ++++++---- lib/routes/jimmyspa/news.ts | 13 +++++---- lib/routes/jin10/category.ts | 9 +++--- lib/routes/jin10/index.ts | 9 +++--- lib/routes/jin10/topic.ts | 5 ++-- lib/routes/jingzhengu/news.ts | 6 ++-- lib/routes/jinritemai/docs.ts | 2 +- lib/routes/jinse/catalogue.ts | 7 +++-- lib/routes/jinse/lives.ts | 8 ++++-- lib/routes/jinse/timeline.ts | 8 ++++-- lib/routes/jisilu/category.ts | 7 ++--- lib/routes/jisilu/explore.ts | 5 ++-- lib/routes/jisilu/people.ts | 7 ++--- lib/routes/jisilu/topic.ts | 5 ++-- lib/routes/jisilu/util.ts | 5 ++-- lib/routes/jiuyangongshe/community.ts | 11 +++++--- lib/routes/jjwxc/author.ts | 9 +++--- lib/routes/jjwxc/book.ts | 12 ++++---- lib/routes/jl1mall/forum.ts | 5 ++-- lib/routes/jlu/ccst/xwzx/index.ts | 5 ++-- lib/routes/jlu/jwc.ts | 5 ++-- lib/routes/jlu/phy/index.ts | 5 ++-- lib/routes/joins/chinese.ts | 9 +++--- lib/routes/joneslanglasalle/index.ts | 7 ++--- lib/routes/jornada/index.ts | 2 +- lib/routes/joshwcomeau/latest.ts | 3 +- lib/routes/joshwcomeau/popular.ts | 3 +- lib/routes/joshwcomeau/utils.ts | 5 ++-- lib/routes/jou/home.ts | 3 +- lib/routes/jou/utils/index.ts | 3 +- lib/routes/jou/yz.ts | 3 +- lib/routes/jpmorganchase/research.ts | 7 +++-- lib/routes/jpxgmn/search.ts | 8 ++++-- lib/routes/jpxgmn/tab.ts | 8 ++++-- lib/routes/jpxgmn/utils.ts | 10 ++++--- lib/routes/jpxgmn/weekly.ts | 8 ++++-- lib/routes/jrj/index.ts | 8 +++--- lib/routes/jseea/news.ts | 5 ++-- lib/routes/jsu/cxzx.ts | 6 ++-- lib/routes/jsu/jwc.ts | 6 ++-- lib/routes/jsu/math.ts | 6 ++-- lib/routes/jsu/rjxy.ts | 6 ++-- lib/routes/jsu/universityindex.ts | 6 ++-- lib/routes/jsu/utils/index.ts | 3 +- lib/routes/juejin/aicoding.ts | 5 ++-- lib/routes/juejin/books.ts | 2 +- lib/routes/juejin/category.ts | 3 +- lib/routes/juejin/collection.ts | 3 +- lib/routes/juejin/collections.ts | 5 ++-- lib/routes/juejin/column.ts | 3 +- lib/routes/juejin/dynamic.ts | 2 +- lib/routes/juejin/pins.ts | 2 +- lib/routes/juejin/posts.ts | 5 ++-- lib/routes/juejin/tag.ts | 3 +- lib/routes/juejin/trending.ts | 3 +- lib/routes/juejin/utils.ts | 11 +++++--- lib/routes/jumeili/home.ts | 5 ++-- lib/routes/jump/discount.ts | 4 +-- lib/routes/junhe/legal-updates.ts | 4 +-- lib/routes/kadokawa/blog.ts | 7 +++-- lib/routes/kakuyomu/works.ts | 8 ++++-- lib/routes/kamen-rider-official/news.ts | 7 +++-- lib/routes/kantarworldpanel/index.ts | 7 +++-- lib/routes/kanxue/topic.ts | 7 +++-- lib/routes/kaopu/news.ts | 2 +- lib/routes/kbs/news.ts | 7 +++-- lib/routes/kbs/today.ts | 7 +++-- lib/routes/kcna/news.ts | 14 ++++++---- lib/routes/kcna/utils.ts | 9 +++--- lib/routes/ke/results.ts | 4 +-- lib/routes/keep/user.ts | 4 +-- lib/routes/keepass/news.ts | 5 ++-- lib/routes/kelownacapnews/news.ts | 5 ++-- lib/routes/kemono/index.ts | 10 ++++--- lib/routes/kemono/types.ts | 2 +- lib/routes/kepu/live.ts | 6 ++-- lib/routes/keylol/index.ts | 13 +++++---- lib/routes/kimlaw/thesis.ts | 5 ++-- lib/routes/kiro/blog.ts | 9 +++--- lib/routes/kiro/changelog.ts | 9 +++--- lib/routes/kisskiss/blog.ts | 5 ++-- lib/routes/komiic/comic.ts | 4 +-- lib/routes/konachan/post.ts | 6 ++-- lib/routes/konghq/blog-posts.ts | 5 ++-- lib/routes/koreaherald/index.ts | 5 ++-- lib/routes/kovidgoyal/kitty/changelog.ts | 5 ++-- lib/routes/koyso/index.ts | 14 +++++----- lib/routes/kpmg/insights.ts | 10 ++++--- lib/routes/kpopping/kpics.ts | 14 +++++----- lib/routes/kpopping/news.ts | 14 +++++----- lib/routes/ktown4u/artist-brandlist.ts | 2 +- lib/routes/kuaidi100/index.ts | 3 +- lib/routes/kuaidi100/supported-company.ts | 3 +- lib/routes/kuaidi100/utils.ts | 1 + lib/routes/kuaishou/profile.ts | 5 ++-- lib/routes/kunchengblog/essay.ts | 7 +++-- lib/routes/kurogames/namespace.ts | 2 +- lib/routes/kurogames/wutheringwaves/news.ts | 11 +++++--- lib/routes/kurogames/wutheringwaves/utils.ts | 6 ++-- lib/routes/kuwaitlocal/index.ts | 5 ++-- lib/routes/kyodonews/index.ts | 17 +++++------ lib/routes/laimanhua/index.ts | 7 +++-- lib/routes/lala/rss.ts | 5 ++-- lib/routes/landiannews/category.ts | 6 ++-- lib/routes/landiannews/index.ts | 4 ++- lib/routes/landiannews/tag.ts | 4 ++- lib/routes/landiannews/utils.ts | 4 +-- lib/routes/lang/room.ts | 4 +-- lib/routes/langchain/index.ts | 5 ++-- lib/routes/lanqiao/author.ts | 6 ++-- lib/routes/lanqiao/courses.ts | 6 ++-- lib/routes/lanqiao/questions.ts | 5 ++-- lib/routes/lanqiao/utils.ts | 3 +- lib/routes/laohu8/personal.ts | 6 ++-- lib/routes/last-origin/news.ts | 5 ++-- lib/routes/latepost/index.ts | 7 +++-- lib/routes/layoffs/index.ts | 5 ++-- lib/routes/leagueoflegends/patch-notes.ts | 5 ++-- lib/routes/learnblockchain/posts.ts | 3 +- lib/routes/learnku/topic.ts | 9 +++--- lib/routes/leetcode/articles.ts | 8 ++++-- lib/routes/leetcode/dailyquestion-cn.ts | 4 +-- lib/routes/leetcode/dailyquestion-en.ts | 4 +-- .../leetcode/dailyquestion-solution-cn.ts | 11 +++++--- .../leetcode/dailyquestion-solution-en.ts | 13 +++++---- lib/routes/leiphone/index.ts | 6 ++-- lib/routes/leiphone/newsflash.ts | 3 +- lib/routes/leiphone/utils.ts | 4 ++- lib/routes/lemmy/index.ts | 12 ++++---- lib/routes/lenovo/drive.ts | 5 ++-- lib/routes/lens/profile.ts | 2 +- lib/routes/letterboxd/index.ts | 10 ++++--- lib/routes/lfsyd/home.ts | 5 ++-- lib/routes/lfsyd/old-home.ts | 3 +- lib/routes/lfsyd/tag.ts | 5 ++-- lib/routes/lfsyd/user.ts | 5 ++-- lib/routes/lfsyd/utils.ts | 6 ++-- lib/routes/lhratings/research.ts | 11 ++++---- lib/routes/lianxh/index.ts | 9 +++--- lib/routes/lifeweek/channel.ts | 3 +- lib/routes/lifeweek/tag.ts | 4 ++- lib/routes/lifeweek/utils.ts | 3 +- lib/routes/lightnovel/light-novel.ts | 9 +++--- lib/routes/likeshop/index.ts | 2 +- lib/routes/line/publisher.ts | 5 ++-- lib/routes/line/today.ts | 5 ++-- lib/routes/line/utils.ts | 10 ++++--- lib/routes/lineageos/changes.ts | 9 +++--- lib/routes/link3/events.ts | 4 +-- lib/routes/link3/profile.ts | 4 +-- lib/routes/linkedin/cn/index.ts | 5 ++-- lib/routes/linkedin/cn/utils.ts | 8 ++++-- lib/routes/linkedin/jobs.ts | 4 ++- lib/routes/linkedin/posts.ts | 8 ++++-- lib/routes/linkedin/utils.ts | 21 +++++++------- lib/routes/linkresearcher/index.ts | 17 ++++++----- lib/routes/linovelib/novel.ts | 5 ++-- lib/routes/linovelib/volume.ts | 7 +++-- lib/routes/liquipedia/cs-matches.ts | 5 ++-- lib/routes/liquipedia/dota2-matches.ts | 5 ++-- lib/routes/literotica/category.ts | 5 ++-- lib/routes/literotica/new.ts | 5 ++-- lib/routes/liulinblog/index.ts | 5 ++-- lib/routes/liulinblog/itnews.ts | 3 +- lib/routes/liveuamap/index.ts | 7 +++-- lib/routes/lkong/forum.ts | 4 +-- lib/routes/lkong/query.ts | 2 +- lib/routes/lkong/thread.ts | 6 ++-- lib/routes/lmu/jobs.ts | 4 +-- lib/routes/lofter/collection.ts | 6 ++-- lib/routes/lofter/tag.ts | 9 +++--- lib/routes/lofter/user.ts | 3 +- lib/routes/logclub/index.ts | 7 +++-- lib/routes/logclub/report.ts | 9 +++--- lib/routes/logonews/index.ts | 11 ++++---- lib/routes/logrocket/index.ts | 7 +++-- lib/routes/loltw/news.ts | 4 +-- lib/routes/loongarch/post.ts | 4 +-- lib/routes/lorientlejour/index.ts | 16 ++++++----- lib/routes/lovelive-anime/news.ts | 12 ++++---- lib/routes/lrepacks/index.ts | 7 +++-- lib/routes/lsnu/jiaowc/tzgg.ts | 5 ++-- lib/routes/ltaaa/article.ts | 14 +++++----- lib/routes/luma/index.ts | 4 +-- lib/routes/luogu/contest.ts | 10 ++++--- lib/routes/luogu/daily.ts | 5 ++-- lib/routes/luogu/user-article.ts | 8 ++++-- lib/routes/luogu/user-blog.ts | 5 ++-- lib/routes/luogu/user-feed.ts | 7 +++-- lib/routes/luolei/index.ts | 8 ++++-- lib/routes/luxiangdong/archive.ts | 2 +- lib/routes/lvv2/news.ts | 9 +++--- lib/routes/lvv2/top.ts | 9 +++--- lib/routes/lxixsxa/discography.ts | 7 +++-- lib/routes/lxixsxa/information.ts | 7 +++-- lib/routes/m-78/news.ts | 10 ++++--- lib/routes/m4/index.ts | 13 +++++---- lib/routes/maccms/index.ts | 7 +++-- lib/routes/macfilos/blog.ts | 5 ++-- lib/routes/macmenubar/recently.ts | 2 +- lib/routes/macupdate/app.ts | 5 ++-- lib/routes/magazinelib/latest-magazine.ts | 11 ++++---- lib/routes/magnumphotos/magazine.ts | 11 +++++--- lib/routes/mail/imap.ts | 9 +++--- lib/routes/makerworld/contest.ts | 9 +++--- lib/routes/makerworld/trending.ts | 9 +++--- lib/routes/makerworld/user-upload.ts | 9 +++--- lib/routes/makerworld/utils.ts | 5 ++-- lib/routes/malaysiakini/index.ts | 7 +++-- lib/routes/mangadex/_access.ts | 7 +++-- lib/routes/mangadex/_feed.ts | 9 +++--- lib/routes/mangadex/_profile.ts | 6 ++-- lib/routes/mangadex/index.ts | 3 +- lib/routes/mangadex/mdlist/feed.ts | 11 ++++---- lib/routes/mangadex/user/feed.ts | 9 +++--- lib/routes/mangadex/user/follows.ts | 9 +++--- lib/routes/manhuagui/comic.ts | 5 ++-- lib/routes/manhuagui/subscribe.ts | 14 ++++++---- lib/routes/manus/blog.ts | 6 ++-- lib/routes/manus/namespace.ts | 2 +- lib/routes/manyvids/video.ts | 12 ++++---- lib/routes/mashiro/index.ts | 10 ++++--- lib/routes/mastodon/account-id.ts | 6 ++-- lib/routes/mastodon/acct.ts | 4 ++- lib/routes/mastodon/tag.ts | 10 ++++--- lib/routes/mastodon/timeline-local.ts | 8 ++++-- lib/routes/mastodon/timeline-remote.ts | 8 ++++-- lib/routes/mastodon/utils.ts | 4 +-- lib/routes/mathpix/blog.ts | 14 +++++----- lib/routes/matters/author.ts | 3 +- lib/routes/matters/latest.ts | 3 +- lib/routes/matters/tags.ts | 6 ++-- lib/routes/mckinsey/cn/index.ts | 9 ++++-- lib/routes/mcmod/index.ts | 12 ++++---- lib/routes/mdpi/journal.ts | 11 ++++---- lib/routes/medieval-china/post.ts | 5 ++-- lib/routes/medium/feed.ts | 7 +++-- lib/routes/medium/following.ts | 8 +++--- lib/routes/medium/for-you.ts | 8 +++--- lib/routes/medium/graphql.ts | 2 +- lib/routes/medium/list.ts | 8 +++--- lib/routes/medium/parse-article.ts | 4 +-- lib/routes/medium/tag.ts | 8 +++--- lib/routes/medsci/index.ts | 5 ++-- lib/routes/meishichina/index.ts | 4 +-- lib/routes/meituan/tech.ts | 7 +++-- lib/routes/melonbooks/parser.ts | 4 ++- lib/routes/melonbooks/search.ts | 13 +++++---- lib/routes/mercari/keyword.ts | 5 ++-- lib/routes/mercari/search.ts | 5 ++-- lib/routes/mercari/util.ts | 14 ++++++---- lib/routes/meta/ai-blog.ts | 5 ++-- lib/routes/metacritic/index.ts | 7 +++-- lib/routes/metacritic/release.ts | 5 ++-- lib/routes/meteoblue/weathernews.ts | 3 +- lib/routes/meteor/boards.ts | 3 +- lib/routes/meteor/index.ts | 3 +- lib/routes/meteor/utils.ts | 4 ++- lib/routes/metmuseum/exhibitions.ts | 2 +- lib/routes/metrics.ts | 1 + lib/routes/mi/crowdfunding.ts | 6 ++-- lib/routes/mi/golden.ts | 2 +- lib/routes/mi/utils.ts | 16 +++++++---- lib/routes/microsoft/addon.ts | 2 +- lib/routes/microsoft/mcr.ts | 2 +- lib/routes/mihoyo/bbs/cache.ts | 4 +-- lib/routes/mihoyo/bbs/follow-list.ts | 5 ++-- lib/routes/mihoyo/bbs/img-ranking.ts | 3 +- lib/routes/mihoyo/bbs/official.ts | 9 +++--- lib/routes/mihoyo/bbs/timeline.ts | 9 +++--- lib/routes/mihoyo/bbs/user-post.ts | 3 +- lib/routes/mihoyo/bbs/utils.ts | 3 +- lib/routes/mihoyo/sr/news.ts | 2 +- lib/routes/mihoyo/ys/news.ts | 2 +- lib/routes/mihoyo/zzz/news.ts | 2 +- lib/routes/mindmeister/example.ts | 12 ++++---- lib/routes/minecraft/blockedservers.ts | 2 +- lib/routes/minecraft/java-runtime.ts | 5 ++-- lib/routes/minecraft/version.ts | 5 ++-- lib/routes/mingpao/index.ts | 9 +++--- lib/routes/miniflux/entry.ts | 4 +-- lib/routes/miniflux/subscription.ts | 4 +-- lib/routes/mirror/index.ts | 10 ++++--- lib/routes/mirrormedia/category.ts | 6 ++-- lib/routes/mirrormedia/index.ts | 6 ++-- lib/routes/mirrormedia/utils.ts | 1 + lib/routes/missav/new.ts | 7 +++-- lib/routes/misskey/featured-notes.ts | 8 ++++-- lib/routes/misskey/home-timeline.ts | 7 +++-- lib/routes/misskey/user-timeline.ts | 7 +++-- lib/routes/misskey/utils.ts | 5 ++-- lib/routes/misskon/posts.ts | 3 +- lib/routes/misskon/tag.ts | 3 +- lib/routes/misskon/top.ts | 6 ++-- lib/routes/misskon/utils.ts | 3 +- lib/routes/mit/hanlab.ts | 5 ++-- lib/routes/mittrchina/index.ts | 4 +-- lib/routes/miui/community/user.ts | 2 +- lib/routes/miui/firmware/index.ts | 5 ++-- lib/routes/mixcloud/index.ts | 10 ++++--- lib/routes/mixcloud/user-playlist.ts | 3 +- lib/routes/mixi2/community.ts | 4 ++- lib/routes/mixi2/discovery.ts | 4 ++- lib/routes/mixi2/home.ts | 4 ++- lib/routes/mixi2/user.ts | 8 ++++-- lib/routes/mixi2/utils.ts | 3 +- lib/routes/miyuki/news.ts | 5 ++-- lib/routes/modb/topic.ts | 9 +++--- lib/routes/modelscope/community.ts | 15 +++++----- lib/routes/modelscope/datasets.ts | 12 ++++---- lib/routes/modelscope/learn.ts | 3 +- lib/routes/modelscope/models.ts | 8 ++++-- lib/routes/modelscope/studios.ts | 12 ++++---- lib/routes/modian/zhongchou.ts | 5 ++-- lib/routes/modrinth/versions.ts | 16 ++++++----- lib/routes/mohw/clarification.ts | 5 ++-- lib/routes/moodysmismicrosite/report.ts | 5 ++-- lib/routes/mox/index.ts | 7 +++-- lib/routes/mpaypass/main.ts | 5 ++-- lib/routes/mpaypass/news.ts | 5 ++-- lib/routes/mrdx/daily.ts | 12 ++++---- lib/routes/mrm/index.ts | 5 ++-- lib/routes/msn/index.ts | 7 +++-- lib/routes/musify/index.ts | 9 +++--- lib/routes/musikguru/news.ts | 14 +++++----- lib/routes/mwm/index.ts | 5 ++-- lib/routes/my-formosa/index.ts | 7 +++-- lib/routes/mycard520/news.ts | 9 +++--- lib/routes/mydrivers/cid.ts | 4 +-- lib/routes/mydrivers/index.ts | 17 +++++------ lib/routes/mydrivers/rank.ts | 7 +++-- lib/routes/mydrivers/util.ts | 9 +++--- lib/routes/myfans/post.ts | 8 ++++-- lib/routes/myfans/utils.ts | 5 ++-- lib/routes/myfigurecollection/activity.ts | 11 ++++---- lib/routes/myfigurecollection/index.ts | 9 +++--- lib/routes/mygopen/index.ts | 2 +- lib/routes/mymusicsheet/usersheets.ts | 8 +++--- lib/routes/mysql/release.ts | 7 +++-- lib/routes/nankai/ai-notice.ts | 7 +++-- lib/routes/nankai/cc-notice.ts | 7 +++-- lib/routes/nankai/graduate-notice.ts | 7 +++-- lib/routes/nankai/jwc.ts | 7 +++-- lib/routes/nankai/notice.ts | 7 +++-- lib/routes/nankai/yzb.ts | 7 +++-- lib/routes/nasa/apod-cn.ts | 2 +- lib/routes/nasa/apod-ncku.ts | 5 ++-- lib/routes/nasa/apod.ts | 6 ++-- lib/routes/natgeo/dailyphoto.ts | 10 ++++--- lib/routes/natgeo/dailyselection.ts | 5 ++-- lib/routes/natgeo/natgeo.ts | 5 ++-- .../nationalgeographic/latest-stories.ts | 7 +++-- lib/routes/naturalism/new.ts | 4 +-- lib/routes/nature/cover.ts | 9 +++--- lib/routes/nature/highlight.ts | 6 ++-- lib/routes/nature/news-and-comment.ts | 7 +++-- lib/routes/nature/news.ts | 6 ++-- lib/routes/nature/research.ts | 7 +++-- lib/routes/nature/siteindex.ts | 6 ++-- lib/routes/nature/utils.ts | 6 ++-- lib/routes/nautil/topics.ts | 8 ++++-- lib/routes/nautiljon/manga-releases.ts | 3 +- lib/routes/nbd/daily.ts | 3 +- lib/routes/nbd/index.ts | 7 +++-- lib/routes/nber/all.ts | 3 +- lib/routes/nber/common.ts | 14 ++++++---- lib/routes/nber/new.ts | 3 +- lib/routes/ncc-cma/cmdp.ts | 9 +++--- lib/routes/ncepu/master/masterinfo.ts | 7 +++-- lib/routes/ncku/csie.ts | 4 ++- lib/routes/ncku/phys.ts | 4 ++- lib/routes/ncpssd/newlist.ts | 5 ++-- lib/routes/ncu/jwc.ts | 5 ++-- lib/routes/ncwu/notice.ts | 6 ++-- lib/routes/ndss-symposium/ndss.ts | 8 ++++-- lib/routes/neatdownloadmanager/download.ts | 5 ++-- lib/routes/neea/index.ts | 5 ++-- lib/routes/neea/jlpt.ts | 9 +++--- lib/routes/nenu/sohac.ts | 9 +++--- lib/routes/nenu/yjsy.ts | 9 +++--- lib/routes/netflav/index.ts | 7 +++-- lib/routes/netflix/newsroom.ts | 5 ++-- lib/routes/netflix/research.ts | 6 ++-- lib/routes/neu/bmie.ts | 5 ++-- lib/routes/neu/news.ts | 6 ++-- lib/routes/neu/yz.ts | 5 ++-- lib/routes/newmuseum/exhibitions.ts | 2 +- lib/routes/newrank/douyin.ts | 7 +++-- lib/routes/newrank/utils.ts | 7 +++-- lib/routes/newrank/wechat.ts | 10 ++++--- lib/routes/news/xhsxw.ts | 9 +++--- lib/routes/newseed/index.ts | 4 +-- lib/routes/newslaundry/explainer.ts | 4 ++- lib/routes/newslaundry/nl-cheatsheet.ts | 4 ++- lib/routes/newslaundry/nl-collaborations.ts | 4 ++- lib/routes/newslaundry/podcast.ts | 4 ++- lib/routes/newslaundry/reports.ts | 4 ++- lib/routes/newslaundry/shot.ts | 4 ++- lib/routes/newslaundry/subscriber-only.ts | 4 ++- lib/routes/newslaundry/utils.ts | 5 ++-- lib/routes/newsmarket/index.ts | 5 ++-- lib/routes/newswav/latest.ts | 5 ++-- lib/routes/newyorker/news.ts | 6 ++-- lib/routes/newzmz/index.ts | 9 +++--- lib/routes/newzmz/util.ts | 8 ++++-- lib/routes/nextapple/realtime.ts | 7 +++-- lib/routes/nextjs/blog.ts | 7 +++-- lib/routes/nga/forum.ts | 5 ++-- lib/routes/nga/post.ts | 7 +++-- lib/routes/ngocn2/index.ts | 5 ++-- lib/routes/nhentai/index.ts | 7 +++-- lib/routes/nhentai/search.ts | 5 ++-- lib/routes/nhentai/util.ts | 10 ++++--- lib/routes/nhk/news-web-easy.ts | 9 +++--- lib/routes/nhk/news.ts | 6 ++-- lib/routes/niaogebiji/cat.ts | 5 ++-- lib/routes/niaogebiji/index.ts | 5 ++-- lib/routes/niaogebiji/today.ts | 2 +- lib/routes/nicovideo/mylist.ts | 4 +-- lib/routes/nicovideo/utils.ts | 11 ++++---- lib/routes/nicovideo/video.ts | 5 ++-- lib/routes/nielsberglund/index.ts | 7 +++-- lib/routes/nifd/research.ts | 5 ++-- lib/routes/nikkei/asia/index.ts | 5 ++-- lib/routes/nikkei/cn/index.ts | 15 +++++----- lib/routes/nikkei/index.ts | 5 ++-- lib/routes/nikkei/news.ts | 7 +++-- lib/routes/nintendo/direct.ts | 7 +++-- lib/routes/nintendo/eshop-cn.ts | 10 ++++--- lib/routes/nintendo/eshop-hk.ts | 7 +++-- lib/routes/nintendo/eshop-jp.ts | 4 +-- lib/routes/nintendo/eshop-us.ts | 8 +++--- lib/routes/nintendo/news-china.ts | 6 ++-- lib/routes/nintendo/news.ts | 5 ++-- lib/routes/nintendo/system-update.ts | 5 ++-- lib/routes/nintendo/utils.ts | 16 +++++++---- lib/routes/nio/nioradio.ts | 5 ++-- lib/routes/nippon/index.ts | 5 ++-- lib/routes/njglyy/utils/index.ts | 3 +- lib/routes/njglyy/ygbjypx.ts | 3 +- lib/routes/njit/jwc.ts | 5 ++-- lib/routes/njit/tzgg.ts | 5 ++-- lib/routes/njnu/ceai/ceai.ts | 6 ++-- lib/routes/njnu/ceai/utils.ts | 3 +- lib/routes/njnu/jwc/jwc.ts | 6 ++-- lib/routes/njnu/jwc/utils.ts | 3 +- lib/routes/nju/admission.ts | 5 ++-- lib/routes/nju/dafls.ts | 5 ++-- lib/routes/nju/exchangesys.ts | 5 ++-- lib/routes/nju/gra.ts | 5 ++-- lib/routes/nju/hosptial.ts | 5 ++-- lib/routes/nju/hqjt.ts | 5 ++-- lib/routes/nju/itsc.ts | 5 ++-- lib/routes/nju/jjc.ts | 5 ++-- lib/routes/nju/jw.ts | 5 ++-- lib/routes/nju/rczp.ts | 4 +-- lib/routes/nju/scit.ts | 5 ++-- lib/routes/nju/zbb.ts | 5 ++-- lib/routes/nju/zcc.ts | 6 ++-- lib/routes/njucm/grabs.ts | 3 +- lib/routes/njucm/utils/index.ts | 3 +- lib/routes/njuferret/blog.ts | 5 ++-- lib/routes/njupt/jwc.ts | 5 ++-- lib/routes/njust/cs.ts | 6 ++-- lib/routes/njust/cwc.ts | 6 ++-- lib/routes/njust/dgxg.ts | 6 ++-- lib/routes/njust/eo.ts | 4 ++- lib/routes/njust/eoe.ts | 6 ++-- lib/routes/njust/gs.ts | 4 ++- lib/routes/njust/jwc.ts | 6 ++-- lib/routes/njxzc/home.ts | 3 +- lib/routes/njxzc/lib.ts | 3 +- lib/routes/njxzc/utils/index.ts | 5 ++-- lib/routes/nlc/read.ts | 10 ++++--- lib/routes/nltimes/news.ts | 5 ++-- lib/routes/nmc/weatheralarm.ts | 5 ++-- lib/routes/nmtv/column.ts | 6 ++-- lib/routes/nodejs/blog.ts | 5 ++-- lib/routes/nogizaka46/blog.ts | 2 +- lib/routes/nogizaka46/news.ts | 2 +- lib/routes/nosec/index.ts | 5 ++-- lib/routes/notateslaapp/update.ts | 5 ++-- lib/routes/notefolio/search.ts | 8 ++++-- lib/routes/notion/database.ts | 18 ++++++------ lib/routes/notion/release.ts | 7 +++-- lib/routes/now/news.ts | 5 ++-- lib/routes/nowcoder/discuss.ts | 5 ++-- lib/routes/nowcoder/experience.ts | 5 ++-- lib/routes/nowcoder/jobcenter.ts | 8 ++++-- lib/routes/nowcoder/recommend.ts | 2 +- lib/routes/nowcoder/schedule.ts | 2 +- lib/routes/npm/package.ts | 4 +-- lib/routes/npr/full.ts | 9 +++--- lib/routes/ntdm/video.ts | 8 ++++-- lib/routes/ntdtv/channel.ts | 5 ++-- lib/routes/ntrblog/articles.ts | 7 +++-- lib/routes/nua/dc.ts | 5 ++-- lib/routes/nua/gra.ts | 4 ++- lib/routes/nua/index.ts | 3 +- lib/routes/nua/lib.ts | 6 ++-- lib/routes/nua/sxw.ts | 3 +- lib/routes/nua/utils.ts | 3 +- lib/routes/nuaa/college/cae.ts | 7 +++-- lib/routes/nuaa/college/cs.ts | 7 +++-- lib/routes/nuaa/jwc/jwc.ts | 7 +++-- lib/routes/nuaa/utils/pypasswaf.ts | 2 +- lib/routes/nuaa/yjsy/yjsy.ts | 7 +++-- lib/routes/nudt/yjszs.ts | 7 +++-- lib/routes/nuist/bulletin.ts | 5 ++-- lib/routes/nuist/cas.ts | 5 ++-- lib/routes/nuist/jwc.ts | 5 ++-- lib/routes/nuist/library/lib.ts | 6 ++-- lib/routes/nuist/scs.ts | 6 ++-- lib/routes/nuist/sese.ts | 5 ++-- lib/routes/nuist/xgc.ts | 5 ++-- lib/routes/nuist/yjs.ts | 11 ++++---- lib/routes/nwafu/all.ts | 6 ++-- lib/routes/nwnu/routes/college/csse.ts | 6 ++-- .../routes/department/academic-affairs.ts | 6 ++-- .../nwnu/routes/department/postgraduate.ts | 6 ++-- lib/routes/nyaa/main.ts | 5 ++-- lib/routes/nycu/aa.ts | 10 ++++--- lib/routes/nycu/announcement.ts | 10 ++++--- lib/routes/nycu/cs.ts | 10 ++++--- lib/routes/nycu/osa.ts | 10 ++++--- lib/routes/nymity/censorbib.ts | 6 ++-- lib/routes/nytimes/book.ts | 6 ++-- lib/routes/nytimes/daily-briefing-chinese.ts | 7 +++-- lib/routes/nytimes/index.ts | 11 +++++--- lib/routes/nytimes/rss.ts | 8 ++++-- lib/routes/nytimes/utils.ts | 3 +- lib/routes/obsidian/plugins.ts | 3 +- lib/routes/obsidian/publish.ts | 8 ++++-- lib/routes/oceanengine/arithmetic-index.ts | 21 +++++++------- lib/routes/oct0pu5/rss.ts | 2 +- lib/routes/odaily/activity.ts | 8 ++++-- lib/routes/odaily/newsflash.ts | 5 ++-- lib/routes/odaily/post.ts | 8 ++++-- lib/routes/odaily/search-news.ts | 5 ++-- lib/routes/odaily/user.ts | 8 ++++-- lib/routes/oeeee/app/channel.ts | 9 +++--- lib/routes/oeeee/app/reporter.ts | 7 +++-- lib/routes/oeeee/utils.ts | 5 ++-- lib/routes/oeeee/web.ts | 9 +++--- lib/routes/oesw/index.ts | 3 +- lib/routes/oesw/namespace.ts | 2 +- lib/routes/oilchem/index.ts | 10 ++++--- lib/routes/okx/index.ts | 9 +++--- lib/routes/olevod/vod.ts | 3 +- lib/routes/olevod/vodlist.ts | 3 +- lib/routes/ollama/blog.ts | 5 ++-- lib/routes/ollama/models.ts | 5 ++-- lib/routes/oncc/index.ts | 7 +++-- lib/routes/oncc/money18.ts | 11 ++++---- lib/routes/onehu/common.ts | 7 +++-- lib/routes/onet/news.ts | 12 ++++---- lib/routes/onet/utils.ts | 3 +- lib/routes/oo-software/changelog.ts | 5 ++-- lib/routes/openai/chatgpt.ts | 13 +++++---- lib/routes/openai/common.ts | 10 ++++--- lib/routes/openai/cookbook.ts | 5 ++-- lib/routes/openai/news.ts | 8 ++++-- lib/routes/openai/research.ts | 3 +- lib/routes/openrice/chart.ts | 11 +++++--- lib/routes/openrice/offers.ts | 6 ++-- lib/routes/openrice/promos.ts | 11 +++++--- lib/routes/openrice/voting.ts | 3 +- lib/routes/openwrt/releases.ts | 5 ++-- lib/routes/orcid/index.ts | 4 +-- lib/routes/oreno3d/get-sec-page-data.ts | 3 +- lib/routes/oreno3d/main.ts | 8 ++++-- lib/routes/ornl/all-news.ts | 14 +++++----- lib/routes/oschina/column.ts | 7 ++--- lib/routes/oschina/event.ts | 14 +++++----- lib/routes/oschina/news.ts | 7 +++-- lib/routes/oschina/topic.ts | 5 ++-- lib/routes/oschina/user.ts | 5 ++-- lib/routes/oshwhub/explore.ts | 14 +++++----- lib/routes/osu/beatmaps/latest-ranked.ts | 10 ++++--- lib/routes/osu/beatmaps/packs.ts | 5 ++-- lib/routes/otobanana/cast.ts | 3 +- lib/routes/otobanana/livestream.ts | 3 +- lib/routes/otobanana/timeline.ts | 3 +- lib/routes/otobanana/utils.ts | 3 +- lib/routes/ouc/hqsz.ts | 9 +++--- lib/routes/ouc/it-postgraduate.ts | 5 ++-- lib/routes/ouc/it-tx.ts | 5 ++-- lib/routes/ouc/it.ts | 5 ++-- lib/routes/ouc/jwc.ts | 5 ++-- lib/routes/ouc/jwgl.ts | 5 ++-- lib/routes/ouc/yjs.ts | 5 ++-- lib/routes/oup/index.ts | 7 +++-- lib/routes/outagereport/index.ts | 2 +- lib/routes/p-articles/contributors.ts | 8 ++++-- lib/routes/p-articles/section.ts | 8 ++++-- lib/routes/p-articles/utils.ts | 3 +- lib/routes/pacilution/latest.ts | 7 +++-- lib/routes/panewslab/author.ts | 5 ++-- lib/routes/panewslab/news.ts | 2 +- lib/routes/panewslab/profundity.ts | 5 ++-- lib/routes/panewslab/topic.ts | 5 ++-- lib/routes/papers/category.ts | 16 +++++------ lib/routes/papers/query.ts | 4 +-- lib/routes/paradigm/writing.ts | 5 ++-- lib/routes/parliament.uk/commonslibrary.ts | 3 +- lib/routes/parliament.uk/lordslibrary.ts | 3 +- lib/routes/parliament.uk/petitions.ts | 6 ++-- lib/routes/parliament/section77.ts | 7 +++-- lib/routes/patagonia/new-arrivals.ts | 8 ++++-- lib/routes/patreon/feed.ts | 12 ++++---- lib/routes/paulgraham/article.ts | 5 ++-- lib/routes/pconline/focus.ts | 5 ++-- lib/routes/pencilnews/index.ts | 5 ++-- lib/routes/penguin-random-house/articles.ts | 6 ++-- .../penguin-random-house/thereaddown.ts | 6 ++-- lib/routes/penguin-random-house/utils.ts | 10 ++++--- lib/routes/people/index.ts | 13 +++++---- lib/routes/people/liuyan.ts | 5 ++-- lib/routes/people/xjpjh.ts | 8 ++++-- lib/routes/peopo/topic.ts | 6 ++-- lib/routes/phoronix/index.ts | 14 ++++++---- lib/routes/pianyivps/rss.ts | 4 +-- lib/routes/pianyuan/app.ts | 6 ++-- lib/routes/pianyuan/search.ts | 6 ++-- lib/routes/pianyuan/utils.ts | 4 ++- lib/routes/picnob.info/user.ts | 15 ++++++---- lib/routes/picnob/user.ts | 9 ++++-- lib/routes/picuki/profile.ts | 15 +++++----- lib/routes/pikabu/community.ts | 6 ++-- lib/routes/pikabu/user.ts | 6 ++-- lib/routes/pikabu/utils.ts | 3 +- lib/routes/pincong/hot.ts | 6 ++-- lib/routes/pincong/index.ts | 6 ++-- lib/routes/pincong/topic.ts | 6 ++-- lib/routes/pingwest/status.ts | 5 ++-- lib/routes/pingwest/tag.ts | 6 ++-- lib/routes/pingwest/user.ts | 6 ++-- lib/routes/pingwest/utils.ts | 1 + lib/routes/pinterest/user.ts | 5 ++-- lib/routes/pixabay/search.ts | 7 +++-- lib/routes/pixelstech/index.ts | 14 +++++----- lib/routes/pixiv/api/get-bookmarks.ts | 5 ++-- lib/routes/pixiv/api/get-illust-detail.ts | 5 ++-- lib/routes/pixiv/api/get-illust-follows.ts | 5 ++-- lib/routes/pixiv/api/get-illusts.ts | 5 ++-- lib/routes/pixiv/api/get-ranking.ts | 6 ++-- lib/routes/pixiv/api/get-user-detail.ts | 5 ++-- lib/routes/pixiv/api/search-illust.ts | 5 ++-- lib/routes/pixiv/api/search-popular-illust.ts | 5 ++-- lib/routes/pixiv/bookmarks.ts | 11 ++++---- lib/routes/pixiv/illustfollow.ts | 13 +++++---- lib/routes/pixiv/novel-api/content/nsfw.ts | 12 ++++---- lib/routes/pixiv/novel-api/content/sfw.ts | 9 +++--- lib/routes/pixiv/novel-api/content/utils.ts | 4 ++- lib/routes/pixiv/novel-api/series/nsfw.ts | 20 +++++++------ lib/routes/pixiv/novel-api/series/sfw.ts | 8 ++++-- .../pixiv/novel-api/user-novels/nsfw.ts | 18 ++++++------ lib/routes/pixiv/novel-api/user-novels/sfw.ts | 3 +- lib/routes/pixiv/novel-series.ts | 7 +++-- lib/routes/pixiv/novels.ts | 8 ++++-- lib/routes/pixiv/pixiv-got.ts | 4 ++- lib/routes/pixiv/ranking.ts | 14 ++++++---- lib/routes/pixiv/search.ts | 16 ++++++----- lib/routes/pixiv/token.ts | 3 +- lib/routes/pixiv/user.ts | 14 ++++++---- lib/routes/pixivision/index.ts | 7 +++-- lib/routes/pixivision/utils.ts | 3 +- lib/routes/piyao/jrpy.ts | 5 ++-- lib/routes/pkmer/recent.ts | 5 ++-- lib/routes/pku/bbs/hot.ts | 7 +++-- lib/routes/pku/cls/announcement.ts | 5 ++-- lib/routes/pku/cls/lecture.ts | 5 ++-- lib/routes/pku/eecs.ts | 5 ++-- lib/routes/pku/hr.ts | 5 ++-- lib/routes/pku/nsd.ts | 7 +++-- lib/routes/pku/pkuyjs.ts | 5 ++-- lib/routes/pku/rccp/mzyt.ts | 6 ++-- lib/routes/pku/scc/recruit.ts | 5 ++-- lib/routes/pku/ss/admission.ts | 5 ++-- lib/routes/pku/ss/common.ts | 5 ++-- lib/routes/pku/ss/notice.ts | 5 ++-- lib/routes/pku/ss/pg-admin.ts | 5 ++-- lib/routes/playno1/av.ts | 7 +++-- lib/routes/playno1/st.ts | 7 +++-- lib/routes/playno1/utils.ts | 6 ++-- lib/routes/playpcesor/rss.ts | 7 +++-- lib/routes/plurk/anonymous.ts | 3 +- lib/routes/plurk/hotlinks.ts | 3 +- lib/routes/plurk/news.ts | 3 +- lib/routes/plurk/search.ts | 6 ++-- lib/routes/plurk/top.ts | 6 ++-- lib/routes/plurk/topic.ts | 7 +++-- lib/routes/plurk/user.ts | 7 +++-- lib/routes/plurk/utils.ts | 3 +- lib/routes/pnas/index.ts | 17 +++++------ lib/routes/podwise/collections.ts | 4 ++- lib/routes/podwise/episodes.ts | 12 ++++---- lib/routes/pornhub/category-url.ts | 10 ++++--- lib/routes/pornhub/category.ts | 6 ++-- lib/routes/pornhub/model.ts | 11 +++++--- lib/routes/pornhub/pornstar.ts | 11 +++++--- lib/routes/pornhub/search.ts | 4 ++- lib/routes/pornhub/users.ts | 10 ++++--- lib/routes/pornhub/utils.ts | 8 ++++-- lib/routes/postman/release-notes.ts | 6 ++-- lib/routes/priconne-redive/news.ts | 9 +++--- lib/routes/producthunt/today.ts | 9 +++--- lib/routes/ps/monthly-games.ts | 10 ++++--- lib/routes/ps/trophy.ts | 5 ++-- lib/routes/psnine/game.ts | 6 ++-- lib/routes/psnine/index.ts | 6 ++-- lib/routes/psnine/node.ts | 8 +++--- lib/routes/psnine/shuzhe.ts | 6 ++-- lib/routes/psnine/trade.ts | 6 ++-- lib/routes/psyche/topic.ts | 4 ++- lib/routes/psyche/type.ts | 6 ++-- lib/routes/psyche/utils.ts | 6 ++-- lib/routes/pts/curations.ts | 7 +++-- lib/routes/pts/index.ts | 13 +++++---- lib/routes/pts/live.ts | 4 +-- lib/routes/pts/projects.ts | 7 +++-- lib/routes/publico/ciencias.ts | 5 ++-- lib/routes/publico/culturas.ts | 5 ++-- lib/routes/publico/economia.ts | 5 ++-- lib/routes/publico/internacional.ts | 5 ++-- lib/routes/publico/mujer.ts | 5 ++-- lib/routes/publico/opinion.ts | 5 ++-- lib/routes/publico/politica.ts | 5 ++-- lib/routes/publico/public.ts | 5 ++-- lib/routes/publico/sociedad.ts | 5 ++-- lib/routes/publico/tremending.ts | 5 ++-- lib/routes/pubmed/trending.ts | 7 +++-- lib/routes/pubscholar/explore.ts | 12 ++++---- lib/routes/pubscholar/utils.ts | 1 + lib/routes/pumc/mdadmission.ts | 5 ++-- lib/routes/putty/changes.ts | 5 ++-- lib/routes/pwc/sustainability.ts | 4 +-- lib/routes/python/release.ts | 9 +++--- lib/routes/qbitai/category.ts | 9 +++--- lib/routes/qbitai/tag.ts | 5 ++-- lib/routes/qbittorrent/news.ts | 7 +++-- lib/routes/qdu/houqin.ts | 7 +++-- lib/routes/qdu/jwc.ts | 7 +++-- lib/routes/qianp/news.ts | 6 ++-- lib/routes/qianzhan/column.ts | 5 ++-- lib/routes/qianzhan/rank.ts | 5 ++-- lib/routes/qiche365/namespace.ts | 1 + lib/routes/qiche365/recall.ts | 5 ++-- lib/routes/qidian/author.ts | 7 +++-- lib/routes/qidian/chapter.ts | 6 ++-- lib/routes/qidian/forum.ts | 5 ++-- lib/routes/qidian/free-next.ts | 5 ++-- lib/routes/qidian/free.ts | 5 ++-- lib/routes/qingting/channel.ts | 4 +-- lib/routes/qingting/podcast.ts | 7 +++-- lib/routes/qipamaijia/index.ts | 5 ++-- lib/routes/qiyoujiage/price.ts | 5 ++-- lib/routes/qlu/notice.ts | 7 +++-- lib/routes/qm120/news.ts | 7 +++-- lib/routes/qoo-app/apps/card.ts | 6 ++-- lib/routes/qoo-app/apps/comment.ts | 18 ++++++------ lib/routes/qoo-app/apps/note.ts | 6 ++-- lib/routes/qoo-app/apps/post.ts | 8 ++++-- lib/routes/qoo-app/news.ts | 7 +++-- lib/routes/qoo-app/notes/note.ts | 16 ++++++----- lib/routes/qoo-app/notes/topic.ts | 8 ++++-- lib/routes/qoo-app/notes/user.ts | 8 ++++-- lib/routes/qoo-app/user/app-comment.ts | 18 ++++++------ lib/routes/qoo-app/utils.ts | 2 +- lib/routes/qq/ac/comic.ts | 7 +++-- lib/routes/qq/ac/rank.ts | 5 ++-- lib/routes/qq/ac/utils.ts | 8 ++++-- lib/routes/qq/cfhd/index.ts | 10 +++---- lib/routes/qq/fact/index.ts | 9 +++--- lib/routes/qq/kg/cache.ts | 3 +- lib/routes/qq/kg/reply.ts | 5 ++-- lib/routes/qq/kg/user.ts | 8 ++++-- lib/routes/qq/lol/news.ts | 11 ++++---- lib/routes/qq/pd/guild.ts | 11 ++++---- lib/routes/qq/pd/utils.ts | 2 +- lib/routes/qq/weread/category.ts | 2 +- lib/routes/qq88/index.ts | 5 ++-- lib/routes/qqorw/index.ts | 7 +++-- lib/routes/qstheory/index.ts | 7 +++-- lib/routes/qstheory/magazine.ts | 7 +++-- lib/routes/qstheory/utils.ts | 3 +- lib/routes/questmobile/report.ts | 7 +++-- lib/routes/questn/community.ts | 4 +-- lib/routes/questn/events.ts | 4 +-- lib/routes/quicker/qa.ts | 7 +++-- lib/routes/quicker/share.ts | 7 +++-- lib/routes/quicker/user.ts | 7 +++-- lib/routes/quicker/versions.ts | 5 ++-- lib/routes/qust/jw.ts | 5 ++-- lib/routes/qweather/3days.ts | 8 ++++-- lib/routes/qweather/now.ts | 9 +++--- lib/routes/qweather/util.tsx | 2 +- lib/routes/qwenlm/blog.ts | 5 ++-- lib/routes/qztc/home/index.ts | 7 +++-- lib/routes/qztc/jwc/index.ts | 7 +++-- lib/routes/qztc/sjxy/index.ts | 7 +++-- lib/routes/radio-canada/latest.ts | 5 ++-- lib/routes/radio/album.ts | 4 +-- lib/routes/radio/index.ts | 4 +-- lib/routes/radio/zhibo.ts | 7 +++-- lib/routes/railway/index.ts | 10 +++---- lib/routes/rarehistoricalphotos/index.ts | 2 +- lib/routes/raspberrypi/magazine.ts | 14 +++++----- lib/routes/rattibha/user.ts | 11 ++++---- lib/routes/rawkuma/manga.ts | 7 +++-- lib/routes/raycast/changelog.ts | 7 +++-- lib/routes/react/blog.ts | 7 +++-- lib/routes/reactiflux/transcripts.ts | 5 ++-- lib/routes/reactnewsletter/reactnewsletter.ts | 8 ++++-- lib/routes/readhub/daily.ts | 9 +++--- lib/routes/readhub/index.ts | 15 +++++----- lib/routes/readhub/util.ts | 8 ++++-- lib/routes/readwise/list.ts | 6 ++-- lib/routes/rebase/geekdaily.ts | 2 +- lib/routes/remnote/changelog.ts | 3 +- lib/routes/researchgate/publications.ts | 5 ++-- lib/routes/resetera/thread.ts | 3 +- lib/routes/resonac/products.ts | 5 ++-- lib/routes/reuters/common.ts | 8 ++++-- lib/routes/reuters/investigates.ts | 6 ++-- lib/routes/rfa/index.ts | 5 ++-- lib/routes/rfi/news.ts | 5 ++-- lib/routes/right/forum.ts | 7 +++-- lib/routes/robots.txt.ts | 1 + lib/routes/rockthejvm/articles.ts | 14 +++++----- lib/routes/rodong/news.ts | 5 ++-- lib/routes/routledge/book-series.ts | 7 +++-- lib/routes/rsc/journal.ts | 9 +++--- lib/routes/rss3/index.ts | 4 +-- lib/routes/rss3/interfaces/metadata.ts | 5 ++-- lib/routes/rsshub/routes.ts | 6 ++-- lib/routes/rsshub/transform/html.ts | 7 +++-- lib/routes/rsshub/transform/json.ts | 5 ++-- lib/routes/rsshub/transform/sitemap.ts | 5 ++-- lib/routes/ruancan/category.ts | 3 +- lib/routes/ruancan/index.ts | 3 +- lib/routes/ruancan/search.ts | 3 +- lib/routes/ruancan/user.ts | 3 +- lib/routes/ruancan/utils.ts | 3 +- lib/routes/ruankao/news.ts | 4 ++- lib/routes/ruc/ai.ts | 7 +++-- lib/routes/ruc/hr.ts | 5 ++-- lib/routes/runtrail/posts.ts | 2 +- lib/routes/rustcc/jobs.ts | 5 ++-- lib/routes/rustcc/news.ts | 5 ++-- lib/routes/sakurazaka46/blog.ts | 7 +++-- lib/routes/sakurazaka46/news.ts | 5 ++-- lib/routes/samd/news.ts | 7 +++-- lib/routes/samrdprc/index.ts | 9 +++--- lib/routes/samrdprc/news.ts | 7 +++-- lib/routes/samsung/research/blog.ts | 5 ++-- lib/routes/sankei/news.ts | 6 ++-- lib/routes/sankei/topics.ts | 6 ++-- lib/routes/sara/index.ts | 5 ++-- lib/routes/saraba1st/digest.ts | 11 ++++---- lib/routes/saraba1st/thread.ts | 5 ++-- lib/routes/sass/gs/index.ts | 5 ++-- lib/routes/scau/yjs.ts | 5 ++-- lib/routes/scau/yjsy.ts | 5 ++-- lib/routes/science/blogs.ts | 10 ++++--- lib/routes/science/cover.ts | 9 +++--- lib/routes/science/current.ts | 9 +++--- lib/routes/science/early.ts | 5 ++-- lib/routes/science/utils.ts | 6 ++-- lib/routes/sciencedirect/call-for-paper.ts | 10 ++++--- lib/routes/sciencedirect/cf-email.ts | 1 - lib/routes/sciencedirect/current-issue.ts | 8 +++--- lib/routes/sciencedirect/journal.ts | 6 ++-- lib/routes/sciencenet/blog.ts | 9 +++--- lib/routes/sciencenet/user.ts | 9 +++--- lib/routes/scientificamerican/podcast.ts | 5 ++-- lib/routes/scitechvista/index.ts | 14 ++++++---- lib/routes/scmp/coronavirus.ts | 3 +- lib/routes/scmp/index.ts | 6 ++-- lib/routes/scmp/topic.ts | 6 ++-- lib/routes/scmp/utils.ts | 3 +- lib/routes/scnu/cs/match.ts | 5 ++-- lib/routes/scnu/jw.ts | 5 ++-- lib/routes/scnu/library.ts | 5 ++-- .../physics-school-announcements-and-news.ts | 5 ++-- lib/routes/scnu/ss.ts | 5 ++-- lib/routes/scnu/yjs.ts | 5 ++-- lib/routes/scoop/apps.ts | 12 ++++---- lib/routes/scpta/news.ts | 7 +++-- lib/routes/sctv/programme.ts | 6 ++-- lib/routes/scu/jwc/tzgg.ts | 5 ++-- lib/routes/scu/scupi/_utils.ts | 5 ++-- lib/routes/scu/scupi/notice.ts | 5 ++-- lib/routes/scut/gzic/media.ts | 7 +++-- lib/routes/scut/gzic/news.ts | 7 +++-- lib/routes/scut/gzic/notice.ts | 7 +++-- lib/routes/scut/jwc/news.ts | 7 +++-- lib/routes/scut/jwc/notice.ts | 7 +++-- lib/routes/scut/jwc/school.ts | 7 +++-- lib/routes/scut/scet/notice.ts | 5 ++-- lib/routes/scut/seie/news-ccenter.ts | 5 ++-- lib/routes/scut/smae/notice.ts | 5 ++-- lib/routes/scut/yjs.ts | 5 ++-- lib/routes/scvtc/xygg.ts | 5 ++-- lib/routes/sdo/ff14risingstones/api.ts | 1 + lib/routes/sdo/ff14risingstones/posts.ts | 8 ++++-- lib/routes/sdo/ff14risingstones/strats.ts | 8 ++++-- lib/routes/sdo/ff14risingstones/timeline.ts | 8 ++++-- .../sdo/ff14risingstones/types/dynamic.ts | 2 +- .../sdo/ff14risingstones/user-dynamics.ts | 8 ++++-- lib/routes/sdo/ff14risingstones/user-posts.ts | 8 ++++-- .../sdo/ff14risingstones/user-resently.ts | 10 ++++--- .../sdo/ff14risingstones/user-strats.ts | 8 ++++-- lib/routes/sdo/ff14risingstones/utils.ts | 14 ++++++---- lib/routes/sdu/cmse.ts | 5 ++-- lib/routes/sdu/cs/index.ts | 5 ++-- lib/routes/sdu/cs/yjsgz.ts | 5 ++-- lib/routes/sdu/epe.ts | 5 ++-- lib/routes/sdu/extractor/index.ts | 4 +-- lib/routes/sdu/extractor/sdrj.ts | 3 +- lib/routes/sdu/extractor/view.ts | 3 +- lib/routes/sdu/extractor/wh/jwc.ts | 3 +- lib/routes/sdu/extractor/wh/news.ts | 3 +- lib/routes/sdu/gjsw.ts | 5 ++-- lib/routes/sdu/mech.ts | 5 ++-- lib/routes/sdu/qd/xszxqd.ts | 5 ++-- lib/routes/sdu/qd/xyb.ts | 5 ++-- lib/routes/sdu/sc.ts | 5 ++-- lib/routes/sdu/wh/jwc.ts | 10 ++++--- lib/routes/sdu/wh/news.ts | 8 ++++-- lib/routes/sdu/ygb.ts | 5 ++-- lib/routes/sdust/yjsy/zhaosheng.ts | 5 ++-- lib/routes/sdzk/index.ts | 5 ++-- lib/routes/sec-in/index.ts | 2 +- lib/routes/sec-wiki/weekly.ts | 2 +- lib/routes/secretsanfrancisco/rss.ts | 10 ++++--- lib/routes/secrss/author.ts | 5 ++-- lib/routes/secrss/category.ts | 5 ++-- lib/routes/seekingalpha/index.ts | 7 +++-- lib/routes/sega/maimaidx.ts | 7 +++-- lib/routes/sega/pjsekai.ts | 8 ++++-- lib/routes/segmentfault/blogs.ts | 5 ++-- lib/routes/segmentfault/channel.ts | 8 ++++-- lib/routes/segmentfault/user.ts | 5 ++-- lib/routes/segmentfault/utils.ts | 8 ++++-- lib/routes/sehuatang/index.ts | 7 +++-- lib/routes/sehuatang/user.ts | 9 +++--- lib/routes/sensortower/blog.ts | 7 +++-- lib/routes/setn/index.ts | 7 +++-- lib/routes/seu/cse/index.ts | 5 ++-- lib/routes/seu/cyber/index.ts | 5 ++-- lib/routes/seu/radio/academic.ts | 5 ++-- lib/routes/seu/yjs.ts | 5 ++-- lib/routes/seu/yzb/index.ts | 5 ++-- lib/routes/sfacg/novel-chapter.ts | 5 ++-- lib/routes/shcstheatre/programs.ts | 9 +++--- lib/routes/shiep/index.ts | 12 ++++---- lib/routes/shisu/en.ts | 5 ++-- lib/routes/shisu/news.ts | 5 ++-- lib/routes/shmeea/index.ts | 7 +++-- lib/routes/shmeea/self-study.ts | 5 ++-- lib/routes/shmtu/jwc.ts | 6 ++-- lib/routes/shmtu/portal.ts | 9 +++--- lib/routes/shmtu/www.ts | 6 ++-- lib/routes/shoac/recent-show.ts | 6 ++-- lib/routes/shopback/store.ts | 5 ++-- lib/routes/shopify/apps/[handle].reviews.ts | 10 ++++--- lib/routes/shopify/apps/search.ts | 8 ++++-- lib/routes/shoppingdesign/posts.ts | 7 +++-- lib/routes/showstart/artist.ts | 8 ++++-- lib/routes/showstart/brand.ts | 8 ++++-- lib/routes/showstart/event.ts | 8 ++++-- lib/routes/showstart/search.ts | 8 ++++-- lib/routes/showstart/service.ts | 2 +- lib/routes/showstart/site.ts | 8 ++++-- lib/routes/showstart/utils.ts | 2 +- lib/routes/shu/global.ts | 5 ++-- lib/routes/shu/gs.ts | 5 ++-- lib/routes/shu/index.ts | 5 ++-- lib/routes/shu/jwb.ts | 5 ++-- lib/routes/shu/society.ts | 5 ++-- lib/routes/shu/xxgk.ts | 5 ++-- lib/routes/shu/xykd.ts | 5 ++-- lib/routes/shuiguopai/index.ts | 9 +++--- lib/routes/sicau/dky.ts | 5 ++-- lib/routes/sicau/jiaowu.ts | 7 +++-- lib/routes/sicau/jk.ts | 4 +-- lib/routes/sicau/yan.ts | 5 ++-- lib/routes/sicau/zsjy.ts | 5 ++-- lib/routes/sigsac/ccs.ts | 8 ++++-- lib/routes/simpleinfo/index.ts | 11 ++++---- lib/routes/sina/chuangshiji.ts | 5 ++-- lib/routes/sina/discovery.ts | 5 ++-- lib/routes/sina/finance/china.ts | 5 ++-- lib/routes/sina/finance/stock/usstock.ts | 3 +- lib/routes/sina/rollnews.ts | 5 ++-- lib/routes/sina/sports.ts | 6 ++-- lib/routes/sina/utils.ts | 14 ++++++---- lib/routes/sinchew/index.ts | 13 +++++---- lib/routes/sis001/author.ts | 10 ++++--- lib/routes/sis001/common.ts | 11 ++++---- lib/routes/sis001/forum.ts | 10 ++++--- lib/routes/sjtu/gs.ts | 5 ++-- lib/routes/sjtu/jwc.ts | 5 ++-- lib/routes/sjtu/seiee/icisee.ts | 7 +++-- lib/routes/sjtu/seiee/index.ts | 7 +++-- lib/routes/sjtu/seiee/utils.ts | 3 +- lib/routes/sjtu/tongqu/activity.ts | 4 +-- lib/routes/sjtu/yzb/zkxx.ts | 7 +++-- lib/routes/skeb/following-creators.ts | 3 +- lib/routes/skeb/following-works.ts | 3 +- lib/routes/skeb/friend-works.ts | 3 +- lib/routes/skeb/index.ts | 9 +++--- lib/routes/skeb/search.ts | 7 +++-- lib/routes/skeb/utils.ts | 5 ++-- lib/routes/skeb/works.ts | 7 +++-- lib/routes/skebetter/illust.ts | 7 +++-- lib/routes/skebetter/index.ts | 7 +++-- lib/routes/skebetter/manga.ts | 7 +++-- lib/routes/skebetter/utils.ts | 2 +- lib/routes/sketis/isabelle-dev/blog/index.ts | 5 ++-- lib/routes/skysports/news.ts | 5 ++-- lib/routes/slowmist/slowmist.ts | 5 ++-- lib/routes/smartlink/index.ts | 2 +- lib/routes/smashingmagazine/category.ts | 5 ++-- lib/routes/smzdm/article.ts | 10 ++++--- lib/routes/smzdm/baoliao.ts | 10 ++++--- lib/routes/smzdm/haowen-fenlei.ts | 13 +++++---- lib/routes/smzdm/haowen.ts | 10 ++++--- lib/routes/smzdm/keyword.ts | 11 +++++--- lib/routes/smzdm/product.ts | 12 ++++---- lib/routes/smzdm/ranking.ts | 6 ++-- lib/routes/snowpeak/us-new-arrivals.ts | 8 ++++-- lib/routes/sobooks/date.ts | 3 +- lib/routes/sobooks/index.ts | 3 +- lib/routes/sobooks/tag.ts | 3 +- lib/routes/sobooks/utils.ts | 3 +- lib/routes/sogou/doodles.ts | 2 +- lib/routes/sogou/search.ts | 11 ++++---- lib/routes/sohu/mobile.ts | 7 +++-- lib/routes/sohu/mp.ts | 11 ++++---- lib/routes/solidot/_article.ts | 3 +- lib/routes/solidot/main.ts | 13 +++++---- lib/routes/sony/downloads.ts | 6 ++-- lib/routes/sorrycc/index.ts | 12 ++++---- lib/routes/sotwe/user.ts | 13 +++++---- lib/routes/soundofhope/channel.ts | 5 ++-- lib/routes/soundon/podcast.ts | 6 ++-- lib/routes/sourceforge/index.ts | 5 ++-- lib/routes/southcn/nfapp/column.ts | 7 +++-- lib/routes/southcn/nfapp/reporter.ts | 7 +++-- lib/routes/southcn/nfapp/utils.ts | 3 +- lib/routes/spankbang/new-videos.ts | 13 +++++---- lib/routes/spglobal/ratings.ts | 5 ++-- lib/routes/spotify/artist.ts | 8 ++++-- lib/routes/spotify/artists-top.ts | 5 ++-- lib/routes/spotify/playlist.ts | 8 ++++-- lib/routes/spotify/saved.ts | 7 +++-- lib/routes/spotify/show.ts | 6 ++-- lib/routes/spotify/tracks-top.ts | 5 ++-- lib/routes/springer/journal.ts | 9 +++--- lib/routes/sputniknews/index.ts | 5 ++-- lib/routes/sqmc/www.ts | 7 +++-- lib/routes/sse/convert.ts | 2 +- lib/routes/sse/disclosure.ts | 2 +- lib/routes/sse/inquire.ts | 4 +-- lib/routes/sse/renewal.ts | 13 +++++---- lib/routes/sse/sselawsrules.ts | 6 ++-- lib/routes/ssm/news.ts | 11 ++++---- lib/routes/sspai/activity.ts | 2 +- lib/routes/sspai/author.ts | 2 +- lib/routes/sspai/bookmarks.ts | 2 +- lib/routes/sspai/column.ts | 2 +- lib/routes/sspai/index.ts | 3 +- lib/routes/sspai/matrix.ts | 2 +- lib/routes/sspai/prime-community.ts | 2 +- lib/routes/sspai/series-update.ts | 2 +- lib/routes/sspai/series.ts | 5 ++-- lib/routes/sspai/shortcuts-gallery.ts | 2 +- lib/routes/sspai/tag.ts | 2 +- lib/routes/sspai/topic.ts | 2 +- lib/routes/sspai/topics.ts | 2 +- lib/routes/sspu/jwc.ts | 5 ++-- lib/routes/sspu/pe.ts | 5 ++-- lib/routes/stanford/blog.ts | 5 ++-- lib/routes/startuplatte/index.ts | 5 ++-- lib/routes/stbu/jsjxy.ts | 7 +++-- lib/routes/stbu/xyxw.ts | 7 +++-- lib/routes/stcn/index.ts | 9 +++--- lib/routes/stcn/kx.ts | 7 ++--- lib/routes/stcn/rank.ts | 7 ++--- lib/routes/stdaily/digitalpaper.ts | 19 +++++++------ lib/routes/steam/appcommunityfeed.ts | 4 +-- lib/routes/steam/curator.ts | 10 ++++--- lib/routes/steam/news.ts | 12 ++++---- lib/routes/steam/search.ts | 3 +- lib/routes/steam/sharefile-changelog.ts | 5 ++-- lib/routes/steam/workshop-search.ts | 11 ++++---- lib/routes/stheadline/std/realtime.ts | 5 ++-- lib/routes/stockedge/daily-news.ts | 4 ++- lib/routes/stockedge/utils.ts | 2 +- lib/routes/storm/channel.ts | 5 ++-- lib/routes/storm/index.ts | 5 ++-- lib/routes/storyfm/episodes.ts | 7 +++-- lib/routes/storyfm/index.ts | 5 ++-- lib/routes/straitstimes/index.ts | 5 ++-- lib/routes/stratechery/index.ts | 2 +- lib/routes/stream-capital/search.ts | 9 +++--- lib/routes/studygolang/go.ts | 3 +- lib/routes/studygolang/jobs.ts | 3 +- lib/routes/studygolang/utils.ts | 8 ++++-- lib/routes/studygolang/weekly.ts | 3 +- lib/routes/subhd/index.ts | 7 +++-- lib/routes/substack/subscribe.ts | 11 ++++---- lib/routes/supchina/index.ts | 5 ++-- lib/routes/supchina/podcasts.ts | 5 ++-- lib/routes/surfshark/blog.ts | 14 +++++----- lib/routes/sustainabilitymag/articles.ts | 5 ++-- lib/routes/sustech/bidding.ts | 5 ++-- lib/routes/sustech/newshub-zh.ts | 5 ++-- lib/routes/sustech/yjs.ts | 2 +- lib/routes/swissinfo/index.ts | 5 ++-- lib/routes/swjtu/gsee/yjs.ts | 5 ++-- lib/routes/swjtu/jtys/yjs.ts | 5 ++-- lib/routes/swjtu/jwc.ts | 5 ++-- lib/routes/swjtu/jyzpxx.ts | 5 ++-- lib/routes/swjtu/scai.ts | 7 +++-- lib/routes/swjtu/sports.ts | 7 +++-- lib/routes/swjtu/utils.ts | 7 +++-- lib/routes/swjtu/xg.ts | 7 +++-- lib/routes/swpu/bgw.ts | 10 ++++--- lib/routes/swpu/cjxy.ts | 7 +++-- lib/routes/swpu/dean.ts | 10 ++++--- lib/routes/swpu/dxy.ts | 10 ++++--- lib/routes/swpu/is.ts | 7 +++-- lib/routes/swpu/scs.ts | 10 ++++--- lib/routes/sycl/feeds.ts | 2 +- lib/routes/syosetu/dev.ts | 5 ++-- lib/routes/syosetu/index.ts | 8 ++++-- lib/routes/syosetu/ranking-isekai.ts | 14 ++++++---- lib/routes/syosetu/ranking-r18.ts | 14 ++++++---- lib/routes/syosetu/ranking.ts | 14 ++++++---- lib/routes/syosetu/search.ts | 17 +++++++---- lib/routes/syosetu/utils.ts | 12 ++++---- lib/routes/sysu/cse.ts | 5 ++-- lib/routes/sysu/ygafz.ts | 5 ++-- lib/routes/szftedu/dongtai.ts | 5 ++-- lib/routes/szftedu/gonggao.ts | 5 ++-- lib/routes/szse/disclosure/listed-notice.ts | 6 ++-- lib/routes/szse/inquire.ts | 4 +-- lib/routes/szse/notice.ts | 9 ++++-- lib/routes/szse/projectdynamic.ts | 6 ++-- lib/routes/szse/rule.ts | 4 +-- lib/routes/szu/yz/index.ts | 6 ++-- lib/routes/szu/yz/utils.ts | 1 + lib/routes/t66y/index.ts | 6 ++-- lib/routes/t66y/post.ts | 6 ++-- lib/routes/tableau/viz-of-the-day.ts | 2 +- lib/routes/tailwindcss/blog.ts | 6 ++-- lib/routes/tailwindcss/utils.ts | 10 ++++--- lib/routes/taiwanmobile/rate-plans.ts | 7 +++-- lib/routes/taiwannews/hot.ts | 5 ++-- lib/routes/tangshufang/index.ts | 5 ++-- lib/routes/taobao/mysql.ts | 9 +++--- lib/routes/taobao/zhongchou.ts | 4 +-- lib/routes/taoguba/blog.ts | 8 ++++-- lib/routes/taoguba/index.ts | 8 ++++-- lib/routes/taoguba/util.ts | 7 +++-- lib/routes/taptap/changelog-cn.ts | 3 +- lib/routes/taptap/changelog-intl.ts | 3 +- lib/routes/taptap/common/changelog.ts | 3 +- lib/routes/taptap/common/review.ts | 3 +- lib/routes/taptap/review-cn.ts | 3 +- lib/routes/taptap/review-intl.ts | 3 +- lib/routes/taptap/topic.ts | 5 ++-- lib/routes/taptap/utils.ts | 13 +++++---- lib/routes/tass/news.ts | 5 ++-- lib/routes/techcrunch/category.ts | 8 ++++-- lib/routes/techcrunch/news.ts | 8 ++++-- lib/routes/techflowpost/express.ts | 10 ++++--- lib/routes/techflowpost/index.ts | 5 ++-- lib/routes/techpowerup/index.ts | 8 ++++-- lib/routes/techpowerup/review.ts | 8 ++++-- lib/routes/techpowerup/utils.ts | 7 +++-- lib/routes/techsir/index.ts | 4 +-- lib/routes/telecompaper/news.ts | 8 +++--- lib/routes/telecompaper/search.ts | 5 ++-- lib/routes/telegram/blog.ts | 6 ++-- lib/routes/telegram/channel-media.ts | 21 ++++++++------ lib/routes/telegram/channel.ts | 18 +++++++----- lib/routes/telegram/stickerpack.ts | 5 ++-- lib/routes/telegram/stories.ts | 10 ++++--- lib/routes/telegram/tglib/channel.ts | 12 ++++---- lib/routes/telegram/tglib/client.ts | 2 +- lib/routes/tencent/cloud/developer/column.ts | 4 +-- lib/routes/tencent/news/author.ts | 9 +++--- lib/routes/tencent/news/coronavirus/data.ts | 9 +++--- lib/routes/tencent/news/coronavirus/total.ts | 7 +++-- lib/routes/tencent/pvp/newsindex.ts | 3 +- lib/routes/tencent/qq/sdk/changelog.ts | 7 +++-- lib/routes/tesla/cx.ts | 7 +++-- lib/routes/tesla/price/get-price.ts | 3 +- lib/routes/tesla/price/index.ts | 3 +- lib/routes/test/api-index.ts | 2 +- lib/routes/test/index.ts | 12 ++++---- lib/routes/tfc-taiwan/category.ts | 7 +++-- lib/routes/tfc-taiwan/index.ts | 5 ++-- lib/routes/tfc-taiwan/utils.ts | 2 +- lib/routes/tgbus/list.ts | 6 ++-- lib/routes/tgbus/utils.ts | 3 +- lib/routes/the/index.ts | 15 +++++----- lib/routes/the/util.ts | 3 +- lib/routes/theatlantic/news.ts | 7 +++-- lib/routes/theatlantic/utils.ts | 8 ++++-- lib/routes/theblock/index.ts | 7 +++-- lib/routes/theblockbeats/index.ts | 9 ++++-- lib/routes/thecover/channel.ts | 6 ++-- lib/routes/thegadgetflow/rss.ts | 10 ++++--- lib/routes/thegradient/index.ts | 7 +++-- lib/routes/thehindu/topic.ts | 5 ++-- lib/routes/theinitium/app.ts | 12 ++++---- lib/routes/theinitium/author.ts | 3 +- lib/routes/theinitium/channel.ts | 3 +- lib/routes/theinitium/follow.ts | 3 +- lib/routes/theinitium/tags.ts | 3 +- lib/routes/theinitium/utils.ts | 11 ++++---- lib/routes/themoviedb/collection.ts | 3 +- lib/routes/themoviedb/episodes.ts | 3 +- lib/routes/themoviedb/seasons.ts | 4 ++- lib/routes/themoviedb/sheet.ts | 3 +- lib/routes/themoviedb/trending.ts | 3 +- lib/routes/themoviedb/utils.ts | 3 +- lib/routes/thenewslens/index.ts | 11 ++++---- lib/routes/thepaper/839studio/category.ts | 5 ++-- lib/routes/thepaper/839studio/studio.ts | 5 ++-- lib/routes/thepaper/channel.ts | 6 ++-- lib/routes/thepaper/factpaper.ts | 6 ++-- lib/routes/thepaper/featured.ts | 6 ++-- lib/routes/thepaper/list.ts | 6 ++-- lib/routes/thepaper/sidebar.ts | 5 ++-- lib/routes/thepaper/user.ts | 5 ++-- lib/routes/thepaper/utils.ts | 12 ++++---- lib/routes/thepetcity/index.ts | 3 +- lib/routes/theverge/index.ts | 10 ++++--- lib/routes/thewirehindi/category.ts | 3 +- lib/routes/thewirehindi/index.ts | 3 +- lib/routes/thewirehindi/utils.ts | 5 ++-- lib/routes/thoughtco/index.ts | 7 +++-- lib/routes/thoughtworks/index.ts | 2 +- lib/routes/threads/index.ts | 9 ++++-- lib/routes/threads/utils.ts | 9 +++--- lib/routes/thwiki/index.ts | 5 ++-- lib/routes/thzt/index.ts | 4 +-- lib/routes/tidb/blog.ts | 7 ++--- lib/routes/tiddlywiki/releases.ts | 4 +-- lib/routes/tiktok/user.ts | 14 +++++----- lib/routes/timednews/news.ts | 5 ++-- lib/routes/tingshuitz/changsha.ts | 6 ++-- lib/routes/tingshuitz/dalian.ts | 5 ++-- lib/routes/tingshuitz/dongguan.ts | 5 ++-- lib/routes/tingshuitz/guangzhou.ts | 2 +- lib/routes/tingshuitz/hangzhou.ts | 5 ++-- lib/routes/tingshuitz/nanjing.ts | 6 ++-- lib/routes/tingshuitz/shenzhen.ts | 6 ++-- lib/routes/tingshuitz/wuhan.ts | 3 +- lib/routes/tingshuitz/xian.ts | 5 ++-- lib/routes/tingshuitz/xiaoshan.ts | 5 ++-- lib/routes/tingshuitz/yangjiang.ts | 5 ++-- lib/routes/tingtingfm/program.ts | 10 ++++--- lib/routes/tisi/index.ts | 5 ++-- lib/routes/tju/cic/index.ts | 5 ++-- lib/routes/tju/news/index.ts | 5 ++-- lib/routes/tju/oaa/index.ts | 7 +++-- lib/routes/tju/yzb/index.ts | 7 +++-- lib/routes/tkww/index.ts | 6 ++-- lib/routes/tmtpost/column.ts | 6 ++-- lib/routes/tmtpost/new.ts | 6 ++-- lib/routes/tmtpost/nictation.ts | 2 +- lib/routes/tmtpost/util.ts | 12 ++++---- lib/routes/tokeninsight/blog.ts | 6 ++-- lib/routes/tokeninsight/bulletin.ts | 6 ++-- lib/routes/tokeninsight/report.ts | 6 ++-- lib/routes/tongji/bks.ts | 5 ++-- lib/routes/tongji/gs.ts | 7 +++-- lib/routes/tongji/sem/_utils.ts | 5 ++-- lib/routes/tongji/sem/notice.ts | 5 ++-- lib/routes/tongji/sse/_article.ts | 3 +- lib/routes/tongji/sse/notice.ts | 10 +++---- lib/routes/tongji/yjs.ts | 7 +++-- lib/routes/tongli/news.ts | 5 ++-- lib/routes/toodaylab/index.ts | 7 +++-- lib/routes/tophub/index.ts | 5 ++-- lib/routes/tophub/list.ts | 13 +++++---- lib/routes/topys/index.ts | 5 ++-- lib/routes/toranoana/news.ts | 5 ++-- lib/routes/toutiao/user.ts | 16 ++++++----- lib/routes/towardsdatascience/latest.ts | 7 +++-- lib/routes/tradingview/blog.ts | 9 +++--- lib/routes/tradingview/desktop.ts | 7 +++-- lib/routes/tradingview/pine.ts | 5 ++-- lib/routes/transcriptforest/index.ts | 7 +++-- lib/routes/transformer-circuits/index.ts | 12 ++++---- lib/routes/trendforce/new.ts | 9 +++--- lib/routes/trendingpapers/papers.ts | 2 +- lib/routes/tribalfootball/latest.ts | 9 +++--- lib/routes/trow/portal.ts | 5 ++-- lib/routes/tsdm39/bd.ts | 9 +++--- lib/routes/tsinghua/lib/tzgg.ts | 5 ++-- lib/routes/tsinghua/lib/zydt.ts | 4 +-- lib/routes/tsinghua/news.ts | 5 ++-- lib/routes/ttv/index.ts | 10 +++---- lib/routes/tumblr/posts.ts | 8 ++++-- lib/routes/tumblr/utils.ts | 6 ++-- lib/routes/tvb/news.ts | 4 +-- lib/routes/tver/series.ts | 5 ++-- lib/routes/tvtropes/featured.ts | 11 ++++---- lib/routes/twitch/live.ts | 3 +- lib/routes/twitch/schedule.ts | 2 +- lib/routes/twitch/video.ts | 3 +- lib/routes/twitter/api/index.ts | 3 +- lib/routes/twitter/api/mobile-api/api.ts | 14 ++++++---- .../twitter/api/mobile-api/constants.ts | 2 +- lib/routes/twitter/api/mobile-api/login.ts | 15 ++++++---- lib/routes/twitter/api/mobile-api/token.ts | 3 +- lib/routes/twitter/api/web-api/api.ts | 7 +++-- lib/routes/twitter/api/web-api/constants.ts | 2 +- lib/routes/twitter/api/web-api/login.ts | 9 +++--- lib/routes/twitter/api/web-api/utils.ts | 12 ++++---- lib/routes/twitter/home-latest.ts | 5 ++-- lib/routes/twitter/home.ts | 5 ++-- lib/routes/twitter/keyword.ts | 4 ++- lib/routes/twitter/likes.ts | 5 ++-- lib/routes/twitter/list.ts | 3 +- lib/routes/twitter/media.ts | 6 ++-- lib/routes/twitter/trends.ts | 5 ++-- lib/routes/twitter/tweet.ts | 7 +++-- lib/routes/twitter/user.ts | 8 ++++-- lib/routes/twitter/utils.ts | 6 ++-- lib/routes/twreporter/category.ts | 2 +- lib/routes/twreporter/fetch-article.ts | 3 +- lib/routes/twreporter/newest.ts | 2 +- lib/routes/txks/news.ts | 3 +- lib/routes/txrjy/fornumtopic.ts | 11 ++++---- lib/routes/tynu/tynu.ts | 6 ++-- lib/routes/typora/changelog-dev.ts | 5 ++-- lib/routes/typora/changelog.ts | 5 ++-- lib/routes/typst/universe.ts | 10 ++++--- lib/routes/u3c3/index.ts | 5 ++-- lib/routes/u9a9/index.ts | 5 ++-- lib/routes/uber/blog.ts | 5 ++-- lib/routes/ucas/ai.ts | 5 ++-- lib/routes/ucas/index.ts | 5 ++-- lib/routes/uchicago/current.ts | 9 +++--- lib/routes/udn/breaking-news.ts | 9 +++--- lib/routes/udn/global/index.ts | 7 +++-- lib/routes/udn/global/tag.ts | 5 ++-- lib/routes/uestc/auto.ts | 3 +- lib/routes/uestc/bbs.ts | 11 ++++---- lib/routes/uestc/cqe.ts | 5 ++-- lib/routes/uestc/gr.ts | 9 +++--- lib/routes/uestc/jwc.ts | 9 +++--- lib/routes/uestc/news.ts | 7 +++-- lib/routes/uestc/scse.ts | 5 ++-- lib/routes/uestc/sice.ts | 5 ++-- lib/routes/uestc/sise.ts | 7 +++-- lib/routes/uibe/hr.ts | 5 ++-- lib/routes/ulapia/index.ts | 5 ++-- lib/routes/ulapia/research.ts | 5 ++-- lib/routes/unipd/ilbolive/news.ts | 7 +++-- lib/routes/uniqlo/new.ts | 2 +- lib/routes/unraid/community-apps.ts | 2 +- lib/routes/unusualwhales/news.ts | 2 +- lib/routes/upc/jsj.ts | 6 ++-- lib/routes/upc/jwc.ts | 7 +++-- lib/routes/upc/main.ts | 5 ++-- lib/routes/upc/yjs.ts | 5 ++-- lib/routes/ups/track.ts | 3 +- lib/routes/uptimerobot/rss.ts | 11 ++++---- lib/routes/uraaka-joshi/uraaka-joshi-user.ts | 7 +++-- lib/routes/uraaka-joshi/uraaka-joshi.ts | 3 +- lib/routes/urbandictionary/random.ts | 4 +-- lib/routes/usenix/loginonline.ts | 5 ++-- lib/routes/usenix/usenix.ts | 8 ++++-- lib/routes/usepanda/index.ts | 2 +- lib/routes/ustb/tj/news.ts | 5 ++-- lib/routes/ustb/yjsy/news.ts | 5 ++-- lib/routes/ustb/yzxc/tzgg.ts | 5 ++-- lib/routes/ustc/eeis.ts | 7 +++-- lib/routes/ustc/gs.ts | 7 +++-- lib/routes/ustc/index.ts | 5 ++-- lib/routes/ustc/job.ts | 2 +- lib/routes/ustc/jwc.ts | 6 ++-- lib/routes/ustc/math.ts | 7 +++-- lib/routes/ustc/scms.ts | 5 ++-- lib/routes/ustc/sist.ts | 7 +++-- lib/routes/usts/jwch.ts | 5 ++-- lib/routes/utgd/category.ts | 6 ++-- lib/routes/utgd/timeline.ts | 6 ++-- lib/routes/utgd/topic.ts | 8 +++--- lib/routes/utgd/utils.ts | 9 ++++-- lib/routes/uw/gix/news.ts | 5 ++-- lib/routes/v1tx/index.ts | 5 ++-- lib/routes/v2ex/post.ts | 2 +- lib/routes/v2ex/tab.ts | 6 ++-- lib/routes/v2ex/topics.ts | 3 +- lib/routes/v2ex/xna.ts | 6 ++-- lib/routes/v2rayshare/index.ts | 2 +- lib/routes/vcb-s/category.ts | 4 +-- lib/routes/vcb-s/index.ts | 4 +-- lib/routes/verfghbw/press.ts | 5 ++-- lib/routes/vertikal/latest.ts | 7 +++-- lib/routes/vice/topic.ts | 12 ++++---- lib/routes/vimeo/category.ts | 8 ++++-- lib/routes/vimeo/channel.ts | 7 +++-- lib/routes/vimeo/usr-videos.ts | 5 ++-- lib/routes/visionias/daily-news-summary.ts | 9 +++--- lib/routes/visionias/monthly-magazine.ts | 9 +++--- lib/routes/visionias/news-today.ts | 9 +++--- lib/routes/visionias/utils.ts | 12 ++++---- lib/routes/visionias/weekly-focus.ts | 8 ++++-- lib/routes/visualstudio/code-blog.ts | 6 ++-- lib/routes/visualstudio/namespace.ts | 2 +- lib/routes/vocus/publication.ts | 5 ++-- lib/routes/vocus/user.ts | 5 ++-- lib/routes/vocus/utils.ts | 5 ++-- lib/routes/vom/featured.ts | 6 ++-- lib/routes/voronoiapp/author.ts | 5 ++-- lib/routes/voronoiapp/common.ts | 5 ++-- lib/routes/voronoiapp/editors-pick.ts | 3 +- lib/routes/voronoiapp/home.ts | 3 +- lib/routes/voronoiapp/latest.ts | 3 +- lib/routes/voronoiapp/popular.ts | 1 + lib/routes/voronoiapp/search.ts | 1 + lib/routes/wabei/index.ts | 5 ++-- lib/routes/wainao/topics.ts | 12 ++++---- lib/routes/wainao/wainao-reads.ts | 2 +- lib/routes/wallhaven/index.ts | 5 ++-- lib/routes/wallpaperhub/index.ts | 4 +-- lib/routes/wallstreetcn/calendar.ts | 2 +- lib/routes/wallstreetcn/hot.ts | 2 +- lib/routes/wallstreetcn/live.ts | 4 +-- lib/routes/wallstreetcn/news.ts | 2 +- lib/routes/wanqu/news.ts | 5 ++-- lib/routes/warhammer-community/namespace.ts | 2 +- lib/routes/warhammer-community/news.ts | 6 ++-- lib/routes/warp/blog.ts | 6 ++-- lib/routes/warp/namespace.ts | 2 +- lib/routes/warthunder/news.ts | 12 ++++---- lib/routes/washingtonpost/app.ts | 16 ++++++----- lib/routes/wbv-gpa/index.ts | 3 +- lib/routes/wchscu/recruit.ts | 8 +++--- lib/routes/wdc/download.ts | 5 ++-- lib/routes/wdfxw/bookfree.ts | 14 +++++----- lib/routes/web/articles.ts | 1 + lib/routes/web/blog.ts | 1 + lib/routes/web/series.ts | 1 + lib/routes/web/utils.ts | 3 +- lib/routes/web3caff/index.ts | 9 +++--- lib/routes/webcatalog/changelog.ts | 5 ++-- lib/routes/wechat/announce.ts | 5 ++-- lib/routes/wechat/ce.ts | 11 ++++---- lib/routes/wechat/data258.ts | 9 +++--- lib/routes/wechat/ershcimi.ts | 7 +++-- lib/routes/wechat/mp.ts | 5 ++-- lib/routes/wechat/msgalbum.ts | 5 ++-- lib/routes/wechat/sogou.ts | 7 +++-- lib/routes/wechat/tgchannel.ts | 5 ++-- lib/routes/wechat/uread.ts | 5 ++-- lib/routes/wechat/wechat2rss.ts | 4 +-- lib/routes/weekendhk/posts.ts | 2 +- lib/routes/weibo/friends.ts | 12 ++++---- lib/routes/weibo/group.ts | 12 ++++---- lib/routes/weibo/keyword.ts | 15 ++++++---- lib/routes/weibo/oasis/user.ts | 3 +- lib/routes/weibo/search/hot.ts | 11 +++++--- lib/routes/weibo/super-index.ts | 8 ++++-- lib/routes/weibo/timeline.ts | 10 ++++--- lib/routes/weibo/user-bookmarks.ts | 14 ++++++---- lib/routes/weibo/user.ts | 13 +++++---- lib/routes/weibo/utils.ts | 12 ++++---- lib/routes/wellcee/rent.ts | 14 ++++++---- lib/routes/wellcee/support-city.ts | 3 +- lib/routes/wellcee/utils.ts | 8 +++--- lib/routes/wenku8/chapter.ts | 5 ++-- lib/routes/wenku8/index.ts | 5 ++-- lib/routes/wenku8/volume.ts | 7 +++-- lib/routes/wfdf/news.ts | 2 +- lib/routes/wfu/jwc.ts | 5 ++-- lib/routes/wfu/news.ts | 5 ++-- lib/routes/whitehouse/news.ts | 5 ++-- lib/routes/who/news-room.ts | 5 ++-- lib/routes/who/news.ts | 2 +- lib/routes/who/speeches.ts | 5 ++-- lib/routes/whu/cs.ts | 5 ++-- lib/routes/whu/gs/index.ts | 5 ++-- lib/routes/whu/hyxt.ts | 7 +++-- lib/routes/whu/news.ts | 17 +++++------ lib/routes/whu/rsgis.ts | 10 ++++--- lib/routes/whu/swrh.ts | 7 +++-- lib/routes/whu/util.ts | 10 ++++--- lib/routes/wiensued/index.ts | 3 +- lib/routes/wikinews/index.ts | 8 ++++-- lib/routes/wikipedia/current-events.ts | 4 +-- lib/routes/windsurf/blog.ts | 12 ++++---- lib/routes/windsurf/changelog.ts | 11 ++++---- lib/routes/winstall/update.ts | 9 +++--- lib/routes/wired/tag.ts | 7 +++-- lib/routes/wise/pair.ts | 12 ++++---- lib/routes/withgoogle/explorables.ts | 5 ++-- lib/routes/wizfile/index.ts | 5 ++-- lib/routes/wmc-bj/publish.ts | 9 +++--- lib/routes/wmpvp/index.ts | 2 +- lib/routes/wnacg/category.ts | 3 +- lib/routes/wnacg/common.ts | 8 ++++-- lib/routes/wnacg/index.ts | 3 +- lib/routes/wnacg/tag.ts | 3 +- lib/routes/wohnnet/index.ts | 3 +- lib/routes/wordpress/index.ts | 10 +++---- lib/routes/wordpress/util.ts | 3 +- lib/routes/worldjournal/index.ts | 5 ++-- lib/routes/worldofwarships/devblog.ts | 7 +++-- lib/routes/woshipm/popular.ts | 3 +- lib/routes/woshipm/user-article.ts | 6 ++-- lib/routes/woshipm/utils.ts | 3 +- lib/routes/woshipm/wen.ts | 8 ++++-- lib/routes/wsj/news.ts | 9 ++++-- lib/routes/wsj/utils.ts | 8 ++++-- lib/routes/wsyu/news.ts | 8 ++++-- lib/routes/wtu/index.ts | 2 +- lib/routes/wtu/job.ts | 8 ++++-- lib/routes/wufazhuce/one.ts | 3 +- lib/routes/wyzxwk/article.ts | 5 ++-- lib/routes/wzu/news.ts | 8 ++++-- lib/routes/x-mol/news.ts | 12 ++++---- lib/routes/x-mol/paper.ts | 10 ++++--- lib/routes/x6d/index.ts | 6 ++-- lib/routes/xaufe/jiaowu.ts | 5 ++-- lib/routes/xaut/index.ts | 7 +++-- lib/routes/xaut/jwc.ts | 5 ++-- lib/routes/xaut/rsc.ts | 5 ++-- lib/routes/xbmu/academic.ts | 5 ++-- lib/routes/xbmu/announcement.ts | 5 ++-- lib/routes/xbookcn/blog.ts | 5 ++-- lib/routes/xboxfan/news.ts | 7 +++-- lib/routes/xianbao/index.ts | 2 +- lib/routes/xiaoheihe/add2cart.ts | 2 +- lib/routes/xiaoheihe/discount.ts | 3 +- lib/routes/xiaoheihe/news.ts | 3 +- lib/routes/xiaoheihe/user.ts | 3 +- lib/routes/xiaohongshu/board.ts | 3 +- lib/routes/xiaohongshu/check-cookie.ts | 3 +- lib/routes/xiaohongshu/user.ts | 12 +++++--- lib/routes/xiaohongshu/util.ts | 11 ++++---- lib/routes/xiaomiyoupin/crowdfunding.ts | 4 +-- lib/routes/xiaomiyoupin/latest.ts | 5 ++-- lib/routes/xiaomiyoupin/utils.ts | 5 ++-- lib/routes/xiaote/index.ts | 2 +- lib/routes/xiaoyuzhou/pickup.ts | 4 +-- lib/routes/xiaoyuzhou/podcast.ts | 8 ++++-- lib/routes/xiaozhuanlan/column.ts | 8 ++++-- lib/routes/xidian/cs.ts | 5 ++-- lib/routes/xidian/gr.ts | 5 ++-- lib/routes/xidian/jwc.ts | 6 ++-- lib/routes/ximalaya/album.ts | 15 ++++++---- lib/routes/ximalaya/utils.ts | 2 +- lib/routes/xinpianchang/index.ts | 5 ++-- lib/routes/xinpianchang/rank.ts | 4 +-- lib/routes/xinpianchang/util.ts | 8 ++++-- lib/routes/xjtu/2yuan/news.ts | 7 +++-- lib/routes/xjtu/dean.ts | 5 ++-- lib/routes/xjtu/dyyy/index.ts | 5 ++-- lib/routes/xjtu/ee-jzxx.ts | 5 ++-- lib/routes/xjtu/ee.ts | 5 ++-- lib/routes/xjtu/gs/tzgg.ts | 5 ++-- lib/routes/xjtu/international.ts | 5 ++-- lib/routes/xjtu/job.ts | 6 ++-- lib/routes/xjtu/std.ts | 9 +++--- lib/routes/xjtu/yz.ts | 7 +++-- lib/routes/xjtu/zs.ts | 9 +++--- lib/routes/xkb/index.ts | 6 ++-- lib/routes/xmanhua/index.ts | 5 ++-- lib/routes/xmnn/epaper.ts | 7 +++-- lib/routes/xmnn/news.ts | 7 +++-- lib/routes/xmu/kydt.ts | 5 ++-- lib/routes/xmut/jwc/bkjw.ts | 6 ++-- lib/routes/xmut/jwc/yjs.ts | 6 ++-- lib/routes/xsijishe/forum.ts | 8 ++++-- lib/routes/xsijishe/rank.ts | 10 ++++--- lib/routes/xueqiu/column.ts | 6 ++-- lib/routes/xueqiu/cookies.ts | 2 +- lib/routes/xueqiu/favorite.ts | 7 +++-- lib/routes/xueqiu/fund.ts | 2 +- lib/routes/xueqiu/hots.ts | 7 +++-- lib/routes/xueqiu/snb.ts | 4 +-- lib/routes/xueqiu/stock-comments.ts | 11 ++++---- lib/routes/xueqiu/stock-info.ts | 7 +++-- lib/routes/xueqiu/timeline.ts | 9 +++--- lib/routes/xueqiu/today.ts | 7 +++-- lib/routes/xueqiu/user-stock.ts | 4 +-- lib/routes/xueqiu/user.ts | 7 +++-- lib/routes/xunhupay/index.ts | 3 +- lib/routes/xwenming/index.ts | 9 +++--- lib/routes/xys/new.ts | 9 +++--- lib/routes/xyu/library.ts | 5 ++-- lib/routes/xyu/notices.ts | 5 ++-- lib/routes/xyzrank/index.ts | 7 +++-- lib/routes/yahoo/news/index.ts | 7 +++-- lib/routes/yahoo/news/listid.ts | 7 +++-- lib/routes/yahoo/news/provider-helper.ts | 7 +++-- lib/routes/yahoo/news/provider.ts | 7 +++-- lib/routes/yahoo/news/utils.ts | 12 ++++---- lib/routes/yamap/articles.ts | 5 ++-- lib/routes/yamibo/bbs/forum.ts | 12 ++++---- lib/routes/yamibo/bbs/thread.ts | 8 ++++-- lib/routes/yamibo/utils.ts | 9 +++--- lib/routes/yande/post.ts | 6 ++-- lib/routes/yangtzeu/dongke.ts | 11 ++++---- lib/routes/ycwb/index.ts | 9 +++--- lib/routes/yenpress/series.ts | 11 ++++---- lib/routes/ygkkk/rss.ts | 5 ++-- lib/routes/yicai/author.ts | 9 +++--- lib/routes/yicai/brief.ts | 4 +-- lib/routes/yicai/carousel.ts | 10 ++++--- lib/routes/yicai/dt.ts | 7 +++-- lib/routes/yicai/feed.ts | 9 +++--- lib/routes/yicai/headline.ts | 5 ++-- lib/routes/yicai/latest.ts | 5 ++-- lib/routes/yicai/news.ts | 4 +-- lib/routes/yicai/utils.ts | 10 ++++--- lib/routes/yicai/video.ts | 4 +-- lib/routes/yicai/vip.ts | 9 +++--- lib/routes/yilinzazhi/index.ts | 6 ++-- lib/routes/yilinzazhi/latest.ts | 8 ++++-- lib/routes/ymgal/article.ts | 7 +++-- lib/routes/ymgal/game.ts | 7 +++-- lib/routes/yna/index.ts | 7 +++-- lib/routes/ynet/list.ts | 9 +++--- lib/routes/yoasobi-music/info.ts | 7 +++-- lib/routes/yoasobi-music/live.ts | 11 ++++---- lib/routes/yoasobi-music/media.ts | 11 ++++---- lib/routes/yomiuri/news.ts | 7 +++-- lib/routes/yomujp/level.ts | 5 ++-- lib/routes/youku/channel.ts | 7 +++-- lib/routes/youmemark/index.ts | 5 ++-- lib/routes/youtube/api/google.ts | 23 ++++++++------- lib/routes/youtube/api/subtitles.ts | 3 +- lib/routes/youtube/api/youtubei.ts | 6 ++-- lib/routes/youtube/channel.ts | 7 +++-- lib/routes/youtube/charts.ts | 5 ++-- lib/routes/youtube/community.ts | 8 ++++-- lib/routes/youtube/custom.ts | 14 ++++++---- lib/routes/youtube/live.ts | 14 ++++++---- lib/routes/youtube/playlist.ts | 8 ++++-- lib/routes/youtube/subscriptions.ts | 12 ++++---- lib/routes/youtube/user.ts | 6 ++-- lib/routes/youtube/utils.ts | 9 ++++-- lib/routes/youzhiyouxing/materials.ts | 6 ++-- lib/routes/yuanliao/index.ts | 9 +++--- lib/routes/yuque/book.ts | 8 ++++-- lib/routes/yxdown/news.ts | 10 ++++--- lib/routes/yxdown/recommend.ts | 10 ++++--- lib/routes/yxdown/utils.ts | 2 +- lib/routes/yxdzqb/index.ts | 11 ++++---- lib/routes/yxrb/home.ts | 5 ++-- lib/routes/yyets/article.ts | 6 ++-- lib/routes/yyets/today.ts | 6 ++-- lib/routes/yystv/category.ts | 8 ++++-- lib/routes/yystv/docs.ts | 6 ++-- lib/routes/yystv/fetcher.ts | 2 +- lib/routes/zagg/new-arrivals.ts | 8 ++++-- lib/routes/zaimanhua/comic.ts | 12 ++++---- lib/routes/zaimanhua/namespace.ts | 2 +- lib/routes/zaimanhua/update.ts | 12 ++++---- lib/routes/zaker/channel.ts | 8 ++++-- lib/routes/zaker/focus.ts | 6 ++-- lib/routes/zaker/utils.ts | 14 +++++----- lib/routes/zaobao/interactive.ts | 5 ++-- lib/routes/zaobao/other.ts | 4 ++- lib/routes/zaobao/realtime.ts | 4 ++- lib/routes/zaobao/util.tsx | 10 ++++--- lib/routes/zaobao/zaobao.tsx | 2 +- lib/routes/zaobao/znews.ts | 4 ++- lib/routes/zaozao/article.ts | 4 +-- lib/routes/zcmu/jwc/index.ts | 5 ++-- lib/routes/zcmu/yxy/index.ts | 5 ++-- lib/routes/zcool/discover.ts | 8 ++++-- lib/routes/zcool/top.ts | 8 ++++-- lib/routes/zcool/user.ts | 11 +++++--- lib/routes/zcool/utils.ts | 3 +- lib/routes/zed/blog.ts | 6 ++-- lib/routes/zed/namespace.ts | 2 +- lib/routes/zhibo8/forum.ts | 5 ++-- lib/routes/zhibo8/luxiang.ts | 5 ++-- lib/routes/zhibo8/more.ts | 7 +++-- lib/routes/zhibo8/post.ts | 5 ++-- lib/routes/zhihu/activities.ts | 11 +++++--- lib/routes/zhihu/all-collections.ts | 12 ++++---- lib/routes/zhihu/answers.ts | 5 ++-- lib/routes/zhihu/bookstore/newest.ts | 2 +- lib/routes/zhihu/check-cookie.ts | 2 +- lib/routes/zhihu/collection.ts | 12 ++++---- lib/routes/zhihu/daily-section.ts | 5 ++-- lib/routes/zhihu/daily.ts | 5 ++-- lib/routes/zhihu/hot.ts | 5 ++-- lib/routes/zhihu/pin/daily.ts | 3 +- lib/routes/zhihu/pin/hotlist.ts | 3 +- lib/routes/zhihu/pin/people.ts | 3 +- lib/routes/zhihu/posts.ts | 10 ++++--- lib/routes/zhihu/question.ts | 5 ++-- lib/routes/zhihu/timeline.ts | 9 +++--- lib/routes/zhihu/topic.ts | 5 ++-- lib/routes/zhihu/utils.ts | 10 ++++--- lib/routes/zhihu/weekly.ts | 5 ++-- lib/routes/zhihu/xhu/activities.ts | 7 +++-- lib/routes/zhihu/xhu/answers.ts | 5 ++-- lib/routes/zhihu/xhu/collection.ts | 7 +++-- lib/routes/zhihu/xhu/posts.ts | 5 ++-- lib/routes/zhihu/xhu/question.ts | 7 +++-- lib/routes/zhihu/xhu/topic.ts | 7 +++-- lib/routes/zhihu/xhu/zhuanlan.ts | 8 ++++-- lib/routes/zhihu/zhuanlan.ts | 8 ++++-- lib/routes/zhitongcaijing/index.ts | 8 ++++-- lib/routes/zhiy/letter.ts | 3 +- lib/routes/zhiy/post.ts | 10 ++++--- lib/routes/zhizhuan100/report.ts | 8 ++++-- lib/routes/zhonglun/index.ts | 7 +++-- lib/routes/zhubai/index.ts | 2 +- lib/routes/zhubai/top20.ts | 7 +++-- lib/routes/zhujiceping/rss.ts | 7 +++-- lib/routes/zhuwang/index.ts | 2 +- lib/routes/zimuxia/index.ts | 5 ++-- lib/routes/zimuxia/portfolio.ts | 6 ++-- lib/routes/zjgtjy/index.ts | 2 +- lib/routes/zjol/paper.ts | 7 +++-- lib/routes/zju/career/index.ts | 5 ++-- lib/routes/zju/cse/index.ts | 5 ++-- lib/routes/zju/cst/custom.ts | 5 ++-- lib/routes/zju/cst/index.ts | 5 ++-- lib/routes/zju/grs/index.ts | 5 ++-- lib/routes/zju/list.ts | 6 ++-- lib/routes/zju/physics/index.ts | 5 ++-- lib/routes/zju/sis/index.ts | 5 ++-- lib/routes/zjut/cs/index.ts | 7 +++-- lib/routes/zjut/da/index.ts | 9 +++--- lib/routes/zjut/jwc/index.ts | 7 +++-- lib/routes/zjut/news.ts | 3 +- lib/routes/zjut/www/index.ts | 7 +++-- lib/routes/zjuvag/blog.ts | 5 ++-- lib/routes/zodgame/forum.ts | 8 +++--- lib/routes/zongheng/detail.ts | 5 ++-- lib/routes/zotero/versions.ts | 5 ++-- lib/routes/zrblog/rss.ts | 7 +++-- lib/routes/zsxq/group.ts | 4 ++- lib/routes/zsxq/user.ts | 4 ++- lib/routes/zsxq/utils.ts | 7 +++-- lib/routes/zuel/notice.ts | 5 ++-- lib/routes/zuvio/boards.ts | 3 +- lib/routes/zuvio/student5.ts | 5 ++-- lib/routes/zuvio/utils.ts | 5 ++-- lib/routes/zxcs/novel.ts | 3 +- lib/routes/zyshow/index.ts | 7 +++-- lib/routes/zyw/hot.ts | 2 +- lib/setup.test.ts | 4 +-- lib/utils/cache.test.ts | 3 +- lib/utils/cache/index.ts | 7 +++-- lib/utils/cache/memory.ts | 2 ++ lib/utils/cache/redis.ts | 4 ++- lib/utils/common-config.test.ts | 3 +- lib/utils/common-config.ts | 5 ++-- lib/utils/common-utils.test.ts | 3 +- lib/utils/common-utils.ts | 8 ++++-- lib/utils/git-hash.ts | 2 +- lib/utils/got-deprecated.ts | 8 ++++-- lib/utils/got.test.ts | 7 +++-- lib/utils/got.ts | 2 ++ lib/utils/header-generator.test.ts | 3 +- lib/utils/header-generator.ts | 2 +- lib/utils/helpers.test.ts | 1 + lib/utils/helpers.ts | 3 +- lib/utils/logger.ts | 2 ++ lib/utils/md5.test.ts | 1 + lib/utils/ofetch.test.ts | 5 ++-- lib/utils/ofetch.ts | 5 ++-- lib/utils/otel/metric.ts | 9 +++--- lib/utils/otel/trace.ts | 4 +-- lib/utils/parse-date.test.ts | 5 ++-- lib/utils/proxy/index.ts | 11 ++++---- lib/utils/proxy/multi-proxy.ts | 1 + lib/utils/proxy/pac-proxy.test.ts | 1 + lib/utils/proxy/unify-proxy.test.ts | 1 + lib/utils/puppeteer-utils.test.ts | 7 +++-- lib/utils/puppeteer-utils.ts | 2 +- lib/utils/puppeteer.test.ts | 5 ++-- lib/utils/puppeteer.ts | 7 +++-- lib/utils/readable-social.test.ts | 3 +- lib/utils/readable-social.ts | 2 +- lib/utils/render.ts | 4 +-- lib/utils/request-rewriter.test.ts | 8 ++++-- lib/utils/request-rewriter/fetch.test.ts | 3 +- lib/utils/request-rewriter/fetch.ts | 16 ++++++----- lib/utils/request-rewriter/get.ts | 14 ++++++---- lib/utils/request-rewriter/index.ts | 3 +- lib/utils/rss-parser.test.ts | 1 + lib/utils/rss-parser.ts | 3 +- lib/utils/timezone.test.ts | 1 + lib/utils/valid-host.test.ts | 1 + lib/utils/wait.test.ts | 1 + lib/utils/wechat-mp.test.ts | 6 ++-- lib/utils/wechat-mp.ts | 7 +++-- lib/views/atom.tsx | 3 +- lib/views/error.tsx | 2 +- lib/views/index.tsx | 4 +-- lib/views/json.ts | 2 +- lib/views/rss.tsx | 3 +- lib/views/rss3.test.ts | 1 + plugins/rollup-plugin-art-templates.ts | 3 +- scripts/workflow/build-docs.ts | 7 +++-- scripts/workflow/build-routes.ts | 12 ++++---- scripts/workflow/build-vercel-packagejson.ts | 3 +- tsdown-lib.config.ts | 1 + tsdown-vercel.config.ts | 1 + tsdown.config.ts | 1 + vitest.config.ts | 5 ++-- 3500 files changed, 12723 insertions(+), 9039 deletions(-) diff --git a/lib/api/category/one.ts b/lib/api/category/one.ts index 06cadeb65..a10c535da 100644 --- a/lib/api/category/one.ts +++ b/lib/api/category/one.ts @@ -1,5 +1,7 @@ +import type { RouteHandler} from '@hono/zod-openapi'; +import { createRoute, z } from '@hono/zod-openapi'; + import { namespaces } from '@/registry'; -import { z, createRoute, RouteHandler } from '@hono/zod-openapi'; const categoryList: Record = {}; @@ -78,4 +80,4 @@ const handler: RouteHandler = (ctx) => { return ctx.json(result); }; -export { route, handler }; +export { handler, route }; diff --git a/lib/api/follow/config.ts b/lib/api/follow/config.ts index bb44f94ff..dc002e1fe 100644 --- a/lib/api/follow/config.ts +++ b/lib/api/follow/config.ts @@ -1,6 +1,8 @@ +import type { RouteHandler } from '@hono/zod-openapi'; +import { createRoute } from '@hono/zod-openapi'; + import { config } from '@/config'; -import { createRoute, RouteHandler } from '@hono/zod-openapi'; -import { gitHash, gitDate } from '@/utils/git-hash'; +import { gitDate, gitHash } from '@/utils/git-hash'; const route = createRoute({ method: 'get', @@ -24,4 +26,4 @@ const handler: RouteHandler = (ctx) => gitDate: gitDate?.getTime(), }); -export { route, handler }; +export { handler, route }; diff --git a/lib/api/index.ts b/lib/api/index.ts index 6286a455b..a3f54b971 100644 --- a/lib/api/index.ts +++ b/lib/api/index.ts @@ -1,13 +1,14 @@ // import { route as rulesRoute, handler as rulesHandler } from '@/api/radar/rules'; -import { route as namespaceAllRoute, handler as namespaceAllHandler } from '@/api/namespace/all'; -import { route as namespaceOneRoute, handler as namespaceOneHandler } from '@/api/namespace/one'; -import { route as radarRulesAllRoute, handler as radarRulesAllHandler } from '@/api/radar/rules/all'; -import { route as radarRulesOneRoute, handler as radarRulesOneHandler } from '@/api/radar/rules/one'; -import { route as categoryOneRoute, handler as categoryOneHandler } from '@/api/category/one'; -import { route as followConfigRoute, handler as followConfigHandler } from '@/api/follow/config'; import { OpenAPIHono } from '@hono/zod-openapi'; import { Scalar } from '@scalar/hono-api-reference'; +import { handler as categoryOneHandler, route as categoryOneRoute } from '@/api/category/one'; +import { handler as followConfigHandler, route as followConfigRoute } from '@/api/follow/config'; +import { handler as namespaceAllHandler, route as namespaceAllRoute } from '@/api/namespace/all'; +import { handler as namespaceOneHandler, route as namespaceOneRoute } from '@/api/namespace/one'; +import { handler as radarRulesAllHandler, route as radarRulesAllRoute } from '@/api/radar/rules/all'; +import { handler as radarRulesOneHandler, route as radarRulesOneRoute } from '@/api/radar/rules/one'; + const app = new OpenAPIHono(); app.openapi(namespaceAllRoute, namespaceAllHandler); diff --git a/lib/api/namespace/all.ts b/lib/api/namespace/all.ts index 768d2a0c9..9c08d2775 100644 --- a/lib/api/namespace/all.ts +++ b/lib/api/namespace/all.ts @@ -1,5 +1,7 @@ +import type { RouteHandler } from '@hono/zod-openapi'; +import { createRoute } from '@hono/zod-openapi'; + import { namespaces } from '@/registry'; -import { createRoute, RouteHandler } from '@hono/zod-openapi'; const route = createRoute({ method: 'get', @@ -14,4 +16,4 @@ const route = createRoute({ const handler: RouteHandler = (ctx) => ctx.json(namespaces); -export { route, handler }; +export { handler, route }; diff --git a/lib/api/namespace/one.ts b/lib/api/namespace/one.ts index cd09375ce..289cb78f2 100644 --- a/lib/api/namespace/one.ts +++ b/lib/api/namespace/one.ts @@ -1,5 +1,7 @@ +import type { RouteHandler} from '@hono/zod-openapi'; +import { createRoute, z } from '@hono/zod-openapi'; + import { namespaces } from '@/registry'; -import { z, createRoute, RouteHandler } from '@hono/zod-openapi'; const ParamsSchema = z.object({ namespace: z.string().openapi({ @@ -30,4 +32,4 @@ const handler: RouteHandler = (ctx) => { return ctx.json(namespaces[namespace]); }; -export { route, handler }; +export { handler, route }; diff --git a/lib/api/radar/rules/all.ts b/lib/api/radar/rules/all.ts index 7266a8291..ada23fbc1 100644 --- a/lib/api/radar/rules/all.ts +++ b/lib/api/radar/rules/all.ts @@ -1,7 +1,9 @@ -import { namespaces } from '@/registry'; +import type { RouteHandler } from '@hono/zod-openapi'; +import { createRoute } from '@hono/zod-openapi'; import { parse } from 'tldts'; -import { RadarDomain } from '@/types'; -import { createRoute, RouteHandler } from '@hono/zod-openapi'; + +import { namespaces } from '@/registry'; +import type { RadarDomain } from '@/types'; const radar: { [domain: string]: RadarDomain; @@ -53,4 +55,4 @@ const route = createRoute({ const handler: RouteHandler = (ctx) => ctx.json(radar); -export { route, handler }; +export { handler, route }; diff --git a/lib/api/radar/rules/one.ts b/lib/api/radar/rules/one.ts index 6cf859875..fe11a79e7 100644 --- a/lib/api/radar/rules/one.ts +++ b/lib/api/radar/rules/one.ts @@ -1,7 +1,9 @@ -import { namespaces } from '@/registry'; +import type { RouteHandler} from '@hono/zod-openapi'; +import { createRoute, z } from '@hono/zod-openapi'; import { parse } from 'tldts'; -import { RadarDomain } from '@/types'; -import { z, createRoute, RouteHandler } from '@hono/zod-openapi'; + +import { namespaces } from '@/registry'; +import type { RadarDomain } from '@/types'; const radar: { [domain: string]: RadarDomain; @@ -69,4 +71,4 @@ const handler: RouteHandler = (ctx) => { return ctx.json(radar[domain]); }; -export { route, handler }; +export { handler, route }; diff --git a/lib/app-bootstrap.tsx b/lib/app-bootstrap.tsx index f8b9215e3..c1bd50bc1 100644 --- a/lib/app-bootstrap.tsx +++ b/lib/app-bootstrap.tsx @@ -1,24 +1,22 @@ import { Hono } from 'hono'; - import { compress } from 'hono/compress'; -import mLogger from '@/middleware/logger'; -import cache from '@/middleware/cache'; -import template from '@/middleware/template'; -import sentry from '@/middleware/sentry'; -import accessControl from '@/middleware/access-control'; -import debug from '@/middleware/debug'; -import header from '@/middleware/header'; -import antiHotlink from '@/middleware/anti-hotlink'; -import parameter from '@/middleware/parameter'; -import trace from '@/middleware/trace'; import { jsxRenderer } from 'hono/jsx-renderer'; import { trimTrailingSlash } from 'hono/trailing-slash'; -import logger from '@/utils/logger'; - -import { notFoundHandler, errorHandler } from '@/errors'; -import registry from '@/registry'; import api from '@/api'; +import { errorHandler, notFoundHandler } from '@/errors'; +import accessControl from '@/middleware/access-control'; +import antiHotlink from '@/middleware/anti-hotlink'; +import cache from '@/middleware/cache'; +import debug from '@/middleware/debug'; +import header from '@/middleware/header'; +import mLogger from '@/middleware/logger'; +import parameter from '@/middleware/parameter'; +import sentry from '@/middleware/sentry'; +import template from '@/middleware/template'; +import trace from '@/middleware/trace'; +import registry from '@/registry'; +import logger from '@/utils/logger'; process.on('uncaughtException', (e) => { logger.error('uncaughtException: ' + e); diff --git a/lib/app.test.ts b/lib/app.test.ts index 5e69fc872..185cc6f62 100644 --- a/lib/app.test.ts +++ b/lib/app.test.ts @@ -1,7 +1,7 @@ +import undici from 'undici'; import { describe, expect, it, vi } from 'vitest'; import app from '@/app'; -import undici from 'undici'; const { config } = await import('@/config'); diff --git a/lib/config.test.ts b/lib/config.test.ts index edf38055a..b25585fc5 100644 --- a/lib/config.test.ts +++ b/lib/config.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, it, afterEach, vi } from 'vitest'; +import { afterEach, describe, expect, it, vi } from 'vitest'; afterEach(() => { vi.resetModules(); diff --git a/lib/config.ts b/lib/config.ts index 5ae40d86c..261d3646f 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -1,4 +1,5 @@ import 'dotenv/config'; + import { ofetch } from 'ofetch'; type ConfigEnvKeys = diff --git a/lib/errors/index.test.ts b/lib/errors/index.test.ts index 511f45f65..30b846971 100644 --- a/lib/errors/index.test.ts +++ b/lib/errors/index.test.ts @@ -1,8 +1,9 @@ -import { describe, expect, it, afterAll } from 'vitest'; -import supertest from 'supertest'; -import server from '@/index'; import { load } from 'cheerio'; +import supertest from 'supertest'; +import { afterAll, describe, expect, it } from 'vitest'; + import { config } from '@/config'; +import server from '@/index'; const request = supertest(server); diff --git a/lib/errors/index.tsx b/lib/errors/index.tsx index 8264c1cb8..a63cb2061 100644 --- a/lib/errors/index.tsx +++ b/lib/errors/index.tsx @@ -1,15 +1,15 @@ -import { type NotFoundHandler, type ErrorHandler } from 'hono'; -import { routePath } from 'hono/route'; -import { getDebugInfo, setDebugInfo } from '@/utils/debug-info'; -import { config } from '@/config'; import * as Sentry from '@sentry/node'; +import { type ErrorHandler, type NotFoundHandler } from 'hono'; +import { routePath } from 'hono/route'; + +import { config } from '@/config'; +import { getDebugInfo, setDebugInfo } from '@/utils/debug-info'; import logger from '@/utils/logger'; +import { requestMetric } from '@/utils/otel'; import Error from '@/views/error'; import NotFoundError from './types/not-found'; -import { requestMetric } from '@/utils/otel'; - export const errorHandler: ErrorHandler = (error, ctx) => { const requestPath = ctx.req.path; const matchedRoute = routePath(ctx); diff --git a/lib/index.ts b/lib/index.ts index fbd179c00..f70d71b34 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,12 +1,14 @@ -import { serve } from '@hono/node-server'; -import logger from '@/utils/logger'; -import { getLocalhostAddress } from '@/utils/common-utils'; -import { config } from '@/config'; -import app from '@/app'; -import os from 'node:os'; import cluster from 'node:cluster'; +import os from 'node:os'; import process from 'node:process'; +import { serve } from '@hono/node-server'; + +import app from '@/app'; +import { config } from '@/config'; +import { getLocalhostAddress } from '@/utils/common-utils'; +import logger from '@/utils/logger'; + const port = config.connect.port; const hostIPList = getLocalhostAddress(); diff --git a/lib/middleware/access-control.test.ts b/lib/middleware/access-control.test.ts index 83dd5be0f..40674096e 100644 --- a/lib/middleware/access-control.test.ts +++ b/lib/middleware/access-control.test.ts @@ -1,4 +1,5 @@ -import { describe, expect, it, vi, afterEach } from 'vitest'; +import { afterEach, describe, expect, it, vi } from 'vitest'; + import md5 from '@/utils/md5'; process.env.NODE_NAME = 'mock'; diff --git a/lib/middleware/access-control.ts b/lib/middleware/access-control.ts index 41123b1f8..01cbbd5f7 100644 --- a/lib/middleware/access-control.ts +++ b/lib/middleware/access-control.ts @@ -1,7 +1,8 @@ import type { MiddlewareHandler } from 'hono'; + import { config } from '@/config'; -import md5 from '@/utils/md5'; import RejectError from '@/errors/types/reject'; +import md5 from '@/utils/md5'; const reject = (requestPath) => { throw new RejectError(`Authentication failed. Access denied.\n${requestPath}`); diff --git a/lib/middleware/anti-hotlink.test.ts b/lib/middleware/anti-hotlink.test.ts index 70c30f134..d718fad4c 100644 --- a/lib/middleware/anti-hotlink.test.ts +++ b/lib/middleware/anti-hotlink.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, it, vi, afterEach, afterAll } from 'vitest'; import Parser from 'rss-parser'; +import { afterAll, afterEach, describe, expect, it, vi } from 'vitest'; const parser = new Parser(); diff --git a/lib/middleware/anti-hotlink.ts b/lib/middleware/anti-hotlink.ts index 6b04cda30..a706330e3 100644 --- a/lib/middleware/anti-hotlink.ts +++ b/lib/middleware/anti-hotlink.ts @@ -1,8 +1,9 @@ -import { config } from '@/config'; -import { load, type CheerioAPI } from 'cheerio'; -import logger from '@/utils/logger'; +import { type CheerioAPI, load } from 'cheerio'; import { type MiddlewareHandler } from 'hono'; -import { Data } from '@/types'; + +import { config } from '@/config'; +import type { Data } from '@/types'; +import logger from '@/utils/logger'; const templateRegex = /\${([^{}]+)}/g; const allowedUrlProperties = new Set(['hash', 'host', 'hostname', 'href', 'origin', 'password', 'pathname', 'port', 'protocol', 'search', 'searchParams', 'username']); diff --git a/lib/middleware/cache.test.ts b/lib/middleware/cache.test.ts index 703da060c..fb9e2b420 100644 --- a/lib/middleware/cache.test.ts +++ b/lib/middleware/cache.test.ts @@ -1,5 +1,6 @@ -import { describe, expect, it, vi, afterEach } from 'vitest'; import Parser from 'rss-parser'; +import { afterEach, describe, expect, it, vi } from 'vitest'; + import wait from '@/utils/wait'; process.env.CACHE_EXPIRE = '1'; diff --git a/lib/middleware/cache.ts b/lib/middleware/cache.ts index 35876a969..3deaa14da 100644 --- a/lib/middleware/cache.ts +++ b/lib/middleware/cache.ts @@ -1,10 +1,10 @@ -import xxhash from 'xxhash-wasm'; import type { MiddlewareHandler } from 'hono'; +import xxhash from 'xxhash-wasm'; import { config } from '@/config'; import RequestInProgressError from '@/errors/types/request-in-progress'; +import type { Data } from '@/types'; import cacheModule from '@/utils/cache/index'; -import { Data } from '@/types'; const bypassList = new Set(['/', '/robots.txt', '/logo.png', '/favicon.ico']); // only give cache string, as the `!` condition tricky diff --git a/lib/middleware/debug.test.ts b/lib/middleware/debug.test.ts index 7bcf980e8..8c7982603 100644 --- a/lib/middleware/debug.test.ts +++ b/lib/middleware/debug.test.ts @@ -1,6 +1,7 @@ -import { describe, expect, it } from 'vitest'; -import app from '@/app'; import { load } from 'cheerio'; +import { describe, expect, it } from 'vitest'; + +import app from '@/app'; process.env.NODE_NAME = 'mock'; diff --git a/lib/middleware/debug.ts b/lib/middleware/debug.ts index 58edeb52a..9d779728a 100644 --- a/lib/middleware/debug.ts +++ b/lib/middleware/debug.ts @@ -1,5 +1,6 @@ -import { MiddlewareHandler } from 'hono'; +import type { MiddlewareHandler } from 'hono'; import { routePath } from 'hono/route'; + import { getDebugInfo, setDebugInfo } from '@/utils/debug-info'; const middleware: MiddlewareHandler = async (ctx, next) => { diff --git a/lib/middleware/filter-engine.test.ts b/lib/middleware/filter-engine.test.ts index 1a9d6e60b..e68e60c1e 100644 --- a/lib/middleware/filter-engine.test.ts +++ b/lib/middleware/filter-engine.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, it, afterAll, vi, afterEach } from 'vitest'; +import { afterAll, afterEach, describe, expect, it, vi } from 'vitest'; afterAll(() => { delete process.env.FILTER_REGEX_ENGINE; diff --git a/lib/middleware/header.test.ts b/lib/middleware/header.test.ts index 103d61b5c..90ab4f6b8 100644 --- a/lib/middleware/header.test.ts +++ b/lib/middleware/header.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, it, afterAll } from 'vitest'; +import { afterAll, describe, expect, it } from 'vitest'; process.env.NODE_NAME = 'mock'; process.env.ALLOW_ORIGIN = 'rsshub.mock'; diff --git a/lib/middleware/header.ts b/lib/middleware/header.ts index 0e4d50f84..72cbfdf26 100644 --- a/lib/middleware/header.ts +++ b/lib/middleware/header.ts @@ -1,8 +1,9 @@ -import { MiddlewareHandler } from 'hono'; -import { routePath } from 'hono/route'; import etagCalculate from 'etag'; +import type { MiddlewareHandler } from 'hono'; +import { routePath } from 'hono/route'; + import { config } from '@/config'; -import { Data } from '@/types'; +import type { Data } from '@/types'; const headers: Record = { 'Access-Control-Allow-Methods': 'GET', diff --git a/lib/middleware/logger.ts b/lib/middleware/logger.ts index 9d2ca59ce..19b038aa3 100644 --- a/lib/middleware/logger.ts +++ b/lib/middleware/logger.ts @@ -1,7 +1,8 @@ -import { requestMetric } from '@/utils/otel'; -import { MiddlewareHandler } from 'hono'; -import logger from '@/utils/logger'; +import type { MiddlewareHandler } from 'hono'; + import { getPath, time } from '@/utils/helpers'; +import logger from '@/utils/logger'; +import { requestMetric } from '@/utils/otel'; enum LogPrefix { Outgoing = '-->', diff --git a/lib/middleware/parameter.test.ts b/lib/middleware/parameter.test.ts index 57debada3..69f3000e3 100644 --- a/lib/middleware/parameter.test.ts +++ b/lib/middleware/parameter.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, it, vi } from 'vitest'; import Parser from 'rss-parser'; +import { describe, expect, it, vi } from 'vitest'; process.env.OPENAI_API_KEY = 'sk-1234567890'; process.env.OPENAI_API_ENDPOINT = 'https://api.openai.mock/v1'; diff --git a/lib/middleware/parameter.ts b/lib/middleware/parameter.ts index d6750bcde..864354f01 100644 --- a/lib/middleware/parameter.ts +++ b/lib/middleware/parameter.ts @@ -1,17 +1,18 @@ -import * as entities from 'entities'; -import { load, type CheerioAPI } from 'cheerio'; -import type { Element } from 'domhandler'; -import { simplecc } from 'simplecc-wasm'; -import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; -import { RE2JS } from 're2js'; -import markdownit from 'markdown-it'; -import { convert } from 'html-to-text'; -import sanitizeHtml from 'sanitize-html'; -import { MiddlewareHandler } from 'hono'; -import cache from '@/utils/cache'; import Parser from '@postlight/parser'; -import { Data, DataItem } from '@/types'; +import { type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import * as entities from 'entities'; +import type { MiddlewareHandler } from 'hono'; +import { convert } from 'html-to-text'; +import markdownit from 'markdown-it'; +import { RE2JS } from 're2js'; +import sanitizeHtml from 'sanitize-html'; +import { simplecc } from 'simplecc-wasm'; + +import { config } from '@/config'; +import type { Data, DataItem } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; const md = markdownit({ html: true, diff --git a/lib/middleware/sentry.ts b/lib/middleware/sentry.ts index 04d59e95e..8c2952bbb 100644 --- a/lib/middleware/sentry.ts +++ b/lib/middleware/sentry.ts @@ -1,8 +1,9 @@ -import { MiddlewareHandler } from 'hono'; -import logger from '@/utils/logger'; -import { config } from '@/config'; import * as Sentry from '@sentry/node'; +import type { MiddlewareHandler } from 'hono'; + +import { config } from '@/config'; import { getRouteNameFromPath } from '@/utils/helpers'; +import logger from '@/utils/logger'; if (config.sentry.dsn) { Sentry.init({ diff --git a/lib/middleware/template.test.ts b/lib/middleware/template.test.ts index b3ac3c60d..695698358 100644 --- a/lib/middleware/template.test.ts +++ b/lib/middleware/template.test.ts @@ -1,6 +1,7 @@ -import { describe, expect, it } from 'vitest'; -import app from '@/app'; import Parser from 'rss-parser'; +import { describe, expect, it } from 'vitest'; + +import app from '@/app'; const parser = new Parser(); diff --git a/lib/middleware/template.tsx b/lib/middleware/template.tsx index a42a815fd..d9f5ed986 100644 --- a/lib/middleware/template.tsx +++ b/lib/middleware/template.tsx @@ -1,10 +1,10 @@ -import { rss3, json, RSS, Atom } from '@/utils/render'; -import { config } from '@/config'; -import { collapseWhitespace, convertDateToISO8601 } from '@/utils/common-utils'; import type { MiddlewareHandler } from 'hono'; -import { Data } from '@/types'; +import { config } from '@/config'; +import type { Data } from '@/types'; import cacheModule from '@/utils/cache/index'; +import { collapseWhitespace, convertDateToISO8601 } from '@/utils/common-utils'; +import { Atom, json, RSS, rss3 } from '@/utils/render'; const middleware: MiddlewareHandler = async (ctx, next) => { // Set RSS (minute) according to the availability of cache diff --git a/lib/middleware/trace.ts b/lib/middleware/trace.ts index 78fa81e44..b02ffdc4d 100644 --- a/lib/middleware/trace.ts +++ b/lib/middleware/trace.ts @@ -1,6 +1,7 @@ -import { MiddlewareHandler } from 'hono'; -import { getPath } from '@/utils/helpers'; +import type { MiddlewareHandler } from 'hono'; + import { config } from '@/config'; +import { getPath } from '@/utils/helpers'; import { tracer } from '@/utils/otel'; const middleware: MiddlewareHandler = async (ctx, next) => { diff --git a/lib/pkg.test.ts b/lib/pkg.test.ts index c45900754..dedbdb80d 100644 --- a/lib/pkg.test.ts +++ b/lib/pkg.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import { init, request } from './pkg'; describe('pkg', () => { diff --git a/lib/pkg.ts b/lib/pkg.ts index 875f71bf8..068a339a6 100644 --- a/lib/pkg.ts +++ b/lib/pkg.ts @@ -1,7 +1,9 @@ -import { type ConfigEnv, setConfig } from '@/config'; -import { Handler, Hono } from 'hono'; +import type { Handler, Hono } from 'hono'; + import type { RoutePath } from '@/../assets/build/route-paths'; -import type { Data, Route, Namespace } from './types'; +import { type ConfigEnv, setConfig } from '@/config'; + +import type { Data, Namespace, Route } from './types'; export * from '@/types'; export { default as ofetch } from '@/utils/ofetch'; diff --git a/lib/registry.test.ts b/lib/registry.test.ts index 0892ca7d7..ec5ce63a3 100644 --- a/lib/registry.test.ts +++ b/lib/registry.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it, vi } from 'vitest'; + import app from '@/app'; import { config } from '@/config'; diff --git a/lib/registry.ts b/lib/registry.ts index 26fd81997..177cc2396 100644 --- a/lib/registry.ts +++ b/lib/registry.ts @@ -1,15 +1,16 @@ -import type { APIRoute, Namespace, Route } from '@/types'; -import { directoryImport } from 'directory-import'; -import { Hono, type Handler } from 'hono'; -import { routePath } from 'hono/route'; import path from 'node:path'; -import { serveStatic } from '@hono/node-server/serve-static'; -import { config } from '@/config'; -import index from '@/routes/index'; +import { serveStatic } from '@hono/node-server/serve-static'; +import { directoryImport } from 'directory-import'; +import { type Handler, Hono } from 'hono'; +import { routePath } from 'hono/route'; + +import { config } from '@/config'; import healthz from '@/routes/healthz'; -import robotstxt from '@/routes/robots.txt'; +import index from '@/routes/index'; import metrics from '@/routes/metrics'; +import robotstxt from '@/routes/robots.txt'; +import type { APIRoute, Namespace, Route } from '@/types'; import logger from '@/utils/logger'; const __dirname = import.meta.dirname; diff --git a/lib/routes.test.ts b/lib/routes.test.ts index d9cb64df8..fc32ad7dc 100644 --- a/lib/routes.test.ts +++ b/lib/routes.test.ts @@ -1,9 +1,11 @@ -import { describe, expect, it } from 'vitest'; -import app from '@/app'; import Parser from 'rss-parser'; -const parser = new Parser(); +import { describe, expect, it } from 'vitest'; + +import app from '@/app'; import { config } from '@/config'; +const parser = new Parser(); + process.env.ALLOW_USER_SUPPLY_UNSAFE_DOMAIN = 'true'; const routes = { diff --git a/lib/routes/005/index.ts b/lib/routes/005/index.ts index f38e0782c..f9d8148f5 100644 --- a/lib/routes/005/index.ts +++ b/lib/routes/005/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'zx' } = ctx.req.param(); diff --git a/lib/routes/0818tuan/index.ts b/lib/routes/0818tuan/index.ts index d39ee8927..a6df25136 100644 --- a/lib/routes/0818tuan/index.ts +++ b/lib/routes/0818tuan/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/0x80/index.ts b/lib/routes/0x80/index.ts index d6aa248a4..2c5ed27a0 100644 --- a/lib/routes/0x80/index.ts +++ b/lib/routes/0x80/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/0xxx/index.ts b/lib/routes/0xxx/index.ts index 057942532..5e573916b 100644 --- a/lib/routes/0xxx/index.ts +++ b/lib/routes/0xxx/index.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { filter } = ctx.req.param(); diff --git a/lib/routes/10000link/info.ts b/lib/routes/10000link/info.ts index b77bbf277..0769c6dfc 100644 --- a/lib/routes/10000link/info.ts +++ b/lib/routes/10000link/info.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = 'newslists', id } = ctx.req.param(); diff --git a/lib/routes/10jqka/realtimenews.ts b/lib/routes/10jqka/realtimenews.ts index 48f821d30..25a3182f7 100644 --- a/lib/routes/10jqka/realtimenews.ts +++ b/lib/routes/10jqka/realtimenews.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/121/weather-live.ts b/lib/routes/121/weather-live.ts index f95a77cdf..893b126e4 100644 --- a/lib/routes/121/weather-live.ts +++ b/lib/routes/121/weather-live.ts @@ -1,12 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '100', 10); diff --git a/lib/routes/12306/index.ts b/lib/routes/12306/index.ts index c36ea80f2..feba70300 100644 --- a/lib/routes/12306/index.ts +++ b/lib/routes/12306/index.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const rootUrl = 'https://kyfw.12306.cn'; diff --git a/lib/routes/12306/zxdt.ts b/lib/routes/12306/zxdt.ts index 69b6696bb..eebd0af52 100644 --- a/lib/routes/12306/zxdt.ts +++ b/lib/routes/12306/zxdt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/12371/zxfb.ts b/lib/routes/12371/zxfb.ts index 756779f6f..e50492205 100644 --- a/lib/routes/12371/zxfb.ts +++ b/lib/routes/12371/zxfb.ts @@ -1,10 +1,10 @@ -import got from '@/utils/got'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; - -import { Route } from '@/types'; const handler = async (ctx) => { const { category = 'zxfb' } = ctx.req.param(); diff --git a/lib/routes/141jav/index.ts b/lib/routes/141jav/index.ts index 159cc0a27..1ccd6a54d 100644 --- a/lib/routes/141jav/index.ts +++ b/lib/routes/141jav/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:type/:keyword{.*}?', diff --git a/lib/routes/141ppv/index.ts b/lib/routes/141ppv/index.ts index abfc0419d..032b982ff 100644 --- a/lib/routes/141ppv/index.ts +++ b/lib/routes/141ppv/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:type/:keyword{.*}?', diff --git a/lib/routes/163/ds.ts b/lib/routes/163/ds.ts index b35e1d9d2..5dde58e46 100644 --- a/lib/routes/163/ds.ts +++ b/lib/routes/163/ds.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const root_url = 'https://inf.ds.163.com'; diff --git a/lib/routes/163/dy.ts b/lib/routes/163/dy.ts index ff6b2df63..5f2a29f8c 100644 --- a/lib/routes/163/dy.ts +++ b/lib/routes/163/dy.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { parseDyArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/163/dy2.ts b/lib/routes/163/dy2.ts index b6d985b81..6c65b2878 100644 --- a/lib/routes/163/dy2.ts +++ b/lib/routes/163/dy2.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { parseDyArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/163/exclusive.ts b/lib/routes/163/exclusive.ts index 77b460133..c781cedcb 100644 --- a/lib/routes/163/exclusive.ts +++ b/lib/routes/163/exclusive.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const ids = { '': { diff --git a/lib/routes/163/music/artist-songs.ts b/lib/routes/163/music/artist-songs.ts index 4f410effe..629f2b76e 100644 --- a/lib/routes/163/music/artist-songs.ts +++ b/lib/routes/163/music/artist-songs.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/music/artist/songs/:id', diff --git a/lib/routes/163/music/artist.ts b/lib/routes/163/music/artist.ts index fd4e9355a..8beeb6db5 100644 --- a/lib/routes/163/music/artist.ts +++ b/lib/routes/163/music/artist.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/music/artist/:id', diff --git a/lib/routes/163/music/djradio.ts b/lib/routes/163/music/djradio.ts index 09efda318..3a02ac3e9 100644 --- a/lib/routes/163/music/djradio.ts +++ b/lib/routes/163/music/djradio.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import cache from '@/utils/cache'; -import { config } from '@/config'; export const route: Route = { path: '/music/djradio/:id/:info?', diff --git a/lib/routes/163/music/playlist.ts b/lib/routes/163/music/playlist.ts index 198c4afef..f3f9b4c4a 100644 --- a/lib/routes/163/music/playlist.ts +++ b/lib/routes/163/music/playlist.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/music/playlist/:id', categories: ['multimedia'], diff --git a/lib/routes/163/music/userevents.ts b/lib/routes/163/music/userevents.ts index 8ca7a06e5..39c7bf949 100644 --- a/lib/routes/163/music/userevents.ts +++ b/lib/routes/163/music/userevents.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; - import path from 'node:path'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; + const renderDescription = (info) => art(path.join(__dirname, '../templates/music/userevents.art'), info); export const route: Route = { diff --git a/lib/routes/163/music/userplaylist.ts b/lib/routes/163/music/userplaylist.ts index ff7ed8ff2..4d272a18c 100644 --- a/lib/routes/163/music/userplaylist.ts +++ b/lib/routes/163/music/userplaylist.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/music/user/playlist/:uid', diff --git a/lib/routes/163/music/userplayrecords.ts b/lib/routes/163/music/userplayrecords.ts index f2473d913..7d9f4f2f4 100644 --- a/lib/routes/163/music/userplayrecords.ts +++ b/lib/routes/163/music/userplayrecords.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const headers = { cookie: config.ncm.cookies, Referer: 'https://music.163.com/', diff --git a/lib/routes/163/news/rank.ts b/lib/routes/163/news/rank.ts index e6210c9ec..aee0db375 100644 --- a/lib/routes/163/news/rank.ts +++ b/lib/routes/163/news/rank.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://news.163.com'; diff --git a/lib/routes/163/news/special.ts b/lib/routes/163/news/special.ts index 0cebb6b24..70b969f8f 100644 --- a/lib/routes/163/news/special.ts +++ b/lib/routes/163/news/special.ts @@ -1,9 +1,11 @@ +import { load } from 'cheerio'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; + const typeMap = { 1: '轻松一刻', 2: '槽值', diff --git a/lib/routes/163/open/vip.ts b/lib/routes/163/open/vip.ts index 70335db97..3ed041646 100644 --- a/lib/routes/163/open/vip.ts +++ b/lib/routes/163/open/vip.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/open/vip', diff --git a/lib/routes/163/renjian.ts b/lib/routes/163/renjian.ts index 21437ee83..50d78180c 100644 --- a/lib/routes/163/renjian.ts +++ b/lib/routes/163/renjian.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/163/today.ts b/lib/routes/163/today.ts index 21c0c9372..5d34784b9 100644 --- a/lib/routes/163/today.ts +++ b/lib/routes/163/today.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/today/:need_content?', diff --git a/lib/routes/163/utils.ts b/lib/routes/163/utils.ts index 711e37728..695e6f620 100644 --- a/lib/routes/163/utils.ts +++ b/lib/routes/163/utils.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const parseDyArticle = (item, tryGet) => tryGet(item.link, async () => { const response = await got(item.link, { diff --git a/lib/routes/18comic/album.ts b/lib/routes/18comic/album.ts index 763efc643..54219ddc6 100644 --- a/lib/routes/18comic/album.ts +++ b/lib/routes/18comic/album.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import { defaultDomain, getApiUrl, getRootUrl, processApiItems } from './utils'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import { art } from '@/utils/render'; + +import { defaultDomain, getApiUrl, getRootUrl, processApiItems } from './utils'; export const route: Route = { path: '/album/:id', diff --git a/lib/routes/18comic/blogs.ts b/lib/routes/18comic/blogs.ts index 0b1ded742..fff7f4375 100644 --- a/lib/routes/18comic/blogs.ts +++ b/lib/routes/18comic/blogs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { defaultDomain, getRootUrl } from './utils'; diff --git a/lib/routes/18comic/index.ts b/lib/routes/18comic/index.ts index 4bc547ab1..d33f21dd6 100644 --- a/lib/routes/18comic/index.ts +++ b/lib/routes/18comic/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { defaultDomain, getRootUrl, ProcessItems } from './utils'; export const route: Route = { diff --git a/lib/routes/18comic/search.ts b/lib/routes/18comic/search.ts index e7b40eed4..40226f1d4 100644 --- a/lib/routes/18comic/search.ts +++ b/lib/routes/18comic/search.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import { apiMapCategory, defaultDomain, getApiUrl, getRootUrl, processApiItems } from './utils'; +import path from 'node:path'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import cache from '@/utils/cache'; + +import { apiMapCategory, defaultDomain, getApiUrl, getRootUrl, processApiItems } from './utils'; export const route: Route = { path: '/search/:option?/:category?/:keyword?/:time?/:order?', diff --git a/lib/routes/18comic/utils.ts b/lib/routes/18comic/utils.ts index d152b360b..3d4d23325 100644 --- a/lib/routes/18comic/utils.ts +++ b/lib/routes/18comic/utils.ts @@ -1,13 +1,15 @@ -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; +import CryptoJS from 'crypto-js'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import md5 from '@/utils/md5'; -import CryptoJS from 'crypto-js'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const defaultDomain = 'jmcomic1.me'; // list of address: https://jmcomic2.bet @@ -151,4 +153,4 @@ const ProcessItems = async (ctx, currentUrl, rootUrl) => { }; }; -export { defaultDomain, getRootUrl, ProcessItems, getApiUrl, processApiItems, apiMapCategory }; +export { apiMapCategory, defaultDomain, getApiUrl, getRootUrl, processApiItems, ProcessItems }; diff --git a/lib/routes/199it/index.ts b/lib/routes/199it/index.ts index bf6543bcb..7a88515d1 100644 --- a/lib/routes/199it/index.ts +++ b/lib/routes/199it/index.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = 'newly' } = ctx.req.param(); diff --git a/lib/routes/19lou/index.ts b/lib/routes/19lou/index.ts index 5869a5f35..579552d48 100644 --- a/lib/routes/19lou/index.ts +++ b/lib/routes/19lou/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import iconv from 'iconv-lite'; +import timezone from '@/utils/timezone'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const setCookie = function (cookieName, cookieValue, seconds, path, domain, secure) { let expires = null; diff --git a/lib/routes/1lou/index.ts b/lib/routes/1lou/index.ts index df177c912..26768f6af 100644 --- a/lib/routes/1lou/index.ts +++ b/lib/routes/1lou/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.1lou.me'; diff --git a/lib/routes/1point3acres/blog.ts b/lib/routes/1point3acres/blog.ts index 3e1c0f4be..07f89b768 100644 --- a/lib/routes/1point3acres/blog.ts +++ b/lib/routes/1point3acres/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/1point3acres/category.ts b/lib/routes/1point3acres/category.ts index e39a5a566..8e7914684 100644 --- a/lib/routes/1point3acres/category.ts +++ b/lib/routes/1point3acres/category.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, apiRootUrl, types, ProcessThreads } from './utils'; + +import { apiRootUrl, ProcessThreads, rootUrl, types } from './utils'; export const route: Route = { path: '/category/:id?/:type?/:order?', diff --git a/lib/routes/1point3acres/offer.ts b/lib/routes/1point3acres/offer.ts index 2202802ce..87d1d05d4 100644 --- a/lib/routes/1point3acres/offer.ts +++ b/lib/routes/1point3acres/offer.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/offer/:year?/:major?/:school?', categories: ['bbs'], diff --git a/lib/routes/1point3acres/section.ts b/lib/routes/1point3acres/section.ts index f51f48206..97109dfc5 100644 --- a/lib/routes/1point3acres/section.ts +++ b/lib/routes/1point3acres/section.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, apiRootUrl, types, ProcessThreads } from './utils'; + +import { apiRootUrl, ProcessThreads, rootUrl, types } from './utils'; const sections = { 257: '留学申请', diff --git a/lib/routes/1point3acres/thread.ts b/lib/routes/1point3acres/thread.ts index 3a15a5c0b..063d062c7 100644 --- a/lib/routes/1point3acres/thread.ts +++ b/lib/routes/1point3acres/thread.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, apiRootUrl, types, ProcessThreads } from './utils'; + +import { apiRootUrl, ProcessThreads, rootUrl, types } from './utils'; export const route: Route = { path: '/thread/:type?/:order?', diff --git a/lib/routes/1point3acres/user/post.ts b/lib/routes/1point3acres/user/post.ts index d80cc9da4..5160ab434 100644 --- a/lib/routes/1point3acres/user/post.ts +++ b/lib/routes/1point3acres/user/post.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/1point3acres/user/thread.ts b/lib/routes/1point3acres/user/thread.ts index ecbaa83b5..3c1fad383 100644 --- a/lib/routes/1point3acres/user/thread.ts +++ b/lib/routes/1point3acres/user/thread.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/1point3acres/utils.ts b/lib/routes/1point3acres/utils.ts index c4b7638aa..b1c9c6f98 100644 --- a/lib/routes/1point3acres/utils.ts +++ b/lib/routes/1point3acres/utils.ts @@ -1,10 +1,12 @@ +import path from 'node:path'; + +import bbobHTML from '@bbob/html'; +import presetHTML5 from '@bbob/preset-html5'; +import type { BBobCoreTagNodeTree } from '@bbob/types'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import type { BBobCoreTagNodeTree } from '@bbob/types'; -import bbobHTML from '@bbob/html'; -import presetHTML5 from '@bbob/preset-html5'; const rootUrl = 'https://instant.1point3acres.com'; const apiRootUrl = 'https://api.1point3acres.com'; @@ -137,4 +139,4 @@ const ProcessThreads = async (tryGet, apiUrl, order) => { return items; }; -export { rootUrl, apiRootUrl, types, ProcessThreads }; +export { apiRootUrl, ProcessThreads, rootUrl, types }; diff --git a/lib/routes/1x/index.ts b/lib/routes/1x/index.ts index 03f8d81ad..8e0121b86 100644 --- a/lib/routes/1x/index.ts +++ b/lib/routes/1x/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const handler = async (ctx) => { const { category = 'latest/awarded' } = ctx.req.param(); const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30; diff --git a/lib/routes/2023game/index.ts b/lib/routes/2023game/index.ts index c54423178..2c10cfb5b 100644 --- a/lib/routes/2023game/index.ts +++ b/lib/routes/2023game/index.ts @@ -1,8 +1,9 @@ -import { Data, DataItem, Route } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import { Context } from 'hono'; export const route: Route = { path: '/:category?/:tab?', diff --git a/lib/routes/2048/index.ts b/lib/routes/2048/index.ts index 0355a37de..c13c46df5 100644 --- a/lib/routes/2048/index.ts +++ b/lib/routes/2048/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/21caijing/channel.ts b/lib/routes/21caijing/channel.ts index 901f95449..2c82967b1 100644 --- a/lib/routes/21caijing/channel.ts +++ b/lib/routes/21caijing/channel.ts @@ -1,13 +1,12 @@ import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const processMenu = (data: any[]) => { const result = {}; diff --git a/lib/routes/2cycd/index.ts b/lib/routes/2cycd/index.ts index 39538da52..5a5ad7cf1 100644 --- a/lib/routes/2cycd/index.ts +++ b/lib/routes/2cycd/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import iconv from 'iconv-lite'; // http://www.2cycd.com/forum.php?mod=forumdisplay&fid=43&orderby=dateline diff --git a/lib/routes/30secondsofcode/category.ts b/lib/routes/30secondsofcode/category.ts index 430c480f7..71baa0a42 100644 --- a/lib/routes/30secondsofcode/category.ts +++ b/lib/routes/30secondsofcode/category.ts @@ -1,7 +1,10 @@ -import { Data, Route } from '@/types'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { processList } from './utils'; + export const route: Route = { path: '/category/:category?/:subCategory?', categories: ['programming'], diff --git a/lib/routes/30secondsofcode/new-and-popular.ts b/lib/routes/30secondsofcode/new-and-popular.ts index 27f174bd8..1ab63ca40 100644 --- a/lib/routes/30secondsofcode/new-and-popular.ts +++ b/lib/routes/30secondsofcode/new-and-popular.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; import { load } from 'cheerio'; -import { processList, rootUrl } from './utils'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { processList, rootUrl } from './utils'; + export const route: Route = { path: '/latest', categories: ['programming'], diff --git a/lib/routes/30secondsofcode/utils.ts b/lib/routes/30secondsofcode/utils.ts index c3e88d970..502ed2ba3 100644 --- a/lib/routes/30secondsofcode/utils.ts +++ b/lib/routes/30secondsofcode/utils.ts @@ -1,8 +1,9 @@ -import { DataItem } from '@/types'; import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; export const rootUrl = 'https://www.30secondsofcode.org'; diff --git a/lib/routes/36kr/hot-list.ts b/lib/routes/36kr/hot-list.ts index a1dc2c1ba..8aeb7e055 100644 --- a/lib/routes/36kr/hot-list.ts +++ b/lib/routes/36kr/hot-list.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { rootUrl, ProcessItem } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { ProcessItem, rootUrl } from './utils'; const categories = { 24: { diff --git a/lib/routes/36kr/index.ts b/lib/routes/36kr/index.ts index f3cfa9741..1898c12ef 100644 --- a/lib/routes/36kr/index.ts +++ b/lib/routes/36kr/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { rootUrl, ProcessItem } from './utils'; +import { ProcessItem, rootUrl } from './utils'; const shortcuts = { '/information': '/information/web_news', diff --git a/lib/routes/36kr/utils.ts b/lib/routes/36kr/utils.ts index 857713c0e..9c5e8d101 100644 --- a/lib/routes/36kr/utils.ts +++ b/lib/routes/36kr/utils.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; import CryptoJS from 'crypto-js'; +import got from '@/utils/got'; + const rootUrl = 'https://www.36kr.com'; const ProcessItem = (item, tryGet) => @@ -32,4 +33,4 @@ const ProcessItem = (item, tryGet) => return item; }); -export { rootUrl, ProcessItem }; +export { ProcessItem, rootUrl }; diff --git a/lib/routes/3dmgame/game.ts b/lib/routes/3dmgame/game.ts index f6bda17f8..888ce02f4 100644 --- a/lib/routes/3dmgame/game.ts +++ b/lib/routes/3dmgame/game.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/3dmgame/news-center.ts b/lib/routes/3dmgame/news-center.ts index 5c8da6f50..d106acbd0 100644 --- a/lib/routes/3dmgame/news-center.ts +++ b/lib/routes/3dmgame/news-center.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/3dmgame/utils.ts b/lib/routes/3dmgame/utils.ts index 4964382f9..37bda8242 100644 --- a/lib/routes/3dmgame/utils.ts +++ b/lib/routes/3dmgame/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/3kns/index.ts b/lib/routes/3kns/index.ts index 88503b317..abbe118cf 100644 --- a/lib/routes/3kns/index.ts +++ b/lib/routes/3kns/index.ts @@ -1,10 +1,12 @@ -import { Data, DataItem, Route } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import { load } from 'cheerio'; -import { Context } from 'hono'; -import path from 'node:path'; export const route: Route = { path: '/:filters?/:order?', diff --git a/lib/routes/423down/index.ts b/lib/routes/423down/index.ts index e24c8d9c6..0a8f8c7b5 100644 --- a/lib/routes/423down/index.ts +++ b/lib/routes/423down/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { category = '' } = ctx.req.param(); diff --git a/lib/routes/4gamers/category.ts b/lib/routes/4gamers/category.ts index 91b46000b..076131dc1 100644 --- a/lib/routes/4gamers/category.ts +++ b/lib/routes/4gamers/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { parseList, parseItem, getCategories } from './utils'; + +import { getCategories, parseItem, parseList } from './utils'; export const route: Route = { path: ['/', '/category/:category'], diff --git a/lib/routes/4gamers/tag.ts b/lib/routes/4gamers/tag.ts index 5c5345cdc..c9dba110e 100644 --- a/lib/routes/4gamers/tag.ts +++ b/lib/routes/4gamers/tag.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { parseList, parseItem } from './utils'; + +import { parseItem, parseList } from './utils'; export const route: Route = { path: '/tag/:tag', diff --git a/lib/routes/4gamers/topic.ts b/lib/routes/4gamers/topic.ts index 07440a99d..1e723898c 100644 --- a/lib/routes/4gamers/topic.ts +++ b/lib/routes/4gamers/topic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { parseList, parseItem } from './utils'; + +import { parseItem, parseList } from './utils'; export const route: Route = { path: '/topic/:topic', diff --git a/lib/routes/4gamers/utils.ts b/lib/routes/4gamers/utils.ts index 946ab598f..5e7da9e82 100644 --- a/lib/routes/4gamers/utils.ts +++ b/lib/routes/4gamers/utils.ts @@ -1,8 +1,9 @@ -import got from '@/utils/got'; import path from 'node:path'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const getCategories = (tryGet) => tryGet('4gamers:categories', async () => { @@ -65,4 +66,4 @@ const renderImages = (images) => images, }); -export { getCategories, parseList, parseItem, renderDescription, renderImages }; +export { getCategories, parseItem, parseList, renderDescription, renderImages }; diff --git a/lib/routes/4khd/article.ts b/lib/routes/4khd/article.ts index 9b9d894e7..75a2a585b 100644 --- a/lib/routes/4khd/article.ts +++ b/lib/routes/4khd/article.ts @@ -1,6 +1,8 @@ import { load } from 'cheerio'; + import { parseDate } from '@/utils/parse-date'; -import { WPPost } from './types'; + +import type { WPPost } from './types'; const processImages = ($) => { $('a').each((_, elem) => { diff --git a/lib/routes/4khd/category.ts b/lib/routes/4khd/category.ts index 1674bdf3f..34d93d5d8 100644 --- a/lib/routes/4khd/category.ts +++ b/lib/routes/4khd/category.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; -import { WPPost } from './types'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; +import type { WPPost } from './types'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/4khd/latest.ts b/lib/routes/4khd/latest.ts index 68a5bc468..62774ef85 100644 --- a/lib/routes/4khd/latest.ts +++ b/lib/routes/4khd/latest.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; -import { WPPost } from './types'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; +import type { WPPost } from './types'; export const route: Route = { path: '/', diff --git a/lib/routes/4ksj/forum.ts b/lib/routes/4ksj/forum.ts index b635e0dd2..15f505c98 100644 --- a/lib/routes/4ksj/forum.ts +++ b/lib/routes/4ksj/forum.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import md5 from '@/utils/md5'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import md5 from '@/utils/md5'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/4kup/article.ts b/lib/routes/4kup/article.ts index fbdbbbb52..d0ff47874 100644 --- a/lib/routes/4kup/article.ts +++ b/lib/routes/4kup/article.ts @@ -1,6 +1,8 @@ import { load } from 'cheerio'; + import { parseDate } from '@/utils/parse-date'; -import { WPPost } from './types'; + +import type { WPPost } from './types'; const processLazyImages = ($) => { $('a.thumb-photo').each((_, elem) => { diff --git a/lib/routes/4kup/category.ts b/lib/routes/4kup/category.ts index e770a52a1..f4e2a64a2 100644 --- a/lib/routes/4kup/category.ts +++ b/lib/routes/4kup/category.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; -import { WPPost } from './types'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; +import type { WPPost } from './types'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/4kup/latest.ts b/lib/routes/4kup/latest.ts index f29c26e84..327b40bf9 100644 --- a/lib/routes/4kup/latest.ts +++ b/lib/routes/4kup/latest.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; -import { WPPost } from './types'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; +import type { WPPost } from './types'; export const route: Route = { path: '/', diff --git a/lib/routes/4kup/popular.ts b/lib/routes/4kup/popular.ts index f902c9219..b55d89e13 100644 --- a/lib/routes/4kup/popular.ts +++ b/lib/routes/4kup/popular.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + import loadArticle from './article'; -import { WPPost } from './types'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; +import type { WPPost } from './types'; export const route: Route = { path: '/popular/:period', diff --git a/lib/routes/4kup/tag.ts b/lib/routes/4kup/tag.ts index 7b828b5b5..023dca2de 100644 --- a/lib/routes/4kup/tag.ts +++ b/lib/routes/4kup/tag.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; -import { WPPost } from './types'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; +import type { WPPost } from './types'; export const route: Route = { path: '/tag/:tag', diff --git a/lib/routes/500px/tribe-set.ts b/lib/routes/500px/tribe-set.ts index 06ef8b69e..29cf03604 100644 --- a/lib/routes/500px/tribe-set.ts +++ b/lib/routes/500px/tribe-set.ts @@ -1,8 +1,9 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import { baseUrl, getTribeDetail, getTribeSets } from './utils'; diff --git a/lib/routes/500px/utils.ts b/lib/routes/500px/utils.ts index 420f97a9f..e80a9852e 100644 --- a/lib/routes/500px/utils.ts +++ b/lib/routes/500px/utils.ts @@ -1,7 +1,8 @@ -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; const baseUrl = 'https://500px.com.cn'; @@ -113,4 +114,4 @@ const getTribeSets = (id, limit) => false ); -export { baseUrl, getUserInfoFromUsername, getUserInfoFromId, getUserWorks, getTribeDetail, getTribeSets }; +export { baseUrl, getTribeDetail, getTribeSets, getUserInfoFromId, getUserInfoFromUsername, getUserWorks }; diff --git a/lib/routes/50forum/zhuanjia.ts b/lib/routes/50forum/zhuanjia.ts index 20c04abfe..beea52818 100644 --- a/lib/routes/50forum/zhuanjia.ts +++ b/lib/routes/50forum/zhuanjia.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/51cto/recommend.ts b/lib/routes/51cto/recommend.ts index 368280b31..d18858624 100644 --- a/lib/routes/51cto/recommend.ts +++ b/lib/routes/51cto/recommend.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; -import { getToken, sign } from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; +import got from '@/utils/got'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import { getToken, sign } from './utils'; export const route: Route = { path: '/index/recommend', diff --git a/lib/routes/51cto/utils.ts b/lib/routes/51cto/utils.ts index 5d61b99cd..912612053 100644 --- a/lib/routes/51cto/utils.ts +++ b/lib/routes/51cto/utils.ts @@ -1,6 +1,6 @@ -import ofetch from '@/utils/ofetch'; import cache from '@/utils/cache'; import md5 from '@/utils/md5'; +import ofetch from '@/utils/ofetch'; export const getToken = () => cache.tryGet( diff --git a/lib/routes/51read/article.ts b/lib/routes/51read/article.ts index 6240362fa..90018f53e 100644 --- a/lib/routes/51read/article.ts +++ b/lib/routes/51read/article.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import type { Route, DataItem } from '@/types'; export const route: Route = { path: '/article/:id', diff --git a/lib/routes/52hrtt/index.ts b/lib/routes/52hrtt/index.ts index 10839a243..69860c718 100644 --- a/lib/routes/52hrtt/index.ts +++ b/lib/routes/52hrtt/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:area?/:type?', diff --git a/lib/routes/52hrtt/symposium.ts b/lib/routes/52hrtt/symposium.ts index 1beb6a752..b01ea7dba 100644 --- a/lib/routes/52hrtt/symposium.ts +++ b/lib/routes/52hrtt/symposium.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/symposium/:id?/:classId?', diff --git a/lib/routes/56kog/class.ts b/lib/routes/56kog/class.ts index baeacd026..8d7fe4ecc 100644 --- a/lib/routes/56kog/class.ts +++ b/lib/routes/56kog/class.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, fetchItems } from './util'; + +import { fetchItems, rootUrl } from './util'; export const route: Route = { path: '/class/:category?', diff --git a/lib/routes/56kog/top.ts b/lib/routes/56kog/top.ts index f4a2b7a92..f9176fd65 100644 --- a/lib/routes/56kog/top.ts +++ b/lib/routes/56kog/top.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, fetchItems } from './util'; + +import { fetchItems, rootUrl } from './util'; export const route: Route = { path: '/top/:category?', diff --git a/lib/routes/56kog/util.ts b/lib/routes/56kog/util.ts index 9eca66058..eea4914fa 100644 --- a/lib/routes/56kog/util.ts +++ b/lib/routes/56kog/util.ts @@ -1,10 +1,12 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.56kog.com'; @@ -105,4 +107,4 @@ const fetchItems = async (limit, currentUrl, tryGet) => { }; }; -export { rootUrl, fetchItems }; +export { fetchItems, rootUrl }; diff --git a/lib/routes/591/list.ts b/lib/routes/591/list.ts index 8a84bb626..fcff9079e 100644 --- a/lib/routes/591/list.ts +++ b/lib/routes/591/list.ts @@ -1,14 +1,13 @@ -import { Route } from '@/types'; - import path from 'node:path'; -import { CookieJar } from 'tough-cookie'; import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const cookieJar = new CookieJar(); diff --git a/lib/routes/5eplay/index.ts b/lib/routes/5eplay/index.ts index 26c76bf4d..14de35b05 100644 --- a/lib/routes/5eplay/index.ts +++ b/lib/routes/5eplay/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/5music/index.ts b/lib/routes/5music/index.ts index 6cae7b716..8b2509489 100644 --- a/lib/routes/5music/index.ts +++ b/lib/routes/5music/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/69shu/article.ts b/lib/routes/69shu/article.ts index 4371e35dc..329038e67 100644 --- a/lib/routes/69shu/article.ts +++ b/lib/routes/69shu/article.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import type { Route, DataItem } from '@/types'; export const route: Route = { path: '/article/:id', diff --git a/lib/routes/6park/index.ts b/lib/routes/6park/index.ts index f4e2ee217..42009e9e9 100644 --- a/lib/routes/6park/index.ts +++ b/lib/routes/6park/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/index/:id?/:type?/:keyword?', diff --git a/lib/routes/6park/news.ts b/lib/routes/6park/news.ts index f63c0f6eb..2050185e5 100644 --- a/lib/routes/6park/news.ts +++ b/lib/routes/6park/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/news/:site?/:id?/:keyword?', diff --git a/lib/routes/6v123/index.ts b/lib/routes/6v123/index.ts index 3ae896f61..51c1991f5 100644 --- a/lib/routes/6v123/index.ts +++ b/lib/routes/6v123/index.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; import iconv from 'iconv-lite'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { category = 'dy' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '25', 10); diff --git a/lib/routes/6v123/latest-movies.ts b/lib/routes/6v123/latest-movies.ts index 760338075..0a1a8a48a 100644 --- a/lib/routes/6v123/latest-movies.ts +++ b/lib/routes/6v123/latest-movies.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processItems } from './utils'; const baseURL = 'https://www.hao6v.cc/gvod/zx.html'; diff --git a/lib/routes/6v123/latest-tvseries.ts b/lib/routes/6v123/latest-tvseries.ts index 133f5d699..e19fd5941 100644 --- a/lib/routes/6v123/latest-tvseries.ts +++ b/lib/routes/6v123/latest-tvseries.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processItems } from './utils'; const baseURL = 'https://www.hao6v.tv/gvod/dsj.html'; diff --git a/lib/routes/6v123/utils.ts b/lib/routes/6v123/utils.ts index d1425e8c5..f4e8bab90 100644 --- a/lib/routes/6v123/utils.ts +++ b/lib/routes/6v123/utils.ts @@ -1,9 +1,10 @@ +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import iconv from 'iconv-lite'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export async function loadDetailPage(link) { const response = await got.get(link, { diff --git a/lib/routes/78dm/index.ts b/lib/routes/78dm/index.ts index f45d6ebc0..d0ea3ca0f 100644 --- a/lib/routes/78dm/index.ts +++ b/lib/routes/78dm/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'news' } = ctx.req.param(); diff --git a/lib/routes/7mmtv/index.ts b/lib/routes/7mmtv/index.ts index 3473277ff..c77db04fa 100644 --- a/lib/routes/7mmtv/index.ts +++ b/lib/routes/7mmtv/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:language?/:category?/:type?', diff --git a/lib/routes/81/81rc/index.ts b/lib/routes/81/81rc/index.ts index e702e9bb0..ca8b87672 100644 --- a/lib/routes/81/81rc/index.ts +++ b/lib/routes/81/81rc/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'sy/gzdt_210283' } = ctx.req.param(); diff --git a/lib/routes/8264/list.ts b/lib/routes/8264/list.ts index f5782c9c4..3e498aea0 100644 --- a/lib/routes/8264/list.ts +++ b/lib/routes/8264/list.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/list/:id?', diff --git a/lib/routes/8kcos/article.ts b/lib/routes/8kcos/article.ts index 0c5491b65..f6c2bdb11 100644 --- a/lib/routes/8kcos/article.ts +++ b/lib/routes/8kcos/article.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/8kcos/cat.ts b/lib/routes/8kcos/cat.ts index 7790739f2..816c3525e 100644 --- a/lib/routes/8kcos/cat.ts +++ b/lib/routes/8kcos/cat.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; + export const route: Route = { path: '/cat/:cat{.+}?', radar: [ diff --git a/lib/routes/8kcos/latest.ts b/lib/routes/8kcos/latest.ts index 8a4326e3c..8a9860e8d 100644 --- a/lib/routes/8kcos/latest.ts +++ b/lib/routes/8kcos/latest.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; + const url = SUB_URL; export const route: Route = { diff --git a/lib/routes/8kcos/tag.ts b/lib/routes/8kcos/tag.ts index 569aad0f4..c86040dfa 100644 --- a/lib/routes/8kcos/tag.ts +++ b/lib/routes/8kcos/tag.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; + export const route: Route = { path: '/tag/:tag', categories: ['picture'], diff --git a/lib/routes/8world/index.ts b/lib/routes/8world/index.ts index 603050800..d64bbbfa1 100644 --- a/lib/routes/8world/index.ts +++ b/lib/routes/8world/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/91porn/author.ts b/lib/routes/91porn/author.ts index 019a4e863..3fdfa9438 100644 --- a/lib/routes/91porn/author.ts +++ b/lib/routes/91porn/author.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { domainValidation } from './utils'; export const route: Route = { diff --git a/lib/routes/91porn/index.ts b/lib/routes/91porn/index.ts index 0b0154ac0..2a026e16a 100644 --- a/lib/routes/91porn/index.ts +++ b/lib/routes/91porn/index.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { domainValidation } from './utils'; export const route: Route = { diff --git a/lib/routes/91porn/utils.ts b/lib/routes/91porn/utils.ts index 36c6a2e61..4f858554a 100644 --- a/lib/routes/91porn/utils.ts +++ b/lib/routes/91porn/utils.ts @@ -1,5 +1,6 @@ import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; + const allowDomain = new Set(['91porn.com', 'www.91porn.com', '0122.91p30.com', 'www.91zuixindizhi.com', 'w1218.91p46.com']); const domainValidation = (domain) => { diff --git a/lib/routes/95mm/category.ts b/lib/routes/95mm/category.ts index b0338b01a..fdca8c7c7 100644 --- a/lib/routes/95mm/category.ts +++ b/lib/routes/95mm/category.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, ProcessItems } from './utils'; +import type { Route } from '@/types'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/95mm/tab.ts b/lib/routes/95mm/tab.ts index 8d82f7b18..e1780bc5f 100644 --- a/lib/routes/95mm/tab.ts +++ b/lib/routes/95mm/tab.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, ProcessItems } from './utils'; +import type { Route } from '@/types'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/tab/:tab?', diff --git a/lib/routes/95mm/tag.ts b/lib/routes/95mm/tag.ts index a3971b92c..d0736ebd9 100644 --- a/lib/routes/95mm/tag.ts +++ b/lib/routes/95mm/tag.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, ProcessItems } from './utils'; +import type { Route } from '@/types'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/tag/:tag', diff --git a/lib/routes/95mm/utils.ts b/lib/routes/95mm/utils.ts index d07ed4e3a..33695a68c 100644 --- a/lib/routes/95mm/utils.ts +++ b/lib/routes/95mm/utils.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://www.95mm.vip'; @@ -57,4 +59,4 @@ const ProcessItems = async (ctx, title, currentUrl) => { }; }; -export { rootUrl, ProcessItems }; +export { ProcessItems, rootUrl }; diff --git a/lib/routes/9to5/subsite.ts b/lib/routes/9to5/subsite.ts index 45f0d6290..07b65cc64 100644 --- a/lib/routes/9to5/subsite.ts +++ b/lib/routes/9to5/subsite.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import parser from '@/utils/rss-parser'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/a9vg/index.ts b/lib/routes/a9vg/index.ts index 91b904dde..dfbc158b9 100644 --- a/lib/routes/a9vg/index.ts +++ b/lib/routes/a9vg/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'news/All' } = ctx.req.param(); diff --git a/lib/routes/aa1/60s.ts b/lib/routes/aa1/60s.ts index 4865c50c2..a06612d24 100644 --- a/lib/routes/aa1/60s.ts +++ b/lib/routes/aa1/60s.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { category } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '100', 10); diff --git a/lib/routes/aamacau/index.ts b/lib/routes/aamacau/index.ts index e60135de1..0dd98c78a 100644 --- a/lib/routes/aamacau/index.ts +++ b/lib/routes/aamacau/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/abc/index.ts b/lib/routes/abc/index.ts index 4751bcfb4..51d60073c 100644 --- a/lib/routes/abc/index.ts +++ b/lib/routes/abc/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category{.+}?', diff --git a/lib/routes/abmedia/category.ts b/lib/routes/abmedia/category.ts index e76552934..e12f635b6 100644 --- a/lib/routes/abmedia/category.ts +++ b/lib/routes/abmedia/category.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/abmedia/index.ts b/lib/routes/abmedia/index.ts index 727014476..7513d30b6 100644 --- a/lib/routes/abmedia/index.ts +++ b/lib/routes/abmedia/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/abskoop/index.ts b/lib/routes/abskoop/index.ts index 0d5268a48..7252758e9 100644 --- a/lib/routes/abskoop/index.ts +++ b/lib/routes/abskoop/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/abskoop/nsfw.ts b/lib/routes/abskoop/nsfw.ts index 602c604b2..4cc07f67c 100644 --- a/lib/routes/abskoop/nsfw.ts +++ b/lib/routes/abskoop/nsfw.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/academia/topics.ts b/lib/routes/academia/topics.ts index c45c9937c..c9dd64309 100644 --- a/lib/routes/academia/topics.ts +++ b/lib/routes/academia/topics.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/topic/:interest', example: '/academia/topic/Urban_History', diff --git a/lib/routes/accessbriefing/index.ts b/lib/routes/accessbriefing/index.ts index dcc8c805d..b613f516d 100644 --- a/lib/routes/accessbriefing/index.ts +++ b/lib/routes/accessbriefing/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { category = 'latest/news' } = ctx.req.param(); diff --git a/lib/routes/acfun/article.ts b/lib/routes/acfun/article.ts index 98c51a8a6..847ad6fb3 100644 --- a/lib/routes/acfun/article.ts +++ b/lib/routes/acfun/article.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const baseUrl = 'https://www.acfun.cn'; const categoryMap = { diff --git a/lib/routes/acfun/bangumi.ts b/lib/routes/acfun/bangumi.ts index 628215da4..1cbfb313b 100644 --- a/lib/routes/acfun/bangumi.ts +++ b/lib/routes/acfun/bangumi.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/acfun/video.ts b/lib/routes/acfun/video.ts index 855dcf5b1..cbf992f31 100644 --- a/lib/routes/acfun/video.ts +++ b/lib/routes/acfun/video.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/acg17/post.ts b/lib/routes/acg17/post.ts index ff9243de4..c3bd077cd 100644 --- a/lib/routes/acg17/post.ts +++ b/lib/routes/acg17/post.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/acgvinyl/news.ts b/lib/routes/acgvinyl/news.ts index 528d70f36..3a8f618f0 100644 --- a/lib/routes/acgvinyl/news.ts +++ b/lib/routes/acgvinyl/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/acpaa/index.ts b/lib/routes/acpaa/index.ts index 37e141e49..60707c519 100644 --- a/lib/routes/acpaa/index.ts +++ b/lib/routes/acpaa/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?/:name?', diff --git a/lib/routes/acs/journal.ts b/lib/routes/acs/journal.ts index f04f41e49..d04f778de 100644 --- a/lib/routes/acs/journal.ts +++ b/lib/routes/acs/journal.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import { art } from '@/utils/render'; export const route: Route = { path: '/journal/:id', diff --git a/lib/routes/adquan/case-library.ts b/lib/routes/adquan/case-library.ts index 83cf24e5a..c0336bc6a 100644 --- a/lib/routes/adquan/case-library.ts +++ b/lib/routes/adquan/case-library.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '24', 10); diff --git a/lib/routes/adquan/index.ts b/lib/routes/adquan/index.ts index 443ede034..d15dfc741 100644 --- a/lib/routes/adquan/index.ts +++ b/lib/routes/adquan/index.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/aeaweb/index.ts b/lib/routes/aeaweb/index.ts index a75426e44..0efe029f4 100644 --- a/lib/routes/aeaweb/index.ts +++ b/lib/routes/aeaweb/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:id', diff --git a/lib/routes/aeon/category.ts b/lib/routes/aeon/category.ts index 0e298e27f..bc87a7e54 100644 --- a/lib/routes/aeon/category.ts +++ b/lib/routes/aeon/category.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { getBuildId, getData } from './utils'; import { parseDate } from '@/utils/parse-date'; +import { getBuildId, getData } from './utils'; + export const route: Route = { path: '/category/:category', categories: ['new-media'], diff --git a/lib/routes/aeon/type.ts b/lib/routes/aeon/type.ts index 9b3a17523..581c25fa8 100644 --- a/lib/routes/aeon/type.ts +++ b/lib/routes/aeon/type.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { getBuildId, getData } from './utils'; import { parseDate } from '@/utils/parse-date'; +import { getBuildId, getData } from './utils'; + export const route: Route = { path: '/:type', categories: ['new-media'], diff --git a/lib/routes/aeon/utils.ts b/lib/routes/aeon/utils.ts index aed85eb99..2e1d05fe8 100644 --- a/lib/routes/aeon/utils.ts +++ b/lib/routes/aeon/utils.ts @@ -1,10 +1,12 @@ -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const getBuildId = () => cache.tryGet( diff --git a/lib/routes/afdian/dynamic.ts b/lib/routes/afdian/dynamic.ts index 539279154..1b00bf34f 100644 --- a/lib/routes/afdian/dynamic.ts +++ b/lib/routes/afdian/dynamic.ts @@ -1,5 +1,5 @@ -import got from '@/utils/got'; import type { Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/dynamic/:uid?', diff --git a/lib/routes/aflcio/blog.ts b/lib/routes/aflcio/blog.ts index 1896c88df..66bdb9016 100644 --- a/lib/routes/aflcio/blog.ts +++ b/lib/routes/aflcio/blog.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '5', 10); diff --git a/lib/routes/afr/latest.ts b/lib/routes/afr/latest.ts index b656755ce..e70f92a59 100644 --- a/lib/routes/afr/latest.ts +++ b/lib/routes/afr/latest.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; import type { Context } from 'hono'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + import { assetsConnectionByCriteriaQuery } from './query'; import { getItem } from './utils'; diff --git a/lib/routes/afr/navigation.ts b/lib/routes/afr/navigation.ts index cbe7421a2..d39e74c72 100644 --- a/lib/routes/afr/navigation.ts +++ b/lib/routes/afr/navigation.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; import type { Context } from 'hono'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + import { pageByNavigationPathQuery } from './query'; import { getItem } from './utils'; diff --git a/lib/routes/afr/utils.ts b/lib/routes/afr/utils.ts index c055ae9e7..f56d36248 100644 --- a/lib/routes/afr/utils.ts +++ b/lib/routes/afr/utils.ts @@ -1,4 +1,5 @@ import * as cheerio from 'cheerio'; + import ofetch from '@/utils/ofetch'; export const getItem = async (item) => { diff --git a/lib/routes/agefans/detail.ts b/lib/routes/agefans/detail.ts index 8f01abb80..1cd53e2c2 100644 --- a/lib/routes/agefans/detail.ts +++ b/lib/routes/agefans/detail.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + import { rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/agefans/update.ts b/lib/routes/agefans/update.ts index 8c987e0fd..c7dbf3dd3 100644 --- a/lib/routes/agefans/update.ts +++ b/lib/routes/agefans/update.ts @@ -1,9 +1,11 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { rootUrl } from './utils'; -import pMap from 'p-map'; export const route: Route = { path: '/update', diff --git a/lib/routes/agirls/topic-list.ts b/lib/routes/agirls/topic-list.ts index ceaecbc35..b7f1f0fff 100644 --- a/lib/routes/agirls/topic-list.ts +++ b/lib/routes/agirls/topic-list.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + import { baseUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/agirls/topic.ts b/lib/routes/agirls/topic.ts index ee288eacb..5ea7dc8a2 100644 --- a/lib/routes/agirls/topic.ts +++ b/lib/routes/agirls/topic.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { baseUrl, parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/agirls/utils.ts b/lib/routes/agirls/utils.ts index 916c7d1c1..13059a697 100644 --- a/lib/routes/agirls/utils.ts +++ b/lib/routes/agirls/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://agirls.aotter.net'; diff --git a/lib/routes/agirls/z-index.ts b/lib/routes/agirls/z-index.ts index 13c497641..689668196 100644 --- a/lib/routes/agirls/z-index.ts +++ b/lib/routes/agirls/z-index.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { baseUrl, parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/agora0/index.ts b/lib/routes/agora0/index.ts index dc287a6a3..ed6f17a67 100644 --- a/lib/routes/agora0/index.ts +++ b/lib/routes/agora0/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/agora0/pen0.ts b/lib/routes/agora0/pen0.ts index 629e340f9..664e4aaeb 100644 --- a/lib/routes/agora0/pen0.ts +++ b/lib/routes/agora0/pen0.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/agri/index.ts b/lib/routes/agri/index.ts index bd4d4ef9f..07cf69db9 100644 --- a/lib/routes/agri/index.ts +++ b/lib/routes/agri/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'zx/zxfb/' } = ctx.req.param(); diff --git a/lib/routes/ahjzu/news.ts b/lib/routes/ahjzu/news.ts index 6a82f99b8..f3f663645 100644 --- a/lib/routes/ahjzu/news.ts +++ b/lib/routes/ahjzu/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/news', diff --git a/lib/routes/aiaa/journal.ts b/lib/routes/aiaa/journal.ts index 4ab11594a..f196199a6 100644 --- a/lib/routes/aiaa/journal.ts +++ b/lib/routes/aiaa/journal.ts @@ -1,7 +1,8 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { name: 'ASR Articles', diff --git a/lib/routes/aibase/daily.ts b/lib/routes/aibase/daily.ts index dcf12dbb3..9d83c5b60 100644 --- a/lib/routes/aibase/daily.ts +++ b/lib/routes/aibase/daily.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import { rootUrl, buildApiUrl } from './util'; -import cache from '@/utils/cache'; + +import { buildApiUrl, rootUrl } from './util'; export const route: Route = { path: '/daily', diff --git a/lib/routes/aibase/discover.ts b/lib/routes/aibase/discover.ts index d20fd8f6f..3e592b386 100644 --- a/lib/routes/aibase/discover.ts +++ b/lib/routes/aibase/discover.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { rootUrl, buildApiUrl, processItems } from './util'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { buildApiUrl, processItems, rootUrl } from './util'; export const handler = async (ctx) => { const { id } = ctx.req.param(); diff --git a/lib/routes/aibase/news.ts b/lib/routes/aibase/news.ts index cdc173d01..83cd1ebf0 100644 --- a/lib/routes/aibase/news.ts +++ b/lib/routes/aibase/news.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import { rootUrl, buildApiUrl } from './util'; + +import { buildApiUrl, rootUrl } from './util'; export const route: Route = { path: '/news', diff --git a/lib/routes/aibase/topic.ts b/lib/routes/aibase/topic.ts index 8880e5ef2..dff5ea8ca 100644 --- a/lib/routes/aibase/topic.ts +++ b/lib/routes/aibase/topic.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { rootUrl, buildApiUrl, processItems } from './util'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { buildApiUrl, processItems, rootUrl } from './util'; export const handler = async (ctx) => { const { id, filter = 'id' } = ctx.req.param(); diff --git a/lib/routes/aibase/util.ts b/lib/routes/aibase/util.ts index e417c3c79..5926f304f 100644 --- a/lib/routes/aibase/util.ts +++ b/lib/routes/aibase/util.ts @@ -1,9 +1,11 @@ +import path from 'node:path'; + +import type { CheerioAPI } from 'cheerio'; + import ofetch from '@/utils/ofetch'; -import { CheerioAPI } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const defaultSrc = '_static/ee6af7e.js'; const defaultToken = 'djflkdsoisknfoklsyhownfrlewfknoiaewf'; @@ -111,4 +113,4 @@ const processItems = (items: any[]): any[] => }; }); -export { rootUrl, processItems, buildApiUrl }; +export { buildApiUrl, processItems, rootUrl }; diff --git a/lib/routes/aiblog-2xv/archives.ts b/lib/routes/aiblog-2xv/archives.ts index d72bc2fca..38528ecf7 100644 --- a/lib/routes/aiblog-2xv/archives.ts +++ b/lib/routes/aiblog-2xv/archives.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/archives', diff --git a/lib/routes/aicaijing/index.ts b/lib/routes/aicaijing/index.ts index 7e5820713..c57ee1cff 100644 --- a/lib/routes/aicaijing/index.ts +++ b/lib/routes/aicaijing/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category?/:id?', diff --git a/lib/routes/aiea/index.ts b/lib/routes/aiea/index.ts index 0d4a11096..d7ad69f45 100644 --- a/lib/routes/aiea/index.ts +++ b/lib/routes/aiea/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; export const route: Route = { diff --git a/lib/routes/aijishu/index.ts b/lib/routes/aijishu/index.ts index 522ad7d88..9371e5643 100644 --- a/lib/routes/aijishu/index.ts +++ b/lib/routes/aijishu/index.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import utils from './utils'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; + export const route: Route = { path: '/:type/:name?', categories: ['programming'], diff --git a/lib/routes/aijishu/utils.ts b/lib/routes/aijishu/utils.ts index c9f44616c..6d4e2346d 100644 --- a/lib/routes/aijishu/utils.ts +++ b/lib/routes/aijishu/utils.ts @@ -1,7 +1,8 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { parseRelativeDate, parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; const parseArticle = (item) => { const articleUrl = `https://aijishu.com${item.url || item.object.url}`; diff --git a/lib/routes/ainvest/article.ts b/lib/routes/ainvest/article.ts index e58f6e4fa..649e2bb32 100644 --- a/lib/routes/ainvest/article.ts +++ b/lib/routes/ainvest/article.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { getHeaders, randomString, encryptAES, decryptAES } from './utils'; + +import { decryptAES, encryptAES, getHeaders, randomString } from './utils'; export const route: Route = { path: '/article', diff --git a/lib/routes/ainvest/news.ts b/lib/routes/ainvest/news.ts index fe124fe21..59dc87aa1 100644 --- a/lib/routes/ainvest/news.ts +++ b/lib/routes/ainvest/news.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { getHeaders, randomString, decryptAES } from './utils'; + +import { decryptAES, getHeaders, randomString } from './utils'; export const route: Route = { path: '/news', diff --git a/lib/routes/ainvest/utils.ts b/lib/routes/ainvest/utils.ts index b67e8ea98..49d15799a 100644 --- a/lib/routes/ainvest/utils.ts +++ b/lib/routes/ainvest/utils.ts @@ -1,6 +1,7 @@ import crypto from 'node:crypto'; + import CryptoJS from 'crypto-js'; -import { KJUR, KEYUTIL, hextob64 } from 'jsrsasign'; +import { hextob64, KEYUTIL, KJUR } from 'jsrsasign'; const publicKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCARnxLlrhTK28bEV7s2IROjT73KLSjfqpKIvV8L+Yhe4BrF0Ut4oOH728HZlbSF0C3N0vXZjLAFesoS4v1pYOjVCPXl920Lh2seCv82m0cK78WMGuqZTfA44Nv7JsQMHC3+J6IZm8YD53ft2d8mYBFgKektduucjx8sObe7eRyoQIDAQAB'; @@ -65,4 +66,4 @@ const getHeaders = (key) => { }; }; -export { randomString, encryptAES, decryptAES, getHeaders }; +export { decryptAES, encryptAES, getHeaders, randomString }; diff --git a/lib/routes/aip/journal-pupp.ts b/lib/routes/aip/journal-pupp.ts index 32f73e72b..a6eb8dcaf 100644 --- a/lib/routes/aip/journal-pupp.ts +++ b/lib/routes/aip/journal-pupp.ts @@ -1,10 +1,12 @@ -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { puppeteerGet, renderDesc } from './utils'; + import { config } from '@/config'; -import { isValidHost } from '@/utils/valid-host'; -import puppeteer from '@/utils/puppeteer'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import cache from '@/utils/cache'; +import puppeteer from '@/utils/puppeteer'; +import { isValidHost } from '@/utils/valid-host'; + +import { puppeteerGet, renderDesc } from './utils'; const handler = async (ctx) => { const pub = ctx.req.param('pub'); diff --git a/lib/routes/aip/journal.ts b/lib/routes/aip/journal.ts index 4a721ec7c..f958c3a5b 100644 --- a/lib/routes/aip/journal.ts +++ b/lib/routes/aip/journal.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + import { renderDesc } from './utils'; export const route: Route = { diff --git a/lib/routes/aip/utils.ts b/lib/routes/aip/utils.ts index 24895b6f6..1590c8d02 100644 --- a/lib/routes/aip/utils.ts +++ b/lib/routes/aip/utils.ts @@ -1,4 +1,5 @@ import path from 'node:path'; + import { art } from '@/utils/render'; const puppeteerGet = async (url, browser) => { diff --git a/lib/routes/air-level/index.ts b/lib/routes/air-level/index.ts index 93ba54123..d5b05efdc 100644 --- a/lib/routes/air-level/index.ts +++ b/lib/routes/air-level/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { load } from 'cheerio'; // 类似 jQuery 的 API HTML 解析器 +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; // 统一使用的请求库 + export const route: Route = { path: '/air/:area', radar: [ diff --git a/lib/routes/air-level/levelrank.ts b/lib/routes/air-level/levelrank.ts index 31136891a..856466be7 100644 --- a/lib/routes/air-level/levelrank.ts +++ b/lib/routes/air-level/levelrank.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { load } from 'cheerio'; // 类似 jQuery 的 API HTML 解析器 +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; // 统一使用的请求库 + export const route: Route = { path: ['/rank/:status?'], radar: [ diff --git a/lib/routes/airchina/index.ts b/lib/routes/airchina/index.ts index 7d5383395..dbe342e58 100644 --- a/lib/routes/airchina/index.ts +++ b/lib/routes/airchina/index.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import buildData from '@/utils/common-config'; +import got from '@/utils/got'; + const baseUrl = 'https://www.airchina.com.cn'; export const route: Route = { diff --git a/lib/routes/aisixiang/column.ts b/lib/routes/aisixiang/column.ts index 409cd2928..ba0d9f536 100644 --- a/lib/routes/aisixiang/column.ts +++ b/lib/routes/aisixiang/column.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; -import { rootUrl, ossUrl, ProcessFeed } from './utils'; +import { ossUrl, ProcessFeed, rootUrl } from './utils'; export const route: Route = { path: '/column/:id', diff --git a/lib/routes/aisixiang/thinktank.ts b/lib/routes/aisixiang/thinktank.ts index 0d618a840..d32d70799 100644 --- a/lib/routes/aisixiang/thinktank.ts +++ b/lib/routes/aisixiang/thinktank.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, ossUrl, ProcessFeed } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { ossUrl, ProcessFeed, rootUrl } from './utils'; export const route: Route = { path: '/thinktank/:id/:type?', diff --git a/lib/routes/aisixiang/toplist.ts b/lib/routes/aisixiang/toplist.ts index 0e9e2990e..3599fe035 100644 --- a/lib/routes/aisixiang/toplist.ts +++ b/lib/routes/aisixiang/toplist.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { rootUrl, ossUrl, ProcessFeed } from './utils'; +import { ossUrl, ProcessFeed, rootUrl } from './utils'; export const route: Route = { path: ['/ranking/:id?/:period?', '/toplist/:id?/:period?'], diff --git a/lib/routes/aisixiang/utils.ts b/lib/routes/aisixiang/utils.ts index 5e96958ab..94ba3e62e 100644 --- a/lib/routes/aisixiang/utils.ts +++ b/lib/routes/aisixiang/utils.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const ossUrl = 'https://oss.aisixiang.com'; const rootUrl = 'https://www.aisixiang.com'; @@ -36,4 +37,4 @@ const ProcessFeed = (limit, tryGet, items) => ) ); -export { rootUrl, ossUrl, ProcessFeed }; +export { ossUrl, ProcessFeed, rootUrl }; diff --git a/lib/routes/aisixiang/zhuanti.ts b/lib/routes/aisixiang/zhuanti.ts index 4699f2b8c..212adbd89 100644 --- a/lib/routes/aisixiang/zhuanti.ts +++ b/lib/routes/aisixiang/zhuanti.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; -import { rootUrl, ossUrl, ProcessFeed } from './utils'; +import { ossUrl, ProcessFeed, rootUrl } from './utils'; export const route: Route = { path: '/zhuanti/:id', diff --git a/lib/routes/ajcass/shxyj.ts b/lib/routes/ajcass/shxyj.ts index e4324927d..7402ef221 100644 --- a/lib/routes/ajcass/shxyj.ts +++ b/lib/routes/ajcass/shxyj.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ajmide/index.ts b/lib/routes/ajmide/index.ts index 60394984c..40fea47b3 100644 --- a/lib/routes/ajmide/index.ts +++ b/lib/routes/ajmide/index.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ali213/news.ts b/lib/routes/ali213/news.ts index c41d832b9..dc3f03d56 100644 --- a/lib/routes/ali213/news.ts +++ b/lib/routes/ali213/news.ts @@ -1,15 +1,14 @@ import path from 'node:path'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - -import { art } from '@/utils/render'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/ali213/zl.ts b/lib/routes/ali213/zl.ts index ac72236f3..baa7d1345 100644 --- a/lib/routes/ali213/zl.ts +++ b/lib/routes/ali213/zl.ts @@ -1,15 +1,14 @@ import path from 'node:path'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - -import { art } from '@/utils/render'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category } = ctx.req.param(); diff --git a/lib/routes/alicesoft/infomation.ts b/lib/routes/alicesoft/infomation.ts index dc855add3..0cffbbdf4 100644 --- a/lib/routes/alicesoft/infomation.ts +++ b/lib/routes/alicesoft/infomation.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + const baseUrl = 'https://www.alicesoft.com'; export const route: Route = { diff --git a/lib/routes/alipan/files.ts b/lib/routes/alipan/files.ts index ddb373028..0c2b5d458 100644 --- a/lib/routes/alipan/files.ts +++ b/lib/routes/alipan/files.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { AnonymousShareInfo, ShareList, TokenResponse } from './types'; + +import type { AnonymousShareInfo, ShareList, TokenResponse } from './types'; export const route: Route = { path: '/files/:share_id/:parent_file_id?', diff --git a/lib/routes/aliresearch/information.ts b/lib/routes/aliresearch/information.ts index 98ea075be..2baf52a7c 100644 --- a/lib/routes/aliresearch/information.ts +++ b/lib/routes/aliresearch/information.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/information/:type?', diff --git a/lib/routes/alistapart/index.ts b/lib/routes/alistapart/index.ts index c60342301..ded80ed7d 100644 --- a/lib/routes/alistapart/index.ts +++ b/lib/routes/alistapart/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getData, getList } from './utils'; export const route: Route = { diff --git a/lib/routes/alistapart/topic.ts b/lib/routes/alistapart/topic.ts index 5dbe0d1e7..350a68253 100644 --- a/lib/routes/alistapart/topic.ts +++ b/lib/routes/alistapart/topic.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getData, getList } from './utils'; export const route: Route = { diff --git a/lib/routes/aliyun/database-month.ts b/lib/routes/aliyun/database-month.ts index 3fffe494e..c005de1d5 100644 --- a/lib/routes/aliyun/database-month.ts +++ b/lib/routes/aliyun/database-month.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/database_month', diff --git a/lib/routes/aliyun/developer/group.ts b/lib/routes/aliyun/developer/group.ts index b2f177177..60a01fbc9 100644 --- a/lib/routes/aliyun/developer/group.ts +++ b/lib/routes/aliyun/developer/group.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/aliyun/notice.ts b/lib/routes/aliyun/notice.ts index 7dc3be6a5..f86cb0b64 100644 --- a/lib/routes/aliyun/notice.ts +++ b/lib/routes/aliyun/notice.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/aljazeera/index.ts b/lib/routes/aljazeera/index.ts index b1aa2cd16..40f93eb45 100644 --- a/lib/routes/aljazeera/index.ts +++ b/lib/routes/aljazeera/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; - -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; const languages = { arabic: { diff --git a/lib/routes/ally/rail.ts b/lib/routes/ally/rail.ts index 9db8b66f7..412d8bb9c 100644 --- a/lib/routes/ally/rail.ts +++ b/lib/routes/ally/rail.ts @@ -1,6 +1,7 @@ -import { DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/alpinelinux/pkgs.ts b/lib/routes/alpinelinux/pkgs.ts index ea0c180d2..bcaf1c4aa 100644 --- a/lib/routes/alpinelinux/pkgs.ts +++ b/lib/routes/alpinelinux/pkgs.ts @@ -1,10 +1,11 @@ -import { Data, Route } from '@/types'; import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import { config } from '@/config'; +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; -import { Context } from 'hono'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; export const route: Route = { name: 'Packages', diff --git a/lib/routes/alternativeto/platform.ts b/lib/routes/alternativeto/platform.ts index 1369c3d92..8d3e5d1df 100644 --- a/lib/routes/alternativeto/platform.ts +++ b/lib/routes/alternativeto/platform.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { baseURL, puppeteerGet } from './utils'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { baseURL, puppeteerGet } from './utils'; + export const route: Route = { path: '/platform/:name/:routeParams?', categories: ['programming'], diff --git a/lib/routes/alternativeto/software.ts b/lib/routes/alternativeto/software.ts index 8df4515eb..8a23ff78b 100644 --- a/lib/routes/alternativeto/software.ts +++ b/lib/routes/alternativeto/software.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { baseURL, puppeteerGet } from './utils'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { baseURL, puppeteerGet } from './utils'; + export const route: Route = { path: '/software/:name/:routeParams?', categories: ['programming'], diff --git a/lib/routes/altotrain/news.ts b/lib/routes/altotrain/news.ts index b5eaa8cee..b5d735f2b 100644 --- a/lib/routes/altotrain/news.ts +++ b/lib/routes/altotrain/news.ts @@ -1,11 +1,15 @@ +import 'dayjs/locale/fr.js'; + +import type { Cheerio} from 'cheerio'; +import { load } from 'cheerio'; +import dayjs from 'dayjs'; +import localizedFormat from 'dayjs/plugin/localizedFormat.js'; +import type { Context } from 'hono'; + import type { Data, DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { Cheerio, load } from 'cheerio'; -import dayjs from 'dayjs'; -import 'dayjs/locale/fr.js'; -import localizedFormat from 'dayjs/plugin/localizedFormat.js'; -import type { Context } from 'hono'; + dayjs.extend(localizedFormat); export const route: Route = { diff --git a/lib/routes/amazfitwatchfaces/index.ts b/lib/routes/amazfitwatchfaces/index.ts index 64a14f10e..2ee9e63e1 100644 --- a/lib/routes/amazfitwatchfaces/index.ts +++ b/lib/routes/amazfitwatchfaces/index.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { device, sort, searchParams } = ctx.req.param(); diff --git a/lib/routes/amazon/awsblogs.ts b/lib/routes/amazon/awsblogs.ts index 8fcdc32f0..c92575515 100644 --- a/lib/routes/amazon/awsblogs.ts +++ b/lib/routes/amazon/awsblogs.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/amazon/kindle-software-updates.ts b/lib/routes/amazon/kindle-software-updates.ts index ce6ebd76e..4af10e1fb 100644 --- a/lib/routes/amazon/kindle-software-updates.ts +++ b/lib/routes/amazon/kindle-software-updates.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; + const host = 'https://www.amazon.com'; export const route: Route = { path: '/kindle/software-updates', diff --git a/lib/routes/amz123/kx.ts b/lib/routes/amz123/kx.ts index 329b764b3..b662c520c 100644 --- a/lib/routes/amz123/kx.ts +++ b/lib/routes/amz123/kx.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/android/platform-tools-releases.ts b/lib/routes/android/platform-tools-releases.ts index cd50bd812..b8a7ac579 100644 --- a/lib/routes/android/platform-tools-releases.ts +++ b/lib/routes/android/platform-tools-releases.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/android/security-bulletin.ts b/lib/routes/android/security-bulletin.ts index 4f29e7c8e..b81271a12 100644 --- a/lib/routes/android/security-bulletin.ts +++ b/lib/routes/android/security-bulletin.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/security-bulletin', categories: ['program-update'], diff --git a/lib/routes/anime1/anime.ts b/lib/routes/anime1/anime.ts index a106a001c..5537c1e95 100644 --- a/lib/routes/anime1/anime.ts +++ b/lib/routes/anime1/anime.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: 'anime/:category/:name', name: 'Anime', diff --git a/lib/routes/anime1/search.ts b/lib/routes/anime1/search.ts index 2e2e8fa80..773cd69eb 100644 --- a/lib/routes/anime1/search.ts +++ b/lib/routes/anime1/search.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: 'search/:keyword', name: 'Search', diff --git a/lib/routes/annualreviews/index.ts b/lib/routes/annualreviews/index.ts index 679f95cbc..632905078 100644 --- a/lib/routes/annualreviews/index.ts +++ b/lib/routes/annualreviews/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/anquanke/category.ts b/lib/routes/anquanke/category.ts index dbc4e5f7f..2da6a9349 100644 --- a/lib/routes/anquanke/category.ts +++ b/lib/routes/anquanke/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/anquanke/vul.ts b/lib/routes/anquanke/vul.ts index e8eea8f71..1ecdf681a 100644 --- a/lib/routes/anquanke/vul.ts +++ b/lib/routes/anquanke/vul.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const handler = async () => { diff --git a/lib/routes/anthropic/engineering.ts b/lib/routes/anthropic/engineering.ts index a325831d6..794e7b0f0 100644 --- a/lib/routes/anthropic/engineering.ts +++ b/lib/routes/anthropic/engineering.ts @@ -1,8 +1,9 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import { Route } from '@/types'; import pMap from 'p-map'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/anthropic/news.ts b/lib/routes/anthropic/news.ts index 9665209cf..e827f9c10 100644 --- a/lib/routes/anthropic/news.ts +++ b/lib/routes/anthropic/news.ts @@ -1,9 +1,10 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import { DataItem, Route } from '@/types'; import pMap from 'p-map'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/news', categories: ['programming'], diff --git a/lib/routes/anthropic/research.ts b/lib/routes/anthropic/research.ts index 7fa69d408..55961d98a 100644 --- a/lib/routes/anthropic/research.ts +++ b/lib/routes/anthropic/research.ts @@ -1,8 +1,9 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import { Route } from '@/types'; import pMap from 'p-map'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/anytxt/release-notes.ts b/lib/routes/anytxt/release-notes.ts index 05e7dac65..f8e2975dd 100644 --- a/lib/routes/anytxt/release-notes.ts +++ b/lib/routes/anytxt/release-notes.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/apache/apisix/blog.ts b/lib/routes/apache/apisix/blog.ts index d1b65259a..8bf1d3274 100644 --- a/lib/routes/apache/apisix/blog.ts +++ b/lib/routes/apache/apisix/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; async function getArticles() { diff --git a/lib/routes/apiseven/blog.ts b/lib/routes/apiseven/blog.ts index 910db1836..eb53f4bcd 100644 --- a/lib/routes/apiseven/blog.ts +++ b/lib/routes/apiseven/blog.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import MarkdownIt from 'markdown-it'; const md = MarkdownIt({ html: true, diff --git a/lib/routes/apkpure/versions.ts b/lib/routes/apkpure/versions.ts index 300c00931..19d288ede 100644 --- a/lib/routes/apkpure/versions.ts +++ b/lib/routes/apkpure/versions.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/routes/apnews/mobile-api.ts b/lib/routes/apnews/mobile-api.ts index 692e45df8..b63d79a9c 100644 --- a/lib/routes/apnews/mobile-api.ts +++ b/lib/routes/apnews/mobile-api.ts @@ -1,9 +1,12 @@ -import { Route, ViewType } from '@/types'; -import { fetchArticle } from './utils'; import pMap from 'p-map'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { fetchArticle } from './utils'; + export const route: Route = { path: '/mobile/:path{.+}?', categories: ['traditional-media'], diff --git a/lib/routes/apnews/rss.ts b/lib/routes/apnews/rss.ts index c14ad4671..3392d90a3 100644 --- a/lib/routes/apnews/rss.ts +++ b/lib/routes/apnews/rss.ts @@ -1,6 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import parser from '@/utils/rss-parser'; + import { fetchArticle } from './utils'; + const HOME_PAGE = 'https://apnews.com'; export const route: Route = { diff --git a/lib/routes/apnews/sitemap.ts b/lib/routes/apnews/sitemap.ts index 833cbceb2..dfc131a0d 100644 --- a/lib/routes/apnews/sitemap.ts +++ b/lib/routes/apnews/sitemap.ts @@ -1,10 +1,14 @@ -import { Route, ViewType } from '@/types'; -import { fetchArticle } from './utils'; -import pMap from 'p-map'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + +import { fetchArticle } from './utils'; + const HOME_PAGE = 'https://apnews.com'; export const route: Route = { diff --git a/lib/routes/apnews/topics.ts b/lib/routes/apnews/topics.ts index 96185f087..7215fe2c3 100644 --- a/lib/routes/apnews/topics.ts +++ b/lib/routes/apnews/topics.ts @@ -1,8 +1,12 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { fetchArticle, removeDuplicateByKey } from './utils'; import pMap from 'p-map'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + +import { fetchArticle, removeDuplicateByKey } from './utils'; + const HOME_PAGE = 'https://apnews.com'; export const route: Route = { diff --git a/lib/routes/apnews/utils.ts b/lib/routes/apnews/utils.ts index b8ce49272..083c19fb9 100644 --- a/lib/routes/apnews/utils.ts +++ b/lib/routes/apnews/utils.ts @@ -1,7 +1,8 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export function removeDuplicateByKey(items, key: string) { return [...new Map(items.map((x) => [x[key], x])).values()]; diff --git a/lib/routes/apnic/index.ts b/lib/routes/apnic/index.ts index 6570faec2..fcf98adb8 100644 --- a/lib/routes/apnic/index.ts +++ b/lib/routes/apnic/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/app-center/release.ts b/lib/routes/app-center/release.ts index e5f014e90..ebe6106ea 100644 --- a/lib/routes/app-center/release.ts +++ b/lib/routes/app-center/release.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import MarkdownIt from 'markdown-it'; export const route: Route = { path: '/release/:user/:app/:distribution_group', diff --git a/lib/routes/app-sales/index.ts b/lib/routes/app-sales/index.ts index b1f7ee9e9..07ed4170d 100644 --- a/lib/routes/app-sales/index.ts +++ b/lib/routes/app-sales/index.ts @@ -1,10 +1,9 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, fetchItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/app-sales/mostwanted.ts b/lib/routes/app-sales/mostwanted.ts index dfbd32dd6..2469ee798 100644 --- a/lib/routes/app-sales/mostwanted.ts +++ b/lib/routes/app-sales/mostwanted.ts @@ -1,10 +1,9 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, fetchItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/app-sales/util.ts b/lib/routes/app-sales/util.ts index 18c92b21b..e58783d87 100644 --- a/lib/routes/app-sales/util.ts +++ b/lib/routes/app-sales/util.ts @@ -1,12 +1,12 @@ -import { type DataItem } from '@/types'; - -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; import path from 'node:path'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; + +import { type DataItem } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + const baseUrl: string = 'https://www.app-sales.net'; /** diff --git a/lib/routes/apple/apps.ts b/lib/routes/apple/apps.ts index fdcba82d6..fd09d51bd 100644 --- a/lib/routes/apple/apps.ts +++ b/lib/routes/apple/apps.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + import { appstoreBearerToken } from './utils'; const platformIds = { diff --git a/lib/routes/apple/design.ts b/lib/routes/apple/design.ts index 7569420f2..db5d47045 100644 --- a/lib/routes/apple/design.ts +++ b/lib/routes/apple/design.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; -import md5 from '@/utils/md5'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import md5 from '@/utils/md5'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { categories: ['design'], example: '/apple/design', diff --git a/lib/routes/apple/exchange-repair.ts b/lib/routes/apple/exchange-repair.ts index 8eb491833..1f879c470 100644 --- a/lib/routes/apple/exchange-repair.ts +++ b/lib/routes/apple/exchange-repair.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const host = 'https://support.apple.com/'; export const route: Route = { diff --git a/lib/routes/apple/podcast.ts b/lib/routes/apple/podcast.ts index 07853678a..d73d90fe3 100644 --- a/lib/routes/apple/podcast.ts +++ b/lib/routes/apple/podcast.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/podcast/:id/:region?', diff --git a/lib/routes/apple/security-releases.ts b/lib/routes/apple/security-releases.ts index bfc1a2458..94ea8e698 100644 --- a/lib/routes/apple/security-releases.ts +++ b/lib/routes/apple/security-releases.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { language = 'en-us' } = ctx.req.param(); diff --git a/lib/routes/apple/utils.ts b/lib/routes/apple/utils.ts index 14f88a746..04cbf4b86 100644 --- a/lib/routes/apple/utils.ts +++ b/lib/routes/apple/utils.ts @@ -1,7 +1,8 @@ -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; // App Store and Podcast use different bearer tokens export const appstoreBearerToken = () => diff --git a/lib/routes/appleinsider/index.ts b/lib/routes/appleinsider/index.ts index bc5e5e1e3..227b4c299 100644 --- a/lib/routes/appleinsider/index.ts +++ b/lib/routes/appleinsider/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/appstare/comments.ts b/lib/routes/appstare/comments.ts index 8db1faf2f..cc8d072cd 100644 --- a/lib/routes/appstare/comments.ts +++ b/lib/routes/appstare/comments.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const handler = async (ctx) => { diff --git a/lib/routes/appstore/in-app-purchase.ts b/lib/routes/appstore/in-app-purchase.ts index d7d4cd27a..94688010f 100644 --- a/lib/routes/appstore/in-app-purchase.ts +++ b/lib/routes/appstore/in-app-purchase.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + import { appstoreBearerToken } from '@/routes/apple/utils'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/iap/:country/:id', diff --git a/lib/routes/appstore/price.ts b/lib/routes/appstore/price.ts index 996a27431..829df08ea 100644 --- a/lib/routes/appstore/price.ts +++ b/lib/routes/appstore/price.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import currency from 'currency-symbol-map'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/price/:country/:type/:id', categories: ['program-update'], diff --git a/lib/routes/appstore/xianmian.ts b/lib/routes/appstore/xianmian.ts index 11954d042..c4cabc5cd 100644 --- a/lib/routes/appstore/xianmian.ts +++ b/lib/routes/appstore/xianmian.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/appstorrent/programs.ts b/lib/routes/appstorrent/programs.ts index 75fc01bac..3e273623b 100644 --- a/lib/routes/appstorrent/programs.ts +++ b/lib/routes/appstorrent/programs.ts @@ -1,12 +1,15 @@ -import { Data, DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; -import got, { Options } from '@/utils/got'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; +import path from 'node:path'; + import { load } from 'cheerio'; import dayjs from 'dayjs'; -import { Context } from 'hono'; -import path from 'node:path'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import type { Options } from '@/utils/got'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/programs', diff --git a/lib/routes/aqara/community.ts b/lib/routes/aqara/community.ts index dfeaf2a8a..2d9a136db 100644 --- a/lib/routes/aqara/community.ts +++ b/lib/routes/aqara/community.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/aqara/news.ts b/lib/routes/aqara/news.ts index f812916c7..898ea0dac 100644 --- a/lib/routes/aqara/news.ts +++ b/lib/routes/aqara/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/aqara/post.ts b/lib/routes/aqara/post.ts index 3bbd283fe..d64e1d96a 100644 --- a/lib/routes/aqara/post.ts +++ b/lib/routes/aqara/post.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '*', diff --git a/lib/routes/aqara/region.ts b/lib/routes/aqara/region.ts index 48174a083..b321cfeb5 100644 --- a/lib/routes/aqara/region.ts +++ b/lib/routes/aqara/region.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + export const route: Route = { path: '/:region/:type?', name: 'Unknown', diff --git a/lib/routes/aqicn/aqi.ts b/lib/routes/aqicn/aqi.ts index f5f94a129..6f07c3e63 100644 --- a/lib/routes/aqicn/aqi.ts +++ b/lib/routes/aqicn/aqi.ts @@ -1,6 +1,6 @@ +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Route } from '@/types'; export const route: Route = { path: '/:city/:pollution?', diff --git a/lib/routes/arcteryx/new-arrivals.ts b/lib/routes/arcteryx/new-arrivals.ts index 49f15c9b9..6885aab2c 100644 --- a/lib/routes/arcteryx/new-arrivals.ts +++ b/lib/routes/arcteryx/new-arrivals.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { generateRssData } from './utils'; export const route: Route = { diff --git a/lib/routes/arcteryx/outlet.ts b/lib/routes/arcteryx/outlet.ts index 4fbc66e79..71020df27 100644 --- a/lib/routes/arcteryx/outlet.ts +++ b/lib/routes/arcteryx/outlet.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { generateRssData } from './utils'; export const route: Route = { diff --git a/lib/routes/arcteryx/regear-new-arrivals.ts b/lib/routes/arcteryx/regear-new-arrivals.ts index 8c89e55ed..a0dba4293 100644 --- a/lib/routes/arcteryx/regear-new-arrivals.ts +++ b/lib/routes/arcteryx/regear-new-arrivals.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const host = 'https://www.regear.arcteryx.com'; function getUSDPrice(number) { return (number / 100).toLocaleString('en-US', { style: 'currency', currency: 'USD' }); diff --git a/lib/routes/artstation/user.ts b/lib/routes/artstation/user.ts index 403bfac2b..420b99aae 100644 --- a/lib/routes/artstation/user.ts +++ b/lib/routes/artstation/user.ts @@ -1,12 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; import { art } from '@/utils/render'; -import { config } from '@/config'; export const route: Route = { path: '/:handle', diff --git a/lib/routes/asiafruitchina/categories.ts b/lib/routes/asiafruitchina/categories.ts index c63053946..51fd1970f 100644 --- a/lib/routes/asiafruitchina/categories.ts +++ b/lib/routes/asiafruitchina/categories.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = 'all' } = ctx.req.param(); diff --git a/lib/routes/asiafruitchina/news.ts b/lib/routes/asiafruitchina/news.ts index d4d3ef356..d624c4d4a 100644 --- a/lib/routes/asiafruitchina/news.ts +++ b/lib/routes/asiafruitchina/news.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/asianfanfics/tag.ts b/lib/routes/asianfanfics/tag.ts index e83463092..60e7eb8f3 100644 --- a/lib/routes/asianfanfics/tag.ts +++ b/lib/routes/asianfanfics/tag.ts @@ -1,9 +1,9 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; import { config } from '@/config'; +import type { DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; // test url http://localhost:1200/asianfanfics/tag/milklove/N diff --git a/lib/routes/asianfanfics/text-search.ts b/lib/routes/asianfanfics/text-search.ts index d6b8fb004..35e915c1f 100644 --- a/lib/routes/asianfanfics/text-search.ts +++ b/lib/routes/asianfanfics/text-search.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + import { config } from '@/config'; -import { DataItem, Route } from '@/types'; +import type { DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; // test url http://localhost:1200/asianfanfics/text-search/milklove diff --git a/lib/routes/asiantolick/index.ts b/lib/routes/asiantolick/index.ts index 55ff5782e..6000d8151 100644 --- a/lib/routes/asiantolick/index.ts +++ b/lib/routes/asiantolick/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category{.+}?', diff --git a/lib/routes/asmr-200/index.ts b/lib/routes/asmr-200/index.ts index aae88f9e2..293f22ffb 100644 --- a/lib/routes/asmr-200/index.ts +++ b/lib/routes/asmr-200/index.ts @@ -1,7 +1,8 @@ -import { Result, Work } from '@/routes/asmr-200/type'; -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import path from 'node:path'; + +import type { Result, Work } from '@/routes/asmr-200/type'; +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/asus/bios.ts b/lib/routes/asus/bios.ts index aa74ef54d..ad34d46a8 100644 --- a/lib/routes/asus/bios.ts +++ b/lib/routes/asus/bios.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import cache from '@/utils/cache'; const endPoints = { zh: { diff --git a/lib/routes/asus/gpu-tweak.ts b/lib/routes/asus/gpu-tweak.ts index 54ea508f4..75e87aad6 100644 --- a/lib/routes/asus/gpu-tweak.ts +++ b/lib/routes/asus/gpu-tweak.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const pageUrl = 'https://www.asus.com/campaign/GPU-Tweak-III/tw/index.php'; export const route: Route = { diff --git a/lib/routes/atcoder/contest.ts b/lib/routes/atcoder/contest.ts index 7e29b3ff5..270a9689a 100644 --- a/lib/routes/atcoder/contest.ts +++ b/lib/routes/atcoder/contest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/atcoder/post.ts b/lib/routes/atcoder/post.ts index 01ce18ee5..55130f768 100644 --- a/lib/routes/atcoder/post.ts +++ b/lib/routes/atcoder/post.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/post/:language?/:keyword?', diff --git a/lib/routes/atptour/news.ts b/lib/routes/atptour/news.ts index a5698bdd3..0382bf2ec 100644 --- a/lib/routes/atptour/news.ts +++ b/lib/routes/atptour/news.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/news/:lang?', diff --git a/lib/routes/augmentcode/blog.ts b/lib/routes/augmentcode/blog.ts index f816bdec5..126bda8d0 100644 --- a/lib/routes/augmentcode/blog.ts +++ b/lib/routes/augmentcode/blog.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '50', 10); diff --git a/lib/routes/auto-stats/index.ts b/lib/routes/auto-stats/index.ts index 350de7136..e5c1640cb 100644 --- a/lib/routes/auto-stats/index.ts +++ b/lib/routes/auto-stats/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/autocentre/index.ts b/lib/routes/autocentre/index.ts index 7a434f5a7..3ee5c0130 100644 --- a/lib/routes/autocentre/index.ts +++ b/lib/routes/autocentre/index.ts @@ -1,4 +1,4 @@ -import { Data, Route } from '@/types'; +import type { Data, Route } from '@/types'; import parser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/azul/packages.ts b/lib/routes/azul/packages.ts index e630ccd59..4aba0504f 100644 --- a/lib/routes/azul/packages.ts +++ b/lib/routes/azul/packages.ts @@ -1,10 +1,9 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/baai/events.ts b/lib/routes/baai/events.ts index 779c9de48..6fc1cbbfe 100644 --- a/lib/routes/baai/events.ts +++ b/lib/routes/baai/events.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { baseUrl, apiHost, parseEventDetail, parseItem } from './utils'; +import { apiHost, baseUrl, parseEventDetail, parseItem } from './utils'; export const route: Route = { path: '/hub/events', diff --git a/lib/routes/baai/hub.ts b/lib/routes/baai/hub.ts index 92c2266ee..93877d157 100644 --- a/lib/routes/baai/hub.ts +++ b/lib/routes/baai/hub.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { baseUrl, apiHost, getTagsData, parseEventDetail, parseItem } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { apiHost, baseUrl, getTagsData, parseEventDetail, parseItem } from './utils'; export const route: Route = { path: ['/hub/:tagId?/:sort?/:range?'], diff --git a/lib/routes/baai/utils.ts b/lib/routes/baai/utils.ts index f6d4a4835..c54648ad6 100644 --- a/lib/routes/baai/utils.ts +++ b/lib/routes/baai/utils.ts @@ -1,8 +1,9 @@ -import ofetch from '@/utils/ofetch'; import { destr } from 'destr'; + +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; const baseUrl = 'https://hub.baai.ac.cn'; const eventUrl = 'https://event.baai.ac.cn'; @@ -39,4 +40,4 @@ const parseEventDetail = async (item) => { return data.data.ac_desc + data.data.ac_desc_two; }; -export { baseUrl, eventUrl, apiHost, getTagsData, parseItem, parseEventDetail }; +export { apiHost, baseUrl, eventUrl, getTagsData, parseEventDetail, parseItem }; diff --git a/lib/routes/backlinko/blog.ts b/lib/routes/backlinko/blog.ts index b87325cf9..a90fe1bde 100644 --- a/lib/routes/backlinko/blog.ts +++ b/lib/routes/backlinko/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bad/index.ts b/lib/routes/bad/index.ts index 9df29dcd7..a821ead9b 100644 --- a/lib/routes/bad/index.ts +++ b/lib/routes/bad/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '*', diff --git a/lib/routes/baidu/gushitong/index.ts b/lib/routes/baidu/gushitong/index.ts index b51ca0056..27212464f 100644 --- a/lib/routes/baidu/gushitong/index.ts +++ b/lib/routes/baidu/gushitong/index.ts @@ -1,8 +1,9 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const STATUS_MAP = { up: '上涨', diff --git a/lib/routes/baidu/search.ts b/lib/routes/baidu/search.ts index 7c95c0d36..0ea1539cd 100644 --- a/lib/routes/baidu/search.ts +++ b/lib/routes/baidu/search.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; + const renderDescription = (description, images) => art(path.join(__dirname, './templates/description.art'), { description, images }); -import { config } from '@/config'; export const route: Route = { path: '/search/:keyword', diff --git a/lib/routes/baidu/tieba/forum.ts b/lib/routes/baidu/tieba/forum.ts index fe432fcd3..04d912a24 100644 --- a/lib/routes/baidu/tieba/forum.ts +++ b/lib/routes/baidu/tieba/forum.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: ['/tieba/forum/good/:kw/:cid?/:sortBy?', '/tieba/forum/:kw/:sortBy?'], diff --git a/lib/routes/baidu/tieba/post.ts b/lib/routes/baidu/tieba/post.ts index d5e9cd067..9ce26f3fc 100644 --- a/lib/routes/baidu/tieba/post.ts +++ b/lib/routes/baidu/tieba/post.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; /** * 获取最新的帖子回复(倒序查看) diff --git a/lib/routes/baidu/tieba/search.ts b/lib/routes/baidu/tieba/search.ts index b2356b8eb..e2240fa3e 100644 --- a/lib/routes/baidu/tieba/search.ts +++ b/lib/routes/baidu/tieba/search.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/tieba/search/:qw/:routeParams?', diff --git a/lib/routes/baidu/tieba/user.ts b/lib/routes/baidu/tieba/user.ts index 73448bddb..a5a9288e4 100644 --- a/lib/routes/baidu/tieba/user.ts +++ b/lib/routes/baidu/tieba/user.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/baidu/top.ts b/lib/routes/baidu/top.ts index 7ff72313b..fedce7cde 100644 --- a/lib/routes/baidu/top.ts +++ b/lib/routes/baidu/top.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/top/:board?', categories: ['other'], diff --git a/lib/routes/baijing/index.ts b/lib/routes/baijing/index.ts index 79b2bda6b..c0918ba51 100644 --- a/lib/routes/baijing/index.ts +++ b/lib/routes/baijing/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/article', diff --git a/lib/routes/bakamh/manga.ts b/lib/routes/bakamh/manga.ts index 10f538227..3bad01f2f 100644 --- a/lib/routes/bakamh/manga.ts +++ b/lib/routes/bakamh/manga.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; const url = 'https://bakamh.com'; diff --git a/lib/routes/bandcamp/live.ts b/lib/routes/bandcamp/live.ts index 845d02156..a6c3ef810 100644 --- a/lib/routes/bandcamp/live.ts +++ b/lib/routes/bandcamp/live.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bandcamp/tag.ts b/lib/routes/bandcamp/tag.ts index b75e1232c..42fdc97c7 100644 --- a/lib/routes/bandcamp/tag.ts +++ b/lib/routes/bandcamp/tag.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/tag/:tag?', diff --git a/lib/routes/bandcamp/weekly.ts b/lib/routes/bandcamp/weekly.ts index 687f5e9af..5e8d49d23 100644 --- a/lib/routes/bandcamp/weekly.ts +++ b/lib/routes/bandcamp/weekly.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/weekly', diff --git a/lib/routes/bandisoft/history.ts b/lib/routes/bandisoft/history.ts index 39fd2dcb6..371d7d5db 100644 --- a/lib/routes/bandisoft/history.ts +++ b/lib/routes/bandisoft/history.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + const idOptions = [ { label: 'Bandizip', diff --git a/lib/routes/bangumi.moe/index.ts b/lib/routes/bangumi.moe/index.ts index e8a3667a8..765492954 100644 --- a/lib/routes/bangumi.moe/index.ts +++ b/lib/routes/bangumi.moe/index.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/bangumi.online/online.ts b/lib/routes/bangumi.online/online.ts index 76ecccb68..916614248 100644 --- a/lib/routes/bangumi.online/online.ts +++ b/lib/routes/bangumi.online/online.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/', categories: ['anime'], diff --git a/lib/routes/bangumi.tv/calendar/_base.ts b/lib/routes/bangumi.tv/calendar/_base.ts index 4e6bc8acc..140b9da62 100644 --- a/lib/routes/bangumi.tv/calendar/_base.ts +++ b/lib/routes/bangumi.tv/calendar/_base.ts @@ -1,5 +1,5 @@ -import got from '@/utils/got'; import { config } from '@/config'; +import got from '@/utils/got'; const getData = (tryGet) => { const bgmCalendarUrl = 'https://api.bgm.tv/calendar'; diff --git a/lib/routes/bangumi.tv/calendar/today.ts b/lib/routes/bangumi.tv/calendar/today.ts index 6055b44ad..0ff553425 100644 --- a/lib/routes/bangumi.tv/calendar/today.ts +++ b/lib/routes/bangumi.tv/calendar/today.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import getData from './_base'; -import { art } from '@/utils/render'; import path from 'node:path'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { art } from '@/utils/render'; + +import getData from './_base'; + export const route: Route = { path: '/calendar/today', categories: ['anime'], diff --git a/lib/routes/bangumi.tv/group/reply.ts b/lib/routes/bangumi.tv/group/reply.ts index 33ead23f1..2e4412235 100644 --- a/lib/routes/bangumi.tv/group/reply.ts +++ b/lib/routes/bangumi.tv/group/reply.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bangumi.tv/group/topic.ts b/lib/routes/bangumi.tv/group/topic.ts index 2ba94387f..3b135a798 100644 --- a/lib/routes/bangumi.tv/group/topic.ts +++ b/lib/routes/bangumi.tv/group/topic.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://bgm.tv'; export const route: Route = { diff --git a/lib/routes/bangumi.tv/other/followrank.ts b/lib/routes/bangumi.tv/other/followrank.ts index 08e6e0f2d..804beecf7 100644 --- a/lib/routes/bangumi.tv/other/followrank.ts +++ b/lib/routes/bangumi.tv/other/followrank.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/bangumi.tv/person/index.ts b/lib/routes/bangumi.tv/person/index.ts index d4e566f81..cb89b750e 100644 --- a/lib/routes/bangumi.tv/person/index.ts +++ b/lib/routes/bangumi.tv/person/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bangumi.tv/subject/comments.ts b/lib/routes/bangumi.tv/subject/comments.ts index 4f52ee191..f3d1e76d2 100644 --- a/lib/routes/bangumi.tv/subject/comments.ts +++ b/lib/routes/bangumi.tv/subject/comments.ts @@ -1,5 +1,6 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import ofetch from '@/utils/ofetch'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; const getComments = async (subjectID, minLength) => { diff --git a/lib/routes/bangumi.tv/subject/ep.ts b/lib/routes/bangumi.tv/subject/ep.ts index 503986f03..60f33d0d6 100644 --- a/lib/routes/bangumi.tv/subject/ep.ts +++ b/lib/routes/bangumi.tv/subject/ep.ts @@ -1,7 +1,9 @@ +import path from 'node:path'; + import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { getLocalName } from './utils'; const getEps = async (subjectID, showOriginalName) => { diff --git a/lib/routes/bangumi.tv/subject/index.ts b/lib/routes/bangumi.tv/subject/index.ts index 9af2260bd..88d303304 100644 --- a/lib/routes/bangumi.tv/subject/index.ts +++ b/lib/routes/bangumi.tv/subject/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import getComments from './comments'; -import getFromAPI from './offcial-subject-api'; -import getEps from './ep'; -import { queryToBoolean } from '@/utils/readable-social'; 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'; 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 cefadca81..703beba30 100644 --- a/lib/routes/bangumi.tv/subject/offcial-subject-api.ts +++ b/lib/routes/bangumi.tv/subject/offcial-subject-api.ts @@ -1,5 +1,6 @@ import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + import { getLocalName } from './utils'; const getFromAPI = (type) => { diff --git a/lib/routes/bangumi.tv/user/blog.ts b/lib/routes/bangumi.tv/user/blog.ts index da55b03ef..c96c32a56 100644 --- a/lib/routes/bangumi.tv/user/blog.ts +++ b/lib/routes/bangumi.tv/user/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bangumi.tv/user/collections.ts b/lib/routes/bangumi.tv/user/collections.ts index 4002c39c4..6514406bb 100644 --- a/lib/routes/bangumi.tv/user/collections.ts +++ b/lib/routes/bangumi.tv/user/collections.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + // 合并不同 subjectType 的 type 映射 const getTypeNames = (subjectType) => { const commonTypeNames = { diff --git a/lib/routes/banshujiang/index.ts b/lib/routes/banshujiang/index.ts index baa469aeb..5724734e0 100644 --- a/lib/routes/banshujiang/index.ts +++ b/lib/routes/banshujiang/index.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category } = ctx.req.param(); diff --git a/lib/routes/banyuetan/index.ts b/lib/routes/banyuetan/index.ts index bcc49e986..440855f87 100644 --- a/lib/routes/banyuetan/index.ts +++ b/lib/routes/banyuetan/index.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const { id = 'jinritan' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/baobua/article.ts b/lib/routes/baobua/article.ts index 7b40702fd..82fe3bdf7 100644 --- a/lib/routes/baobua/article.ts +++ b/lib/routes/baobua/article.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/baobua/category.ts b/lib/routes/baobua/category.ts index 54cad3a70..0618fd7dc 100644 --- a/lib/routes/baobua/category.ts +++ b/lib/routes/baobua/category.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/baobua/latest.ts b/lib/routes/baobua/latest.ts index 664f95c76..0fc235ff7 100644 --- a/lib/routes/baobua/latest.ts +++ b/lib/routes/baobua/latest.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/', diff --git a/lib/routes/baobua/search.ts b/lib/routes/baobua/search.ts index 804a61ea5..11d62506b 100644 --- a/lib/routes/baobua/search.ts +++ b/lib/routes/baobua/search.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/search/:keyword', diff --git a/lib/routes/baoyu/index.ts b/lib/routes/baoyu/index.ts index 5b1011208..6097f7fac 100644 --- a/lib/routes/baoyu/index.ts +++ b/lib/routes/baoyu/index.ts @@ -1,9 +1,10 @@ -import { Route, DataItem } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import parser from '@/utils/rss-parser'; -import cache from '@/utils/cache'; export const route: Route = { path: '/blog', diff --git a/lib/routes/baozimh/index.ts b/lib/routes/baozimh/index.ts index e726b5dac..3cbf55fb8 100644 --- a/lib/routes/baozimh/index.ts +++ b/lib/routes/baozimh/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://www.baozimh.com'; diff --git a/lib/routes/barronschina/index.ts b/lib/routes/barronschina/index.ts index 70339fbf7..f5e22d252 100644 --- a/lib/routes/barronschina/index.ts +++ b/lib/routes/barronschina/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/baselang/index.ts b/lib/routes/baselang/index.ts index d8c7c13db..3ca25a30a 100644 --- a/lib/routes/baselang/index.ts +++ b/lib/routes/baselang/index.ts @@ -1,9 +1,10 @@ -import { Route, type Data } from '@/types'; +import type { Context } from 'hono'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { type Data, Route } from '@/types'; +import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import logger from '@/utils/logger'; -import { Context } from 'hono'; type WordpressPost = { id: number; diff --git a/lib/routes/bast/index.ts b/lib/routes/bast/index.ts index cfa5b946f..3b2c9e63c 100644 --- a/lib/routes/bast/index.ts +++ b/lib/routes/bast/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '*', diff --git a/lib/routes/bbc/index.ts b/lib/routes/bbc/index.ts index 5eff388ef..bc48c45df 100644 --- a/lib/routes/bbc/index.ts +++ b/lib/routes/bbc/index.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; -import utils from './utils'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import parser from '@/utils/rss-parser'; + +import utils from './utils'; + export const route: Route = { path: '/:site?/:channel?', name: 'News', diff --git a/lib/routes/bbc/learningenglish.ts b/lib/routes/bbc/learningenglish.ts index 8259efab9..4c51ea488 100644 --- a/lib/routes/bbc/learningenglish.ts +++ b/lib/routes/bbc/learningenglish.ts @@ -1,9 +1,10 @@ +import { load } from 'cheerio'; +import { type Context } from 'hono'; + import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; -import { load } from 'cheerio'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type Context } from 'hono'; const channelMap = { 'take-away-english': '随身英语', diff --git a/lib/routes/bbcnewslabs/news.ts b/lib/routes/bbcnewslabs/news.ts index 894ea0e93..267d5efdf 100644 --- a/lib/routes/bbcnewslabs/news.ts +++ b/lib/routes/bbcnewslabs/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bc3ts/list.ts b/lib/routes/bc3ts/list.ts index 0325f3380..2cbdee43a 100644 --- a/lib/routes/bc3ts/list.ts +++ b/lib/routes/bc3ts/list.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { Media, PostResponse } from './types'; -import { config } from '@/config'; + +import type { Media, PostResponse } from './types'; export const route: Route = { path: '/post/list/:sort?', diff --git a/lib/routes/bdys/index.ts b/lib/routes/bdys/index.ts index 2a0c7527a..5a112d699 100644 --- a/lib/routes/bdys/index.ts +++ b/lib/routes/bdys/index.ts @@ -1,15 +1,16 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; import pMap from 'p-map'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; // Visit https://www.bdys.me for the list of domains const allowDomains = new Set(['52bdys.com', 'bde4.icu', 'bdys01.com']); diff --git a/lib/routes/behance/user.ts b/lib/routes/behance/user.ts index 8930c03c4..3a7f30220 100644 --- a/lib/routes/behance/user.ts +++ b/lib/routes/behance/user.ts @@ -1,10 +1,13 @@ -import { Route, ViewType } from '@/types'; +import crypto from 'node:crypto'; +import path from 'node:path'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import crypto from 'node:crypto'; -import path from 'node:path'; import { art } from '@/utils/render'; + import { getAppreciatedQuery, getProfileProjectsAndSelectionsQuery, getProjectPageQuery } from './queries'; export const route: Route = { diff --git a/lib/routes/beijingprice/index.ts b/lib/routes/beijingprice/index.ts index 8004d50b5..519c6f677 100644 --- a/lib/routes/beijingprice/index.ts +++ b/lib/routes/beijingprice/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/bellroy/new-releases.ts b/lib/routes/bellroy/new-releases.ts index c8c25522c..a706ef4fb 100644 --- a/lib/routes/bellroy/new-releases.ts +++ b/lib/routes/bellroy/new-releases.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/bendibao/news.ts b/lib/routes/bendibao/news.ts index 0f5404bcf..c97c77a9f 100644 --- a/lib/routes/bendibao/news.ts +++ b/lib/routes/bendibao/news.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/news/:city', diff --git a/lib/routes/bestblogs/feeds.ts b/lib/routes/bestblogs/feeds.ts index d4509e646..151f2b1e5 100644 --- a/lib/routes/bestblogs/feeds.ts +++ b/lib/routes/bestblogs/feeds.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/bestofjs/monthly.ts b/lib/routes/bestofjs/monthly.ts index e34606b29..9df1bb83f 100644 --- a/lib/routes/bestofjs/monthly.ts +++ b/lib/routes/bestofjs/monthly.ts @@ -1,8 +1,11 @@ import path from 'node:path'; + import { load } from 'cheerio'; -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; const BASEURL = 'https://bestofjs.org/rankings/monthly'; diff --git a/lib/routes/bfl/announcements.ts b/lib/routes/bfl/announcements.ts index bc7bb930b..dd4861f46 100644 --- a/lib/routes/bfl/announcements.ts +++ b/lib/routes/bfl/announcements.ts @@ -1,8 +1,9 @@ -import { Route, DataItem, Data } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const ROOT_URL = 'https://bfl.ai'; // 根 URL 定义为常量 diff --git a/lib/routes/bgmlist/onair.ts b/lib/routes/bgmlist/onair.ts index d44221cb4..f2aeb21f7 100644 --- a/lib/routes/bgmlist/onair.ts +++ b/lib/routes/bgmlist/onair.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; diff --git a/lib/routes/bigquant/collections.ts b/lib/routes/bigquant/collections.ts index dd3ec64ba..c5b85488b 100644 --- a/lib/routes/bigquant/collections.ts +++ b/lib/routes/bigquant/collections.ts @@ -1,7 +1,10 @@ -import { Route, ViewType } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/bilibili/app.ts b/lib/routes/bilibili/app.ts index f42c7dd78..408e846e8 100644 --- a/lib/routes/bilibili/app.ts +++ b/lib/routes/bilibili/app.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; const config = { diff --git a/lib/routes/bilibili/article.ts b/lib/routes/bilibili/article.ts index 1c9980d0e..828f67465 100644 --- a/lib/routes/bilibili/article.ts +++ b/lib/routes/bilibili/article.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; -import cacheGeneral from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cacheGeneral from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import cache from './cache'; + export const route: Route = { path: '/user/article/:uid', categories: ['social-media'], diff --git a/lib/routes/bilibili/audio.ts b/lib/routes/bilibili/audio.ts index 5071ac56c..b1a1fe48a 100644 --- a/lib/routes/bilibili/audio.ts +++ b/lib/routes/bilibili/audio.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; const audio = 'https://www.bilibili.com/audio/au'; diff --git a/lib/routes/bilibili/bangumi.ts b/lib/routes/bilibili/bangumi.ts index 570f2f4d5..850e105f5 100644 --- a/lib/routes/bilibili/bangumi.ts +++ b/lib/routes/bilibili/bangumi.ts @@ -1,6 +1,8 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; -import { EpisodeResult } from './types'; + +import type { EpisodeResult } from './types'; import utils from './utils'; export const route: Route = { diff --git a/lib/routes/bilibili/bilibili-recommend.ts b/lib/routes/bilibili/bilibili-recommend.ts index c6c93f0bf..6a49ca86b 100644 --- a/lib/routes/bilibili/bilibili-recommend.ts +++ b/lib/routes/bilibili/bilibili-recommend.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/bilibili/cache.ts b/lib/routes/bilibili/cache.ts index b17896a96..cbacd15e7 100644 --- a/lib/routes/bilibili/cache.ts +++ b/lib/routes/bilibili/cache.ts @@ -1,13 +1,15 @@ -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import utils from './utils'; import { load } from 'cheerio'; -import { config } from '@/config'; -import logger from '@/utils/logger'; -import { getPuppeteerPage } from '@/utils/puppeteer'; import { JSDOM } from 'jsdom'; import { RateLimiterMemory, RateLimiterQueue } from 'rate-limiter-flexible'; +import { config } from '@/config'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import logger from '@/utils/logger'; +import { getPuppeteerPage } from '@/utils/puppeteer'; + +import utils from './utils'; + const subtitleLimiter = new RateLimiterMemory({ points: 5, duration: 1, diff --git a/lib/routes/bilibili/check-cookie.ts b/lib/routes/bilibili/check-cookie.ts index 45359c2f5..f320751b6 100644 --- a/lib/routes/bilibili/check-cookie.ts +++ b/lib/routes/bilibili/check-cookie.ts @@ -1,7 +1,8 @@ -import { APIRoute } from '@/types'; -import cacheIn from './cache'; +import type { APIRoute } from '@/types'; import ofetch from '@/utils/ofetch'; +import cacheIn from './cache'; + export const apiRoute: APIRoute = { path: '/check-cookie', description: '检查 bilibili cookie 是否有效', diff --git a/lib/routes/bilibili/coin.ts b/lib/routes/bilibili/coin.ts index e2a19b82b..3936af22d 100644 --- a/lib/routes/bilibili/coin.ts +++ b/lib/routes/bilibili/coin.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + import cache from './cache'; import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/user/coin/:uid/:embed?', diff --git a/lib/routes/bilibili/danmaku.ts b/lib/routes/bilibili/danmaku.ts index 334096374..9b52a7d78 100644 --- a/lib/routes/bilibili/danmaku.ts +++ b/lib/routes/bilibili/danmaku.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; -import { load } from 'cheerio'; -import cache from './cache'; -import got from '@/utils/got'; import zlib from 'node:zlib'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import cache from './cache'; + const processFloatTime = (time) => { const totalSeconds = Number.parseInt(time); const seconds = totalSeconds % 60; diff --git a/lib/routes/bilibili/dynamic.ts b/lib/routes/bilibili/dynamic.ts index 8a7cf4419..df9cca0ed 100644 --- a/lib/routes/bilibili/dynamic.ts +++ b/lib/routes/bilibili/dynamic.ts @@ -1,15 +1,18 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import JSONbig from 'json-bigint'; -import utils, { getLiveUrl, getVideoUrl } from './utils'; -import { parseDate } from '@/utils/parse-date'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; -import cacheIn from './cache'; -import { BilibiliWebDynamicResponse, Item2, Modules } from './api-interface'; -import { parseDuration } from '@/utils/helpers'; + import { config } from '@/config'; import CaptchaError from '@/errors/types/captcha'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDuration } from '@/utils/helpers'; +import { parseDate } from '@/utils/parse-date'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; + +import type { BilibiliWebDynamicResponse, Item2, Modules } from './api-interface'; +import cacheIn from './cache'; +import utils, { getLiveUrl, getVideoUrl } from './utils'; export const route: Route = { path: '/user/dynamic/:uid/:routeParams?', diff --git a/lib/routes/bilibili/fav.ts b/lib/routes/bilibili/fav.ts index 81ed06aaf..f1d104548 100644 --- a/lib/routes/bilibili/fav.ts +++ b/lib/routes/bilibili/fav.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import utils from './utils'; export const route: Route = { path: '/fav/:uid/:fid/:embed?', diff --git a/lib/routes/bilibili/followers.ts b/lib/routes/bilibili/followers.ts index 2662aedda..b0b34adf1 100644 --- a/lib/routes/bilibili/followers.ts +++ b/lib/routes/bilibili/followers.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import cache from './cache'; export const route: Route = { path: '/user/followers/:uid/:loginUid', diff --git a/lib/routes/bilibili/followings-article.ts b/lib/routes/bilibili/followings-article.ts index aa8371d22..1798fd935 100644 --- a/lib/routes/bilibili/followings-article.ts +++ b/lib/routes/bilibili/followings-article.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import cache from './cache'; export const route: Route = { path: '/followings/article/:uid', diff --git a/lib/routes/bilibili/followings-dynamic.ts b/lib/routes/bilibili/followings-dynamic.ts index 8ed597214..5bdda1f5d 100644 --- a/lib/routes/bilibili/followings-dynamic.ts +++ b/lib/routes/bilibili/followings-dynamic.ts @@ -1,13 +1,16 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; -import { config } from '@/config'; -import utils from './utils'; -import JSONbig from 'json-bigint'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; import querystring from 'node:querystring'; + +import JSONbig from 'json-bigint'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import logger from '@/utils/logger'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; + +import cache from './cache'; +import utils from './utils'; export const route: Route = { path: '/followings/dynamic/:uid/:routeParams?', diff --git a/lib/routes/bilibili/followings-video.ts b/lib/routes/bilibili/followings-video.ts index 9332ce112..dd64b01bd 100644 --- a/lib/routes/bilibili/followings-video.ts +++ b/lib/routes/bilibili/followings-video.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; import { config } from '@/config'; -import utils from './utils'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import logger from '@/utils/logger'; +import cache from './cache'; +import utils from './utils'; + export const route: Route = { path: '/followings/video/:uid/:embed?', categories: ['social-media'], diff --git a/lib/routes/bilibili/followings.ts b/lib/routes/bilibili/followings.ts index 5fc22cbea..55644f48a 100644 --- a/lib/routes/bilibili/followings.ts +++ b/lib/routes/bilibili/followings.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import cache from './cache'; export const route: Route = { path: '/user/followings/:uid/:loginUid', diff --git a/lib/routes/bilibili/hot-search.ts b/lib/routes/bilibili/hot-search.ts index 647159f69..ecfaff915 100644 --- a/lib/routes/bilibili/hot-search.ts +++ b/lib/routes/bilibili/hot-search.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import cache from './cache'; import utils from './utils'; diff --git a/lib/routes/bilibili/like.ts b/lib/routes/bilibili/like.ts index 3c92b4b84..e930c4d1c 100644 --- a/lib/routes/bilibili/like.ts +++ b/lib/routes/bilibili/like.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + import cache from './cache'; import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/user/like/:uid/:embed?', diff --git a/lib/routes/bilibili/link-news.ts b/lib/routes/bilibili/link-news.ts index 04bd0d4b2..3a43bc62b 100644 --- a/lib/routes/bilibili/link-news.ts +++ b/lib/routes/bilibili/link-news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/bilibili/live-area.ts b/lib/routes/bilibili/live-area.ts index c3cb69dbc..d19530615 100644 --- a/lib/routes/bilibili/live-area.ts +++ b/lib/routes/bilibili/live-area.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/bilibili/live-room.ts b/lib/routes/bilibili/live-room.ts index 7285da7ad..800b4c83f 100644 --- a/lib/routes/bilibili/live-room.ts +++ b/lib/routes/bilibili/live-room.ts @@ -1,10 +1,12 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from './cache'; import { decodeHTML } from 'entities'; + +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import cache from './cache'; + export const route: Route = { path: '/live/room/:roomID', categories: ['live'], diff --git a/lib/routes/bilibili/live-search.ts b/lib/routes/bilibili/live-search.ts index 1e54f69a9..e06e4b826 100644 --- a/lib/routes/bilibili/live-search.ts +++ b/lib/routes/bilibili/live-search.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import utils from './utils'; + import cache from './cache'; +import utils from './utils'; export const route: Route = { path: '/live/search/:key/:order', diff --git a/lib/routes/bilibili/mall-ip.ts b/lib/routes/bilibili/mall-ip.ts index 7f1100537..fb590d673 100644 --- a/lib/routes/bilibili/mall-ip.ts +++ b/lib/routes/bilibili/mall-ip.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/bilibili/mall-new.ts b/lib/routes/bilibili/mall-new.ts index 0552e1588..1c3a1895f 100644 --- a/lib/routes/bilibili/mall-new.ts +++ b/lib/routes/bilibili/mall-new.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/bilibili/manga-followings.ts b/lib/routes/bilibili/manga-followings.ts index 3ecf19ef2..29af1585a 100644 --- a/lib/routes/bilibili/manga-followings.ts +++ b/lib/routes/bilibili/manga-followings.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import cache from './cache'; export const route: Route = { path: '/manga/followings/:uid/:limits?', diff --git a/lib/routes/bilibili/manga-update.ts b/lib/routes/bilibili/manga-update.ts index 4cf7f182a..cae76c3ba 100644 --- a/lib/routes/bilibili/manga-update.ts +++ b/lib/routes/bilibili/manga-update.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/bilibili/page.ts b/lib/routes/bilibili/page.ts index 91cd5ea73..33551058e 100644 --- a/lib/routes/bilibili/page.ts +++ b/lib/routes/bilibili/page.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/bilibili/partion-ranking.ts b/lib/routes/bilibili/partion-ranking.ts index 2ae4f3fc7..1b160d167 100644 --- a/lib/routes/bilibili/partion-ranking.ts +++ b/lib/routes/bilibili/partion-ranking.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; + const got_ins = got.extend({ headers: { Referer: 'https://www.bilibili.com/', diff --git a/lib/routes/bilibili/partion.ts b/lib/routes/bilibili/partion.ts index 043d0897a..bce20691e 100644 --- a/lib/routes/bilibili/partion.ts +++ b/lib/routes/bilibili/partion.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/bilibili/platform.ts b/lib/routes/bilibili/platform.ts index c7cbd590c..d92d957cc 100644 --- a/lib/routes/bilibili/platform.ts +++ b/lib/routes/bilibili/platform.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; export const route: Route = { path: '/platform/:area?/:p_type?/:uid?', diff --git a/lib/routes/bilibili/popular.ts b/lib/routes/bilibili/popular.ts index cc8df1a43..6398942ae 100644 --- a/lib/routes/bilibili/popular.ts +++ b/lib/routes/bilibili/popular.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/bilibili/ranking.ts b/lib/routes/bilibili/ranking.ts index aef830044..dc8134408 100644 --- a/lib/routes/bilibili/ranking.ts +++ b/lib/routes/bilibili/ranking.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; -import utils, { getVideoUrl } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + import cache from './cache'; +import utils, { getVideoUrl } from './utils'; // https://www.bilibili.com/v/popular/rank/all diff --git a/lib/routes/bilibili/readlist.ts b/lib/routes/bilibili/readlist.ts index 7dcc13305..18aa1f6c9 100644 --- a/lib/routes/bilibili/readlist.ts +++ b/lib/routes/bilibili/readlist.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/bilibili/reply.ts b/lib/routes/bilibili/reply.ts index 25a69415c..5af8d0aa7 100644 --- a/lib/routes/bilibili/reply.ts +++ b/lib/routes/bilibili/reply.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import cache from './cache'; export const route: Route = { diff --git a/lib/routes/bilibili/user-bangumi.ts b/lib/routes/bilibili/user-bangumi.ts index 0e4f35545..889fbae48 100644 --- a/lib/routes/bilibili/user-bangumi.ts +++ b/lib/routes/bilibili/user-bangumi.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import cache from './cache'; export const route: Route = { diff --git a/lib/routes/bilibili/user-channel.ts b/lib/routes/bilibili/user-channel.ts index a319a67fd..4e8ba7ace 100644 --- a/lib/routes/bilibili/user-channel.ts +++ b/lib/routes/bilibili/user-channel.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import cacheIn from './cache'; import utils from './utils'; diff --git a/lib/routes/bilibili/user-collection.ts b/lib/routes/bilibili/user-collection.ts index 5dab48de7..fa09627dc 100644 --- a/lib/routes/bilibili/user-collection.ts +++ b/lib/routes/bilibili/user-collection.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import cache from './cache'; -import utils from './utils'; import { parseDate } from '@/utils/parse-date'; import { queryToBoolean } from '@/utils/readable-social'; +import cache from './cache'; +import utils from './utils'; + const notFoundData = { title: '此 bilibili 频道不存在', }; diff --git a/lib/routes/bilibili/user-fav.ts b/lib/routes/bilibili/user-fav.ts index 04deeb6d0..fc6cee593 100644 --- a/lib/routes/bilibili/user-fav.ts +++ b/lib/routes/bilibili/user-fav.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import cache from './cache'; import utils from './utils'; -import { config } from '@/config'; export const route: Route = { path: '/user/fav/:uid/:embed?', diff --git a/lib/routes/bilibili/utils.ts b/lib/routes/bilibili/utils.ts index a6109afaa..bee611e0e 100644 --- a/lib/routes/bilibili/utils.ts +++ b/lib/routes/bilibili/utils.ts @@ -1,10 +1,13 @@ +import path from 'node:path'; + +import CryptoJS from 'crypto-js'; + import { config } from '@/config'; import md5 from '@/utils/md5'; import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import CryptoJS from 'crypto-js'; -import path from 'node:path'; -import { MediaResult, ResultResponse, SeasonResult } from './types'; + +import type { MediaResult, ResultResponse, SeasonResult } from './types'; // a function randomHexStr(length) { diff --git a/lib/routes/bilibili/video-all.ts b/lib/routes/bilibili/video-all.ts index cb43f447e..ea5e55655 100644 --- a/lib/routes/bilibili/video-all.ts +++ b/lib/routes/bilibili/video-all.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + import cache from './cache'; import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/user/video-all/:uid/:embed?', diff --git a/lib/routes/bilibili/video.ts b/lib/routes/bilibili/video.ts index c11bc5033..417b9d33b 100644 --- a/lib/routes/bilibili/video.ts +++ b/lib/routes/bilibili/video.ts @@ -1,11 +1,14 @@ -import { Route, ViewType } from '@/types'; +import type { Context } from 'hono'; + +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDuration } from '@/utils/helpers'; import logger from '@/utils/logger'; -import type { Context } from 'hono'; + import cache from './cache'; import utils, { getVideoUrl } from './utils'; -import { config } from '@/config'; export const route: Route = { path: '/user/video/:uid/:embed?', diff --git a/lib/routes/bilibili/vsearch.ts b/lib/routes/bilibili/vsearch.ts index 401f80eb4..7f2c94538 100644 --- a/lib/routes/bilibili/vsearch.ts +++ b/lib/routes/bilibili/vsearch.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import utils from './utils'; + import cacheIn from './cache'; +import utils from './utils'; export const route: Route = { path: '/vsearch/:kw/:order?/:embed?/:tid?', diff --git a/lib/routes/bilibili/watchlater.ts b/lib/routes/bilibili/watchlater.ts index 2fa1a14c6..2be2aee30 100644 --- a/lib/routes/bilibili/watchlater.ts +++ b/lib/routes/bilibili/watchlater.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; import { config } from '@/config'; -import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import cache from './cache'; +import utils from './utils'; export const route: Route = { path: '/watchlater/:uid/:embed?', diff --git a/lib/routes/bilibili/weekly-recommend.ts b/lib/routes/bilibili/weekly-recommend.ts index 60484f501..ad30fca8c 100644 --- a/lib/routes/bilibili/weekly-recommend.ts +++ b/lib/routes/bilibili/weekly-recommend.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import utils, { getVideoUrl } from './utils'; -import { parseDuration } from '@/utils/helpers'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDuration } from '@/utils/helpers'; + import cache from './cache'; +import utils, { getVideoUrl } from './utils'; export const route: Route = { path: '/weekly/:embed?', diff --git a/lib/routes/binance/announcement.ts b/lib/routes/binance/announcement.ts index ff12ebc29..b671770fb 100644 --- a/lib/routes/binance/announcement.ts +++ b/lib/routes/binance/announcement.ts @@ -1,9 +1,12 @@ -import { DataItem, Route, ViewType } from '@/types'; +import * as cheerio from 'cheerio'; + +import type { DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import * as cheerio from 'cheerio'; -import { AnnouncementCatalog, AnnouncementsConfig } from './types'; + +import type { AnnouncementCatalog, AnnouncementsConfig } from './types'; interface AnnouncementFragment { reactRoot: [{ id: 'Fragment'; children: { id: string; props: object }[]; props: object }]; diff --git a/lib/routes/binance/launchpool.ts b/lib/routes/binance/launchpool.ts index 5e8be2362..de9663168 100644 --- a/lib/routes/binance/launchpool.ts +++ b/lib/routes/binance/launchpool.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bing/daily-wallpaper.ts b/lib/routes/bing/daily-wallpaper.ts index 4545b273a..c19a684de 100644 --- a/lib/routes/bing/daily-wallpaper.ts +++ b/lib/routes/bing/daily-wallpaper.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bing/search.ts b/lib/routes/bing/search.ts index bd7628dc8..85f352e41 100644 --- a/lib/routes/bing/search.ts +++ b/lib/routes/bing/search.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; -import parser from '@/utils/rss-parser'; -import { parseDate } from '@/utils/parse-date'; +import 'dayjs/locale/zh-cn.js'; + import dayjs from 'dayjs'; import localizedFormat from 'dayjs/plugin/localizedFormat.js'; -import 'dayjs/locale/zh-cn.js'; + +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; + dayjs.extend(localizedFormat); export const route: Route = { diff --git a/lib/routes/biodiscover/index.ts b/lib/routes/biodiscover/index.ts index 0b71e5ef4..9f576d06f 100644 --- a/lib/routes/biodiscover/index.ts +++ b/lib/routes/biodiscover/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bioone/featured.ts b/lib/routes/bioone/featured.ts index b954f1e4c..c8c9f8ea8 100644 --- a/lib/routes/bioone/featured.ts +++ b/lib/routes/bioone/featured.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bioone/journal.ts b/lib/routes/bioone/journal.ts index b376f93bd..b7a0a7b55 100644 --- a/lib/routes/bioone/journal.ts +++ b/lib/routes/bioone/journal.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/biquge/index.ts b/lib/routes/biquge/index.ts index 95e773f24..817222c6c 100644 --- a/lib/routes/biquge/index.ts +++ b/lib/routes/biquge/index.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + const allowHost = new Set([ 'www.xbiquwx.la', 'www.biqu5200.net', diff --git a/lib/routes/bit/cs/cs.ts b/lib/routes/bit/cs/cs.ts index 078e9d43c..ed0141fb2 100644 --- a/lib/routes/bit/cs/cs.ts +++ b/lib/routes/bit/cs/cs.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/bit/cs/utils.ts b/lib/routes/bit/cs/utils.ts index dbb80c89e..ad67790a4 100644 --- a/lib/routes/bit/cs/utils.ts +++ b/lib/routes/bit/cs/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bit/jwc/jwc.ts b/lib/routes/bit/jwc/jwc.ts index f7748715b..c0e1d4052 100644 --- a/lib/routes/bit/jwc/jwc.ts +++ b/lib/routes/bit/jwc/jwc.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/bit/jwc/utils.ts b/lib/routes/bit/jwc/utils.ts index 8fabcc5e5..1bcc9b522 100644 --- a/lib/routes/bit/jwc/utils.ts +++ b/lib/routes/bit/jwc/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bit/rszhaopin.ts b/lib/routes/bit/rszhaopin.ts index 8e330f519..b966cc924 100644 --- a/lib/routes/bit/rszhaopin.ts +++ b/lib/routes/bit/rszhaopin.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/bit/yjs.ts b/lib/routes/bit/yjs.ts index d1dafe44d..c20f2aa01 100644 --- a/lib/routes/bit/yjs.ts +++ b/lib/routes/bit/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bitbucket/commits.ts b/lib/routes/bitbucket/commits.ts index f60fbd4c4..4d3d3ee89 100644 --- a/lib/routes/bitbucket/commits.ts +++ b/lib/routes/bitbucket/commits.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { config } from '@/config'; import queryString from 'query-string'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bitbucket/tags.ts b/lib/routes/bitbucket/tags.ts index 95933b2e4..9add7af62 100644 --- a/lib/routes/bitbucket/tags.ts +++ b/lib/routes/bitbucket/tags.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { config } from '@/config'; import queryString from 'query-string'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bitget/announcement.ts b/lib/routes/bitget/announcement.ts index 258ec98f6..b0b018ce0 100644 --- a/lib/routes/bitget/announcement.ts +++ b/lib/routes/bitget/announcement.ts @@ -1,10 +1,13 @@ -import { DataItem, Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import { BitgetResponse } from './type'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; +import type { DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import type { BitgetResponse } from './type'; const handler: Route['handler'] = async (ctx) => { const baseUrl = 'https://www.bitget.com'; diff --git a/lib/routes/bitmovin/blog.ts b/lib/routes/bitmovin/blog.ts index e5ac7f607..d7ff08da8 100644 --- a/lib/routes/bitmovin/blog.ts +++ b/lib/routes/bitmovin/blog.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/bjfu/grs.ts b/lib/routes/bjfu/grs.ts index 4907b0f9e..17cb96940 100644 --- a/lib/routes/bjfu/grs.ts +++ b/lib/routes/bjfu/grs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bjfu/it/index.ts b/lib/routes/bjfu/it/index.ts index 4da69a465..b9028da85 100644 --- a/lib/routes/bjfu/it/index.ts +++ b/lib/routes/bjfu/it/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; -import iconv from 'iconv-lite'; export const route: Route = { path: '/it/:type', diff --git a/lib/routes/bjfu/it/utils.ts b/lib/routes/bjfu/it/utils.ts index b6c1ce6d7..ef3517502 100644 --- a/lib/routes/bjfu/it/utils.ts +++ b/lib/routes/bjfu/it/utils.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bjfu/jwc/index.ts b/lib/routes/bjfu/jwc/index.ts index 6061aa69d..60cbe7444 100644 --- a/lib/routes/bjfu/jwc/index.ts +++ b/lib/routes/bjfu/jwc/index.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/bjfu/jwc/utils.ts b/lib/routes/bjfu/jwc/utils.ts index 5595f4534..c0e633eba 100644 --- a/lib/routes/bjfu/jwc/utils.ts +++ b/lib/routes/bjfu/jwc/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bjfu/kjc.ts b/lib/routes/bjfu/kjc.ts index de90da988..dee0e77ed 100644 --- a/lib/routes/bjfu/kjc.ts +++ b/lib/routes/bjfu/kjc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bjfu/news/index.ts b/lib/routes/bjfu/news/index.ts index 1e6edb774..843c7858e 100644 --- a/lib/routes/bjfu/news/index.ts +++ b/lib/routes/bjfu/news/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; -import iconv from 'iconv-lite'; export const route: Route = { path: '/news/:type', diff --git a/lib/routes/bjfu/news/utils.ts b/lib/routes/bjfu/news/utils.ts index fb1dbb16e..3511db1b2 100644 --- a/lib/routes/bjfu/news/utils.ts +++ b/lib/routes/bjfu/news/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bjnews/cat.ts b/lib/routes/bjnews/cat.ts index c88801b3e..ce7296654 100644 --- a/lib/routes/bjnews/cat.ts +++ b/lib/routes/bjnews/cat.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { fetchArticle } from './utils'; -import pMap from 'p-map'; export const route: Route = { path: '/cat/:cat', diff --git a/lib/routes/bjnews/column.ts b/lib/routes/bjnews/column.ts index 709138563..6529d9b3e 100644 --- a/lib/routes/bjnews/column.ts +++ b/lib/routes/bjnews/column.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bjnews/utils.ts b/lib/routes/bjnews/utils.ts index 5b0496a7f..86379eae1 100644 --- a/lib/routes/bjnews/utils.ts +++ b/lib/routes/bjnews/utils.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; export function fetchArticle(item) { return cache.tryGet(item.link, async () => { diff --git a/lib/routes/bjp/apod.ts b/lib/routes/bjp/apod.ts index ae159d5b6..95ecda4fc 100644 --- a/lib/routes/bjp/apod.ts +++ b/lib/routes/bjp/apod.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bjsk/index.ts b/lib/routes/bjsk/index.ts index 907b9c770..c89e2a7a6 100644 --- a/lib/routes/bjsk/index.ts +++ b/lib/routes/bjsk/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://www.bjsk.org.cn'; diff --git a/lib/routes/bjsk/keti.ts b/lib/routes/bjsk/keti.ts index fef951a68..ea706b6f6 100644 --- a/lib/routes/bjsk/keti.ts +++ b/lib/routes/bjsk/keti.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bjtu/gs.ts b/lib/routes/bjtu/gs.ts index e702c0b01..af3ab85f7 100644 --- a/lib/routes/bjtu/gs.ts +++ b/lib/routes/bjtu/gs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://gs.bjtu.edu.cn'; diff --git a/lib/routes/bjtu/namespace.ts b/lib/routes/bjtu/namespace.ts index 4fd3ddb7a..7b2e129ca 100644 --- a/lib/routes/bjtu/namespace.ts +++ b/lib/routes/bjtu/namespace.ts @@ -1,4 +1,5 @@ import type { Namespace } from '@/types'; + export const namespace: Namespace = { name: 'Beijing Jiaotong University', url: 'bjtu.edu.cn', diff --git a/lib/routes/bjwxdxh/index.ts b/lib/routes/bjwxdxh/index.ts index e01223dc4..b90d7a8af 100644 --- a/lib/routes/bjwxdxh/index.ts +++ b/lib/routes/bjwxdxh/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:type?', diff --git a/lib/routes/bjx/fd.ts b/lib/routes/bjx/fd.ts index 9d6c4d681..899c70388 100644 --- a/lib/routes/bjx/fd.ts +++ b/lib/routes/bjx/fd.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/fd/:type', diff --git a/lib/routes/bjx/huanbao.ts b/lib/routes/bjx/huanbao.ts index 302471c8d..a2e2fc104 100644 --- a/lib/routes/bjx/huanbao.ts +++ b/lib/routes/bjx/huanbao.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; import timezone from '@/utils/timezone'; -import pMap from 'p-map'; export const route: Route = { path: '/huanbao', diff --git a/lib/routes/bjx/types.ts b/lib/routes/bjx/types.ts index 19e062ae4..3dd8f58c9 100644 --- a/lib/routes/bjx/types.ts +++ b/lib/routes/bjx/types.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/blizzard/news-cn.ts b/lib/routes/blizzard/news-cn.ts index b13237a75..7580c1fc9 100644 --- a/lib/routes/blizzard/news-cn.ts +++ b/lib/routes/blizzard/news-cn.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/blizzard/news.ts b/lib/routes/blizzard/news.ts index 4d083bc40..4cbf0dcc5 100644 --- a/lib/routes/blizzard/news.ts +++ b/lib/routes/blizzard/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/news/:language?/:category?', diff --git a/lib/routes/blockworks/index.ts b/lib/routes/blockworks/index.ts index e4afea423..e1a5ad6b7 100644 --- a/lib/routes/blockworks/index.ts +++ b/lib/routes/blockworks/index.ts @@ -1,11 +1,12 @@ -import { Route, Data, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import logger from '@/utils/logger'; import parser from '@/utils/rss-parser'; -import { config } from '@/config'; export const route: Route = { path: '/', diff --git a/lib/routes/blogread/index.ts b/lib/routes/blogread/index.ts index e9591a61c..c6091c6c1 100644 --- a/lib/routes/blogread/index.ts +++ b/lib/routes/blogread/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import * as cheerio from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/newest', categories: ['programming'], diff --git a/lib/routes/bloomberg/authors.ts b/lib/routes/bloomberg/authors.ts index b8192de67..6a72b1f61 100644 --- a/lib/routes/bloomberg/authors.ts +++ b/lib/routes/bloomberg/authors.ts @@ -1,9 +1,12 @@ -import { Route, ViewType } from '@/types'; import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import rssParser from '@/utils/rss-parser'; + import { parseArticle } from './utils'; -import pMap from 'p-map'; const parseAuthorNewsList = async (slug) => { const baseURL = `https://www.bloomberg.com/authors/${slug}`; diff --git a/lib/routes/bloomberg/index.ts b/lib/routes/bloomberg/index.ts index e4fdefcbd..f3625721b 100644 --- a/lib/routes/bloomberg/index.ts +++ b/lib/routes/bloomberg/index.ts @@ -1,6 +1,10 @@ -import { Route, ViewType } from '@/types'; -import { rootUrl, parseNewsList, parseArticle } from './utils'; import pMap from 'p-map'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + +import { parseArticle, parseNewsList, rootUrl } from './utils'; + const siteTitleMapping = { '/': 'News', bpol: 'Politics', diff --git a/lib/routes/bloomberg/utils.ts b/lib/routes/bloomberg/utils.ts index 924e16083..ae2a85c8f 100644 --- a/lib/routes/bloomberg/utils.ts +++ b/lib/routes/bloomberg/utils.ts @@ -1,11 +1,12 @@ -import cache from '@/utils/cache'; -import { load } from 'cheerio'; import path from 'node:path'; + +import { load } from 'cheerio'; import { destr } from 'destr'; -import { parseDate } from '@/utils/parse-date'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const rootUrl = 'https://www.bloomberg.com/feeds'; @@ -603,4 +604,4 @@ const documentToHtmlString = async (document) => { return str; }; -export { rootUrl, parseNewsList, parseArticle }; +export { parseArticle, parseNewsList, rootUrl }; diff --git a/lib/routes/bluestacks/release.ts b/lib/routes/bluestacks/release.ts index 5f1289379..8823a1da4 100644 --- a/lib/routes/bluestacks/release.ts +++ b/lib/routes/bluestacks/release.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/routes/bmkg/earthquake.ts b/lib/routes/bmkg/earthquake.ts index 4467954f0..d60f1dd89 100644 --- a/lib/routes/bmkg/earthquake.ts +++ b/lib/routes/bmkg/earthquake.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bmkg/news.ts b/lib/routes/bmkg/news.ts index d9bc9c9e2..7a9a21693 100644 --- a/lib/routes/bmkg/news.ts +++ b/lib/routes/bmkg/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/news', diff --git a/lib/routes/bnext/index.ts b/lib/routes/bnext/index.ts index 217355ef3..2c9848c16 100644 --- a/lib/routes/bnext/index.ts +++ b/lib/routes/bnext/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import parser from '@/utils/rss-parser'; import type { Item } from 'rss-parser'; +import type { Route } from '@/types'; +import parser from '@/utils/rss-parser'; + const FEED_URL = 'https://rss.bnextmedia.com.tw/feed/bnext'; export const route: Route = { diff --git a/lib/routes/bnu/bs.ts b/lib/routes/bnu/bs.ts index 0728c7980..4693d6946 100644 --- a/lib/routes/bnu/bs.ts +++ b/lib/routes/bnu/bs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bnu/dwxgb.ts b/lib/routes/bnu/dwxgb.ts index aee206c81..4b67dc0bc 100644 --- a/lib/routes/bnu/dwxgb.ts +++ b/lib/routes/bnu/dwxgb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bnu/fdy.ts b/lib/routes/bnu/fdy.ts index 0d52179a6..b94dbfc77 100644 --- a/lib/routes/bnu/fdy.ts +++ b/lib/routes/bnu/fdy.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bnu/fe.ts b/lib/routes/bnu/fe.ts index 9f405637c..68ff77d12 100644 --- a/lib/routes/bnu/fe.ts +++ b/lib/routes/bnu/fe.ts @@ -1,8 +1,9 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/fe/:category', diff --git a/lib/routes/bnu/jwb.ts b/lib/routes/bnu/jwb.ts index dc728361d..f28cb29c9 100644 --- a/lib/routes/bnu/jwb.ts +++ b/lib/routes/bnu/jwb.ts @@ -1,8 +1,9 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/jwb', diff --git a/lib/routes/bnu/lib.ts b/lib/routes/bnu/lib.ts index 2598d6d39..12c815ad8 100644 --- a/lib/routes/bnu/lib.ts +++ b/lib/routes/bnu/lib.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bnu/mba.ts b/lib/routes/bnu/mba.ts index e42435d0e..09715046c 100644 --- a/lib/routes/bnu/mba.ts +++ b/lib/routes/bnu/mba.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/boc/whpj.ts b/lib/routes/boc/whpj.ts index e167d8473..51ee1f489 100644 --- a/lib/routes/boc/whpj.ts +++ b/lib/routes/boc/whpj.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/whpj/:format?', categories: ['other'], diff --git a/lib/routes/bookfere/category.ts b/lib/routes/bookfere/category.ts index 503ac1604..16ceacd57 100644 --- a/lib/routes/bookfere/category.ts +++ b/lib/routes/bookfere/category.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bookwalker/search.ts b/lib/routes/bookwalker/search.ts index 5af765464..a6fab55c9 100644 --- a/lib/routes/bookwalker/search.ts +++ b/lib/routes/bookwalker/search.ts @@ -1,12 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { filter = 'order=sell_desc' } = ctx.req.param(); diff --git a/lib/routes/booru/mmda.ts b/lib/routes/booru/mmda.ts index 677ac99bb..90b385306 100644 --- a/lib/routes/booru/mmda.ts +++ b/lib/routes/booru/mmda.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import queryString from 'query-string'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; +import queryString from 'query-string'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/mmda/tags/:tags?', categories: ['picture'], diff --git a/lib/routes/bossdesign/index.ts b/lib/routes/bossdesign/index.ts index 84c3fc16f..fa4db84ce 100644 --- a/lib/routes/bossdesign/index.ts +++ b/lib/routes/bossdesign/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/brave/latest.ts b/lib/routes/brave/latest.ts index d623ad315..9fd36130e 100644 --- a/lib/routes/brave/latest.ts +++ b/lib/routes/brave/latest.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/brooklynmuseum/exhibitions.ts b/lib/routes/brooklynmuseum/exhibitions.ts index 4b8aecb10..9e7980ccf 100644 --- a/lib/routes/brooklynmuseum/exhibitions.ts +++ b/lib/routes/brooklynmuseum/exhibitions.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; export const route: Route = { diff --git a/lib/routes/bse/index.ts b/lib/routes/bse/index.ts index 58c4fffcb..96a3d1712 100644 --- a/lib/routes/bse/index.ts +++ b/lib/routes/bse/index.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const nodes = { important_news: { diff --git a/lib/routes/bsky/feeds.ts b/lib/routes/bsky/feeds.ts index d97bfca02..3e194b6d3 100644 --- a/lib/routes/bsky/feeds.ts +++ b/lib/routes/bsky/feeds.ts @@ -1,10 +1,12 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -import { resolveHandle, getFeed, getFeedGenerator } from './utils'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import { getFeed, getFeedGenerator, resolveHandle } from './utils'; export const route: Route = { path: '/profile/:handle/feed/:space/:routeParams?', diff --git a/lib/routes/bsky/keyword.ts b/lib/routes/bsky/keyword.ts index 3b6f71616..53ec169cb 100644 --- a/lib/routes/bsky/keyword.ts +++ b/lib/routes/bsky/keyword.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/bsky/posts.ts b/lib/routes/bsky/posts.ts index ca6020353..91d1b36de 100644 --- a/lib/routes/bsky/posts.ts +++ b/lib/routes/bsky/posts.ts @@ -1,12 +1,14 @@ -import { Route, ViewType } from '@/types'; - -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import { resolveHandle, getProfile, getAuthorFeed } from './utils'; -import { art } from '@/utils/render'; import path from 'node:path'; import querystring from 'node:querystring'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { getAuthorFeed, getProfile, resolveHandle } from './utils'; + export const route: Route = { path: '/profile/:handle/:routeParams?', categories: ['social-media'], diff --git a/lib/routes/bsky/utils.ts b/lib/routes/bsky/utils.ts index 654a2eda7..f167308a2 100644 --- a/lib/routes/bsky/utils.ts +++ b/lib/routes/bsky/utils.ts @@ -1,5 +1,5 @@ -import got from '@/utils/got'; import { config } from '@/config'; +import got from '@/utils/got'; /** * docs: https://atproto.com/lexicons/app-bsky @@ -78,4 +78,4 @@ const getFeedGenerator = (uri, tryGet) => false ); -export { resolveHandle, getProfile, getFeed, getAuthorFeed, getFeedGenerator }; +export { getAuthorFeed, getFeed, getFeedGenerator, getProfile, resolveHandle }; diff --git a/lib/routes/bt0/mv.ts b/lib/routes/bt0/mv.ts index 36ef8d33e..4fe24a61a 100644 --- a/lib/routes/bt0/mv.ts +++ b/lib/routes/bt0/mv.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; + import { doGot, genSize } from './util'; export const route: Route = { diff --git a/lib/routes/bt0/tlist.ts b/lib/routes/bt0/tlist.ts index 481eab960..55dc9763a 100644 --- a/lib/routes/bt0/tlist.ts +++ b/lib/routes/bt0/tlist.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { doGot, genSize } from './util'; +import type { Route } from '@/types'; import { parseRelativeDate } from '@/utils/parse-date'; +import { doGot, genSize } from './util'; + const categoryDict = { 1: '电影', 2: '电视剧', diff --git a/lib/routes/bt0/util.ts b/lib/routes/bt0/util.ts index 1cb34774a..dfcd8d720 100644 --- a/lib/routes/bt0/util.ts +++ b/lib/routes/bt0/util.ts @@ -1,5 +1,7 @@ import { CookieJar } from 'tough-cookie'; + import got from '@/utils/got'; + const cookieJar = new CookieJar(); async function doGot(num, host, link) { diff --git a/lib/routes/btzj/index.ts b/lib/routes/btzj/index.ts index d18a042b8..0bc11e7e1 100644 --- a/lib/routes/btzj/index.ts +++ b/lib/routes/btzj/index.ts @@ -1,14 +1,16 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + const allowDomain = new Set(['2btjia.com', '88btbtt.com', 'btbtt15.com', 'btbtt20.com']); export const route: Route = { diff --git a/lib/routes/buaa/jiaowu.ts b/lib/routes/buaa/jiaowu.ts index f19ba75e9..3f7af4110 100644 --- a/lib/routes/buaa/jiaowu.ts +++ b/lib/routes/buaa/jiaowu.ts @@ -1,8 +1,9 @@ -import { Data, Route } from '@/types'; -import { Context } from 'hono'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/buaa/lib/space/newbook.ts b/lib/routes/buaa/lib/space/newbook.ts index add51285f..303cb1e46 100644 --- a/lib/routes/buaa/lib/space/newbook.ts +++ b/lib/routes/buaa/lib/space/newbook.ts @@ -1,11 +1,13 @@ -import { Data, DataItem, Route } from '@/types'; -import { Context } from 'hono'; +import path from 'node:path'; + +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; interface Book { bibId: string; diff --git a/lib/routes/buaa/news/index.ts b/lib/routes/buaa/news/index.ts index 3389d086a..24fef9850 100644 --- a/lib/routes/buaa/news/index.ts +++ b/lib/routes/buaa/news/index.ts @@ -1,8 +1,9 @@ -import { Route, Data, DataItem } from '@/types'; -import { Context } from 'hono'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/buaa/sme.ts b/lib/routes/buaa/sme.ts index 9511895ac..2e370a20e 100755 --- a/lib/routes/buaa/sme.ts +++ b/lib/routes/buaa/sme.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/buct/cist.ts b/lib/routes/buct/cist.ts index c482373d4..64b358b94 100644 --- a/lib/routes/buct/cist.ts +++ b/lib/routes/buct/cist.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/cist', diff --git a/lib/routes/buct/gr.ts b/lib/routes/buct/gr.ts index f9f0f36fd..eeabde4d2 100644 --- a/lib/routes/buct/gr.ts +++ b/lib/routes/buct/gr.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import type { Context } from 'hono'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + export const route: Route = { path: '/gr/:type', categories: ['university'], diff --git a/lib/routes/buct/jwc.ts b/lib/routes/buct/jwc.ts index 3c084861a..35c4b7dcc 100644 --- a/lib/routes/buct/jwc.ts +++ b/lib/routes/buct/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/jwc', diff --git a/lib/routes/bugzilla/bug.ts b/lib/routes/bugzilla/bug.ts index afd82f3a3..da5530d1c 100644 --- a/lib/routes/bugzilla/bug.ts +++ b/lib/routes/bugzilla/bug.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; -import { Context } from 'hono'; +import type { Context } from 'hono'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Data, DataItem, Route } from '@/types'; +import type { Data, DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/bulianglin/rss.ts b/lib/routes/bulianglin/rss.ts index a69cef1fc..4dd3edc1a 100644 --- a/lib/routes/bulianglin/rss.ts +++ b/lib/routes/bulianglin/rss.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/bullionvault/gold-news.ts b/lib/routes/bullionvault/gold-news.ts index dfd5e22a0..07dda6093 100644 --- a/lib/routes/bullionvault/gold-news.ts +++ b/lib/routes/bullionvault/gold-news.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/bupt/jwc.ts b/lib/routes/bupt/jwc.ts index db112b71b..f1c9507eb 100644 --- a/lib/routes/bupt/jwc.ts +++ b/lib/routes/bupt/jwc.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import type { Context } from 'hono'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/jwc/:type', diff --git a/lib/routes/bupt/rczp.ts b/lib/routes/bupt/rczp.ts index bbe4458a5..acf1d795c 100644 --- a/lib/routes/bupt/rczp.ts +++ b/lib/routes/bupt/rczp.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/rczp', diff --git a/lib/routes/bupt/scss.ts b/lib/routes/bupt/scss.ts index 2c3c86abe..3a87e867e 100644 --- a/lib/routes/bupt/scss.ts +++ b/lib/routes/bupt/scss.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/scss/tzgg', diff --git a/lib/routes/byau/xinwen/index.ts b/lib/routes/byau/xinwen/index.ts index b6dc00800..aa1892012 100644 --- a/lib/routes/byau/xinwen/index.ts +++ b/lib/routes/byau/xinwen/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/byteclicks/index.ts b/lib/routes/byteclicks/index.ts index 16fcb0585..67865b163 100644 --- a/lib/routes/byteclicks/index.ts +++ b/lib/routes/byteclicks/index.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { parseItem } from './utils'; + const baseUrl = 'https://byteclicks.com'; export const route: Route = { diff --git a/lib/routes/byteclicks/tag.ts b/lib/routes/byteclicks/tag.ts index 8ca6ba2d0..8a15daa89 100644 --- a/lib/routes/byteclicks/tag.ts +++ b/lib/routes/byteclicks/tag.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { parseItem } from './utils'; + const baseUrl = 'https://byteclicks.com'; export const route: Route = { diff --git a/lib/routes/bytes/bytes.ts b/lib/routes/bytes/bytes.ts index c7b2b24a6..906306c11 100644 --- a/lib/routes/bytes/bytes.ts +++ b/lib/routes/bytes/bytes.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -const currentURL = 'https://bytes.dev/archives'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +const currentURL = 'https://bytes.dev/archives'; + export const route: Route = { path: '/', radar: [ diff --git a/lib/routes/c114/roll.ts b/lib/routes/c114/roll.ts index 2e4835cad..12629867a 100644 --- a/lib/routes/c114/roll.ts +++ b/lib/routes/c114/roll.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import iconv from 'iconv-lite'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { original = 'false' } = ctx.req.param(); diff --git a/lib/routes/caai/index.ts b/lib/routes/caai/index.ts index 82e17bd37..360519205 100644 --- a/lib/routes/caai/index.ts +++ b/lib/routes/caai/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import utils from './utils'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import utils from './utils'; + export const route: Route = { path: '/:caty', categories: ['study'], diff --git a/lib/routes/caai/utils.ts b/lib/routes/caai/utils.ts index 47a57b593..0894a5ca8 100644 --- a/lib/routes/caai/utils.ts +++ b/lib/routes/caai/utils.ts @@ -1,8 +1,10 @@ -import { load } from 'cheerio'; -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; const base = 'http://www.caai.cn'; diff --git a/lib/routes/caam/index.ts b/lib/routes/caam/index.ts index f2ee231f2..9753cb908 100644 --- a/lib/routes/caam/index.ts +++ b/lib/routes/caam/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/caareviews/book.ts b/lib/routes/caareviews/book.ts index 38cbcafd9..5950fa4b9 100644 --- a/lib/routes/caareviews/book.ts +++ b/lib/routes/caareviews/book.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, getList, getItems } from './utils'; +import type { Route } from '@/types'; + +import { getItems, getList, rootUrl } from './utils'; export const route: Route = { path: '/book', diff --git a/lib/routes/caareviews/essay.ts b/lib/routes/caareviews/essay.ts index 4c99eee9d..2b404cfe5 100644 --- a/lib/routes/caareviews/essay.ts +++ b/lib/routes/caareviews/essay.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, getList, getItems } from './utils'; +import type { Route } from '@/types'; + +import { getItems, getList, rootUrl } from './utils'; export const route: Route = { path: '/essay', diff --git a/lib/routes/caareviews/exhibition.ts b/lib/routes/caareviews/exhibition.ts index a6fd9d97d..fc9ab6c52 100644 --- a/lib/routes/caareviews/exhibition.ts +++ b/lib/routes/caareviews/exhibition.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, getList, getItems } from './utils'; +import type { Route } from '@/types'; + +import { getItems, getList, rootUrl } from './utils'; export const route: Route = { path: '/exhibition', diff --git a/lib/routes/caareviews/utils.ts b/lib/routes/caareviews/utils.ts index 918fd88f4..98a478178 100644 --- a/lib/routes/caareviews/utils.ts +++ b/lib/routes/caareviews/utils.ts @@ -1,9 +1,11 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'http://www.caareviews.org'; @@ -43,4 +45,4 @@ const getItems = (ctx, list) => ) ); -export { rootUrl, getList, getItems }; +export { getItems, getList, rootUrl }; diff --git a/lib/routes/cags/edu/index.ts b/lib/routes/cags/edu/index.ts index f5e71ed6d..9a117f4e4 100644 --- a/lib/routes/cags/edu/index.ts +++ b/lib/routes/cags/edu/index.ts @@ -1,5 +1,5 @@ +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cahkms/index.ts b/lib/routes/cahkms/index.ts index 4f0258db7..7b7e6e5dd 100644 --- a/lib/routes/cahkms/index.ts +++ b/lib/routes/cahkms/index.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const titles = { '01': '关于我们', diff --git a/lib/routes/caijing/roll.ts b/lib/routes/caijing/roll.ts index bdcf72e67..eac82084e 100644 --- a/lib/routes/caijing/roll.ts +++ b/lib/routes/caijing/roll.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/caixin/article.ts b/lib/routes/caixin/article.ts index 1fd50c392..522d1f506 100644 --- a/lib/routes/caixin/article.ts +++ b/lib/routes/caixin/article.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/caixin/blog.ts b/lib/routes/caixin/blog.ts index 5a3a789dd..89d61546f 100644 --- a/lib/routes/caixin/blog.ts +++ b/lib/routes/caixin/blog.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { isValidHost } from '@/utils/valid-host'; import { parseDate } from '@/utils/parse-date'; +import { isValidHost } from '@/utils/valid-host'; + import { parseBlogArticle } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/blog/:column?', diff --git a/lib/routes/caixin/category.ts b/lib/routes/caixin/category.ts index 134c9a162..ba2d71265 100644 --- a/lib/routes/caixin/category.ts +++ b/lib/routes/caixin/category.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { isValidHost } from '@/utils/valid-host'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { isValidHost } from '@/utils/valid-host'; + import { parseArticle } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/:column/:category', diff --git a/lib/routes/caixin/database.ts b/lib/routes/caixin/database.ts index 1cc8cfa9f..5909b3b7a 100644 --- a/lib/routes/caixin/database.ts +++ b/lib/routes/caixin/database.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/database', diff --git a/lib/routes/caixin/k.ts b/lib/routes/caixin/k.ts index 3f75a2945..9328f5aa5 100644 --- a/lib/routes/caixin/k.ts +++ b/lib/routes/caixin/k.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/caixin/latest.ts b/lib/routes/caixin/latest.ts index 7705ecefe..4af188a3b 100644 --- a/lib/routes/caixin/latest.ts +++ b/lib/routes/caixin/latest.ts @@ -1,9 +1,10 @@ -import { Route, ViewType } from '@/types'; -import { getFulltext } from './utils-fulltext'; - +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { parseArticle } from './utils'; +import { getFulltext } from './utils-fulltext'; export const route: Route = { path: '/latest', diff --git a/lib/routes/caixin/utils-fulltext.ts b/lib/routes/caixin/utils-fulltext.ts index 6b517feb1..3d1b01da0 100644 --- a/lib/routes/caixin/utils-fulltext.ts +++ b/lib/routes/caixin/utils-fulltext.ts @@ -1,7 +1,9 @@ import crypto from 'node:crypto'; + import { hextob64, KJUR } from 'jsrsasign'; -import ofetch from '@/utils/ofetch'; + import { config } from '@/config'; +import ofetch from '@/utils/ofetch'; // The following constant is extracted from this script: https://file.caixin.com/pkg/cx-pay-layer/js/wap.js?v=5.15.421933 . It is believed to contain no sensitive information. // Refer to this discussion for further explanation: https://github.com/DIYgod/RSSHub/pull/17231 diff --git a/lib/routes/caixin/utils.ts b/lib/routes/caixin/utils.ts index fd00ad4c1..9268e05d8 100644 --- a/lib/routes/caixin/utils.ts +++ b/lib/routes/caixin/utils.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const parseArticle = async (item) => { if (/\.blog\.caixin\.com$/.test(new URL(item.link).hostname)) { return parseBlogArticle(item); diff --git a/lib/routes/caixin/weekly.ts b/lib/routes/caixin/weekly.ts index 2ce6f0b95..c67ef5b04 100644 --- a/lib/routes/caixin/weekly.ts +++ b/lib/routes/caixin/weekly.ts @@ -1,7 +1,8 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/caixinglobal/latest.ts b/lib/routes/caixinglobal/latest.ts index 598e3a5f9..87b02b238 100644 --- a/lib/routes/caixinglobal/latest.ts +++ b/lib/routes/caixinglobal/latest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/camchina/index.ts b/lib/routes/camchina/index.ts index 0c7976c9b..811d9311c 100644 --- a/lib/routes/camchina/index.ts +++ b/lib/routes/camchina/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/cankaoxiaoxi/index.ts b/lib/routes/cankaoxiaoxi/index.ts index 96388e0d1..b6bc80fb3 100644 --- a/lib/routes/cankaoxiaoxi/index.ts +++ b/lib/routes/cankaoxiaoxi/index.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: ['/column/:id?', '/:id?'], diff --git a/lib/routes/capitalmind/insights.ts b/lib/routes/capitalmind/insights.ts index 195a83f1f..4ed414609 100644 --- a/lib/routes/capitalmind/insights.ts +++ b/lib/routes/capitalmind/insights.ts @@ -1,4 +1,5 @@ -import { Data, Route } from '@/types'; +import type { Data, Route } from '@/types'; + import { baseUrl, fetchArticles } from './utils'; export const route: Route = { diff --git a/lib/routes/capitalmind/podcasts.ts b/lib/routes/capitalmind/podcasts.ts index 12e2d7c75..4a1bfa7d8 100644 --- a/lib/routes/capitalmind/podcasts.ts +++ b/lib/routes/capitalmind/podcasts.ts @@ -1,4 +1,5 @@ -import { Data, Route } from '@/types'; +import type { Data, Route } from '@/types'; + import { baseUrl, fetchArticles } from './utils'; export const route: Route = { diff --git a/lib/routes/capitalmind/utils.ts b/lib/routes/capitalmind/utils.ts index fa2d05566..5f92b4276 100644 --- a/lib/routes/capitalmind/utils.ts +++ b/lib/routes/capitalmind/utils.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; -import { DataItem } from '@/types'; +import ofetch from '@/utils/ofetch'; export const baseUrl = 'https://www.capitalmind.in'; diff --git a/lib/routes/cara/likes.ts b/lib/routes/cara/likes.ts index 422452a46..30b82896d 100644 --- a/lib/routes/cara/likes.ts +++ b/lib/routes/cara/likes.ts @@ -1,10 +1,12 @@ +import path from 'node:path'; + import type { Data, DataItem, Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { API_HOST, CDN_HOST, HOST } from './constant'; import type { PostsResponse } from './types'; import { customFetch, parseUserData } from './utils'; -import { API_HOST, CDN_HOST, HOST } from './constant'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; export const route: Route = { path: ['/likes/:user'], diff --git a/lib/routes/cara/portfolio.ts b/lib/routes/cara/portfolio.ts index bfbc41b5d..48e57f2f7 100644 --- a/lib/routes/cara/portfolio.ts +++ b/lib/routes/cara/portfolio.ts @@ -1,8 +1,9 @@ import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; + +import { API_HOST, CDN_HOST, HOST } from './constant'; import type { PortfolioResponse } from './types'; import { customFetch, fetchPortfolioItem, parseUserData } from './utils'; -import { API_HOST, CDN_HOST, HOST } from './constant'; -import cache from '@/utils/cache'; export const route: Route = { path: ['/portfolio/:user'], diff --git a/lib/routes/cara/timeline.ts b/lib/routes/cara/timeline.ts index 776feba31..00ff39209 100644 --- a/lib/routes/cara/timeline.ts +++ b/lib/routes/cara/timeline.ts @@ -1,10 +1,12 @@ +import path from 'node:path'; + import type { Data, DataItem, Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { API_HOST, CDN_HOST, HOST } from './constant'; import type { PostsResponse } from './types'; import { customFetch, parseUserData } from './utils'; -import { API_HOST, CDN_HOST, HOST } from './constant'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; export const route: Route = { path: ['/timeline/:user'], diff --git a/lib/routes/cara/utils.ts b/lib/routes/cara/utils.ts index 92d1ce4c4..39c2aa74b 100644 --- a/lib/routes/cara/utils.ts +++ b/lib/routes/cara/utils.ts @@ -1,12 +1,14 @@ -import { config } from '@/config'; -import ofetch from '@/utils/ofetch'; -import type { FetchOptions, FetchRequest, ResponseType } from 'ofetch'; -import type { PortfolioDetailResponse, PortfolioResponse, UserNextData } from './types'; -import type { DataItem } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import { API_HOST, CDN_HOST, HOST } from './constant'; import { load } from 'cheerio'; +import type { FetchOptions, FetchRequest, ResponseType } from 'ofetch'; + +import { config } from '@/config'; +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import { API_HOST, CDN_HOST, HOST } from './constant'; +import type { PortfolioDetailResponse, PortfolioResponse, UserNextData } from './types'; export function customFetch(request: FetchRequest, options?: FetchOptions) { return ofetch(request, { diff --git a/lib/routes/cartoonmad/comic.ts b/lib/routes/cartoonmad/comic.ts index 0cb816462..75eddc6f0 100644 --- a/lib/routes/cartoonmad/comic.ts +++ b/lib/routes/cartoonmad/comic.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import got from '@/utils/got'; -import iconv from 'iconv-lite'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const baseUrl = 'https://www.cartoonmad.com'; const KEY = '5e585'; diff --git a/lib/routes/cas/cg/index.ts b/lib/routes/cas/cg/index.ts index 714d637bd..a4aba4e7c 100644 --- a/lib/routes/cas/cg/index.ts +++ b/lib/routes/cas/cg/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cas/genetics/index.ts b/lib/routes/cas/genetics/index.ts index 1f910cf67..842288e94 100644 --- a/lib/routes/cas/genetics/index.ts +++ b/lib/routes/cas/genetics/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://genetics.cas.cn'; diff --git a/lib/routes/cas/ia/yjs.ts b/lib/routes/cas/ia/yjs.ts index 536334dc6..d37b8a99c 100644 --- a/lib/routes/cas/ia/yjs.ts +++ b/lib/routes/cas/ia/yjs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/ia/yjs', categories: ['university'], diff --git a/lib/routes/cas/iee/kydt.ts b/lib/routes/cas/iee/kydt.ts index e52b38d43..8d5e23ffc 100644 --- a/lib/routes/cas/iee/kydt.ts +++ b/lib/routes/cas/iee/kydt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cas/is/index.ts b/lib/routes/cas/is/index.ts index c608a8cc8..ec7390918 100644 --- a/lib/routes/cas/is/index.ts +++ b/lib/routes/cas/is/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://is.cas.cn'; diff --git a/lib/routes/cas/mesalab/kb.ts b/lib/routes/cas/mesalab/kb.ts index 346aacc2a..35bebdfa8 100644 --- a/lib/routes/cas/mesalab/kb.ts +++ b/lib/routes/cas/mesalab/kb.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cas/sim/kyjz.ts b/lib/routes/cas/sim/kyjz.ts index 1be7fd41e..116fc6ccb 100644 --- a/lib/routes/cas/sim/kyjz.ts +++ b/lib/routes/cas/sim/kyjz.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'http://www.sim.cas.cn/'; diff --git a/lib/routes/casssp/news.ts b/lib/routes/casssp/news.ts index 8c9c5f20b..ec9e359fb 100644 --- a/lib/routes/casssp/news.ts +++ b/lib/routes/casssp/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/cast/index.ts b/lib/routes/cast/index.ts index 56759bd7a..887283ca4 100644 --- a/lib/routes/cast/index.ts +++ b/lib/routes/cast/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const baseUrl = 'https://www.cast.org.cn'; async function parsePage(html: string) { diff --git a/lib/routes/catti/news.ts b/lib/routes/catti/news.ts index 8d926c514..20fd5aae4 100644 --- a/lib/routes/catti/news.ts +++ b/lib/routes/catti/news.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; type NewsCategory = { title: string; diff --git a/lib/routes/cau/ele.ts b/lib/routes/cau/ele.ts index e7810da2d..99d251040 100644 --- a/lib/routes/cau/ele.ts +++ b/lib/routes/cau/ele.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/cau/yjs.ts b/lib/routes/cau/yjs.ts index e2a447355..a2a77d545 100644 --- a/lib/routes/cau/yjs.ts +++ b/lib/routes/cau/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/caus/index.ts b/lib/routes/caus/index.ts index a7a8bf1ba..d93a108da 100644 --- a/lib/routes/caus/index.ts +++ b/lib/routes/caus/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/cbaigui/index.ts b/lib/routes/cbaigui/index.ts index 81bc814dc..fab210c7b 100644 --- a/lib/routes/cbaigui/index.ts +++ b/lib/routes/cbaigui/index.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; - -import { getSubPath } from '@/utils/common-utils'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { rootUrl, apiSlug, GetFilterId } from './utils'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { apiSlug, GetFilterId, rootUrl } from './utils'; export const route: Route = { path: '*', diff --git a/lib/routes/cbaigui/utils.ts b/lib/routes/cbaigui/utils.ts index eb43835f1..1adfa72d9 100644 --- a/lib/routes/cbaigui/utils.ts +++ b/lib/routes/cbaigui/utils.ts @@ -11,4 +11,4 @@ const GetFilterId = async (type, name) => { return filterResponse.findLast((f) => f.name === name)?.id ?? undefined; }; -export { rootUrl, apiSlug, GetFilterId }; +export { apiSlug, GetFilterId, rootUrl }; diff --git a/lib/routes/cbc/topics.ts b/lib/routes/cbc/topics.ts index 95aa18303..5b9721eed 100644 --- a/lib/routes/cbc/topics.ts +++ b/lib/routes/cbc/topics.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/topics/:topic?', diff --git a/lib/routes/cbirc/index.ts b/lib/routes/cbirc/index.ts index e4e5fb69e..41a1bbfdc 100644 --- a/lib/routes/cbirc/index.ts +++ b/lib/routes/cbirc/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/cbndata/information.ts b/lib/routes/cbndata/information.ts index f0c8a984a..ceb96c5c4 100644 --- a/lib/routes/cbndata/information.ts +++ b/lib/routes/cbndata/information.ts @@ -1,13 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { id = 'all' } = ctx.req.param(); diff --git a/lib/routes/cbnweek/index.ts b/lib/routes/cbnweek/index.ts index aa3ad620d..9b2474be1 100644 --- a/lib/routes/cbnweek/index.ts +++ b/lib/routes/cbnweek/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/cbpanet/index.ts b/lib/routes/cbpanet/index.ts index c21d1d2f2..46b080bae 100644 --- a/lib/routes/cbpanet/index.ts +++ b/lib/routes/cbpanet/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { bigId = '2', smallId = '11' } = ctx.req.param(); diff --git a/lib/routes/ccac/news.ts b/lib/routes/ccac/news.ts index 94f4cec3a..8af1f2ff9 100644 --- a/lib/routes/ccac/news.ts +++ b/lib/routes/ccac/news.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import utils from './utils'; + export const route: Route = { path: '/news/:type/:lang?', categories: ['government'], diff --git a/lib/routes/ccagm/index.ts b/lib/routes/ccagm/index.ts index 9c294c348..af79a1dc5 100644 --- a/lib/routes/ccagm/index.ts +++ b/lib/routes/ccagm/index.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'association-news' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '10', 10); diff --git a/lib/routes/cccfna/index.ts b/lib/routes/cccfna/index.ts index de3dabbf3..de6152dd9 100644 --- a/lib/routes/cccfna/index.ts +++ b/lib/routes/cccfna/index.ts @@ -1,9 +1,10 @@ -import { Route, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/:category/:type?', diff --git a/lib/routes/cccmc/index.ts b/lib/routes/cccmc/index.ts index 4e314289c..3d9b618f7 100644 --- a/lib/routes/cccmc/index.ts +++ b/lib/routes/cccmc/index.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'ywgg/tzgg' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '15', 10); diff --git a/lib/routes/ccf/ccfcv/index.ts b/lib/routes/ccf/ccfcv/index.ts index 902d88cfe..4b038d0ea 100644 --- a/lib/routes/ccf/ccfcv/index.ts +++ b/lib/routes/ccf/ccfcv/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://tc.ccf.org.cn'; diff --git a/lib/routes/ccf/news.ts b/lib/routes/ccf/news.ts index e3ddc11b6..98daceb06 100644 --- a/lib/routes/ccf/news.ts +++ b/lib/routes/ccf/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ccf/tfbd/index.ts b/lib/routes/ccf/tfbd/index.ts index 557698989..7f3e8ec6b 100644 --- a/lib/routes/ccf/tfbd/index.ts +++ b/lib/routes/ccf/tfbd/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import utils from './utils'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import utils from './utils'; + export const route: Route = { path: '/tfbd/:caty/:id', categories: ['study'], diff --git a/lib/routes/ccf/tfbd/utils.ts b/lib/routes/ccf/tfbd/utils.ts index c7e9ddbd9..544f2c9a7 100644 --- a/lib/routes/ccf/tfbd/utils.ts +++ b/lib/routes/ccf/tfbd/utils.ts @@ -1,8 +1,10 @@ -import { load } from 'cheerio'; -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; const base = 'http://tfbd.ccf.org.cn'; diff --git a/lib/routes/ccfa/index.ts b/lib/routes/ccfa/index.ts index dfb7bf2b4..83c7c988d 100644 --- a/lib/routes/ccfa/index.ts +++ b/lib/routes/ccfa/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { type = '1' } = ctx.req.param(); diff --git a/lib/routes/ccg/index.ts b/lib/routes/ccg/index.ts index b3ee013f7..782783ff7 100644 --- a/lib/routes/ccg/index.ts +++ b/lib/routes/ccg/index.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = 'news' } = ctx.req.param(); diff --git a/lib/routes/ccnu/career.ts b/lib/routes/ccnu/career.ts index 171e1cc8f..d77e93149 100644 --- a/lib/routes/ccnu/career.ts +++ b/lib/routes/ccnu/career.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ccnu/cs.ts b/lib/routes/ccnu/cs.ts index c463ca940..b83e71aef 100644 --- a/lib/routes/ccnu/cs.ts +++ b/lib/routes/ccnu/cs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ccnu/wu.ts b/lib/routes/ccnu/wu.ts index 68a537d7c..5c076f8de 100644 --- a/lib/routes/ccnu/wu.ts +++ b/lib/routes/ccnu/wu.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ccnu/yjs.ts b/lib/routes/ccnu/yjs.ts index 7f838f99b..c5e71f259 100644 --- a/lib/routes/ccnu/yjs.ts +++ b/lib/routes/ccnu/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ccreports/index.ts b/lib/routes/ccreports/index.ts index 76c4914e0..969e3e137 100644 --- a/lib/routes/ccreports/index.ts +++ b/lib/routes/ccreports/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cctv/category.ts b/lib/routes/cctv/category.ts index f1f854bb2..6b018770a 100644 --- a/lib/routes/cctv/category.ts +++ b/lib/routes/cctv/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import getMzzlbg from './utils/mzzlbg'; -import xinwen1j1 from './utils/xinwen1j1'; import getNews from './utils/news'; +import xinwen1j1 from './utils/xinwen1j1'; import getXWLB from './xwlb'; export const route: Route = { diff --git a/lib/routes/cctv/jx.ts b/lib/routes/cctv/jx.ts index bc15e61dc..c1ee3fe06 100644 --- a/lib/routes/cctv/jx.ts +++ b/lib/routes/cctv/jx.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/cctv/lm.ts b/lib/routes/cctv/lm.ts index 7294c74c0..a1af83099 100644 --- a/lib/routes/cctv/lm.ts +++ b/lib/routes/cctv/lm.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/lm/:id?', diff --git a/lib/routes/cctv/utils/news.ts b/lib/routes/cctv/utils/news.ts index d466486f3..14ef0ce7f 100644 --- a/lib/routes/cctv/utils/news.ts +++ b/lib/routes/cctv/utils/news.ts @@ -1,9 +1,10 @@ +import path from 'node:path'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import path from 'node:path'; +import { PRESETS } from '@/utils/header-generator'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { PRESETS } from '@/utils/header-generator'; const getNews = async (category) => { const url = `https://news.cctv.com/2019/07/gaiban/cmsdatainterface/page/${category}_1.jsonp`; diff --git a/lib/routes/cctv/utils/xinwen1j1.ts b/lib/routes/cctv/utils/xinwen1j1.ts index 57a1edf3f..a2072272c 100644 --- a/lib/routes/cctv/utils/xinwen1j1.ts +++ b/lib/routes/cctv/utils/xinwen1j1.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; // // 测试http://localhost:1200/cctv/xinwen1j1 diff --git a/lib/routes/cctv/xwlb.ts b/lib/routes/cctv/xwlb.ts index e7f2fdc54..9d8856f6b 100644 --- a/lib/routes/cctv/xwlb.ts +++ b/lib/routes/cctv/xwlb.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import dayjs from 'dayjs'; +import customParseFormat from 'dayjs/plugin/customParseFormat.js'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import dayjs from 'dayjs'; -import customParseFormat from 'dayjs/plugin/customParseFormat.js'; + dayjs.extend(customParseFormat); export const route: Route = { diff --git a/lib/routes/cde/index.ts b/lib/routes/cde/index.ts index f142f95f0..2d342a48a 100644 --- a/lib/routes/cde/index.ts +++ b/lib/routes/cde/index.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import utils from './utils'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + const channelLinkMap = { news: 'https://www.cde.org.cn/main/news/listpage/545cf855a50574699b46b26bcb165f32', policy: 'https://www.cde.org.cn/main/policy/listpage/9f9c74c73e0f8f56a8bfbc646055026d', diff --git a/lib/routes/cde/xxgk.ts b/lib/routes/cde/xxgk.ts index 72c539675..adf107dff 100644 --- a/lib/routes/cde/xxgk.ts +++ b/lib/routes/cde/xxgk.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import utils from './utils'; const baseUrl = 'https://www.cde.org.cn'; diff --git a/lib/routes/cde/zdyz.ts b/lib/routes/cde/zdyz.ts index a3166acf5..5f78fa511 100644 --- a/lib/routes/cde/zdyz.ts +++ b/lib/routes/cde/zdyz.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import utils from './utils'; const baseUrl = 'https://www.cde.org.cn'; diff --git a/lib/routes/cdi/index.ts b/lib/routes/cdi/index.ts index 93338d725..f518124bf 100644 --- a/lib/routes/cdi/index.ts +++ b/lib/routes/cdi/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/cdu/cdrw.ts b/lib/routes/cdu/cdrw.ts index 912a746b6..57c9336b3 100644 --- a/lib/routes/cdu/cdrw.ts +++ b/lib/routes/cdu/cdrw.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cdu/jwgg.ts b/lib/routes/cdu/jwgg.ts index dcd2f2be0..0b682be6d 100644 --- a/lib/routes/cdu/jwgg.ts +++ b/lib/routes/cdu/jwgg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cdu/tzggcdunews.ts b/lib/routes/cdu/tzggcdunews.ts index c4f299dc4..319cdf884 100644 --- a/lib/routes/cdu/tzggcdunews.ts +++ b/lib/routes/cdu/tzggcdunews.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cdzjryb/project-list.ts b/lib/routes/cdzjryb/project-list.ts index f9cc192e3..f60cc6f8a 100644 --- a/lib/routes/cdzjryb/project-list.ts +++ b/lib/routes/cdzjryb/project-list.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/zw/projectList', diff --git a/lib/routes/ce/district.ts b/lib/routes/ce/district.ts index 23eebe8a6..7a083ccd3 100644 --- a/lib/routes/ce/district.ts +++ b/lib/routes/ce/district.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/district/:category?', diff --git a/lib/routes/cebbank/all.ts b/lib/routes/cebbank/all.ts index 6d9764174..8fc204ea9 100644 --- a/lib/routes/cebbank/all.ts +++ b/lib/routes/cebbank/all.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import md5 from '@/utils/md5'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import md5 from '@/utils/md5'; export const route: Route = { path: '/quotation/all', diff --git a/lib/routes/cebbank/history.ts b/lib/routes/cebbank/history.ts index cc68ca081..5dc11efaf 100644 --- a/lib/routes/cebbank/history.ts +++ b/lib/routes/cebbank/history.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { art } from '@/utils/render'; + import utils from './utils'; const { TYPE } = utils; diff --git a/lib/routes/ceph/blog.ts b/lib/routes/ceph/blog.ts index 7c5e1dc9a..155518378 100644 --- a/lib/routes/ceph/blog.ts +++ b/lib/routes/ceph/blog.ts @@ -1,9 +1,10 @@ -import { Data, Route } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { Context } from 'hono'; export const route: Route = { path: '/blog/:topic?', diff --git a/lib/routes/cfachina/analygarden.ts b/lib/routes/cfachina/analygarden.ts index 0995860ec..13bf4c7bc 100644 --- a/lib/routes/cfachina/analygarden.ts +++ b/lib/routes/cfachina/analygarden.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cffex/announcement.ts b/lib/routes/cffex/announcement.ts index f9d449335..ecbac0127 100644 --- a/lib/routes/cffex/announcement.ts +++ b/lib/routes/cffex/announcement.ts @@ -1,9 +1,10 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; export const route: Route = { path: '/announcement', diff --git a/lib/routes/cfmmc/index.ts b/lib/routes/cfmmc/index.ts index 974bb41cf..447ca72c8 100644 --- a/lib/routes/cfmmc/index.ts +++ b/lib/routes/cfmmc/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:id{.+}?', diff --git a/lib/routes/cfr/index.ts b/lib/routes/cfr/index.ts index efcd50804..181bbe391 100644 --- a/lib/routes/cfr/index.ts +++ b/lib/routes/cfr/index.ts @@ -1,10 +1,12 @@ -import type { Data, Route } from '@/types'; -import type { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { getDataItem } from './utils'; +import type { Context } from 'hono'; import pMap from 'p-map'; +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { getDataItem } from './utils'; + export const route: Route = { path: '/:category/:subCategory?', categories: ['traditional-media'], diff --git a/lib/routes/cfr/namespace.ts b/lib/routes/cfr/namespace.ts index 939154e0c..a2816e468 100644 --- a/lib/routes/cfr/namespace.ts +++ b/lib/routes/cfr/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'Council on Foreign Relations', diff --git a/lib/routes/cfr/utils.ts b/lib/routes/cfr/utils.ts index 56f6ba9cc..3521b1560 100644 --- a/lib/routes/cfr/utils.ts +++ b/lib/routes/cfr/utils.ts @@ -1,9 +1,11 @@ import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; -import ofetch from '@/utils/ofetch'; + import type { DataItem } from '@/types'; -import { parseDate } from '@/utils/parse-date'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + import type { LinkData, VideoSetup } from './types'; export function getDataItem(href: string) { diff --git a/lib/routes/cgtn/podcast.ts b/lib/routes/cgtn/podcast.ts index dcda53ae9..d43adfb85 100644 --- a/lib/routes/cgtn/podcast.ts +++ b/lib/routes/cgtn/podcast.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; async function getData(category, id) { const url = `https://radio.cgtn.com/downapiRES/radio/v1/program/historyList/programId${id}_category${category}_page1.json`; diff --git a/lib/routes/chaincatcher/home.ts b/lib/routes/chaincatcher/home.ts index 199e9543a..619c9e72e 100644 --- a/lib/routes/chaincatcher/home.ts +++ b/lib/routes/chaincatcher/home.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://www.chaincatcher.com'; diff --git a/lib/routes/chaincatcher/news.ts b/lib/routes/chaincatcher/news.ts index e0119edf9..ba3003a8d 100644 --- a/lib/routes/chaincatcher/news.ts +++ b/lib/routes/chaincatcher/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/changba/user.ts b/lib/routes/changba/user.ts index b08fcfb62..a07980d2a 100644 --- a/lib/routes/changba/user.ts +++ b/lib/routes/changba/user.ts @@ -1,10 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; + const headers = { 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1' }; export const route: Route = { diff --git a/lib/routes/chaoxing/qk.ts b/lib/routes/chaoxing/qk.ts index 1790f4b49..0381ae90a 100644 --- a/lib/routes/chaoxing/qk.ts +++ b/lib/routes/chaoxing/qk.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/qk/:id/:needContent?', diff --git a/lib/routes/chaping/banner.ts b/lib/routes/chaping/banner.ts index 359f30701..e26ecb272 100644 --- a/lib/routes/chaping/banner.ts +++ b/lib/routes/chaping/banner.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/chaping/news.ts b/lib/routes/chaping/news.ts index 5f74b2aa0..8cceee184 100644 --- a/lib/routes/chaping/news.ts +++ b/lib/routes/chaping/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/chaping/newsflash.ts b/lib/routes/chaping/newsflash.ts index 8f77d1080..d54eb163d 100644 --- a/lib/routes/chaping/newsflash.ts +++ b/lib/routes/chaping/newsflash.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/cherrytimes/market.ts b/lib/routes/cherrytimes/market.ts index 121be3e0b..cc0ff977e 100644 --- a/lib/routes/cherrytimes/market.ts +++ b/lib/routes/cherrytimes/market.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/market', categories: ['new-media'], diff --git a/lib/routes/chiculture/topic.ts b/lib/routes/chiculture/topic.ts index c992caa53..276df7a1a 100644 --- a/lib/routes/chiculture/topic.ts +++ b/lib/routes/chiculture/topic.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/topic/:category?', diff --git a/lib/routes/chikubi/category.ts b/lib/routes/chikubi/category.ts index 0b29eb176..c3ebafa91 100644 --- a/lib/routes/chikubi/category.ts +++ b/lib/routes/chikubi/category.ts @@ -1,4 +1,5 @@ -import { Route, Data } from '@/types'; +import type { Data, Route } from '@/types'; + import { getBySlug, getPostsBy } from './utils'; export const route: Route = { diff --git a/lib/routes/chikubi/index.ts b/lib/routes/chikubi/index.ts index d23747d25..8957304c5 100644 --- a/lib/routes/chikubi/index.ts +++ b/lib/routes/chikubi/index.ts @@ -1,4 +1,5 @@ -import { Route, Data } from '@/types'; +import type { Data, Route } from '@/types'; + import { getPosts } from './utils'; export const route: Route = { diff --git a/lib/routes/chikubi/navigation.ts b/lib/routes/chikubi/navigation.ts index 7598d3ffe..68b8f0ec4 100644 --- a/lib/routes/chikubi/navigation.ts +++ b/lib/routes/chikubi/navigation.ts @@ -1,7 +1,8 @@ -import { Route, Data } from '@/types'; -import { getBySlug, getPostsBy, processItems } from './utils'; +import type { Data, Route } from '@/types'; import parser from '@/utils/rss-parser'; +import { getBySlug, getPostsBy, processItems } from './utils'; + export const route: Route = { path: '/:keyword', categories: ['multimedia'], diff --git a/lib/routes/chikubi/nipple-video-category.ts b/lib/routes/chikubi/nipple-video-category.ts index 6be5f39c6..5077f504b 100644 --- a/lib/routes/chikubi/nipple-video-category.ts +++ b/lib/routes/chikubi/nipple-video-category.ts @@ -1,7 +1,8 @@ -import { Route, Data } from '@/types'; -import { processItems } from './utils'; +import type { Data, Route } from '@/types'; import parser from '@/utils/rss-parser'; +import { processItems } from './utils'; + export const route: Route = { path: '/nipple-video-category/:keyword', categories: ['multimedia'], diff --git a/lib/routes/chikubi/nipple-video-maker.ts b/lib/routes/chikubi/nipple-video-maker.ts index 1dc2d3130..2d2d1a2ee 100644 --- a/lib/routes/chikubi/nipple-video-maker.ts +++ b/lib/routes/chikubi/nipple-video-maker.ts @@ -1,7 +1,8 @@ -import { Route, Data } from '@/types'; -import { processItems } from './utils'; +import type { Data, Route } from '@/types'; import parser from '@/utils/rss-parser'; +import { processItems } from './utils'; + export const route: Route = { path: '/nipple-video-maker/:keyword', categories: ['multimedia'], diff --git a/lib/routes/chikubi/search.ts b/lib/routes/chikubi/search.ts index e92b55604..da1802990 100644 --- a/lib/routes/chikubi/search.ts +++ b/lib/routes/chikubi/search.ts @@ -1,7 +1,8 @@ -import { Route, Data } from '@/types'; -import { getPosts } from './utils'; +import type { Data, Route } from '@/types'; import got from '@/utils/got'; +import { getPosts } from './utils'; + export const route: Route = { path: '/search/:keyword', categories: ['multimedia'], diff --git a/lib/routes/chikubi/tag.ts b/lib/routes/chikubi/tag.ts index 43f92307b..35eea4bee 100644 --- a/lib/routes/chikubi/tag.ts +++ b/lib/routes/chikubi/tag.ts @@ -1,4 +1,5 @@ -import { Route, Data } from '@/types'; +import type { Data, Route } from '@/types'; + import { getBySlug, getPostsBy } from './utils'; export const route: Route = { diff --git a/lib/routes/chikubi/utils.ts b/lib/routes/chikubi/utils.ts index 2edbdea74..e2b075b23 100644 --- a/lib/routes/chikubi/utils.ts +++ b/lib/routes/chikubi/utils.ts @@ -1,7 +1,8 @@ -import { DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const CONTENT_TYPES = { diff --git a/lib/routes/china/finance/finance.ts b/lib/routes/china/finance/finance.ts index f32547a99..aa1e3b258 100644 --- a/lib/routes/china/finance/finance.ts +++ b/lib/routes/china/finance/finance.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/china/news/highlights/news.ts b/lib/routes/china/news/highlights/news.ts index a04233028..604093829 100644 --- a/lib/routes/china/news/highlights/news.ts +++ b/lib/routes/china/news/highlights/news.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/china/news/military/news.ts b/lib/routes/china/news/military/news.ts index a088ad43c..a5520bcfd 100644 --- a/lib/routes/china/news/military/news.ts +++ b/lib/routes/china/news/military/news.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/chinacdc/index.ts b/lib/routes/chinacdc/index.ts index 9c625f36c..e72ddd1a6 100644 --- a/lib/routes/chinacdc/index.ts +++ b/lib/routes/chinacdc/index.ts @@ -1,15 +1,14 @@ import path from 'node:path'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - -import { art } from '@/utils/render'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = 'zxyw' } = ctx.req.param(); diff --git a/lib/routes/chinadaily/language.ts b/lib/routes/chinadaily/language.ts index 37ae513d1..7bd2523e8 100644 --- a/lib/routes/chinadaily/language.ts +++ b/lib/routes/chinadaily/language.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const { category = 'thelatest' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/chinadegrees/province.ts b/lib/routes/chinadegrees/province.ts index 52d7f15f7..8a762d1c6 100644 --- a/lib/routes/chinadegrees/province.ts +++ b/lib/routes/chinadegrees/province.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import { art } from '@/utils/render'; + const baseUrl = 'http://www.chinadegrees.com.cn'; export const route: Route = { diff --git a/lib/routes/chinafactcheck/index.ts b/lib/routes/chinafactcheck/index.ts index 69b19df15..75d1721a7 100644 --- a/lib/routes/chinafactcheck/index.ts +++ b/lib/routes/chinafactcheck/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import utils from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import utils from './utils'; + export const route: Route = { path: '/', radar: [ diff --git a/lib/routes/chinafactcheck/utils.ts b/lib/routes/chinafactcheck/utils.ts index 96e71d4c9..293a1ad6e 100644 --- a/lib/routes/chinafactcheck/utils.ts +++ b/lib/routes/chinafactcheck/utils.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; + +import { config } from '@/config'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; const siteLink = 'https://chinafactcheck.com'; diff --git a/lib/routes/chinaisa/index.ts b/lib/routes/chinaisa/index.ts index 17bc02430..548079fa2 100644 --- a/lib/routes/chinaisa/index.ts +++ b/lib/routes/chinaisa/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/chinamoney/notice.ts b/lib/routes/chinamoney/notice.ts index 8fb5c22ee..c524af19d 100644 --- a/lib/routes/chinamoney/notice.ts +++ b/lib/routes/chinamoney/notice.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { channels } from './channels'; export const route: Route = { diff --git a/lib/routes/chinanews/index.ts b/lib/routes/chinanews/index.ts index 762247fb8..aaccff0ba 100644 --- a/lib/routes/chinanews/index.ts +++ b/lib/routes/chinanews/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.chinanews.com.cn'; diff --git a/lib/routes/chinania/index.ts b/lib/routes/chinania/index.ts index b49960a7b..9875fb0de 100644 --- a/lib/routes/chinania/index.ts +++ b/lib/routes/chinania/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/chinaratings/credit-research.ts b/lib/routes/chinaratings/credit-research.ts index d5e8ad31c..bc9a87059 100644 --- a/lib/routes/chinaratings/credit-research.ts +++ b/lib/routes/chinaratings/credit-research.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'Industry/Comment' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '15', 10); diff --git a/lib/routes/chinathinktanks/viewpoint.ts b/lib/routes/chinathinktanks/viewpoint.ts index 9cdd0e718..021c8654e 100644 --- a/lib/routes/chinathinktanks/viewpoint.ts +++ b/lib/routes/chinathinktanks/viewpoint.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { CookieJar } from 'tough-cookie'; const cookieJar = new CookieJar(); const baseUrl = 'https://www.chinathinktanks.org.cn'; diff --git a/lib/routes/chinatimes/index.ts b/lib/routes/chinatimes/index.ts index 46e050656..dc7a7bf0b 100644 --- a/lib/routes/chinatimes/index.ts +++ b/lib/routes/chinatimes/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import puppeteer from '@/utils/puppeteer'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import puppeteer from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/chinaventure/index.ts b/lib/routes/chinaventure/index.ts index 146de6e66..aff835216 100644 --- a/lib/routes/chinaventure/index.ts +++ b/lib/routes/chinaventure/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/chinawriter/index.ts b/lib/routes/chinawriter/index.ts index 5f583dca8..946c8bc79 100644 --- a/lib/routes/chinawriter/index.ts +++ b/lib/routes/chinawriter/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:id{.+}?', diff --git a/lib/routes/chiphell/portal.ts b/lib/routes/chiphell/portal.ts index 4b6f577d3..1ff83542b 100644 --- a/lib/routes/chiphell/portal.ts +++ b/lib/routes/chiphell/portal.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import * as cheerio from 'cheerio'; import type { Context } from 'hono'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/chlinlearn/daily-blog.ts b/lib/routes/chlinlearn/daily-blog.ts index 36a03081d..e0ef1a3aa 100644 --- a/lib/routes/chlinlearn/daily-blog.ts +++ b/lib/routes/chlinlearn/daily-blog.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import CryptoJS from 'crypto-js'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { parseDate } from '@/utils/parse-date'; // 解析日期的工具函数 import timezone from '@/utils/timezone'; -import CryptoJS from 'crypto-js'; export const route: Route = { path: '/daily-blog', diff --git a/lib/routes/chnmuseum/xingnew.ts b/lib/routes/chnmuseum/xingnew.ts index f7cee82d3..afccbdacb 100644 --- a/lib/routes/chnmuseum/xingnew.ts +++ b/lib/routes/chnmuseum/xingnew.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/chnmuseum/xwzt.ts b/lib/routes/chnmuseum/xwzt.ts index 5b5394709..719d91e62 100644 --- a/lib/routes/chnmuseum/xwzt.ts +++ b/lib/routes/chnmuseum/xwzt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/zx/xwzt', categories: ['travel'], diff --git a/lib/routes/chocolatey/packages.ts b/lib/routes/chocolatey/packages.ts index f56fa0423..5a4cc3777 100644 --- a/lib/routes/chocolatey/packages.ts +++ b/lib/routes/chocolatey/packages.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { id } = ctx.req.param(); diff --git a/lib/routes/chongbuluo/index.ts b/lib/routes/chongbuluo/index.ts index d392278fd..db542bbb7 100644 --- a/lib/routes/chongbuluo/index.ts +++ b/lib/routes/chongbuluo/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/newthread', diff --git a/lib/routes/chongdiantou/index.ts b/lib/routes/chongdiantou/index.ts index d798231e9..36c91c288 100644 --- a/lib/routes/chongdiantou/index.ts +++ b/lib/routes/chongdiantou/index.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import { namespace } from './namespace'; import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { namespace } from './namespace'; export const route: Route = { path: '/', diff --git a/lib/routes/chsi/hotnews.ts b/lib/routes/chsi/hotnews.ts index d41290c10..316ab02af 100644 --- a/lib/routes/chsi/hotnews.ts +++ b/lib/routes/chsi/hotnews.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://yz.chsi.com.cn'; diff --git a/lib/routes/chsi/kydt.ts b/lib/routes/chsi/kydt.ts index faf9b25d7..b590fdaa2 100644 --- a/lib/routes/chsi/kydt.ts +++ b/lib/routes/chsi/kydt.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const host = 'https://yz.chsi.com.cn'; diff --git a/lib/routes/chsi/kyzx.ts b/lib/routes/chsi/kyzx.ts index 3955db976..824ceb163 100644 --- a/lib/routes/chsi/kyzx.ts +++ b/lib/routes/chsi/kyzx.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const host = 'https://yz.chsi.com.cn'; diff --git a/lib/routes/chuanliu/nice.ts b/lib/routes/chuanliu/nice.ts index ed0cc0f84..9982f44ac 100644 --- a/lib/routes/chuanliu/nice.ts +++ b/lib/routes/chuanliu/nice.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/chuapp/chuapp.ts b/lib/routes/chuapp/chuapp.ts index 99e277de4..6ffd5d28e 100644 --- a/lib/routes/chuapp/chuapp.ts +++ b/lib/routes/chuapp/chuapp.ts @@ -1,9 +1,10 @@ -import { Context } from 'hono'; import { load } from 'cheerio'; -import { Data, Route, DataItem } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/chub/characters.ts b/lib/routes/chub/characters.ts index f2d1b3b10..0ed1d8a44 100644 --- a/lib/routes/chub/characters.ts +++ b/lib/routes/chub/characters.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/cib/whpj.ts b/lib/routes/cib/whpj.ts index ed4575417..ec3637e60 100644 --- a/lib/routes/cib/whpj.ts +++ b/lib/routes/cib/whpj.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import crypto from 'node:crypto'; +import https from 'node:https'; + +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import https from 'node:https'; -import crypto from 'node:crypto'; -import { config } from '@/config'; export const route: Route = { path: '/whpj/:format?', diff --git a/lib/routes/cih-index/report.ts b/lib/routes/cih-index/report.ts index f909df9bc..b3f6a0263 100644 --- a/lib/routes/cih-index/report.ts +++ b/lib/routes/cih-index/report.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ciidbnu/index.ts b/lib/routes/ciidbnu/index.ts index c4e44fa19..f9411e84a 100644 --- a/lib/routes/ciidbnu/index.ts +++ b/lib/routes/ciidbnu/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cisia/index.ts b/lib/routes/cisia/index.ts index 49d31e88c..7e3bb4fea 100644 --- a/lib/routes/cisia/index.ts +++ b/lib/routes/cisia/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/civitai/discussions.ts b/lib/routes/civitai/discussions.ts index 6a54687df..200574e1b 100644 --- a/lib/routes/civitai/discussions.ts +++ b/lib/routes/civitai/discussions.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import { load } from 'cheerio'; export const route: Route = { path: '/discussions/:modelId', diff --git a/lib/routes/civitai/models.ts b/lib/routes/civitai/models.ts index 1a16ae584..06cafbe50 100644 --- a/lib/routes/civitai/models.ts +++ b/lib/routes/civitai/models.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/civitai/user.ts b/lib/routes/civitai/user.ts index 08018c164..0cecea8da 100644 --- a/lib/routes/civitai/user.ts +++ b/lib/routes/civitai/user.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ciweimao/chapter.ts b/lib/routes/ciweimao/chapter.ts index a6a88675d..10412edba 100644 --- a/lib/routes/ciweimao/chapter.ts +++ b/lib/routes/ciweimao/chapter.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cjlu/yjsy/index.ts b/lib/routes/cjlu/yjsy/index.ts index 41dabe8ee..1b333b623 100644 --- a/lib/routes/cjlu/yjsy/index.ts +++ b/lib/routes/cjlu/yjsy/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import timezone from '@/utils/timezone'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { getPuppeteerPage } from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; const host = 'https://yjsy.cjlu.edu.cn/'; diff --git a/lib/routes/clickme/index.ts b/lib/routes/clickme/index.ts index 0bee42418..ff72aa192 100644 --- a/lib/routes/clickme/index.ts +++ b/lib/routes/clickme/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/cline/blog.ts b/lib/routes/cline/blog.ts index 82dd8a80d..a24306c92 100644 --- a/lib/routes/cline/blog.ts +++ b/lib/routes/cline/blog.ts @@ -1,7 +1,8 @@ -import { load, type CheerioAPI } from 'cheerio'; +import { type CheerioAPI, load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Route, DataItem } from '@/types'; const rootUrl = 'https://cline.bot'; const blogUrl = `${rootUrl}/blog`; diff --git a/lib/routes/cloudflarestatus/index.ts b/lib/routes/cloudflarestatus/index.ts index 5744857f6..f49a12b6a 100644 --- a/lib/routes/cloudflarestatus/index.ts +++ b/lib/routes/cloudflarestatus/index.ts @@ -1,13 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '100', 10); diff --git a/lib/routes/cloudnative/blog.ts b/lib/routes/cloudnative/blog.ts index 46e74981b..4da530cc9 100644 --- a/lib/routes/cloudnative/blog.ts +++ b/lib/routes/cloudnative/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cls/depth.ts b/lib/routes/cls/depth.ts index d80754cdb..28330d50d 100644 --- a/lib/routes/cls/depth.ts +++ b/lib/routes/cls/depth.ts @@ -1,14 +1,15 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { rootUrl, getSearchParams } from './utils'; +import { load } from 'cheerio'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { getSearchParams, rootUrl } from './utils'; const categories = { 1000: '头条', diff --git a/lib/routes/cls/hot.ts b/lib/routes/cls/hot.ts index 4da407fac..88c2ab1d5 100644 --- a/lib/routes/cls/hot.ts +++ b/lib/routes/cls/hot.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { rootUrl, getSearchParams } from './utils'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { getSearchParams, rootUrl } from './utils'; export const route: Route = { path: '/hot', diff --git a/lib/routes/cls/subject.ts b/lib/routes/cls/subject.ts index 858135e44..cd92e10aa 100644 --- a/lib/routes/cls/subject.ts +++ b/lib/routes/cls/subject.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { rootUrl, getSearchParams } from './utils'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { getSearchParams, rootUrl } from './utils'; export const handler = async (ctx) => { const { id = '1103' } = ctx.req.param(); diff --git a/lib/routes/cls/telegraph.ts b/lib/routes/cls/telegraph.ts index ec0c4d09a..46f034cac 100644 --- a/lib/routes/cls/telegraph.ts +++ b/lib/routes/cls/telegraph.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { rootUrl, getSearchParams } from './utils'; +import { getSearchParams, rootUrl } from './utils'; const categories = { watch: '看盘', diff --git a/lib/routes/cls/utils.ts b/lib/routes/cls/utils.ts index 27c7cbac2..59efa53c0 100644 --- a/lib/routes/cls/utils.ts +++ b/lib/routes/cls/utils.ts @@ -15,4 +15,4 @@ const getSearchParams = (moreParams) => { return searchParams; }; -export { rootUrl, getSearchParams }; +export { getSearchParams, rootUrl }; diff --git a/lib/routes/cma/channel.ts b/lib/routes/cma/channel.ts index dc9a13e5d..a24f5ea29 100644 --- a/lib/routes/cma/channel.ts +++ b/lib/routes/cma/channel.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/channel/:id?', diff --git a/lib/routes/cmde/index.ts b/lib/routes/cmde/index.ts index 99e34f4c5..5a5f567b6 100644 --- a/lib/routes/cmde/index.ts +++ b/lib/routes/cmde/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; const rootURL = 'https://www.cmde.org.cn'; diff --git a/lib/routes/cmpxchg8b/articles.ts b/lib/routes/cmpxchg8b/articles.ts index e8330ff3d..63a883b2a 100644 --- a/lib/routes/cmpxchg8b/articles.ts +++ b/lib/routes/cmpxchg8b/articles.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; const baseUrl = 'https://lock.cmpxchg8b.com/'; const title = 'cmpxchg8b'; diff --git a/lib/routes/cmu/andypavlo/blog.ts b/lib/routes/cmu/andypavlo/blog.ts index c31ed07b2..bdf87b6a8 100644 --- a/lib/routes/cmu/andypavlo/blog.ts +++ b/lib/routes/cmu/andypavlo/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; async function getArticles() { diff --git a/lib/routes/cn-healthcare/index.ts b/lib/routes/cn-healthcare/index.ts index a624b006d..df0fef415 100644 --- a/lib/routes/cn-healthcare/index.ts +++ b/lib/routes/cn-healthcare/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/cna/index.ts b/lib/routes/cna/index.ts index 632032c74..6145100d6 100644 --- a/lib/routes/cna/index.ts +++ b/lib/routes/cna/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getFullText } from './utils'; export const route: Route = { diff --git a/lib/routes/cna/utils.ts b/lib/routes/cna/utils.ts index 77cd2e864..8df70e51a 100644 --- a/lib/routes/cna/utils.ts +++ b/lib/routes/cna/utils.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + export async function getFullText(item) { const detailResponse = await got({ method: 'get', diff --git a/lib/routes/cna/web/index.ts b/lib/routes/cna/web/index.ts index bf79963bd..b56bd7921 100644 --- a/lib/routes/cna/web/index.ts +++ b/lib/routes/cna/web/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getFullText } from '../utils'; export const route: Route = { diff --git a/lib/routes/cnbc/rss.ts b/lib/routes/cnbc/rss.ts index ecc6620f1..06a3f8dda 100644 --- a/lib/routes/cnbc/rss.ts +++ b/lib/routes/cnbc/rss.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import parser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/cnbeta/category.ts b/lib/routes/cnbeta/category.ts index a873cb078..f2a916204 100644 --- a/lib/routes/cnbeta/category.ts +++ b/lib/routes/cnbeta/category.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/cnbeta/common.ts b/lib/routes/cnbeta/common.ts index 5f4af2781..a96f3a49b 100644 --- a/lib/routes/cnbeta/common.ts +++ b/lib/routes/cnbeta/common.ts @@ -1,10 +1,11 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; -import { rootUrl, ProcessItems } from './utils'; +import { ProcessItems, rootUrl } from './utils'; export async function handler(ctx) { const { type, id } = ctx.req.param(); diff --git a/lib/routes/cnbeta/index.ts b/lib/routes/cnbeta/index.ts index 9d7f3012e..2d1d8d94f 100644 --- a/lib/routes/cnbeta/index.ts +++ b/lib/routes/cnbeta/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/cnbeta/topics.ts b/lib/routes/cnbeta/topics.ts index 84dc83eaf..a2d986130 100644 --- a/lib/routes/cnbeta/topics.ts +++ b/lib/routes/cnbeta/topics.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/cnbeta/utils.ts b/lib/routes/cnbeta/utils.ts index bdeea0358..a7df94b7d 100644 --- a/lib/routes/cnbeta/utils.ts +++ b/lib/routes/cnbeta/utils.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.cnbeta.com.tw'; @@ -24,4 +25,4 @@ const ProcessItems = (items, limit, tryGet) => ) ); -export { rootUrl, ProcessItems }; +export { ProcessItems, rootUrl }; diff --git a/lib/routes/cnblogs/common.ts b/lib/routes/cnblogs/common.ts index 456c8ad66..c0dfee69e 100644 --- a/lib/routes/cnblogs/common.ts +++ b/lib/routes/cnblogs/common.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cncf/index.ts b/lib/routes/cncf/index.ts index 3dae0089e..a4d07888f 100644 --- a/lib/routes/cncf/index.ts +++ b/lib/routes/cncf/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://www.cncf.io'; diff --git a/lib/routes/cncf/reports.ts b/lib/routes/cncf/reports.ts index 08fdf72b4..7e7e2890b 100644 --- a/lib/routes/cncf/reports.ts +++ b/lib/routes/cncf/reports.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://www.cncf.io'; diff --git a/lib/routes/cneb/yjxw.ts b/lib/routes/cneb/yjxw.ts index 650ad57b4..3ec000203 100644 --- a/lib/routes/cneb/yjxw.ts +++ b/lib/routes/cneb/yjxw.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const indexs = { gnxw: 0, diff --git a/lib/routes/cneb/yjxx.ts b/lib/routes/cneb/yjxx.ts index da1f585dd..23ea3ee59 100644 --- a/lib/routes/cneb/yjxx.ts +++ b/lib/routes/cneb/yjxx.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/yjxx/*', diff --git a/lib/routes/cngal/entry.ts b/lib/routes/cngal/entry.ts index 537900cbc..4929fd8a8 100644 --- a/lib/routes/cngal/entry.ts +++ b/lib/routes/cngal/entry.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/cngal/weekly.ts b/lib/routes/cngal/weekly.ts index 4f745797c..f02f5f499 100644 --- a/lib/routes/cngal/weekly.ts +++ b/lib/routes/cngal/weekly.ts @@ -1,9 +1,10 @@ -import { Route, ViewType } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/weekly', diff --git a/lib/routes/cngold/index.ts b/lib/routes/cngold/index.ts index 955fa46e0..201c66eaa 100644 --- a/lib/routes/cngold/index.ts +++ b/lib/routes/cngold/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/cnjxol/index.ts b/lib/routes/cnjxol/index.ts index 453b3bf09..ba41317fc 100644 --- a/lib/routes/cnjxol/index.ts +++ b/lib/routes/cnjxol/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const categories = { jxrb: '嘉兴日报', diff --git a/lib/routes/cnki/author.ts b/lib/routes/cnki/author.ts index 94b6d8400..add89da88 100644 --- a/lib/routes/cnki/author.ts +++ b/lib/routes/cnki/author.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { ProcessItem } from './utils'; export const route: Route = { diff --git a/lib/routes/cnki/debut.ts b/lib/routes/cnki/debut.ts index 67ce6192b..0e5c6a722 100644 --- a/lib/routes/cnki/debut.ts +++ b/lib/routes/cnki/debut.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://chn.oversea.cnki.net'; diff --git a/lib/routes/cnki/journals.ts b/lib/routes/cnki/journals.ts index 9e4d7e5ff..24cd3b80d 100644 --- a/lib/routes/cnki/journals.ts +++ b/lib/routes/cnki/journals.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { ProcessItem } from './utils'; -import parser from '@/utils/rss-parser'; import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; + +import { ProcessItem } from './utils'; const rootUrl = 'https://navi.cnki.net'; diff --git a/lib/routes/cnki/utils.ts b/lib/routes/cnki/utils.ts index a4676fb26..1f55c34e4 100644 --- a/lib/routes/cnki/utils.ts +++ b/lib/routes/cnki/utils.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const ProcessItem = async (item) => { const detailResponse = await got(item.link); const $ = load(detailResponse.data); diff --git a/lib/routes/cnljxh/index.ts b/lib/routes/cnljxh/index.ts index 7fd6d4923..9f27bfdd5 100644 --- a/lib/routes/cnljxh/index.ts +++ b/lib/routes/cnljxh/index.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'news', id = '10' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '20', 10); diff --git a/lib/routes/cntheory/paper.ts b/lib/routes/cntheory/paper.ts index b545950f7..159a4b324 100644 --- a/lib/routes/cntheory/paper.ts +++ b/lib/routes/cntheory/paper.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/paper/:id?', diff --git a/lib/routes/cntv/column.ts b/lib/routes/cntv/column.ts index 0b1dce06a..c73c89420 100644 --- a/lib/routes/cntv/column.ts +++ b/lib/routes/cntv/column.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/:column', diff --git a/lib/routes/cnu/iec.ts b/lib/routes/cnu/iec.ts index cc584863f..21fc4eb76 100644 --- a/lib/routes/cnu/iec.ts +++ b/lib/routes/cnu/iec.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Route } from '@/types'; export const route: Route = { path: '/iec', diff --git a/lib/routes/cnu/jdxw.ts b/lib/routes/cnu/jdxw.ts index 2179592e2..c2ecd618b 100644 --- a/lib/routes/cnu/jdxw.ts +++ b/lib/routes/cnu/jdxw.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Route } from '@/types'; export const route: Route = { path: '/jdxw', diff --git a/lib/routes/cnu/jwc.ts b/lib/routes/cnu/jwc.ts index 99fa0f5a9..c18fe69a1 100644 --- a/lib/routes/cnu/jwc.ts +++ b/lib/routes/cnu/jwc.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Route } from '@/types'; export const route: Route = { path: '/jwc', diff --git a/lib/routes/cnu/physics.ts b/lib/routes/cnu/physics.ts index 48b5519e5..1c6b57515 100644 --- a/lib/routes/cnu/physics.ts +++ b/lib/routes/cnu/physics.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Route } from '@/types'; export const route: Route = { path: '/physics', diff --git a/lib/routes/cnu/smkxxy.ts b/lib/routes/cnu/smkxxy.ts index afbfe7d7b..ea14a82c1 100644 --- a/lib/routes/cnu/smkxxy.ts +++ b/lib/routes/cnu/smkxxy.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Route } from '@/types'; export const route: Route = { path: '/smkxxy', diff --git a/lib/routes/cockroachlabs/blog.ts b/lib/routes/cockroachlabs/blog.ts index cc28c09b4..a5ef5cc23 100644 --- a/lib/routes/cockroachlabs/blog.ts +++ b/lib/routes/cockroachlabs/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/codeforces/contests.ts b/lib/routes/codeforces/contests.ts index cabbd8e7d..dd16d8c45 100644 --- a/lib/routes/codeforces/contests.ts +++ b/lib/routes/codeforces/contests.ts @@ -1,14 +1,15 @@ -import { Route } from '@/types'; +import 'dayjs/locale/zh-cn.js'; -import ofetch from '@/utils/ofetch'; import path from 'node:path'; -import { art } from '@/utils/render'; import dayjs from 'dayjs'; -import localizedFormat from 'dayjs/plugin/localizedFormat.js'; import duration from 'dayjs/plugin/duration.js'; +import localizedFormat from 'dayjs/plugin/localizedFormat.js'; import relativeTime from 'dayjs/plugin/relativeTime.js'; -import 'dayjs/locale/zh-cn.js'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; dayjs.extend(localizedFormat); dayjs.extend(duration); diff --git a/lib/routes/codeforces/recent-actions.ts b/lib/routes/codeforces/recent-actions.ts index 2baaf8c82..867350429 100644 --- a/lib/routes/codeforces/recent-actions.ts +++ b/lib/routes/codeforces/recent-actions.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/recent-actions/:minrating?', categories: ['programming'], diff --git a/lib/routes/cognition/blog.ts b/lib/routes/cognition/blog.ts index ae87cb673..8a1d34b72 100644 --- a/lib/routes/cognition/blog.ts +++ b/lib/routes/cognition/blog.ts @@ -1,7 +1,8 @@ +import { load } from 'cheerio'; + import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/blog', diff --git a/lib/routes/cohere/index.ts b/lib/routes/cohere/index.ts index 1e7cc83f8..b0c52eef3 100644 --- a/lib/routes/cohere/index.ts +++ b/lib/routes/cohere/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/coindesk/consensus-magazine.ts b/lib/routes/coindesk/consensus-magazine.ts index 3ae06e973..dec30fb54 100644 --- a/lib/routes/coindesk/consensus-magazine.ts +++ b/lib/routes/coindesk/consensus-magazine.ts @@ -1,8 +1,11 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + import { parseItem } from './utils'; + const rootUrl = 'https://www.coindesk.com'; export const route: Route = { diff --git a/lib/routes/coindesk/news.ts b/lib/routes/coindesk/news.ts index 42adf1da8..c0d823613 100644 --- a/lib/routes/coindesk/news.ts +++ b/lib/routes/coindesk/news.ts @@ -1,6 +1,7 @@ -import { Route, Data, DataItem } from '@/types'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import parser from '@/utils/rss-parser'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/coindesk/utils.ts b/lib/routes/coindesk/utils.ts index d43d91f8e..a8ed6705a 100644 --- a/lib/routes/coindesk/utils.ts +++ b/lib/routes/coindesk/utils.ts @@ -1,5 +1,6 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const parseItem = async (item) => { diff --git a/lib/routes/cointelegraph/index.ts b/lib/routes/cointelegraph/index.ts index a1fe1db5e..e984e6d7f 100644 --- a/lib/routes/cointelegraph/index.ts +++ b/lib/routes/cointelegraph/index.ts @@ -1,9 +1,10 @@ -import { Route, Data, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import logger from '@/utils/logger'; import parser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/colamanga/manga.ts b/lib/routes/colamanga/manga.ts index be2b600b1..e5d0acb01 100644 --- a/lib/routes/colamanga/manga.ts +++ b/lib/routes/colamanga/manga.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; -import puppeteer from '@/utils/puppeteer'; - import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import { Context } from 'hono'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; +import puppeteer from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; const domain = 'www.colamanga.com'; diff --git a/lib/routes/collabo-cafe/category.ts b/lib/routes/collabo-cafe/category.ts index 844de43fc..299c32b47 100644 --- a/lib/routes/collabo-cafe/category.ts +++ b/lib/routes/collabo-cafe/category.ts @@ -1,7 +1,9 @@ -import { Data, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { Context } from 'hono'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { parseItems } from './parser'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/collabo-cafe/index.ts b/lib/routes/collabo-cafe/index.ts index bb511df12..46a4f3098 100644 --- a/lib/routes/collabo-cafe/index.ts +++ b/lib/routes/collabo-cafe/index.ts @@ -1,6 +1,8 @@ -import { Data, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { parseItems } from './parser'; export const handler = async (): Promise => { diff --git a/lib/routes/collabo-cafe/parser.ts b/lib/routes/collabo-cafe/parser.ts index e7f894d69..8ef2f0cfe 100644 --- a/lib/routes/collabo-cafe/parser.ts +++ b/lib/routes/collabo-cafe/parser.ts @@ -1,6 +1,7 @@ +import type { CheerioAPI } from 'cheerio'; + import { type DataItem } from '@/types'; import { parseDate } from '@/utils/parse-date'; -import { CheerioAPI } from 'cheerio'; export function parseItems($: CheerioAPI): DataItem[] { return $('div.top-post-list article') diff --git a/lib/routes/collabo-cafe/tag.ts b/lib/routes/collabo-cafe/tag.ts index a47b6bc56..f74969e72 100644 --- a/lib/routes/collabo-cafe/tag.ts +++ b/lib/routes/collabo-cafe/tag.ts @@ -1,7 +1,9 @@ -import { Data, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { Context } from 'hono'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { parseItems } from './parser'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/comicat/search.ts b/lib/routes/comicat/search.ts index 4e3716756..46d191f7a 100644 --- a/lib/routes/comicat/search.ts +++ b/lib/routes/comicat/search.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://comicat.org'; diff --git a/lib/routes/comicskingdom/index.ts b/lib/routes/comicskingdom/index.ts index 3b18872da..661e14890 100644 --- a/lib/routes/comicskingdom/index.ts +++ b/lib/routes/comicskingdom/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/:name', diff --git a/lib/routes/commonhealth/index.ts b/lib/routes/commonhealth/index.ts index 6e0b1116e..297c09242 100644 --- a/lib/routes/commonhealth/index.ts +++ b/lib/routes/commonhealth/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const apiKey = 'Cah2snYi52eJjpshbIfof1Tpx8ZhzXqh'; diff --git a/lib/routes/consumer/index.ts b/lib/routes/consumer/index.ts index 83b0e249e..404cbc683 100644 --- a/lib/routes/consumer/index.ts +++ b/lib/routes/consumer/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/consumer/shopping-guide.ts b/lib/routes/consumer/shopping-guide.ts index f0fc9b221..976aac567 100644 --- a/lib/routes/consumer/shopping-guide.ts +++ b/lib/routes/consumer/shopping-guide.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/cool18/index.ts b/lib/routes/cool18/index.ts index 6957c5ee2..6f8007a8a 100644 --- a/lib/routes/cool18/index.ts +++ b/lib/routes/cool18/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import type { Context } from 'hono'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; type PageDataItem = { tid: string; diff --git a/lib/routes/coolapk/dyh.ts b/lib/routes/coolapk/dyh.ts index 4bc6e7d32..a998c093f 100644 --- a/lib/routes/coolapk/dyh.ts +++ b/lib/routes/coolapk/dyh.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/dyh/:dyhId', diff --git a/lib/routes/coolapk/hot.ts b/lib/routes/coolapk/hot.ts index 2bfeec1e3..13b21508e 100644 --- a/lib/routes/coolapk/hot.ts +++ b/lib/routes/coolapk/hot.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; + const getLinkAndTitle = (type, period) => { const baseURL = 'https://api.coolapk.com/v6/page/dataList?url='; let link; diff --git a/lib/routes/coolapk/huati.ts b/lib/routes/coolapk/huati.ts index 67dc7d951..5a21aeb3a 100644 --- a/lib/routes/coolapk/huati.ts +++ b/lib/routes/coolapk/huati.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/huati/:tag', diff --git a/lib/routes/coolapk/toutiao.ts b/lib/routes/coolapk/toutiao.ts index bd163a880..174050108 100644 --- a/lib/routes/coolapk/toutiao.ts +++ b/lib/routes/coolapk/toutiao.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/coolapk/tuwen.ts b/lib/routes/coolapk/tuwen.ts index 9c9d699cf..4b5b7130c 100644 --- a/lib/routes/coolapk/tuwen.ts +++ b/lib/routes/coolapk/tuwen.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/coolapk/user-dynamic.ts b/lib/routes/coolapk/user-dynamic.ts index a23425839..736f1fef5 100644 --- a/lib/routes/coolapk/user-dynamic.ts +++ b/lib/routes/coolapk/user-dynamic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/user/:uid/dynamic', diff --git a/lib/routes/coolapk/utils.ts b/lib/routes/coolapk/utils.ts index ec29fe2e5..607ce5f77 100644 --- a/lib/routes/coolapk/utils.ts +++ b/lib/routes/coolapk/utils.ts @@ -1,7 +1,8 @@ -import cache from '@/utils/cache'; -import md5 from '@/utils/md5'; import { load } from 'cheerio'; + +import cache from '@/utils/cache'; import got from '@/utils/got'; +import md5 from '@/utils/md5'; import { parseDate } from '@/utils/parse-date'; const dynamicTpye = { 0: '基本动态', 8: '酷图', 9: '评论', 10: '提问', 11: '回答', 12: '图文', 15: '二手', 17: '观点', 20: '交易动态' }; diff --git a/lib/routes/coolbuy/index.ts b/lib/routes/coolbuy/index.ts index c999fb3c4..f092729a9 100644 --- a/lib/routes/coolbuy/index.ts +++ b/lib/routes/coolbuy/index.ts @@ -1,11 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '50', 10); diff --git a/lib/routes/coolidge/film-guide.ts b/lib/routes/coolidge/film-guide.ts index a14c68f86..0c8b3d7ce 100644 --- a/lib/routes/coolidge/film-guide.ts +++ b/lib/routes/coolidge/film-guide.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import { type Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; const handler = async () => { const link = 'https://coolidge.org/film-guide'; diff --git a/lib/routes/coolidge/news.ts b/lib/routes/coolidge/news.ts index 52508736a..8f4c1f221 100644 --- a/lib/routes/coolidge/news.ts +++ b/lib/routes/coolidge/news.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import { type Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; const handler = async () => { const link = 'https://coolidge.org/about-us/news-media'; diff --git a/lib/routes/coolpc/news.ts b/lib/routes/coolpc/news.ts index 3f6383d96..cfe0dc870 100644 --- a/lib/routes/coolpc/news.ts +++ b/lib/routes/coolpc/news.ts @@ -1,6 +1,7 @@ -import { DataItem, Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/coomer/index.ts b/lib/routes/coomer/index.ts index e7e836418..48b8757bb 100644 --- a/lib/routes/coomer/index.ts +++ b/lib/routes/coomer/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const headers = { Accept: 'text/css' }; diff --git a/lib/routes/copymanga/comic.ts b/lib/routes/copymanga/comic.ts index 3807794e8..29791ccc3 100644 --- a/lib/routes/copymanga/comic.ts +++ b/lib/routes/copymanga/comic.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; +import pMap from 'p-map'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; -import pMap from 'p-map'; export const route: Route = { path: '/comic/:id/:chapterCnt?', diff --git a/lib/routes/cosplaytele/article.ts b/lib/routes/cosplaytele/article.ts index 00db9197e..2089557dc 100644 --- a/lib/routes/cosplaytele/article.ts +++ b/lib/routes/cosplaytele/article.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/cosplaytele/category.ts b/lib/routes/cosplaytele/category.ts index e29adff15..0111e614c 100644 --- a/lib/routes/cosplaytele/category.ts +++ b/lib/routes/cosplaytele/category.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/cosplaytele/latest.ts b/lib/routes/cosplaytele/latest.ts index d50a194d4..50ccbb11a 100644 --- a/lib/routes/cosplaytele/latest.ts +++ b/lib/routes/cosplaytele/latest.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/', diff --git a/lib/routes/cosplaytele/popular.ts b/lib/routes/cosplaytele/popular.ts index 16e6296dd..82b9333bf 100644 --- a/lib/routes/cosplaytele/popular.ts +++ b/lib/routes/cosplaytele/popular.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/popular/:period', diff --git a/lib/routes/cosplaytele/tag.ts b/lib/routes/cosplaytele/tag.ts index 9a9a799c9..db3639c03 100644 --- a/lib/routes/cosplaytele/tag.ts +++ b/lib/routes/cosplaytele/tag.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/tag/:tag', diff --git a/lib/routes/counter-strike/news.ts b/lib/routes/counter-strike/news.ts index 688ef3303..f82187934 100644 --- a/lib/routes/counter-strike/news.ts +++ b/lib/routes/counter-strike/news.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; -import type { BBobCoreTagNodeTree, PresetFactory } from '@bbob/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; import bbobHTML from '@bbob/html'; import presetHTML5 from '@bbob/preset-html5'; +import type { BBobCoreTagNodeTree, PresetFactory } from '@bbob/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const swapLinebreak = (tree: BBobCoreTagNodeTree) => diff --git a/lib/routes/cpcaauto/index.ts b/lib/routes/cpcaauto/index.ts index c55f5e732..e359184f2 100644 --- a/lib/routes/cpcaauto/index.ts +++ b/lib/routes/cpcaauto/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { type = 'news', id } = ctx.req.param(); diff --git a/lib/routes/cpcey/index.ts b/lib/routes/cpcey/index.ts index 14570381f..631c54874 100644 --- a/lib/routes/cpcey/index.ts +++ b/lib/routes/cpcey/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://cpc.ey.gov.tw'; diff --git a/lib/routes/cpta/handler.ts b/lib/routes/cpta/handler.ts index 605349447..8c4e753c9 100644 --- a/lib/routes/cpta/handler.ts +++ b/lib/routes/cpta/handler.ts @@ -1,9 +1,10 @@ -import { DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import pMap from 'p-map'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + type NewsCategory = { title: string; baseUrl: string; diff --git a/lib/routes/cpuid/news.ts b/lib/routes/cpuid/news.ts index ed815da00..08c2cee9b 100644 --- a/lib/routes/cpuid/news.ts +++ b/lib/routes/cpuid/news.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const newsUrl = 'https://www.cpuid.com/news.html'; export const route: Route = { diff --git a/lib/routes/cqgas/tqtz.ts b/lib/routes/cqgas/tqtz.ts index 281690acc..16cffb4d5 100644 --- a/lib/routes/cqgas/tqtz.ts +++ b/lib/routes/cqgas/tqtz.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const url = 'http://www.cqgas.cn/portal/article/page?cateId=1082&pageNo=1'; export const route: Route = { path: '/tqtz', diff --git a/lib/routes/cqu/index.ts b/lib/routes/cqu/index.ts index c28ae10d2..e2147ad45 100644 --- a/lib/routes/cqu/index.ts +++ b/lib/routes/cqu/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/jwc/:path{.+}?', diff --git a/lib/routes/cqwu/index.ts b/lib/routes/cqwu/index.ts index 9b1123fb1..737e6a185 100644 --- a/lib/routes/cqwu/index.ts +++ b/lib/routes/cqwu/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/crac/exam.ts b/lib/routes/crac/exam.ts index 3e575f4df..4d20e718c 100644 --- a/lib/routes/crac/exam.ts +++ b/lib/routes/crac/exam.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { art } from '@/utils/render'; export const route: Route = { diff --git a/lib/routes/crac/index.ts b/lib/routes/crac/index.ts index 41e61cfde..8105b17c4 100644 --- a/lib/routes/crac/index.ts +++ b/lib/routes/crac/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/:type?', diff --git a/lib/routes/creative-comic/book.ts b/lib/routes/creative-comic/book.ts index ade9fa7b3..b03014465 100644 --- a/lib/routes/creative-comic/book.ts +++ b/lib/routes/creative-comic/book.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { getUuid, getBook, getChapter, getChapters, getImgEncrypted, getImgKey, decrypt, getRealKey, apiHost } from './utils'; + +import { apiHost, decrypt, getBook, getChapter, getChapters, getImgEncrypted, getImgKey, getRealKey, getUuid } from './utils'; export const route: Route = { path: '/book/:id/:coverOnly?/:quality?', diff --git a/lib/routes/creative-comic/utils.ts b/lib/routes/creative-comic/utils.ts index a68723b5d..115136b89 100644 --- a/lib/routes/creative-comic/utils.ts +++ b/lib/routes/creative-comic/utils.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import CryptoJS from 'crypto-js'; +import got from '@/utils/got'; + const apiHost = 'https://api.creative-comic.tw'; const device = 'web_desktop'; const DEFAULT_TOKEN = 'freeforccc2020reading'; @@ -82,4 +83,4 @@ const getRealKey = (imgKey, token = DEFAULT_TOKEN) => { }; }; -export { apiHost, getBook, getChapter, getChapters, getImgEncrypted, getImgKey, getUuid, decrypt, token2Key, getRealKey }; +export { apiHost, decrypt, getBook, getChapter, getChapters, getImgEncrypted, getImgKey, getRealKey, getUuid, token2Key }; diff --git a/lib/routes/crossbell/feeds/following.ts b/lib/routes/crossbell/feeds/following.ts index b58028df9..96085286a 100644 --- a/lib/routes/crossbell/feeds/following.ts +++ b/lib/routes/crossbell/feeds/following.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/crossbell/notes/character.ts b/lib/routes/crossbell/notes/character.ts index c9075b405..57e376e45 100644 --- a/lib/routes/crossbell/notes/character.ts +++ b/lib/routes/crossbell/notes/character.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { getItem } from './utils'; export const route: Route = { diff --git a/lib/routes/crossbell/notes/index.ts b/lib/routes/crossbell/notes/index.ts index f59ae3063..a2ba1d4fe 100644 --- a/lib/routes/crossbell/notes/index.ts +++ b/lib/routes/crossbell/notes/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { getItem } from './utils'; export const route: Route = { diff --git a/lib/routes/crossbell/notes/source.ts b/lib/routes/crossbell/notes/source.ts index 31a20e614..16fe50cdb 100644 --- a/lib/routes/crossbell/notes/source.ts +++ b/lib/routes/crossbell/notes/source.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { getItem } from './utils'; export const route: Route = { diff --git a/lib/routes/crush/index.ts b/lib/routes/crush/index.ts index a6bb6de3e..5656c1c1f 100644 --- a/lib/routes/crush/index.ts +++ b/lib/routes/crush/index.ts @@ -1,9 +1,10 @@ -import { type Data, type DataItem, type Route } from '@/types'; import { type CheerioAPI, load } from 'cheerio'; + +import { type Data, type DataItem, type Route } from '@/types'; +import md5 from '@/utils/md5'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import md5 from '@/utils/md5'; const baseUrl = 'https://www.crush.ninja'; diff --git a/lib/routes/cryptoslate/index.ts b/lib/routes/cryptoslate/index.ts index 978411c33..abebfd6e0 100644 --- a/lib/routes/cryptoslate/index.ts +++ b/lib/routes/cryptoslate/index.ts @@ -1,9 +1,10 @@ -import { Route, Data } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import logger from '@/utils/logger'; -import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; +import type { Data, Route } from '@/types'; +import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; + export const route: Route = { path: '/', categories: ['finance'], diff --git a/lib/routes/cs/index.ts b/lib/routes/cs/index.ts index bcde4c99b..4d28d0181 100644 --- a/lib/routes/cs/index.ts +++ b/lib/routes/cs/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const decodeBufferByCharset = (buffer) => { const isGBK = /charset="?'?gb/i.test(buffer.toString()); diff --git a/lib/routes/cs/video.ts b/lib/routes/cs/video.ts index 090f66561..9669cd574 100644 --- a/lib/routes/cs/video.ts +++ b/lib/routes/cs/video.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/video/:category?', diff --git a/lib/routes/cs/zzkx.ts b/lib/routes/cs/zzkx.ts index 783ce264b..9faf0397e 100644 --- a/lib/routes/cs/zzkx.ts +++ b/lib/routes/cs/zzkx.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + export const route: Route = { path: ['/news/zzkx', '/zzkx'], name: 'Unknown', diff --git a/lib/routes/csdn/blog.ts b/lib/routes/csdn/blog.ts index 3f5fd52cc..648a3b212 100644 --- a/lib/routes/csdn/blog.ts +++ b/lib/routes/csdn/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import rssParser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/css-tricks/articles.ts b/lib/routes/css-tricks/articles.ts index fc8170a1e..4a2f12ce7 100644 --- a/lib/routes/css-tricks/articles.ts +++ b/lib/routes/css-tricks/articles.ts @@ -1,7 +1,11 @@ -import { Data, Route, ViewType } from '@/types'; import { load } from 'cheerio'; + +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; + import { processWithWp } from './utils'; + export const route: Route = { path: '/articles', view: ViewType.Articles, diff --git a/lib/routes/css-tricks/collections.ts b/lib/routes/css-tricks/collections.ts index 592b7d289..2fd414469 100644 --- a/lib/routes/css-tricks/collections.ts +++ b/lib/routes/css-tricks/collections.ts @@ -1,5 +1,8 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { extractMiniCards, processWithWp, rootUrl } from './utils'; + export const route: Route = { path: '/collections/:type', view: ViewType.Articles, diff --git a/lib/routes/css-tricks/popular.ts b/lib/routes/css-tricks/popular.ts index 83cdd35ab..0d05dc3e1 100644 --- a/lib/routes/css-tricks/popular.ts +++ b/lib/routes/css-tricks/popular.ts @@ -1,5 +1,8 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { extractMiniCards, processWithWp, rootUrl } from './utils'; + export const route: Route = { path: '/popular', view: ViewType.Articles, diff --git a/lib/routes/css-tricks/utils.ts b/lib/routes/css-tricks/utils.ts index e5e780271..637e2ba06 100644 --- a/lib/routes/css-tricks/utils.ts +++ b/lib/routes/css-tricks/utils.ts @@ -1,6 +1,7 @@ import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; import ofetch from '@/utils/ofetch'; -import { DataItem } from '@/types'; import { parseDate } from '@/utils/parse-date'; export const rootUrl = 'https://css-tricks.com'; diff --git a/lib/routes/cssn/iolaw.ts b/lib/routes/cssn/iolaw.ts index f0a48813c..46e280be2 100644 --- a/lib/routes/cssn/iolaw.ts +++ b/lib/routes/cssn/iolaw.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/cste/index.ts b/lib/routes/cste/index.ts index 2ba81cbb2..69b292903 100644 --- a/lib/routes/cste/index.ts +++ b/lib/routes/cste/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/csu/career.ts b/lib/routes/csu/career.ts index 2157d2dd4..2ee08d4d4 100644 --- a/lib/routes/csu/career.ts +++ b/lib/routes/csu/career.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { unzip } from './utils'; export const route: Route = { diff --git a/lib/routes/csu/cse.ts b/lib/routes/csu/cse.ts index 2eb839739..b8b8662d2 100644 --- a/lib/routes/csu/cse.ts +++ b/lib/routes/csu/cse.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; async function fetch(address) { diff --git a/lib/routes/csu/mail.ts b/lib/routes/csu/mail.ts index 0beb31e32..46bda33d5 100644 --- a/lib/routes/csu/mail.ts +++ b/lib/routes/csu/mail.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/csust/tggs.ts b/lib/routes/csust/tggs.ts index eeea3d77d..38d44b98a 100644 --- a/lib/routes/csust/tggs.ts +++ b/lib/routes/csust/tggs.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { createCsustHandler } from './utils'; const handler = createCsustHandler({ diff --git a/lib/routes/csust/utils.ts b/lib/routes/csust/utils.ts index 7c19453bb..d373d8ed6 100644 --- a/lib/routes/csust/utils.ts +++ b/lib/routes/csust/utils.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; -import { load, type CheerioAPI } from 'cheerio'; +import { type CheerioAPI, load } from 'cheerio'; + import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; // 抓取并清清理内容 diff --git a/lib/routes/csust/xkxs.ts b/lib/routes/csust/xkxs.ts index bc97111ad..fa641b293 100644 --- a/lib/routes/csust/xkxs.ts +++ b/lib/routes/csust/xkxs.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { createCsustHandler } from './utils'; const handler = createCsustHandler({ diff --git a/lib/routes/ctbu/xxgg.ts b/lib/routes/ctbu/xxgg.ts index c651f29ee..c67fdae61 100644 --- a/lib/routes/ctbu/xxgg.ts +++ b/lib/routes/ctbu/xxgg.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const baseURL = 'https://www.ctbu.edu.cn/index/xxgg.htm'; export const route: Route = { diff --git a/lib/routes/ctinews/topic.ts b/lib/routes/ctinews/topic.ts index 6eefb5336..90536389f 100644 --- a/lib/routes/ctinews/topic.ts +++ b/lib/routes/ctinews/topic.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/cts/news.ts b/lib/routes/cts/news.ts index 2e9c46511..ce35dba65 100644 --- a/lib/routes/cts/news.ts +++ b/lib/routes/cts/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import pMap from 'p-map'; export const route: Route = { path: '/:category', diff --git a/lib/routes/cuc/yz.ts b/lib/routes/cuc/yz.ts index eec7f8c93..3e45816a3 100644 --- a/lib/routes/cuc/yz.ts +++ b/lib/routes/cuc/yz.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; /* 研究生招生网通知公告*/ diff --git a/lib/routes/cuilingmag/index.ts b/lib/routes/cuilingmag/index.ts index 986df7f89..ba719c741 100644 --- a/lib/routes/cuilingmag/index.ts +++ b/lib/routes/cuilingmag/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { category } = ctx.req.param(); diff --git a/lib/routes/cupl/jwc.ts b/lib/routes/cupl/jwc.ts index 45dc33cb9..6250b0b48 100644 --- a/lib/routes/cupl/jwc.ts +++ b/lib/routes/cupl/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; // import cache from '@/utils/cache'; export const route: Route = { diff --git a/lib/routes/curiouscat/user.ts b/lib/routes/curiouscat/user.ts index 9a372b393..36972528f 100644 --- a/lib/routes/curiouscat/user.ts +++ b/lib/routes/curiouscat/user.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; const fetchAPIByUser = async (user) => { diff --git a/lib/routes/curius/links.ts b/lib/routes/curius/links.ts index e491b4ce3..fec1d3f48 100644 --- a/lib/routes/curius/links.ts +++ b/lib/routes/curius/links.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/links/:name', diff --git a/lib/routes/cursor/blog.ts b/lib/routes/cursor/blog.ts index 844fc44bd..0175ee7cf 100644 --- a/lib/routes/cursor/blog.ts +++ b/lib/routes/cursor/blog.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; +import { type Context } from 'hono'; + import { type Data, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { type Context } from 'hono'; export const handler = async (ctx: Context): Promise => { const { topic } = ctx.req.param(); diff --git a/lib/routes/cursor/changelog.ts b/lib/routes/cursor/changelog.ts index bd196616f..6fea01bc4 100644 --- a/lib/routes/cursor/changelog.ts +++ b/lib/routes/cursor/changelog.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType, type Language } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Language, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '100', 10); diff --git a/lib/routes/cw/author.ts b/lib/routes/cw/author.ts index d24a1777f..8b9cfa23d 100644 --- a/lib/routes/cw/author.ts +++ b/lib/routes/cw/author.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { baseUrl, parsePage } from './utils'; +import type { Route } from '@/types'; import puppeteer from '@/utils/puppeteer'; +import { baseUrl, parsePage } from './utils'; + export const route: Route = { path: '/author/:channel', categories: ['traditional-media'], diff --git a/lib/routes/cw/master.ts b/lib/routes/cw/master.ts index aa34fb7b4..e354e49a7 100644 --- a/lib/routes/cw/master.ts +++ b/lib/routes/cw/master.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { baseUrl, parsePage } from './utils'; +import type { Route } from '@/types'; import puppeteer from '@/utils/puppeteer'; +import { baseUrl, parsePage } from './utils'; + export const route: Route = { path: '/master/:channel', categories: ['traditional-media'], diff --git a/lib/routes/cw/sub.ts b/lib/routes/cw/sub.ts index 6ddd42434..3ea82a68b 100644 --- a/lib/routes/cw/sub.ts +++ b/lib/routes/cw/sub.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { baseUrl, parsePage } from './utils'; +import type { Route } from '@/types'; import puppeteer from '@/utils/puppeteer'; +import { baseUrl, parsePage } from './utils'; + export const route: Route = { path: '/sub/:channel', categories: ['traditional-media'], diff --git a/lib/routes/cw/today.ts b/lib/routes/cw/today.ts index f4cd8e1fb..118fc237c 100644 --- a/lib/routes/cw/today.ts +++ b/lib/routes/cw/today.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { baseUrl, parsePage } from './utils'; +import type { Route } from '@/types'; import puppeteer from '@/utils/puppeteer'; +import { baseUrl, parsePage } from './utils'; + export const route: Route = { path: '/today', categories: ['traditional-media'], diff --git a/lib/routes/cw/utils.ts b/lib/routes/cw/utils.ts index 2ca5b2cb3..2093f3322 100644 --- a/lib/routes/cw/utils.ts +++ b/lib/routes/cw/utils.ts @@ -1,10 +1,12 @@ -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import cache from '@/utils/cache'; +import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { getCookies, setCookies } from '@/utils/puppeteer-utils'; -import logger from '@/utils/logger'; + let cookie; -import ofetch from '@/utils/ofetch'; const baseUrl = 'https://www.cw.com.tw'; @@ -118,6 +120,6 @@ const parseItems = (list, browser, tryGet) => ) ); -export { baseUrl, pathMap, getCookie, parsePage, parseList, parseItems }; +export { baseUrl, getCookie, parseItems, parseList, parsePage, pathMap }; export { setCookies } from '@/utils/puppeteer-utils'; diff --git a/lib/routes/cybersecurityventures/news.ts b/lib/routes/cybersecurityventures/news.ts index 5eeaaed9b..b4f258c30 100644 --- a/lib/routes/cybersecurityventures/news.ts +++ b/lib/routes/cybersecurityventures/news.ts @@ -1,9 +1,11 @@ +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import type { Context } from 'hono'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + import type { RawRecord } from './types'; const categories: Record< diff --git a/lib/routes/cyzone/author.ts b/lib/routes/cyzone/author.ts index 1c75e31bf..995f3c128 100644 --- a/lib/routes/cyzone/author.ts +++ b/lib/routes/cyzone/author.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, apiRootUrl, processItems, getInfo } from './util'; + +import { apiRootUrl, getInfo, processItems, rootUrl } from './util'; export const route: Route = { path: '/author/:id', diff --git a/lib/routes/cyzone/index.ts b/lib/routes/cyzone/index.ts index 92683285a..5cde9e975 100644 --- a/lib/routes/cyzone/index.ts +++ b/lib/routes/cyzone/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, apiRootUrl, processItems, getInfo } from './util'; + +import { apiRootUrl, getInfo, processItems, rootUrl } from './util'; export const route: Route = { path: ['/channel/:id?', '/:id?'], diff --git a/lib/routes/cyzone/label.ts b/lib/routes/cyzone/label.ts index 9defe810e..47f454120 100644 --- a/lib/routes/cyzone/label.ts +++ b/lib/routes/cyzone/label.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, apiRootUrl, processItems, getInfo } from './util'; + +import { apiRootUrl, getInfo, processItems, rootUrl } from './util'; export const route: Route = { path: '/label/:name', diff --git a/lib/routes/cyzone/util.ts b/lib/routes/cyzone/util.ts index b399c6303..6f1cc8f9e 100644 --- a/lib/routes/cyzone/util.ts +++ b/lib/routes/cyzone/util.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.cyzone.cn'; @@ -114,4 +115,4 @@ const processItems = async (apiUrl, limit, tryGet, ...params) => { return items; }; -export { rootUrl, apiRootUrl, getInfo, processItems }; +export { apiRootUrl, getInfo, processItems, rootUrl }; diff --git a/lib/routes/cztv/daily.ts b/lib/routes/cztv/daily.ts index 1ab73037c..052d27f21 100644 --- a/lib/routes/cztv/daily.ts +++ b/lib/routes/cztv/daily.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const renderDesc = (item) => art(path.join(__dirname, 'templates/daily.art'), item); diff --git a/lib/routes/cztv/zjxwlb.ts b/lib/routes/cztv/zjxwlb.ts index 3929a9649..1f9247f1b 100644 --- a/lib/routes/cztv/zjxwlb.ts +++ b/lib/routes/cztv/zjxwlb.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const renderDesc = (item) => art(path.join(__dirname, 'templates/zjxwlb.art'), item); diff --git a/lib/routes/dahecube/index.ts b/lib/routes/dahecube/index.ts index 16d5a8bcf..b0811d01e 100644 --- a/lib/routes/dahecube/index.ts +++ b/lib/routes/dahecube/index.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import utils from './utils'; + const { TYPE, parseUrl } = utils; export const route: Route = { diff --git a/lib/routes/daily/discussed.ts b/lib/routes/daily/discussed.ts index cdc7027bf..a4266157d 100644 --- a/lib/routes/daily/discussed.ts +++ b/lib/routes/daily/discussed.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { baseUrl, getData, getList, variables } from './utils.js'; const query = ` diff --git a/lib/routes/daily/popular.ts b/lib/routes/daily/popular.ts index 32e654ec7..8e2e92fd8 100644 --- a/lib/routes/daily/popular.ts +++ b/lib/routes/daily/popular.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { baseUrl, getData, getList, variables } from './utils.js'; const query = ` diff --git a/lib/routes/daily/source.ts b/lib/routes/daily/source.ts index 34bfec4e6..b764d5527 100644 --- a/lib/routes/daily/source.ts +++ b/lib/routes/daily/source.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; -import { baseUrl, getBuildId, getData, getList } from './utils'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, getBuildId, getData, getList } from './utils'; interface Source { id: string; diff --git a/lib/routes/daily/squads.ts b/lib/routes/daily/squads.ts index 1aabbd2d9..72d25a9ce 100644 --- a/lib/routes/daily/squads.ts +++ b/lib/routes/daily/squads.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { baseUrl, getData, getList, variables } from './utils.js'; const sourceQuery = ` diff --git a/lib/routes/daily/upvoted.ts b/lib/routes/daily/upvoted.ts index 0633880f6..7278cfb92 100644 --- a/lib/routes/daily/upvoted.ts +++ b/lib/routes/daily/upvoted.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { baseUrl, getData, getList, variables } from './utils.js'; const query = ` diff --git a/lib/routes/daily/user.ts b/lib/routes/daily/user.ts index 579ea0bcb..387702372 100644 --- a/lib/routes/daily/user.ts +++ b/lib/routes/daily/user.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; -import { baseUrl, getBuildId, getData, getList } from './utils'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, getBuildId, getData, getList } from './utils'; const userPostQuery = ` query AuthorFeed( diff --git a/lib/routes/daily/utils.ts b/lib/routes/daily/utils.ts index 548adcca6..5205f6f24 100644 --- a/lib/routes/daily/utils.ts +++ b/lib/routes/daily/utils.ts @@ -1,10 +1,11 @@ -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { DataItem } from '@/types'; + +import { config } from '@/config'; +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const baseUrl = 'https://app.daily.dev'; const gqlUrl = `https://api.daily.dev/graphql`; diff --git a/lib/routes/damai/activity.ts b/lib/routes/damai/activity.ts index 16036a77b..b6113cb27 100644 --- a/lib/routes/damai/activity.ts +++ b/lib/routes/damai/activity.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/activity/:city/:category/:subcategory/:keyword?', categories: ['shopping'], diff --git a/lib/routes/dangdang/notice.ts b/lib/routes/dangdang/notice.ts index d21414fac..014290fbd 100644 --- a/lib/routes/dangdang/notice.ts +++ b/lib/routes/dangdang/notice.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/daoxuan/rss.ts b/lib/routes/daoxuan/rss.ts index 46b847728..d11710e1a 100644 --- a/lib/routes/daoxuan/rss.ts +++ b/lib/routes/daoxuan/rss.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/dapenti/subject.ts b/lib/routes/dapenti/subject.ts index 875ded5c7..55617c720 100644 --- a/lib/routes/dapenti/subject.ts +++ b/lib/routes/dapenti/subject.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/dapenti/tugua.ts b/lib/routes/dapenti/tugua.ts index ce11d934d..3e18827ee 100644 --- a/lib/routes/dapenti/tugua.ts +++ b/lib/routes/dapenti/tugua.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/dapenti/utils.ts b/lib/routes/dapenti/utils.ts index b53be5a96..0b69eefb1 100644 --- a/lib/routes/dapenti/utils.ts +++ b/lib/routes/dapenti/utils.ts @@ -1,7 +1,8 @@ -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/darwinawards/index.ts b/lib/routes/darwinawards/index.ts index ee5567d7d..5b737ddfb 100644 --- a/lib/routes/darwinawards/index.ts +++ b/lib/routes/darwinawards/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { name: 'Award Winners', diff --git a/lib/routes/dataguidance/index.ts b/lib/routes/dataguidance/index.ts index d44b4b4c5..a5d3517f4 100644 --- a/lib/routes/dataguidance/index.ts +++ b/lib/routes/dataguidance/index.ts @@ -1,7 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; - import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/daum/potplayer.ts b/lib/routes/daum/potplayer.ts index 0fbe6a4f6..0b4bf90fb 100644 --- a/lib/routes/daum/potplayer.ts +++ b/lib/routes/daum/potplayer.ts @@ -1,8 +1,8 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type Context } from 'hono'; export const handler = async (ctx: Context): Promise => { const { lang } = ctx.req.param(); diff --git a/lib/routes/dayanzai/index.ts b/lib/routes/dayanzai/index.ts index 43039cfa3..abb37cb3a 100644 --- a/lib/routes/dayanzai/index.ts +++ b/lib/routes/dayanzai/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/dbaplus/new.ts b/lib/routes/dbaplus/new.ts index 5e7e4a708..45ee23cf4 100644 --- a/lib/routes/dbaplus/new.ts +++ b/lib/routes/dbaplus/new.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const { id = '9' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/dbaplus/rss.ts b/lib/routes/dbaplus/rss.ts index 81922af6b..a7aca514d 100644 --- a/lib/routes/dbaplus/rss.ts +++ b/lib/routes/dbaplus/rss.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/', categories: ['programming'], diff --git a/lib/routes/dblp/publication.ts b/lib/routes/dblp/publication.ts index e430c9e78..fd2112ac0 100644 --- a/lib/routes/dblp/publication.ts +++ b/lib/routes/dblp/publication.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; // 导入所需模组 import ofetch from '@/utils/ofetch'; // import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/dcard/section.ts b/lib/routes/dcard/section.ts index 9a92f53b5..64337340f 100644 --- a/lib/routes/dcard/section.ts +++ b/lib/routes/dcard/section.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -import utils from './utils'; import puppeteer from '@/utils/puppeteer'; +import utils from './utils'; + export const route: Route = { path: '/:section/:type?', categories: ['bbs'], diff --git a/lib/routes/dcfever/news.ts b/lib/routes/dcfever/news.ts index d19c37485..4d18c8203 100644 --- a/lib/routes/dcfever/news.ts +++ b/lib/routes/dcfever/news.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/dcfever/reviews.ts b/lib/routes/dcfever/reviews.ts index ce4d997d6..84e49498f 100644 --- a/lib/routes/dcfever/reviews.ts +++ b/lib/routes/dcfever/reviews.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/dcfever/trading-search.ts b/lib/routes/dcfever/trading-search.ts index b5d85a60a..dcc787820 100644 --- a/lib/routes/dcfever/trading-search.ts +++ b/lib/routes/dcfever/trading-search.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + // import { parseRelativeDate } from '@/utils/parse-date'; import { baseUrl, parseTradeItem } from './utils'; diff --git a/lib/routes/dcfever/trading.ts b/lib/routes/dcfever/trading.ts index 7b32fad24..95a218f1f 100644 --- a/lib/routes/dcfever/trading.ts +++ b/lib/routes/dcfever/trading.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + // import { parseRelativeDate } from '@/utils/parse-date'; import { baseUrl, parseTradeItem } from './utils'; diff --git a/lib/routes/dcfever/utils.ts b/lib/routes/dcfever/utils.ts index 14fc30582..fc532dd3e 100644 --- a/lib/routes/dcfever/utils.ts +++ b/lib/routes/dcfever/utils.ts @@ -1,9 +1,11 @@ -import ofetch from '@/utils/ofetch'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import cache from '@/utils/cache'; const baseUrl = 'https://www.dcfever.com'; diff --git a/lib/routes/ddosi/category.ts b/lib/routes/ddosi/category.ts index fd333d394..5c8ee1a93 100644 --- a/lib/routes/ddosi/category.ts +++ b/lib/routes/ddosi/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { config } from '@/config'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ddosi/index.ts b/lib/routes/ddosi/index.ts index 9ea014e15..c93a8db9f 100644 --- a/lib/routes/ddosi/index.ts +++ b/lib/routes/ddosi/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { config } from '@/config'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/deadbydaylight/index.ts b/lib/routes/deadbydaylight/index.ts index e32a7bc50..acc689c0b 100644 --- a/lib/routes/deadbydaylight/index.ts +++ b/lib/routes/deadbydaylight/index.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, linkify: true, diff --git a/lib/routes/deadline/posts.ts b/lib/routes/deadline/posts.ts index 71dc880b2..6991508cc 100644 --- a/lib/routes/deadline/posts.ts +++ b/lib/routes/deadline/posts.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/', diff --git a/lib/routes/dealstreetasia/home.ts b/lib/routes/dealstreetasia/home.ts index e1e740c97..5d732c18f 100644 --- a/lib/routes/dealstreetasia/home.ts +++ b/lib/routes/dealstreetasia/home.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // An HTML parser with an API similar to jQuery + +import type { Route } from '@/types'; // import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; // Unified request library used -import { load } from 'cheerio'; // An HTML parser with an API similar to jQuery // import puppeteer from '@/utils/puppeteer'; // import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/dealstreetasia/section.ts b/lib/routes/dealstreetasia/section.ts index d8fc0d7db..876e68a72 100644 --- a/lib/routes/dealstreetasia/section.ts +++ b/lib/routes/dealstreetasia/section.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // An HTML parser with an API similar to jQuery + +import type { Route } from '@/types'; // import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; // Unified request library used -import { load } from 'cheerio'; // An HTML parser with an API similar to jQuery // import puppeteer from '@/utils/puppeteer'; // import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/decrypt/index.ts b/lib/routes/decrypt/index.ts index 31748e776..6d9896371 100644 --- a/lib/routes/decrypt/index.ts +++ b/lib/routes/decrypt/index.ts @@ -1,9 +1,10 @@ -import { Route, Data } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; +import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import logger from '@/utils/logger'; import parser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/dedao/articles.ts b/lib/routes/dedao/articles.ts index 58e4a9b0f..c0be9f871 100644 --- a/lib/routes/dedao/articles.ts +++ b/lib/routes/dedao/articles.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/articles/:id?', diff --git a/lib/routes/dedao/index.ts b/lib/routes/dedao/index.ts index dfbc69a3b..42d1c1546 100644 --- a/lib/routes/dedao/index.ts +++ b/lib/routes/dedao/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/dedao/knowledge.ts b/lib/routes/dedao/knowledge.ts index e754f7d26..9d2ccc81a 100644 --- a/lib/routes/dedao/knowledge.ts +++ b/lib/routes/dedao/knowledge.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/knowledge/:topic?/:type?', diff --git a/lib/routes/dedao/list.ts b/lib/routes/dedao/list.ts index 28e11dd69..ae6c6ad2d 100644 --- a/lib/routes/dedao/list.ts +++ b/lib/routes/dedao/list.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/list/:category?', diff --git a/lib/routes/dedao/user.ts b/lib/routes/dedao/user.ts index a51c6afd5..ede8cde81 100644 --- a/lib/routes/dedao/user.ts +++ b/lib/routes/dedao/user.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const types = { 0: '动态', diff --git a/lib/routes/deepin/homepage.ts b/lib/routes/deepin/homepage.ts index 19add2eee..ffec7dc80 100644 --- a/lib/routes/deepin/homepage.ts +++ b/lib/routes/deepin/homepage.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/deepin/thread.ts b/lib/routes/deepin/thread.ts index 99c30b9ec..5c7ec6275 100644 --- a/lib/routes/deepin/thread.ts +++ b/lib/routes/deepin/thread.ts @@ -1,6 +1,6 @@ -import { Route, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/deepl/blog.ts b/lib/routes/deepl/blog.ts index c28b9cc5e..65385238c 100644 --- a/lib/routes/deepl/blog.ts +++ b/lib/routes/deepl/blog.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { lang = 'en' } = ctx.req.param(); diff --git a/lib/routes/deeplearning/the-batch.ts b/lib/routes/deeplearning/the-batch.ts index 27a36e496..bc822317d 100644 --- a/lib/routes/deeplearning/the-batch.ts +++ b/lib/routes/deeplearning/the-batch.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { tag } = ctx.req.param(); diff --git a/lib/routes/deepmind/blog.ts b/lib/routes/deepmind/blog.ts index 3697e645e..9ebebde92 100644 --- a/lib/routes/deepmind/blog.ts +++ b/lib/routes/deepmind/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import parser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/deepseek/news.ts b/lib/routes/deepseek/news.ts index ebfc9a63a..0f6de7af3 100644 --- a/lib/routes/deepseek/news.ts +++ b/lib/routes/deepseek/news.ts @@ -1,7 +1,8 @@ -import { Route, Data, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; const ROOT_URL = 'https://api-docs.deepseek.com/zh-cn'; diff --git a/lib/routes/dehenglaw/index.ts b/lib/routes/dehenglaw/index.ts index 16289792a..5a2902acc 100644 --- a/lib/routes/dehenglaw/index.ts +++ b/lib/routes/dehenglaw/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { language = 'CN', category = 'paper' } = ctx.req.param(); diff --git a/lib/routes/deltaio/blog.ts b/lib/routes/deltaio/blog.ts index 8554df6f8..349262769 100644 --- a/lib/routes/deltaio/blog.ts +++ b/lib/routes/deltaio/blog.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; export const route: Route = { path: '/blog', diff --git a/lib/routes/dev.to/guides.ts b/lib/routes/dev.to/guides.ts index 300c367ae..19a5dbcac 100644 --- a/lib/routes/dev.to/guides.ts +++ b/lib/routes/dev.to/guides.ts @@ -1,8 +1,9 @@ -import { Data, DataItem, Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/guides', diff --git a/lib/routes/dev.to/top.ts b/lib/routes/dev.to/top.ts index e8ca2bb5a..1542d57e0 100644 --- a/lib/routes/dev.to/top.ts +++ b/lib/routes/dev.to/top.ts @@ -1,8 +1,9 @@ -import { Data, DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; export const route: Route = { path: '/top/:period', diff --git a/lib/routes/devolverdigital/blog.ts b/lib/routes/devolverdigital/blog.ts index 77c4f7045..a601649ee 100644 --- a/lib/routes/devolverdigital/blog.ts +++ b/lib/routes/devolverdigital/blog.ts @@ -1,5 +1,6 @@ -import { DataItem, Route } from '@/types'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/devtrium/posts.ts b/lib/routes/devtrium/posts.ts index f70c1d426..a87f9a8eb 100644 --- a/lib/routes/devtrium/posts.ts +++ b/lib/routes/devtrium/posts.ts @@ -1,5 +1,6 @@ -import { DataItem, Route } from '@/types'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/dewu/declaration.ts b/lib/routes/dewu/declaration.ts index 0e6e8f4c5..0ab73bc25 100644 --- a/lib/routes/dewu/declaration.ts +++ b/lib/routes/dewu/declaration.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/dgjyw/index.ts b/lib/routes/dgjyw/index.ts index 757267147..457ceef7f 100644 --- a/lib/routes/dgjyw/index.ts +++ b/lib/routes/dgjyw/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '*', diff --git a/lib/routes/dgtle/article.ts b/lib/routes/dgtle/article.ts index 2a06d367f..fb1b9289c 100644 --- a/lib/routes/dgtle/article.ts +++ b/lib/routes/dgtle/article.ts @@ -1,10 +1,9 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, ProcessItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/dgtle/news.ts b/lib/routes/dgtle/news.ts index 6c7f1bc0a..b6df72a4e 100644 --- a/lib/routes/dgtle/news.ts +++ b/lib/routes/dgtle/news.ts @@ -1,10 +1,9 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, ProcessItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/dgtle/util.ts b/lib/routes/dgtle/util.ts index e68680ccc..f2389f38b 100644 --- a/lib/routes/dgtle/util.ts +++ b/lib/routes/dgtle/util.ts @@ -1,12 +1,12 @@ -import { type DataItem } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type CheerioAPI, load } from 'cheerio'; + +import { type DataItem } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, load } from 'cheerio'; -import path from 'node:path'; +import { art } from '@/utils/render'; const baseUrl: string = 'https://www.dgtle.com'; diff --git a/lib/routes/dgtle/video.ts b/lib/routes/dgtle/video.ts index 9b6147722..a0fd5071c 100644 --- a/lib/routes/dgtle/video.ts +++ b/lib/routes/dgtle/video.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseRelativeDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '18', 10); diff --git a/lib/routes/dgut/jwb.ts b/lib/routes/dgut/jwb.ts index 336c3ed6f..dedbc368f 100644 --- a/lib/routes/dgut/jwb.ts +++ b/lib/routes/dgut/jwb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/dhu/jiaowu/news.ts b/lib/routes/dhu/jiaowu/news.ts index 2589b5964..14b1efe76 100644 --- a/lib/routes/dhu/jiaowu/news.ts +++ b/lib/routes/dhu/jiaowu/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://jw.dhu.edu.cn'; diff --git a/lib/routes/dhu/news/xsxx.ts b/lib/routes/dhu/news/xsxx.ts index 31ad2eea8..4db0e2f79 100644 --- a/lib/routes/dhu/news/xsxx.ts +++ b/lib/routes/dhu/news/xsxx.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://news.dhu.edu.cn/_wp3services/generalQuery?queryObj=articles&siteId=14&columnId=6410&pageIndex=1&rows=20'; diff --git a/lib/routes/dhu/xxgk/news.ts b/lib/routes/dhu/xxgk/news.ts index d911c41f5..36c52a931 100644 --- a/lib/routes/dhu/xxgk/news.ts +++ b/lib/routes/dhu/xxgk/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const siteUrl = 'https://xxgk.dhu.edu.cn'; const baseUrl = 'https://xxgk.dhu.edu.cn/1737/list.htm'; diff --git a/lib/routes/dhu/yjs/news.ts b/lib/routes/dhu/yjs/news.ts index 9e8f9e0e2..ef1eae126 100644 --- a/lib/routes/dhu/yjs/news.ts +++ b/lib/routes/dhu/yjs/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://gs.dhu.edu.cn'; diff --git a/lib/routes/dhu/yjs/zs.ts b/lib/routes/dhu/yjs/zs.ts index a098619fb..c76d4750f 100644 --- a/lib/routes/dhu/yjs/zs.ts +++ b/lib/routes/dhu/yjs/zs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://yjszs.dhu.edu.cn'; diff --git a/lib/routes/diandong/news.ts b/lib/routes/diandong/news.ts index 616d621da..2d148136c 100644 --- a/lib/routes/diandong/news.ts +++ b/lib/routes/diandong/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://webapi.diandong.com'; diff --git a/lib/routes/dianping/user.ts b/lib/routes/dianping/user.ts index 09cbf1b8f..f0b774322 100644 --- a/lib/routes/dianping/user.ts +++ b/lib/routes/dianping/user.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/user/:id', diff --git a/lib/routes/diariofruticola/filtro.ts b/lib/routes/diariofruticola/filtro.ts index 9f7423501..ee5e0eefc 100644 --- a/lib/routes/diariofruticola/filtro.ts +++ b/lib/routes/diariofruticola/filtro.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { filter } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/diershoubing/news.ts b/lib/routes/diershoubing/news.ts index 855f9644f..11e1daa44 100644 --- a/lib/routes/diershoubing/news.ts +++ b/lib/routes/diershoubing/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + const renderDesc = (data) => art(path.join(__dirname, 'templates/news.art'), data); export const route: Route = { diff --git a/lib/routes/digitalcameraworld/news.ts b/lib/routes/digitalcameraworld/news.ts index df2d55786..7955857e4 100644 --- a/lib/routes/digitalcameraworld/news.ts +++ b/lib/routes/digitalcameraworld/news.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + const host = 'https://www.digitalcameraworld.com'; export const route: Route = { path: '/news', diff --git a/lib/routes/digitalpolicyalert/activity-tracker.ts b/lib/routes/digitalpolicyalert/activity-tracker.ts index b72fa50d7..349e3a948 100644 --- a/lib/routes/digitalpolicyalert/activity-tracker.ts +++ b/lib/routes/digitalpolicyalert/activity-tracker.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + const createSearchParams = (queryString: string, limit: number = 30): URLSearchParams => { const params = new URLSearchParams(queryString); params.set('offset', '0'); diff --git a/lib/routes/dingshao/share.ts b/lib/routes/dingshao/share.ts index 371edb20c..b234012bc 100644 --- a/lib/routes/dingshao/share.ts +++ b/lib/routes/dingshao/share.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import type { Context } from 'hono'; -import { Value } from './types'; + +import type { Value } from './types'; export const route: Route = { path: '/share/:shortId', diff --git a/lib/routes/discord/channel.ts b/lib/routes/discord/channel.ts index 133e90fc2..2b1e3139d 100644 --- a/lib/routes/discord/channel.ts +++ b/lib/routes/discord/channel.ts @@ -1,11 +1,12 @@ -import { DataItem, Route } from '@/types'; +import path from 'node:path'; import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { DataItem, Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { baseUrl, getChannel, getChannelMessages, getGuild } from './discord-api'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/channel/:channelId', diff --git a/lib/routes/discord/discord-api.ts b/lib/routes/discord/discord-api.ts index 9cf85e3ec..d94c5508a 100644 --- a/lib/routes/discord/discord-api.ts +++ b/lib/routes/discord/discord-api.ts @@ -1,5 +1,5 @@ -import { APIMessage } from 'discord-api-types/v10'; -import { RESTGetAPIGuildResult, RESTGetAPIGuildChannelsResult, RESTGetAPIChannelResult, RESTGetAPIChannelMessagesQuery, RESTGetAPIChannelMessagesResult } from 'discord-api-types/rest/v10'; +import type { RESTGetAPIChannelMessagesQuery, RESTGetAPIChannelMessagesResult, RESTGetAPIChannelResult, RESTGetAPIGuildChannelsResult, RESTGetAPIGuildResult } from 'discord-api-types/rest/v10'; +import type { APIMessage } from 'discord-api-types/v10'; import { config } from '@/config'; import cache from '@/utils/cache'; diff --git a/lib/routes/discord/search.ts b/lib/routes/discord/search.ts index 633539f7d..aa7c3951f 100644 --- a/lib/routes/discord/search.ts +++ b/lib/routes/discord/search.ts @@ -1,14 +1,15 @@ import path from 'node:path'; import { config } from '@/config'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; import { queryToBoolean } from '@/utils/readable-social'; +import { art } from '@/utils/render'; -import { baseUrl, getGuild, searchGuildMessages, SearchGuildMessagesParams, HasType, VALID_HAS_TYPES } from './discord-api'; +import type { HasType, SearchGuildMessagesParams} from './discord-api'; +import { baseUrl, getGuild, searchGuildMessages, VALID_HAS_TYPES } from './discord-api'; export const route: Route = { path: '/search/:guildId/:routeParams', diff --git a/lib/routes/discourse/notifications.ts b/lib/routes/discourse/notifications.ts index 3d21131c4..54271bc30 100644 --- a/lib/routes/discourse/notifications.ts +++ b/lib/routes/discourse/notifications.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { getConfig } from './utils'; -import ofetch from '@/utils/ofetch'; import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { getConfig } from './utils'; export const route: Route = { path: '/:configId/notifications/:fulltext?', diff --git a/lib/routes/discourse/official.ts b/lib/routes/discourse/official.ts index 333dc2e84..4df45e28f 100644 --- a/lib/routes/discourse/official.ts +++ b/lib/routes/discourse/official.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { getConfig } from './utils'; +import type { Route } from '@/types'; import got from '@/utils/got'; import RSSParser from '@/utils/rss-parser'; +import { getConfig } from './utils'; + export const route: Route = { path: '/:configId/official/:path{.+}', categories: ['bbs'], diff --git a/lib/routes/discourse/posts.ts b/lib/routes/discourse/posts.ts index 9e4f4e66f..f39ef1253 100644 --- a/lib/routes/discourse/posts.ts +++ b/lib/routes/discourse/posts.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { getConfig } from './utils'; +import type { Route } from '@/types'; import got from '@/utils/got'; import RSSParser from '@/utils/rss-parser'; +import { getConfig } from './utils'; + export const route: Route = { path: '/:configId/posts', categories: ['bbs'], diff --git a/lib/routes/discuz/discuz.ts b/lib/routes/discuz/discuz.ts index 217590169..b3eedadc4 100644 --- a/lib/routes/discuz/discuz.ts +++ b/lib/routes/discuz/discuz.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; function fixUrl(itemLink, baseUrl) { // 处理相对链接 diff --git a/lib/routes/disinfo/publications.ts b/lib/routes/disinfo/publications.ts index d20ef56dd..446807790 100644 --- a/lib/routes/disinfo/publications.ts +++ b/lib/routes/disinfo/publications.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/diskanalyzer/whats-new.ts b/lib/routes/diskanalyzer/whats-new.ts index 6c00fda58..ebdb7bece 100644 --- a/lib/routes/diskanalyzer/whats-new.ts +++ b/lib/routes/diskanalyzer/whats-new.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/distill/index.ts b/lib/routes/distill/index.ts index aea659c95..96a02766f 100644 --- a/lib/routes/distill/index.ts +++ b/lib/routes/distill/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/dlnews/category.ts b/lib/routes/dlnews/category.ts index 3ec34bedc..d06b15deb 100644 --- a/lib/routes/dlnews/category.ts +++ b/lib/routes/dlnews/category.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import got from '@/utils/got'; -import { getData, getList } from './utils'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; import pMap from 'p-map'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + +import { getData, getList } from './utils'; + const _website = 'dlnews'; const topics = { defi: 'DeFi', diff --git a/lib/routes/dlsite/campaign.ts b/lib/routes/dlsite/campaign.ts index ff06faa5c..8893504a4 100644 --- a/lib/routes/dlsite/campaign.ts +++ b/lib/routes/dlsite/campaign.ts @@ -1,8 +1,9 @@ -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const host = 'https://www.dlsite.com'; const infos = { // 全年齢向け diff --git a/lib/routes/dlsite/ci-en/article.ts b/lib/routes/dlsite/ci-en/article.ts index a5a513f06..446fa3b45 100644 --- a/lib/routes/dlsite/ci-en/article.ts +++ b/lib/routes/dlsite/ci-en/article.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/ci-en/:id/article', diff --git a/lib/routes/dlsite/new.ts b/lib/routes/dlsite/new.ts index 1a426ce1d..783891b55 100644 --- a/lib/routes/dlsite/new.ts +++ b/lib/routes/dlsite/new.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const host = 'https://www.dlsite.com'; const infos = { diff --git a/lib/routes/dlsite/utils.ts b/lib/routes/dlsite/utils.ts index 8b63c01f2..1ee4e405a 100644 --- a/lib/routes/dlsite/utils.ts +++ b/lib/routes/dlsite/utils.ts @@ -1,11 +1,13 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; +import dayjs from 'dayjs'; + import { getSubPath } from '@/utils/common-utils'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import dayjs from 'dayjs'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.dlsite.com'; diff --git a/lib/routes/dlsite/z-index/index.ts b/lib/routes/dlsite/z-index/index.ts index dc17b3e0c..7f0fb90b8 100644 --- a/lib/routes/dlsite/z-index/index.ts +++ b/lib/routes/dlsite/z-index/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { ProcessItems } from '../utils'; export const route: Route = { diff --git a/lib/routes/dmzj/news.ts b/lib/routes/dmzj/news.ts index 84d2b000a..4a4cdfb1f 100644 --- a/lib/routes/dmzj/news.ts +++ b/lib/routes/dmzj/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/dn/news.ts b/lib/routes/dn/news.ts index 09f7239f9..a96ba8729 100644 --- a/lib/routes/dn/news.ts +++ b/lib/routes/dn/news.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:language/news/:category?', diff --git a/lib/routes/dnaindia/common.ts b/lib/routes/dnaindia/common.ts index 46c27b2b7..e501d9b50 100644 --- a/lib/routes/dnaindia/common.ts +++ b/lib/routes/dnaindia/common.ts @@ -1,9 +1,10 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; +import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import logger from '@/utils/logger'; export async function handler(ctx) { const { category, topic } = ctx.req.param(); diff --git a/lib/routes/dnaindia/news.ts b/lib/routes/dnaindia/news.ts index fc75655cd..51191db28 100644 --- a/lib/routes/dnaindia/news.ts +++ b/lib/routes/dnaindia/news.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/dnaindia/topic.ts b/lib/routes/dnaindia/topic.ts index b38dea7f6..0a20bee67 100644 --- a/lib/routes/dnaindia/topic.ts +++ b/lib/routes/dnaindia/topic.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/dockerhub/build.ts b/lib/routes/dockerhub/build.ts index f067982e0..d7b74a65c 100644 --- a/lib/routes/dockerhub/build.ts +++ b/lib/routes/dockerhub/build.ts @@ -1,5 +1,7 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; + import { hash } from './utils'; export const route: Route = { diff --git a/lib/routes/dockerhub/repositories.ts b/lib/routes/dockerhub/repositories.ts index dbdf3093c..7eb2067af 100644 --- a/lib/routes/dockerhub/repositories.ts +++ b/lib/routes/dockerhub/repositories.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Context } from 'hono'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Context } from 'hono'; export const route: Route = { name: 'Owner Repositories', diff --git a/lib/routes/dockerhub/tag.ts b/lib/routes/dockerhub/tag.ts index a47c82468..44325f3ed 100644 --- a/lib/routes/dockerhub/tag.ts +++ b/lib/routes/dockerhub/tag.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { hash } from './utils'; export const route: Route = { diff --git a/lib/routes/docschina/weekly.ts b/lib/routes/docschina/weekly.ts index 421bd84fa..0b76531c3 100644 --- a/lib/routes/docschina/weekly.ts +++ b/lib/routes/docschina/weekly.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; import markdownit from 'markdown-it'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + const md = markdownit({ html: true, breaks: true, diff --git a/lib/routes/dol/announce.ts b/lib/routes/dol/announce.ts index 19c123f71..d0e6863a4 100644 --- a/lib/routes/dol/announce.ts +++ b/lib/routes/dol/announce.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/domp4/detail.ts b/lib/routes/domp4/detail.ts index a67c21bb1..c2c094930 100644 --- a/lib/routes/domp4/detail.ts +++ b/lib/routes/domp4/detail.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { decodeCipherText, composeMagnetUrl, getUrlType, ensureDomain } from './utils'; +import { composeMagnetUrl, decodeCipherText, ensureDomain, getUrlType } from './utils'; // 兼容没有 script 标签的情况,直接解析 dom function getDomList($, detailUrl) { diff --git a/lib/routes/domp4/latest-movie-bt.ts b/lib/routes/domp4/latest-movie-bt.ts index ad75b11f1..70e9b9268 100644 --- a/lib/routes/domp4/latest-movie-bt.ts +++ b/lib/routes/domp4/latest-movie-bt.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { getItemList as detailItemList } from './detail'; -import { ensureDomain } from './utils'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { getItemList as detailItemList } from './detail'; +import { ensureDomain } from './utils'; function getItemList($) { const list = $(`#vod .list-group-item`) diff --git a/lib/routes/domp4/latest.ts b/lib/routes/domp4/latest.ts index 190798333..1409ca634 100644 --- a/lib/routes/domp4/latest.ts +++ b/lib/routes/domp4/latest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { ensureDomain } from './utils'; function getItemList($, type) { diff --git a/lib/routes/domp4/utils.ts b/lib/routes/domp4/utils.ts index 517fb88e2..06f5d2dac 100644 --- a/lib/routes/domp4/utils.ts +++ b/lib/routes/domp4/utils.ts @@ -93,4 +93,4 @@ function ensureDomain(ctx, domain = defaultDomain) { return origin; } -export { defaultDomain, magnetTrackers, getUrlType, composeMagnetUrl, decodeCipherText, ensureDomain }; +export { composeMagnetUrl, decodeCipherText, defaultDomain, ensureDomain, getUrlType, magnetTrackers }; diff --git a/lib/routes/dongqiudi/daily.ts b/lib/routes/dongqiudi/daily.ts index 89184f09e..0b83dc5b4 100644 --- a/lib/routes/dongqiudi/daily.ts +++ b/lib/routes/dongqiudi/daily.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + export const route: Route = { path: '/daily', categories: ['new-media'], diff --git a/lib/routes/dongqiudi/player-news.ts b/lib/routes/dongqiudi/player-news.ts index a3f8038c9..da2ae5d5a 100644 --- a/lib/routes/dongqiudi/player-news.ts +++ b/lib/routes/dongqiudi/player-news.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/dongqiudi/result.ts b/lib/routes/dongqiudi/result.ts index ca3855e03..13b8b9125 100644 --- a/lib/routes/dongqiudi/result.ts +++ b/lib/routes/dongqiudi/result.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { JSDOM } from 'jsdom'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/dongqiudi/special.ts b/lib/routes/dongqiudi/special.ts index 99f691bc2..fa570669f 100644 --- a/lib/routes/dongqiudi/special.ts +++ b/lib/routes/dongqiudi/special.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import utils from './utils'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + export const route: Route = { path: '/special/:id', categories: ['new-media'], diff --git a/lib/routes/dongqiudi/team-news.ts b/lib/routes/dongqiudi/team-news.ts index aad780a64..a0853f9a4 100644 --- a/lib/routes/dongqiudi/team-news.ts +++ b/lib/routes/dongqiudi/team-news.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/dongqiudi/top-news.ts b/lib/routes/dongqiudi/top-news.ts index a3166f248..4df9f9092 100644 --- a/lib/routes/dongqiudi/top-news.ts +++ b/lib/routes/dongqiudi/top-news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import utils from './utils'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + export const route: Route = { path: '/top_news/:id?', categories: ['new-media'], diff --git a/lib/routes/dongqiudi/utils.ts b/lib/routes/dongqiudi/utils.ts index d41fb78bf..6294b06b8 100644 --- a/lib/routes/dongqiudi/utils.ts +++ b/lib/routes/dongqiudi/utils.ts @@ -1,7 +1,8 @@ -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import got from '@/utils/got'; import { JSDOM } from 'jsdom'; + +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const ProcessVideo = (content) => { diff --git a/lib/routes/dora-world/article.ts b/lib/routes/dora-world/article.ts index 561c4955f..bdf4d8a0a 100644 --- a/lib/routes/dora-world/article.ts +++ b/lib/routes/dora-world/article.ts @@ -1,7 +1,9 @@ -import { Route, Data, DataItem, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/dorohedoro/news.ts b/lib/routes/dorohedoro/news.ts index fb63712b7..4dd5bfaeb 100644 --- a/lib/routes/dorohedoro/news.ts +++ b/lib/routes/dorohedoro/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/douban/book/latest.ts b/lib/routes/douban/book/latest.ts index e9da79784..8a2264d22 100644 --- a/lib/routes/douban/book/latest.ts +++ b/lib/routes/douban/book/latest.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; const linkUrl = 'https://book.douban.com/latest'; diff --git a/lib/routes/douban/book/rank.ts b/lib/routes/douban/book/rank.ts index 132fd52cc..b17915659 100644 --- a/lib/routes/douban/book/rank.ts +++ b/lib/routes/douban/book/rank.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/douban/channel/subject.ts b/lib/routes/douban/channel/subject.ts index b90e2ac21..2575783ad 100644 --- a/lib/routes/douban/channel/subject.ts +++ b/lib/routes/douban/channel/subject.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/douban/channel/topic.ts b/lib/routes/douban/channel/topic.ts index 5d2734e57..3b285f6ca 100644 --- a/lib/routes/douban/channel/topic.ts +++ b/lib/routes/douban/channel/topic.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/douban/commercialpress/latest.ts b/lib/routes/douban/commercialpress/latest.ts index 2bfbdc516..06b39fda4 100644 --- a/lib/routes/douban/commercialpress/latest.ts +++ b/lib/routes/douban/commercialpress/latest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/commercialpress/latest', categories: ['social-media'], diff --git a/lib/routes/douban/event/hot.ts b/lib/routes/douban/event/hot.ts index c66337ce6..cf2449475 100644 --- a/lib/routes/douban/event/hot.ts +++ b/lib/routes/douban/event/hot.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/douban/movie/coming.ts b/lib/routes/douban/movie/coming.ts index f42108280..0a24716f1 100644 --- a/lib/routes/douban/movie/coming.ts +++ b/lib/routes/douban/movie/coming.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/movie/coming', diff --git a/lib/routes/douban/other/bookstore.ts b/lib/routes/douban/other/bookstore.ts index 848cf401f..6c8621619 100644 --- a/lib/routes/douban/other/bookstore.ts +++ b/lib/routes/douban/other/bookstore.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/douban/other/celebrity.ts b/lib/routes/douban/other/celebrity.ts index 8edad45e3..d059b4143 100644 --- a/lib/routes/douban/other/celebrity.ts +++ b/lib/routes/douban/other/celebrity.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/celebrity/:id/:sort?', categories: ['social-media'], diff --git a/lib/routes/douban/other/classification.ts b/lib/routes/douban/other/classification.ts index ea0851651..4723fd732 100644 --- a/lib/routes/douban/other/classification.ts +++ b/lib/routes/douban/other/classification.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/douban/other/discussion.ts b/lib/routes/douban/other/discussion.ts index 741408abb..f78227d95 100644 --- a/lib/routes/douban/other/discussion.ts +++ b/lib/routes/douban/other/discussion.ts @@ -1,4 +1,6 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; /* * @Author: nightmare-mio wanglongwei2009@qq.com @@ -7,7 +9,6 @@ import cache from '@/utils/cache'; * @Description: */ import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/douban/other/doulist.ts b/lib/routes/douban/other/doulist.ts index e01af8a46..77bf929e9 100644 --- a/lib/routes/douban/other/doulist.ts +++ b/lib/routes/douban/other/doulist.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/doulist/:id', categories: ['social-media'], diff --git a/lib/routes/douban/other/explore-column.ts b/lib/routes/douban/other/explore-column.ts index b76e27ad2..c5a502da7 100644 --- a/lib/routes/douban/other/explore-column.ts +++ b/lib/routes/douban/other/explore-column.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { load } from 'cheerio'; import * as url from 'node:url'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + const host = 'https://www.douban.com/explore/column/'; export const route: Route = { path: '/explore/column/:id', diff --git a/lib/routes/douban/other/explore.ts b/lib/routes/douban/other/explore.ts index 10dba7bda..e0f2d0577 100644 --- a/lib/routes/douban/other/explore.ts +++ b/lib/routes/douban/other/explore.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/explore', categories: ['social-media'], diff --git a/lib/routes/douban/other/group.ts b/lib/routes/douban/other/group.ts index c4b93a12d..21c05025b 100644 --- a/lib/routes/douban/other/group.ts +++ b/lib/routes/douban/other/group.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/group/:groupid/:type?', diff --git a/lib/routes/douban/other/jobs.ts b/lib/routes/douban/other/jobs.ts index 0bb203a45..6503090aa 100644 --- a/lib/routes/douban/other/jobs.ts +++ b/lib/routes/douban/other/jobs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const rootUrl = 'https://jobs.douban.com'; const titleMap = { diff --git a/lib/routes/douban/other/later.ts b/lib/routes/douban/other/later.ts index 1fe3cbb5d..f097ac2d9 100644 --- a/lib/routes/douban/other/later.ts +++ b/lib/routes/douban/other/later.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/movie/later', categories: ['social-media'], diff --git a/lib/routes/douban/other/latest-music.ts b/lib/routes/douban/other/latest-music.ts index 06489ad97..a5d1e2184 100644 --- a/lib/routes/douban/other/latest-music.ts +++ b/lib/routes/douban/other/latest-music.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/music/latest/:area?', categories: ['social-media'], diff --git a/lib/routes/douban/other/list.ts b/lib/routes/douban/other/list.ts index 47fbc7886..e4e36eb30 100644 --- a/lib/routes/douban/other/list.ts +++ b/lib/routes/douban/other/list.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { fallback, queryToFloat, queryToInteger } from '@/utils/readable-social'; import { art } from '@/utils/render'; -import { fallback, queryToInteger, queryToFloat } from '@/utils/readable-social'; export const route: Route = { path: '/list/:type?/:routeParams?', diff --git a/lib/routes/douban/other/playing.ts b/lib/routes/douban/other/playing.ts index 13f5434da..779a40b8c 100644 --- a/lib/routes/douban/other/playing.ts +++ b/lib/routes/douban/other/playing.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: ['/movie/playing', '/movie/playing/:score'], categories: ['social-media'], diff --git a/lib/routes/douban/other/recommended.ts b/lib/routes/douban/other/recommended.ts index b2f534e94..34965de88 100644 --- a/lib/routes/douban/other/recommended.ts +++ b/lib/routes/douban/other/recommended.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import path from 'node:path'; -import { art } from '@/utils/render'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { fallback, queryToInteger } from '@/utils/readable-social'; +import { art } from '@/utils/render'; export const route: Route = { path: '/recommended/:type?/:routeParams?', diff --git a/lib/routes/douban/other/replied.ts b/lib/routes/douban/other/replied.ts index 836ecb5c8..23767e6ce 100644 --- a/lib/routes/douban/other/replied.ts +++ b/lib/routes/douban/other/replied.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/replied/:uid', diff --git a/lib/routes/douban/other/replies.ts b/lib/routes/douban/other/replies.ts index 63582f658..7d2515a61 100644 --- a/lib/routes/douban/other/replies.ts +++ b/lib/routes/douban/other/replies.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/replies/:uid', diff --git a/lib/routes/douban/other/topic.ts b/lib/routes/douban/other/topic.ts index 3a4b17ce6..e5c56ea4b 100644 --- a/lib/routes/douban/other/topic.ts +++ b/lib/routes/douban/other/topic.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/douban/other/ustop.ts b/lib/routes/douban/other/ustop.ts index 8d9c54847..871f84242 100644 --- a/lib/routes/douban/other/ustop.ts +++ b/lib/routes/douban/other/ustop.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/douban/other/weekly-best.ts b/lib/routes/douban/other/weekly-best.ts index 04b47f983..00120e022 100644 --- a/lib/routes/douban/other/weekly-best.ts +++ b/lib/routes/douban/other/weekly-best.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/movie/weekly/:type?', diff --git a/lib/routes/douban/people/status.ts b/lib/routes/douban/people/status.ts index 9a2eb06fe..dff0f91a0 100644 --- a/lib/routes/douban/people/status.ts +++ b/lib/routes/douban/people/status.ts @@ -1,9 +1,12 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; + +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { fallback, queryToBoolean, queryToInteger } from '@/utils/readable-social'; -import { config } from '@/config'; + export const route: Route = { path: '/people/:userid/status/:routeParams?', categories: ['social-media'], diff --git a/lib/routes/douban/people/wish.ts b/lib/routes/douban/people/wish.ts index 6facc1f1b..bd676988b 100644 --- a/lib/routes/douban/people/wish.ts +++ b/lib/routes/douban/people/wish.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; + import { load } from 'cheerio'; -import got from '@/utils/got'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + export const route: Route = { path: '/people/:userid/wish/:routeParams?', categories: ['social-media'], diff --git a/lib/routes/douyin/hashtag.ts b/lib/routes/douyin/hashtag.ts index 3edfec85c..b88b79ce5 100644 --- a/lib/routes/douyin/hashtag.ts +++ b/lib/routes/douyin/hashtag.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; -import { config } from '@/config'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; -import { templates, resolveUrl, proxyVideo, getOriginAvatar } from './utils'; import puppeteer from '@/utils/puppeteer'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; +import { art } from '@/utils/render'; + +import { getOriginAvatar, proxyVideo, resolveUrl, templates } from './utils'; export const route: Route = { path: '/hashtag/:cid/:routeParams?', diff --git a/lib/routes/douyin/live.ts b/lib/routes/douyin/live.ts index 3159461b1..014192f77 100644 --- a/lib/routes/douyin/live.ts +++ b/lib/routes/douyin/live.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { config } from '@/config'; -import { getOriginAvatar } from './utils'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; import puppeteer from '@/utils/puppeteer'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import { getOriginAvatar } from './utils'; export const route: Route = { path: '/live/:rid', diff --git a/lib/routes/douyin/user.ts b/lib/routes/douyin/user.ts index 86d6284f2..2ac99cfec 100644 --- a/lib/routes/douyin/user.ts +++ b/lib/routes/douyin/user.ts @@ -1,14 +1,15 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import { config } from '@/config'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; -import { templates, resolveUrl, proxyVideo, getOriginAvatar } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; -import puppeteer from '@/utils/puppeteer'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; -import { PostData } from './types'; +import { parseDate } from '@/utils/parse-date'; +import puppeteer from '@/utils/puppeteer'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; +import { art } from '@/utils/render'; + +import type { PostData } from './types'; +import { getOriginAvatar, proxyVideo, resolveUrl, templates } from './utils'; export const route: Route = { path: '/user/:uid/:routeParams?', diff --git a/lib/routes/douyin/utils.ts b/lib/routes/douyin/utils.ts index 8a5d6e72f..95bce56c5 100644 --- a/lib/routes/douyin/utils.ts +++ b/lib/routes/douyin/utils.ts @@ -42,4 +42,4 @@ const getOriginAvatar = (url) => .replace(/^(.*\.douyinpic\.com\/).*(\/aweme-avatar\/)([^?]*)(\?.*)?$/, '$1origin$2$3') .replaceAll(/~\w+_\d+x\d+/g, ''); -export { templates, resolveUrl, proxyVideo, getOriginAvatar }; +export { getOriginAvatar, proxyVideo, resolveUrl, templates }; diff --git a/lib/routes/douyu/group.ts b/lib/routes/douyu/group.ts index 8271054d7..3a4f26f6a 100644 --- a/lib/routes/douyu/group.ts +++ b/lib/routes/douyu/group.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/group/:id/:sort?', diff --git a/lib/routes/douyu/post.ts b/lib/routes/douyu/post.ts index b54b0dc30..153690ba2 100644 --- a/lib/routes/douyu/post.ts +++ b/lib/routes/douyu/post.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/post/:id', diff --git a/lib/routes/douyu/room.ts b/lib/routes/douyu/room.ts index bd0a36c6c..540ad628d 100644 --- a/lib/routes/douyu/room.ts +++ b/lib/routes/douyu/room.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/dribbble/keyword.ts b/lib/routes/dribbble/keyword.ts index b40f939c3..fd51c58ae 100644 --- a/lib/routes/dribbble/keyword.ts +++ b/lib/routes/dribbble/keyword.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/dribbble/popular.ts b/lib/routes/dribbble/popular.ts index 628394e81..0b2ed50bc 100644 --- a/lib/routes/dribbble/popular.ts +++ b/lib/routes/dribbble/popular.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/dribbble/user.ts b/lib/routes/dribbble/user.ts index 5dedf78c4..17f716ad9 100644 --- a/lib/routes/dribbble/user.ts +++ b/lib/routes/dribbble/user.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/dribbble/utils.ts b/lib/routes/dribbble/utils.ts index 2e9fca4ec..274a20f87 100644 --- a/lib/routes/dribbble/utils.ts +++ b/lib/routes/dribbble/utils.ts @@ -1,9 +1,11 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const host = 'https://dribbble.com'; diff --git a/lib/routes/dtcj/datahero.ts b/lib/routes/dtcj/datahero.ts index 022dbc50d..3cb71fc66 100644 --- a/lib/routes/dtcj/datahero.ts +++ b/lib/routes/dtcj/datahero.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const titles = { diff --git a/lib/routes/dtcj/datainsight.ts b/lib/routes/dtcj/datainsight.ts index a003171b3..8cbb8d78d 100644 --- a/lib/routes/dtcj/datainsight.ts +++ b/lib/routes/dtcj/datainsight.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/duckdb/news.ts b/lib/routes/duckdb/news.ts index eece112c5..1e0621f96 100644 --- a/lib/routes/duckdb/news.ts +++ b/lib/routes/duckdb/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; export const route: Route = { path: '/news', diff --git a/lib/routes/duozhuayu/search.ts b/lib/routes/duozhuayu/search.ts index 9f7267039..e61b89d29 100644 --- a/lib/routes/duozhuayu/search.ts +++ b/lib/routes/duozhuayu/search.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import aesjs from 'aes-js'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import aesjs from 'aes-js'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/search/:wd', diff --git a/lib/routes/dushu/fuzhou/index.ts b/lib/routes/dushu/fuzhou/index.ts index 1124d1caa..f66d27f49 100644 --- a/lib/routes/dushu/fuzhou/index.ts +++ b/lib/routes/dushu/fuzhou/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import path from 'node:path'; const host = 'https://gateway-api-ipv4.dushu365.com/compose-orch/offlineActivity/v100/activity/list'; const itemLink = 'https://card.dushu.io/requirement/offline-activity/activity-detail/v/index.html'; diff --git a/lib/routes/dut/index.ts b/lib/routes/dut/index.ts index dbee2d986..117bf63e6 100644 --- a/lib/routes/dut/index.ts +++ b/lib/routes/dut/index.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; +import { isValidHost } from '@/utils/valid-host'; + import defaults from './defaults'; import shortcuts from './shortcuts'; -import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: ['/*/*', '/:0?'], diff --git a/lib/routes/dw/news.ts b/lib/routes/dw/news.ts index 806f745b9..5777d82d2 100644 --- a/lib/routes/dw/news.ts +++ b/lib/routes/dw/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { processItems } from './utils'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { processItems } from './utils'; export const route: Route = { path: '/news/:lang?/:id?', diff --git a/lib/routes/dw/rss.ts b/lib/routes/dw/rss.ts index 54bd497f1..66dba4ed2 100644 --- a/lib/routes/dw/rss.ts +++ b/lib/routes/dw/rss.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import { config } from '@/config'; import Parser from 'rss-parser'; + +import { config } from '@/config'; +import type { Route } from '@/types'; + import { processItems } from './utils'; export const route: Route = { diff --git a/lib/routes/dw/utils.ts b/lib/routes/dw/utils.ts index 83a746dba..ea36656f6 100644 --- a/lib/routes/dw/utils.ts +++ b/lib/routes/dw/utils.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import { type CheerioAPI, load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load, type CheerioAPI } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; const formatId = '605'; diff --git a/lib/routes/dx2025/index.ts b/lib/routes/dx2025/index.ts index 8381eb2f3..d0ce740f9 100644 --- a/lib/routes/dx2025/index.ts +++ b/lib/routes/dx2025/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/:type?/:category?', diff --git a/lib/routes/dxy/board.ts b/lib/routes/dxy/board.ts index 35b55bba6..11552325b 100644 --- a/lib/routes/dxy/board.ts +++ b/lib/routes/dxy/board.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { phoneBaseUrl, webBaseUrl, generateNonce, sign, getPost } from './utils'; -import { config } from '@/config'; -import { BoardInfo, PostListData } from './types'; + +import type { BoardInfo, PostListData } from './types'; +import { generateNonce, getPost, phoneBaseUrl, sign, webBaseUrl } from './utils'; export const route: Route = { path: '/bbs/board/:boardId', diff --git a/lib/routes/dxy/profile/thread.ts b/lib/routes/dxy/profile/thread.ts index a34b6fb91..3aae46ea1 100644 --- a/lib/routes/dxy/profile/thread.ts +++ b/lib/routes/dxy/profile/thread.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { webBaseUrl, generateNonce, sign, getPost } from '../utils'; -import { config } from '@/config'; + +import { generateNonce, getPost, sign, webBaseUrl } from '../utils'; export const route: Route = { path: '/bbs/profile/thread/:userId', diff --git a/lib/routes/dxy/special.ts b/lib/routes/dxy/special.ts index 3d41e6e65..dbe27a8ba 100644 --- a/lib/routes/dxy/special.ts +++ b/lib/routes/dxy/special.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { phoneBaseUrl, webBaseUrl, generateNonce, sign, getPost } from './utils'; -import { config } from '@/config'; -import { RecommendListData, SpecialBoardDetail } from './types'; + +import type { RecommendListData, SpecialBoardDetail } from './types'; +import { generateNonce, getPost, phoneBaseUrl, sign, webBaseUrl } from './utils'; export const route: Route = { path: '/bbs/special/:specialId', diff --git a/lib/routes/dxy/utils.ts b/lib/routes/dxy/utils.ts index b404e3920..49f788ff9 100644 --- a/lib/routes/dxy/utils.ts +++ b/lib/routes/dxy/utils.ts @@ -1,8 +1,10 @@ -import CryptoJS from 'crypto-js'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; +import CryptoJS from 'crypto-js'; + +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { PostData } from './types'; + +import type { PostData } from './types'; const APP_SIGN_KEY = '4bTogwpz7RzNO2VTFtW7zcfRkAE97ox6ZSgcQi7FgYdqrHqKB7aGqEZ4o7yssa2aEXoV3bQwh12FFgVNlpyYk2Yjm9d2EZGeGu3'; const phoneBaseUrl = 'https://3g.dxy.cn'; @@ -72,4 +74,4 @@ const getPost = (item, tryGet) => return item; }); -export { phoneBaseUrl, webBaseUrl, generateNonce, sign, getPost }; +export { generateNonce, getPost, phoneBaseUrl, sign, webBaseUrl }; diff --git a/lib/routes/dykszx/news.ts b/lib/routes/dykszx/news.ts index c6bdf5229..fbe8753fc 100644 --- a/lib/routes/dykszx/news.ts +++ b/lib/routes/dykszx/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; const HOST = 'https://www.dykszx.com'; diff --git a/lib/routes/dytt/index.ts b/lib/routes/dytt/index.ts index 69c8d4c3a..879b13287 100644 --- a/lib/routes/dytt/index.ts +++ b/lib/routes/dytt/index.ts @@ -1,15 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import cache from '@/utils/cache'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; import iconv from 'iconv-lite'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - const domain: string = 'www.dydytt.net'; const baseUrl: string = `https://${domain}`; diff --git a/lib/routes/e-hentai/index.ts b/lib/routes/e-hentai/index.ts index fb7cf6009..de5ec45c8 100644 --- a/lib/routes/e-hentai/index.ts +++ b/lib/routes/e-hentai/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import path from 'node:path'; -import { art } from '@/utils/render'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/:what?/:id?/:needTorrents?/:needImages?', diff --git a/lib/routes/ea/apex-news.ts b/lib/routes/ea/apex-news.ts index c041cb201..4f75e74ec 100644 --- a/lib/routes/ea/apex-news.ts +++ b/lib/routes/ea/apex-news.ts @@ -1,9 +1,10 @@ -import { parseDate } from '@/utils/parse-date'; -import { ViewType, type Route, type DataItem } from '@/types'; +import MarkdownIt from 'markdown-it'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import MarkdownIt from 'markdown-it'; +import { parseDate } from '@/utils/parse-date'; const md = MarkdownIt({ html: true, diff --git a/lib/routes/eagle/blog.ts b/lib/routes/eagle/blog.ts index 08cf75b96..ec897d9b8 100644 --- a/lib/routes/eagle/blog.ts +++ b/lib/routes/eagle/blog.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + const cateList = new Set(['all', 'design-resources', 'learn-design', 'inside-eagle']); export const route: Route = { diff --git a/lib/routes/eagle/changelog.ts b/lib/routes/eagle/changelog.ts index bcfe5d599..be577c12c 100644 --- a/lib/routes/eagle/changelog.ts +++ b/lib/routes/eagle/changelog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/earthquake/ceic.ts b/lib/routes/earthquake/ceic.ts index 796696204..b9ad819d3 100644 --- a/lib/routes/earthquake/ceic.ts +++ b/lib/routes/earthquake/ceic.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/earthquake/index.ts b/lib/routes/earthquake/index.ts index 107e9f288..b9e116de8 100644 --- a/lib/routes/earthquake/index.ts +++ b/lib/routes/earthquake/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/eastday/24.ts b/lib/routes/eastday/24.ts index 297269e05..6c50ffdab 100644 --- a/lib/routes/eastday/24.ts +++ b/lib/routes/eastday/24.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const categories = { 社会: 'shehui', diff --git a/lib/routes/eastday/portrait.ts b/lib/routes/eastday/portrait.ts index b9d1873f7..d68172890 100644 --- a/lib/routes/eastday/portrait.ts +++ b/lib/routes/eastday/portrait.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/portrait', diff --git a/lib/routes/eastday/sh.ts b/lib/routes/eastday/sh.ts index e79f7a641..8fdae1aaa 100644 --- a/lib/routes/eastday/sh.ts +++ b/lib/routes/eastday/sh.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/eastmoney/gerenzhongxin/cfh.ts b/lib/routes/eastmoney/gerenzhongxin/cfh.ts index 883f99075..3fe81e7a9 100644 --- a/lib/routes/eastmoney/gerenzhongxin/cfh.ts +++ b/lib/routes/eastmoney/gerenzhongxin/cfh.ts @@ -1,6 +1,7 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/eastmoney/gerenzhongxin/gather.ts b/lib/routes/eastmoney/gerenzhongxin/gather.ts index 79d9505e2..6bcb5c2b5 100644 --- a/lib/routes/eastmoney/gerenzhongxin/gather.ts +++ b/lib/routes/eastmoney/gerenzhongxin/gather.ts @@ -1,4 +1,5 @@ import { type Route, ViewType } from '@/types'; + import { handler as cfhHandler } from './cfh'; import { handler as gubaHandler } from './guba'; import { handler as trplHandler } from './trpl'; diff --git a/lib/routes/eastmoney/gerenzhongxin/guba.ts b/lib/routes/eastmoney/gerenzhongxin/guba.ts index 082d2d105..3be927cc8 100644 --- a/lib/routes/eastmoney/gerenzhongxin/guba.ts +++ b/lib/routes/eastmoney/gerenzhongxin/guba.ts @@ -1,6 +1,7 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/eastmoney/gerenzhongxin/trpl.ts b/lib/routes/eastmoney/gerenzhongxin/trpl.ts index eadcfe389..b5e37c73a 100644 --- a/lib/routes/eastmoney/gerenzhongxin/trpl.ts +++ b/lib/routes/eastmoney/gerenzhongxin/trpl.ts @@ -1,8 +1,9 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import md5 from '@/utils/md5'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/gerenzhongxin/trpl/:uid', diff --git a/lib/routes/eastmoney/report/index.ts b/lib/routes/eastmoney/report/index.ts index 754a9f056..b90bce783 100644 --- a/lib/routes/eastmoney/report/index.ts +++ b/lib/routes/eastmoney/report/index.ts @@ -1,11 +1,15 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { getRatingChangeStr, getEpsOrPeStr } from '../utils'; + +import { getEpsOrPeStr, getRatingChangeStr } from '../utils'; export const route: Route = { path: '/report/:category', diff --git a/lib/routes/eastmoney/search/index.ts b/lib/routes/eastmoney/search/index.ts index 9d0b05009..1b6d122dc 100644 --- a/lib/routes/eastmoney/search/index.ts +++ b/lib/routes/eastmoney/search/index.ts @@ -1,6 +1,7 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/eastmoney/ttjj/user.ts b/lib/routes/eastmoney/ttjj/user.ts index 6d8ce0df3..222c01d5b 100644 --- a/lib/routes/eastmoney/ttjj/user.ts +++ b/lib/routes/eastmoney/ttjj/user.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/eastmoney/utils.ts b/lib/routes/eastmoney/utils.ts index 008c595fa..6d040d8e3 100644 --- a/lib/routes/eastmoney/utils.ts +++ b/lib/routes/eastmoney/utils.ts @@ -32,4 +32,4 @@ function getEpsOrPeStr(epsOrPe, keepDecimal) { return EpsOrPeStr; } -export { getRatingChangeStr, getEpsOrPeStr }; +export { getEpsOrPeStr, getRatingChangeStr }; diff --git a/lib/routes/easynomad/joblist.ts b/lib/routes/easynomad/joblist.ts index ddc554994..51ff8612a 100644 --- a/lib/routes/easynomad/joblist.ts +++ b/lib/routes/easynomad/joblist.ts @@ -1,11 +1,14 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import MarkdownIt from 'markdown-it'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const md = MarkdownIt({ html: true, linkify: true, }); -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/', diff --git a/lib/routes/ebc/realtime.ts b/lib/routes/ebc/realtime.ts index b81aa09a8..0d748f341 100644 --- a/lib/routes/ebc/realtime.ts +++ b/lib/routes/ebc/realtime.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ecnu/bksy.ts b/lib/routes/ecnu/bksy.ts index 660c310c9..6b31b948b 100644 --- a/lib/routes/ecnu/bksy.ts +++ b/lib/routes/ecnu/bksy.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/cee.ts b/lib/routes/ecnu/cee.ts index b6b1d093e..f32cca255 100644 --- a/lib/routes/ecnu/cee.ts +++ b/lib/routes/ecnu/cee.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/contest.ts b/lib/routes/ecnu/contest.ts index 1bf3e211a..d8b40dc4e 100644 --- a/lib/routes/ecnu/contest.ts +++ b/lib/routes/ecnu/contest.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/acm/contest/:category?', categories: ['university'], diff --git a/lib/routes/ecnu/cs.ts b/lib/routes/ecnu/cs.ts index 8eae5c9b0..d17599109 100644 --- a/lib/routes/ecnu/cs.ts +++ b/lib/routes/ecnu/cs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/dase.ts b/lib/routes/ecnu/dase.ts index fa212dcdb..b4db79361 100644 --- a/lib/routes/ecnu/dase.ts +++ b/lib/routes/ecnu/dase.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/dx.ts b/lib/routes/ecnu/dx.ts index a263f620a..45ddc286d 100644 --- a/lib/routes/ecnu/dx.ts +++ b/lib/routes/ecnu/dx.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/dxb.ts b/lib/routes/ecnu/dxb.ts index c6e8890b1..c7f8c0718 100644 --- a/lib/routes/ecnu/dxb.ts +++ b/lib/routes/ecnu/dxb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/ed.ts b/lib/routes/ecnu/ed.ts index c556769fe..0d420244a 100644 --- a/lib/routes/ecnu/ed.ts +++ b/lib/routes/ecnu/ed.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/geoai.ts b/lib/routes/ecnu/geoai.ts index c59d6951f..e5578ad98 100644 --- a/lib/routes/ecnu/geoai.ts +++ b/lib/routes/ecnu/geoai.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/ghcollege.ts b/lib/routes/ecnu/ghcollege.ts index 74b3f132c..3deef4413 100644 --- a/lib/routes/ecnu/ghcollege.ts +++ b/lib/routes/ecnu/ghcollege.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/history.ts b/lib/routes/ecnu/history.ts index 9b776c044..d9eae7a3d 100644 --- a/lib/routes/ecnu/history.ts +++ b/lib/routes/ecnu/history.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/jwc.ts b/lib/routes/ecnu/jwc.ts index d49e926d4..cc323f252 100644 --- a/lib/routes/ecnu/jwc.ts +++ b/lib/routes/ecnu/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/mxcsy.ts b/lib/routes/ecnu/mxcsy.ts index d51ddf965..1755a8b04 100644 --- a/lib/routes/ecnu/mxcsy.ts +++ b/lib/routes/ecnu/mxcsy.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/philo.ts b/lib/routes/ecnu/philo.ts index f9796ee17..446532cba 100644 --- a/lib/routes/ecnu/philo.ts +++ b/lib/routes/ecnu/philo.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/sei.ts b/lib/routes/ecnu/sei.ts index 3f073a985..2040bd15a 100644 --- a/lib/routes/ecnu/sei.ts +++ b/lib/routes/ecnu/sei.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/yjs.ts b/lib/routes/ecnu/yjs.ts index 62078b7fe..d3eb0ca88 100644 --- a/lib/routes/ecnu/yjs.ts +++ b/lib/routes/ecnu/yjs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/economist/espresso.ts b/lib/routes/economist/espresso.ts index b80ccdb95..bf1ff7c3e 100644 --- a/lib/routes/economist/espresso.ts +++ b/lib/routes/economist/espresso.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import * as cheerio from 'cheerio'; +import sanitizeHtml from 'sanitize-html'; +import xxhash from 'xxhash-wasm'; + +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; -import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; -import xxhash from 'xxhash-wasm'; -import sanitizeHtml from 'sanitize-html'; const link = 'https://www.economist.com/the-world-in-brief'; diff --git a/lib/routes/economist/full.ts b/lib/routes/economist/full.ts index ee745ec3a..3e2fd85fb 100644 --- a/lib/routes/economist/full.ts +++ b/lib/routes/economist/full.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import parser from '@/utils/rss-parser'; + const getArticleDetail = (link) => cache.tryGet(link, async () => { const response = await got(link); diff --git a/lib/routes/economist/global-business-review.ts b/lib/routes/economist/global-business-review.ts index dbb37f3df..8dff9446e 100644 --- a/lib/routes/economist/global-business-review.ts +++ b/lib/routes/economist/global-business-review.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/ecust/e/news.ts b/lib/routes/ecust/e/news.ts index 285ea71fb..2b982158f 100644 --- a/lib/routes/ecust/e/news.ts +++ b/lib/routes/ecust/e/news.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const baseUrl = 'https://e.ecust.edu.cn'; diff --git a/lib/routes/ecust/gschool/yjs.ts b/lib/routes/ecust/gschool/yjs.ts index a67525ba6..67fef4f09 100644 --- a/lib/routes/ecust/gschool/yjs.ts +++ b/lib/routes/ecust/gschool/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ecust/jwc/notice.ts b/lib/routes/ecust/jwc/notice.ts index e92a211d0..8aecda512 100644 --- a/lib/routes/ecust/jwc/notice.ts +++ b/lib/routes/ecust/jwc/notice.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://jwc.ecust.edu.cn'; diff --git a/lib/routes/eeo/kuaixun.ts b/lib/routes/eeo/kuaixun.ts index c404feb31..05da6fefa 100644 --- a/lib/routes/eeo/kuaixun.ts +++ b/lib/routes/eeo/kuaixun.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '50', 10); diff --git a/lib/routes/egsea/flash.ts b/lib/routes/egsea/flash.ts index 09336478f..8a540461f 100644 --- a/lib/routes/egsea/flash.ts +++ b/lib/routes/egsea/flash.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ehentai/ehapi.ts b/lib/routes/ehentai/ehapi.ts index 7753a10bb..ba9284bea 100644 --- a/lib/routes/ehentai/ehapi.ts +++ b/lib/routes/ehentai/ehapi.ts @@ -1,9 +1,11 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + +import { config } from '@/config'; import got from '@/utils/got'; import logger from '@/utils/logger'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import path from 'node:path'; -import { config } from '@/config'; const headers = {}; const has_cookie = config.ehentai.ipb_member_id && config.ehentai.ipb_pass_hash && config.ehentai.sk; diff --git a/lib/routes/ehentai/favorites.ts b/lib/routes/ehentai/favorites.ts index 14abc9d46..fe16161c8 100644 --- a/lib/routes/ehentai/favorites.ts +++ b/lib/routes/ehentai/favorites.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import EhAPI from './ehapi'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import EhAPI from './ehapi'; export const route: Route = { path: '/favorites/:favcat?/:order?/:page?/:routeParams?', diff --git a/lib/routes/ehentai/search.ts b/lib/routes/ehentai/search.ts index f52936925..81294f6db 100644 --- a/lib/routes/ehentai/search.ts +++ b/lib/routes/ehentai/search.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; + import EhAPI from './ehapi'; export const route: Route = { diff --git a/lib/routes/ehentai/tag.ts b/lib/routes/ehentai/tag.ts index b5d37229d..686854cfa 100644 --- a/lib/routes/ehentai/tag.ts +++ b/lib/routes/ehentai/tag.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; + import EhAPI from './ehapi'; export const route: Route = { diff --git a/lib/routes/ekantipur/issue.ts b/lib/routes/ekantipur/issue.ts index c6797094b..63181c3f8 100644 --- a/lib/routes/ekantipur/issue.ts +++ b/lib/routes/ekantipur/issue.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // an HTML parser with a jQuery-like API + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // Require necessary modules import got from '@/utils/got'; // a customised got -import { load } from 'cheerio'; // an HTML parser with a jQuery-like API export const route: Route = { path: '/:channel?', diff --git a/lib/routes/elasticsearch-cn/index.ts b/lib/routes/elasticsearch-cn/index.ts index c95a33c65..4a23f1150 100644 --- a/lib/routes/elasticsearch-cn/index.ts +++ b/lib/routes/elasticsearch-cn/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:params?', diff --git a/lib/routes/elecfans/article.ts b/lib/routes/elecfans/article.ts index 669b34c2c..b9247e867 100644 --- a/lib/routes/elecfans/article.ts +++ b/lib/routes/elecfans/article.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/article/:atype', diff --git a/lib/routes/elecfans/soft.ts b/lib/routes/elecfans/soft.ts index 70b38a1ca..77c0249f8 100644 --- a/lib/routes/elecfans/soft.ts +++ b/lib/routes/elecfans/soft.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/soft/:atype', diff --git a/lib/routes/eleduck/jobs.ts b/lib/routes/eleduck/jobs.ts index f3188bd0f..fc4d2ee96 100644 --- a/lib/routes/eleduck/jobs.ts +++ b/lib/routes/eleduck/jobs.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/eleduck/posts.ts b/lib/routes/eleduck/posts.ts index df1d94c3c..2f992e8bc 100644 --- a/lib/routes/eleduck/posts.ts +++ b/lib/routes/eleduck/posts.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/elsevier/issue.ts b/lib/routes/elsevier/issue.ts index 9a9ee1b3d..5d7d992c6 100644 --- a/lib/routes/elsevier/issue.ts +++ b/lib/routes/elsevier/issue.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import path from 'node:path'; import { art } from '@/utils/render'; -import { CookieJar } from 'tough-cookie'; const cookieJar = new CookieJar(); export const route: Route = { diff --git a/lib/routes/elsevier/journal.ts b/lib/routes/elsevier/journal.ts index 2784a40c5..63517fd88 100644 --- a/lib/routes/elsevier/journal.ts +++ b/lib/routes/elsevier/journal.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import path from 'node:path'; import { art } from '@/utils/render'; -import { CookieJar } from 'tough-cookie'; const cookieJar = new CookieJar(); export const route: Route = { diff --git a/lib/routes/embassy/index.ts b/lib/routes/embassy/index.ts index 8c504f845..e881792ec 100644 --- a/lib/routes/embassy/index.ts +++ b/lib/routes/embassy/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import supportedList from './supported-list'; diff --git a/lib/routes/engineering/tag.ts b/lib/routes/engineering/tag.ts index 58b6baa47..cf23dc6e1 100644 --- a/lib/routes/engineering/tag.ts +++ b/lib/routes/engineering/tag.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/tag/:tag', categories: ['programming'], diff --git a/lib/routes/englishhome/index.ts b/lib/routes/englishhome/index.ts index d3f0a0968..6376fc793 100644 --- a/lib/routes/englishhome/index.ts +++ b/lib/routes/englishhome/index.ts @@ -1,4 +1,4 @@ -import { Route, type Data } from '@/types'; +import type { type Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/enterprisecraftsmanship/index.ts b/lib/routes/enterprisecraftsmanship/index.ts index 135585483..6774cf3b1 100644 --- a/lib/routes/enterprisecraftsmanship/index.ts +++ b/lib/routes/enterprisecraftsmanship/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; export const route: Route = { path: '/archives', diff --git a/lib/routes/epicgames/index.ts b/lib/routes/epicgames/index.ts index af9035631..eb00ad08f 100644 --- a/lib/routes/epicgames/index.ts +++ b/lib/routes/epicgames/index.ts @@ -1,10 +1,12 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import dayjs from 'dayjs'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import dayjs from 'dayjs'; export const route: Route = { path: '/freegames/:locale?/:country?', diff --git a/lib/routes/eprice/rss.ts b/lib/routes/eprice/rss.ts index cc648f1bd..2d65fc05b 100644 --- a/lib/routes/eprice/rss.ts +++ b/lib/routes/eprice/rss.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; +import parser from '@/utils/rss-parser'; + const allowRegion = new Set(['tw', 'hk']); export const route: Route = { diff --git a/lib/routes/eshukan/academic.ts b/lib/routes/eshukan/academic.ts index 9214a6838..a8493107e 100644 --- a/lib/routes/eshukan/academic.ts +++ b/lib/routes/eshukan/academic.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { id = '1' } = ctx.req.param(); diff --git a/lib/routes/espn/news.ts b/lib/routes/espn/news.ts index 7cdf2840c..9abe4a921 100644 --- a/lib/routes/espn/news.ts +++ b/lib/routes/espn/news.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; -import path from 'node:path'; import { art } from '@/utils/render'; const renderMedia = (media) => diff --git a/lib/routes/esquirehk/tag.ts b/lib/routes/esquirehk/tag.ts index f47300b11..05993c8b4 100644 --- a/lib/routes/esquirehk/tag.ts +++ b/lib/routes/esquirehk/tag.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; +import { destr } from 'destr'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { destr } from 'destr'; const topics = new Set(['style', 'watches', 'lifestyle', 'health', 'money-investment', 'gear', 'people', 'watch', 'mens-talk']); diff --git a/lib/routes/europechinese/latest.ts b/lib/routes/europechinese/latest.ts index abb8df4a8..4ac16222a 100644 --- a/lib/routes/europechinese/latest.ts +++ b/lib/routes/europechinese/latest.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/eventbrite/events.ts b/lib/routes/eventbrite/events.ts index bedc5a680..f9c99ef7c 100644 --- a/lib/routes/eventbrite/events.ts +++ b/lib/routes/eventbrite/events.ts @@ -1,9 +1,10 @@ +import { load } from 'cheerio'; +import type { Context } from 'hono'; + import type { Data, DataItem, Route } from '@/types'; import { toTitleCase } from '@/utils/common-utils'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import type { Context } from 'hono'; export const route: Route = { path: '/:region/:eventType?/:includePromoted?', diff --git a/lib/routes/eventernote/actors.ts b/lib/routes/eventernote/actors.ts index b44739e63..d7178d963 100644 --- a/lib/routes/eventernote/actors.ts +++ b/lib/routes/eventernote/actors.ts @@ -1,7 +1,8 @@ -import { type DataItem, type Route, ViewType } from '@/types'; -import type { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import { type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; const dateStringRegex = /(?\d{4})-(?\d{2})-(?\d{2})/; const timeStringRegexes = [ diff --git a/lib/routes/everia/article.ts b/lib/routes/everia/article.ts index 0d3fb2064..eab88176f 100644 --- a/lib/routes/everia/article.ts +++ b/lib/routes/everia/article.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import got from '@/utils/got'; async function loadArticle(link) { diff --git a/lib/routes/everia/category.ts b/lib/routes/everia/category.ts index d3e2e7f3f..f4e6182e4 100644 --- a/lib/routes/everia/category.ts +++ b/lib/routes/everia/category.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/everia/latest.ts b/lib/routes/everia/latest.ts index 9cb958335..48c8898ab 100644 --- a/lib/routes/everia/latest.ts +++ b/lib/routes/everia/latest.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/', diff --git a/lib/routes/everia/search.ts b/lib/routes/everia/search.ts index 95655a4ce..5e8750031 100644 --- a/lib/routes/everia/search.ts +++ b/lib/routes/everia/search.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/search/:keyword', diff --git a/lib/routes/everia/tag.ts b/lib/routes/everia/tag.ts index e14585ecf..a3d008b5b 100644 --- a/lib/routes/everia/tag.ts +++ b/lib/routes/everia/tag.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/tag/:tag', diff --git a/lib/routes/expats/czech-news.ts b/lib/routes/expats/czech-news.ts index 4f39637bc..b4a9146ff 100644 --- a/lib/routes/expats/czech-news.ts +++ b/lib/routes/expats/czech-news.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'daily-news' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/f-droid/apprelease.ts b/lib/routes/f-droid/apprelease.ts index 070e2f97a..227a28eab 100644 --- a/lib/routes/f-droid/apprelease.ts +++ b/lib/routes/f-droid/apprelease.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/famitsu/category.ts b/lib/routes/famitsu/category.ts index 4cb7ac525..aea7bfe93 100644 --- a/lib/routes/famitsu/category.ts +++ b/lib/routes/famitsu/category.ts @@ -1,12 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import * as cheerio from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; -import { ArticleDetail, Category, CategoryArticle } from './types'; + +import type { ArticleDetail, Category, CategoryArticle } from './types'; const baseUrl = 'https://www.famitsu.com'; diff --git a/lib/routes/fanbox/index.ts b/lib/routes/fanbox/index.ts index 89a1a19fa..e4cbeec3b 100644 --- a/lib/routes/fanbox/index.ts +++ b/lib/routes/fanbox/index.ts @@ -1,10 +1,12 @@ +import type { Context } from 'hono'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; import type { Data, Route } from '@/types'; -import { isValidHost } from '@/utils/valid-host'; -import type { Context } from 'hono'; -import { getHeaders, parseItem } from './utils'; -import type { PostListResponse, UserInfoResponse } from './types'; import ofetch from '@/utils/ofetch'; +import { isValidHost } from '@/utils/valid-host'; + +import type { PostListResponse, UserInfoResponse } from './types'; +import { getHeaders, parseItem } from './utils'; export const route: Route = { path: '/:creator', diff --git a/lib/routes/fanbox/utils.ts b/lib/routes/fanbox/utils.ts index 5600b11c2..b346d6b86 100644 --- a/lib/routes/fanbox/utils.ts +++ b/lib/routes/fanbox/utils.ts @@ -1,11 +1,13 @@ +import path from 'node:path'; + import { config } from '@/config'; import type { DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; -import type { ArticlePost, FilePost, ImagePost, PostDetailResponse, PostItem, TextPost, VideoPost } from './types'; -import { parseDate } from '@/utils/parse-date'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import type { ArticlePost, FilePost, ImagePost, PostDetailResponse, PostItem, TextPost, VideoPost } from './types'; export function getHeaders() { const sessionid = config.fanbox.session; diff --git a/lib/routes/fangchan/list.ts b/lib/routes/fangchan/list.ts index f5bc6325d..cfded31d3 100644 --- a/lib/routes/fangchan/list.ts +++ b/lib/routes/fangchan/list.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const { id = 'datalist' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/fanqienovel/page.ts b/lib/routes/fanqienovel/page.ts index 91c63326e..58bc7e73e 100644 --- a/lib/routes/fanqienovel/page.ts +++ b/lib/routes/fanqienovel/page.ts @@ -1,7 +1,8 @@ -import type { Data, Route } from '@/types'; -import type { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; interface Chapter { diff --git a/lib/routes/fansly/post.ts b/lib/routes/fansly/post.ts index a62fb53b6..bb41701a1 100644 --- a/lib/routes/fansly/post.ts +++ b/lib/routes/fansly/post.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; -import { getAccountByUsername, getTimelineByAccountId, parseDescription, baseUrl } from './utils'; + +import { baseUrl, getAccountByUsername, getTimelineByAccountId, parseDescription } from './utils'; export const route: Route = { path: '/user/:username', diff --git a/lib/routes/fansly/tag.ts b/lib/routes/fansly/tag.ts index 89444c104..bed607760 100644 --- a/lib/routes/fansly/tag.ts +++ b/lib/routes/fansly/tag.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; -import { getTagId, getTagSuggestion, findAccountById, parseDescription, baseUrl, icon } from './utils'; + +import { baseUrl, findAccountById, getTagId, getTagSuggestion, icon, parseDescription } from './utils'; export const route: Route = { path: '/tag/:tag', diff --git a/lib/routes/fansly/utils.ts b/lib/routes/fansly/utils.ts index cb58ff59b..7d35ce46a 100644 --- a/lib/routes/fansly/utils.ts +++ b/lib/routes/fansly/utils.ts @@ -1,8 +1,9 @@ -import got from '@/utils/got'; import path from 'node:path'; -import { art } from '@/utils/render'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; const apiBaseUrl = 'https://apiv3.fansly.com'; const baseUrl = 'https://fansly.com'; @@ -161,4 +162,4 @@ const renderTipGoal = (tipGoalId, tipGoals) => { }); }; -export { findAccountById, baseUrl, icon, getAccountByUsername, getTimelineByAccountId, getTagId, getTagSuggestion, parseAttachments, parseDescription, parseMedia, renderMedia, renderPoll, renderTipGoal }; +export { baseUrl, findAccountById, getAccountByUsername, getTagId, getTagSuggestion, getTimelineByAccountId, icon, parseAttachments, parseDescription, parseMedia, renderMedia, renderPoll, renderTipGoal }; diff --git a/lib/routes/fantia/search.ts b/lib/routes/fantia/search.ts index 432cca1f4..77d71cc96 100644 --- a/lib/routes/fantia/search.ts +++ b/lib/routes/fantia/search.ts @@ -1,7 +1,8 @@ -import { Route, ViewType } from '@/types'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; export const route: Route = { path: '/search/:type?/:caty?/:period?/:order?/:rating?/:keyword?', diff --git a/lib/routes/fantia/user.ts b/lib/routes/fantia/user.ts index 4f720a943..f723e18f4 100644 --- a/lib/routes/fantia/user.ts +++ b/lib/routes/fantia/user.ts @@ -1,8 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; export const route: Route = { path: '/user/:id', diff --git a/lib/routes/fantube/creator.ts b/lib/routes/fantube/creator.ts index 9b457de26..dc49ec7ce 100644 --- a/lib/routes/fantube/creator.ts +++ b/lib/routes/fantube/creator.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import { getCreatorFragment, getCreatorPostReelList, baseUrl } from './utils'; import path from 'node:path'; + +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; +import { baseUrl, getCreatorFragment, getCreatorPostReelList } from './utils'; + export const route: Route = { path: '/r18/creator/:identifier', categories: ['multimedia'], diff --git a/lib/routes/fantube/utils.ts b/lib/routes/fantube/utils.ts index 5223609c2..bd303aec8 100644 --- a/lib/routes/fantube/utils.ts +++ b/lib/routes/fantube/utils.ts @@ -1,7 +1,9 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + import cache from '@/utils/cache'; -import { CreatorFragment, PostReelNode } from './types'; +import ofetch from '@/utils/ofetch'; + +import type { CreatorFragment, PostReelNode } from './types'; export const baseUrl = 'https://www.fantube.tokyo'; diff --git a/lib/routes/fanxinzhui/index.ts b/lib/routes/fanxinzhui/index.ts index 44a77a458..93b9bad32 100644 --- a/lib/routes/fanxinzhui/index.ts +++ b/lib/routes/fanxinzhui/index.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/', diff --git a/lib/routes/farcaster/user.ts b/lib/routes/farcaster/user.ts index f5c5a63d7..646edb57e 100644 --- a/lib/routes/farcaster/user.ts +++ b/lib/routes/farcaster/user.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/farmatters/index.ts b/lib/routes/farmatters/index.ts index c69c94797..3da082383 100644 --- a/lib/routes/farmatters/index.ts +++ b/lib/routes/farmatters/index.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import MarkdownIt from 'markdown-it'; +import timezone from '@/utils/timezone'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/fashionnetwork/index.ts b/lib/routes/fashionnetwork/index.ts index 02c9ffc90..e4d249846 100644 --- a/lib/routes/fashionnetwork/index.ts +++ b/lib/routes/fashionnetwork/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { id = '0' } = ctx.req.param(); diff --git a/lib/routes/fastbull/express-news.ts b/lib/routes/fastbull/express-news.ts index fe101ffed..0cfffe2b5 100644 --- a/lib/routes/fastbull/express-news.ts +++ b/lib/routes/fastbull/express-news.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/fastbull/news.ts b/lib/routes/fastbull/news.ts index 4e7eef638..99b9d0ecf 100644 --- a/lib/routes/fastbull/news.ts +++ b/lib/routes/fastbull/news.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/news', diff --git a/lib/routes/fda/cdrh.ts b/lib/routes/fda/cdrh.ts index 680af6173..32c1b4d1d 100644 --- a/lib/routes/fda/cdrh.ts +++ b/lib/routes/fda/cdrh.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/fediverse/timeline.ts b/lib/routes/fediverse/timeline.ts index 109d24b1b..9d72a80b3 100644 --- a/lib/routes/fediverse/timeline.ts +++ b/lib/routes/fediverse/timeline.ts @@ -1,10 +1,10 @@ -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route, ViewType } from '@/types'; - -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import parser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/feng/forum.ts b/lib/routes/feng/forum.ts index 1c516c720..4e23c9d61 100644 --- a/lib/routes/feng/forum.ts +++ b/lib/routes/feng/forum.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import { parseDate } from '@/utils/parse-date'; -import { baseUrl, getForumMeta, getThreads, getThread } from './utils'; -import { art } from '@/utils/render'; import path from 'node:path'; +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { baseUrl, getForumMeta, getThread, getThreads } from './utils'; + export const route: Route = { path: '/forum/:id/:type?', categories: ['bbs'], diff --git a/lib/routes/feng/utils.ts b/lib/routes/feng/utils.ts index ff0d26a18..f640e84dc 100644 --- a/lib/routes/feng/utils.ts +++ b/lib/routes/feng/utils.ts @@ -1,7 +1,9 @@ -import cache from '@/utils/cache'; import CryptoJS from 'crypto-js'; -import got from '@/utils/got'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + const apiUrl = 'https://api.wfdata.club'; const baseUrl = 'https://www.feng.com'; const KEY = '2b7e151628aed2a6'; @@ -73,4 +75,4 @@ const getThread = (tid, topicId) => { }); }; -export { baseUrl, getForumMeta, getThreads, getThread }; +export { baseUrl, getForumMeta, getThread, getThreads }; diff --git a/lib/routes/ff14/ff14-global.ts b/lib/routes/ff14/ff14-global.ts index a75fc3714..c7eb127b6 100644 --- a/lib/routes/ff14/ff14-global.ts +++ b/lib/routes/ff14/ff14-global.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: ['/global/:lang/:type?', '/ff14_global/:lang/:type?'], diff --git a/lib/routes/ff14/ff14-zh.ts b/lib/routes/ff14/ff14-zh.ts index 26f88cb17..941c86c29 100644 --- a/lib/routes/ff14/ff14-zh.ts +++ b/lib/routes/ff14/ff14-zh.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: ['/zh/:type?', '/ff14_zh/:type?'], diff --git a/lib/routes/fffdm/manhua/manhua.ts b/lib/routes/fffdm/manhua/manhua.ts index f5a2b0f56..cdd460b0a 100644 --- a/lib/routes/fffdm/manhua/manhua.ts +++ b/lib/routes/fffdm/manhua/manhua.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const domain = 'manhua.fffdm.com'; const host = `https://${domain}`; -import { art } from '@/utils/render'; -import path from 'node:path'; -import { parseDate } from '@/utils/parse-date'; const get_pic = async (url) => { const response = await got(url); diff --git a/lib/routes/finology/bullets.ts b/lib/routes/finology/bullets.ts index 5d680005d..322acd5bf 100644 --- a/lib/routes/finology/bullets.ts +++ b/lib/routes/finology/bullets.ts @@ -1,7 +1,9 @@ -import { Data, Route, ViewType } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/bullets', diff --git a/lib/routes/finology/category.ts b/lib/routes/finology/category.ts index 5f913d244..2e50180fb 100644 --- a/lib/routes/finology/category.ts +++ b/lib/routes/finology/category.ts @@ -1,7 +1,9 @@ -import { Data, Route } from '@/types'; -import { getItems } from './utils'; import type { Context } from 'hono'; +import type { Data, Route } from '@/types'; + +import { getItems } from './utils'; + export const route: Route = { path: '/category/:category', categories: ['finance'], diff --git a/lib/routes/finology/most-viewed.ts b/lib/routes/finology/most-viewed.ts index c66f079fe..f89b9b4d4 100644 --- a/lib/routes/finology/most-viewed.ts +++ b/lib/routes/finology/most-viewed.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { commonHandler } from './category'; export const route: Route = { diff --git a/lib/routes/finology/tag.ts b/lib/routes/finology/tag.ts index 5c9ce51b7..418cb3994 100644 --- a/lib/routes/finology/tag.ts +++ b/lib/routes/finology/tag.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import { commonHandler } from './category'; import type { Context } from 'hono'; +import type { Route } from '@/types'; + +import { commonHandler } from './category'; + export const route: Route = { path: '/tag/:topic', categories: ['finance'], diff --git a/lib/routes/finology/utils.ts b/lib/routes/finology/utils.ts index d2e64a3d8..746df215f 100644 --- a/lib/routes/finology/utils.ts +++ b/lib/routes/finology/utils.ts @@ -1,9 +1,10 @@ -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import ofetch from '@/utils/ofetch'; -import { DataItem } from '@/types'; const getItems = async (url: string, extra: { date: boolean; selector: string }) => { const mainUrl = 'https://insider.finology.in'; diff --git a/lib/routes/finviz/news.ts b/lib/routes/finviz/news.ts index a75311d2d..434dc3731 100644 --- a/lib/routes/finviz/news.ts +++ b/lib/routes/finviz/news.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const categories = { news: 0, diff --git a/lib/routes/finviz/quote.ts b/lib/routes/finviz/quote.ts index b4edc586e..6e951e195 100644 --- a/lib/routes/finviz/quote.ts +++ b/lib/routes/finviz/quote.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/firecore/index.ts b/lib/routes/firecore/index.ts index b1083914c..5ea112fb7 100644 --- a/lib/routes/firecore/index.ts +++ b/lib/routes/firecore/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/firefox/addons.ts b/lib/routes/firefox/addons.ts index 8f9bcc021..993cabdd8 100644 --- a/lib/routes/firefox/addons.ts +++ b/lib/routes/firefox/addons.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/addons/:id', categories: ['program-update'], diff --git a/lib/routes/firefox/breaches.ts b/lib/routes/firefox/breaches.ts index 0a565cbbc..5894e772e 100644 --- a/lib/routes/firefox/breaches.ts +++ b/lib/routes/firefox/breaches.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/firefox/release.ts b/lib/routes/firefox/release.ts index fdc05936a..96b5c1495 100644 --- a/lib/routes/firefox/release.ts +++ b/lib/routes/firefox/release.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const platformSlugs = { diff --git a/lib/routes/fisher-spb/news.ts b/lib/routes/fisher-spb/news.ts index 24278646f..057aafce8 100644 --- a/lib/routes/fisher-spb/news.ts +++ b/lib/routes/fisher-spb/news.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/news', diff --git a/lib/routes/fishshell/index.ts b/lib/routes/fishshell/index.ts index c1a1bbb5e..9c6450fd3 100644 --- a/lib/routes/fishshell/index.ts +++ b/lib/routes/fishshell/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import got from '@/utils/got'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/fjksbm/index.ts b/lib/routes/fjksbm/index.ts index da87a6f52..364ed25b8 100644 --- a/lib/routes/fjksbm/index.ts +++ b/lib/routes/fjksbm/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/flashcat/blog.ts b/lib/routes/flashcat/blog.ts index 10f7dd228..8c01e7510 100644 --- a/lib/routes/flashcat/blog.ts +++ b/lib/routes/flashcat/blog.ts @@ -1,6 +1,7 @@ -import { Route, Data } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/flyert/creditcard.ts b/lib/routes/flyert/creditcard.ts index 7a2e2f1b8..ea92ab34e 100644 --- a/lib/routes/flyert/creditcard.ts +++ b/lib/routes/flyert/creditcard.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; -import iconv from 'iconv-lite'; const gbk2utf8 = (s) => iconv.decode(s, 'gbk'); const host = 'https://www.flyert.com.cn'; diff --git a/lib/routes/flyert/forum.ts b/lib/routes/flyert/forum.ts index 8184b4150..670a9d57f 100644 --- a/lib/routes/flyert/forum.ts +++ b/lib/routes/flyert/forum.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import iconv from 'iconv-lite'; -import { load } from 'cheerio'; -import { rootUrl, parseArticleList, parsePostList, parseArticle, parsePost } from './util'; + +import { parseArticle, parseArticleList, parsePost, parsePostList, rootUrl } from './util'; export const handler = async (ctx) => { const { params } = ctx.req.param(); diff --git a/lib/routes/flyert/preferential.ts b/lib/routes/flyert/preferential.ts index 06f5a1515..475789093 100644 --- a/lib/routes/flyert/preferential.ts +++ b/lib/routes/flyert/preferential.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/flyert/util.ts b/lib/routes/flyert/util.ts index 02feb1036..dea3b16a9 100644 --- a/lib/routes/flyert/util.ts +++ b/lib/routes/flyert/util.ts @@ -1,8 +1,10 @@ -import { CheerioAPI } from 'cheerio'; -import timezone from '@/utils/timezone'; +import path from 'node:path'; + +import type { CheerioAPI } from 'cheerio'; + import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.flyert.com.cn'; @@ -182,4 +184,4 @@ const parsePost = ($$: CheerioAPI, item) => { return item; }; -export { rootUrl, parseArticleList, parsePostList, parseArticle, parsePost }; +export { parseArticle, parseArticleList, parsePost, parsePostList, rootUrl }; diff --git a/lib/routes/flyert/utils.ts b/lib/routes/flyert/utils.ts index 6a2303dc4..8502f150e 100644 --- a/lib/routes/flyert/utils.ts +++ b/lib/routes/flyert/utils.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; import pMap from 'p-map'; + +import got from '@/utils/got'; import wait from '@/utils/wait'; const gbk2utf8 = (s) => iconv.decode(s, 'gbk'); diff --git a/lib/routes/focustaiwan/index.ts b/lib/routes/focustaiwan/index.ts index 46c8ca5e5..d8b8615f7 100644 --- a/lib/routes/focustaiwan/index.ts +++ b/lib/routes/focustaiwan/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import path from 'node:path'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/follow/profile.ts b/lib/routes/follow/profile.ts index c0e422878..c0434b25e 100644 --- a/lib/routes/follow/profile.ts +++ b/lib/routes/follow/profile.ts @@ -1,9 +1,11 @@ -import { ViewType, type Data, type Route } from '@/types'; import type { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; -import type { FeedSubscription, FollowResponse, InboxSubscription, ListSubscription, Profile, Subscription } from './types'; import { parse } from 'tldts'; +import { type Data, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import type { FeedSubscription, FollowResponse, InboxSubscription, ListSubscription, Profile, Subscription } from './types'; + export const route: Route = { name: 'User subscriptions', categories: ['social-media'], diff --git a/lib/routes/followin/index.ts b/lib/routes/followin/index.ts index 2ef59c3dc..055cd8bfc 100644 --- a/lib/routes/followin/index.ts +++ b/lib/routes/followin/index.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { apiUrl, favicon, getBParam, getBuildId, getGToken, parseList, parseItem } from './utils'; + +import { apiUrl, favicon, getBParam, getBuildId, getGToken, parseItem, parseList } from './utils'; export const route: Route = { path: '/:categoryId?/:lang?', diff --git a/lib/routes/followin/kol.ts b/lib/routes/followin/kol.ts index 5fc385511..83b5ab69f 100644 --- a/lib/routes/followin/kol.ts +++ b/lib/routes/followin/kol.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { baseUrl, getBuildId, parseList, parseItem } from './utils'; + +import { baseUrl, getBuildId, parseItem, parseList } from './utils'; export const route: Route = { path: '/kol/:kolId/:lang?', diff --git a/lib/routes/followin/news.ts b/lib/routes/followin/news.ts index 27b0f004e..1ae433a73 100644 --- a/lib/routes/followin/news.ts +++ b/lib/routes/followin/news.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { baseUrl, favicon, getBuildId, parseList, parseItem } from './utils'; + +import { baseUrl, favicon, getBuildId, parseItem, parseList } from './utils'; export const route: Route = { path: '/news/:lang?', diff --git a/lib/routes/followin/tag.ts b/lib/routes/followin/tag.ts index 7840de2d5..7d277f3f0 100644 --- a/lib/routes/followin/tag.ts +++ b/lib/routes/followin/tag.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { apiUrl, baseUrl, getBParam, getBuildId, getGToken, parseList, parseItem } from './utils'; + +import { apiUrl, baseUrl, getBParam, getBuildId, getGToken, parseItem, parseList } from './utils'; export const route: Route = { path: '/tag/:tagId/:lang?', diff --git a/lib/routes/followin/topic.ts b/lib/routes/followin/topic.ts index 3c4960f0f..3d3938a46 100644 --- a/lib/routes/followin/topic.ts +++ b/lib/routes/followin/topic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { baseUrl, getBuildId, parseList, parseItem } from './utils'; + +import { baseUrl, getBuildId, parseItem, parseList } from './utils'; export const route: Route = { path: '/topic/:topicId/:lang?', diff --git a/lib/routes/followin/utils.ts b/lib/routes/followin/utils.ts index 24e4e21e8..1f210423a 100644 --- a/lib/routes/followin/utils.ts +++ b/lib/routes/followin/utils.ts @@ -1,10 +1,12 @@ -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const apiUrl = 'https://api.followin.io'; const baseUrl = 'https://followin.io'; const favicon = `${baseUrl}/favicon.ico`; @@ -70,4 +72,4 @@ const parseItem = (item, tryGet) => return item; }); -export { apiUrl, baseUrl, favicon, getBParam, getBuildId, getGToken, parseList, parseItem }; +export { apiUrl, baseUrl, favicon, getBParam, getBuildId, getGToken, parseItem, parseList }; diff --git a/lib/routes/foodtalks/index.ts b/lib/routes/foodtalks/index.ts index 9a9454286..0ea4f240e 100644 --- a/lib/routes/foodtalks/index.ts +++ b/lib/routes/foodtalks/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { namespace } from './namespace'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; + +import { namespace } from './namespace'; export const route: Route = { path: '/', diff --git a/lib/routes/foreignaffairs/rss.ts b/lib/routes/foreignaffairs/rss.ts index 4649d38c5..274a8ae49 100644 --- a/lib/routes/foreignaffairs/rss.ts +++ b/lib/routes/foreignaffairs/rss.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; export const route: Route = { path: '/rss', diff --git a/lib/routes/foresightnews/article.ts b/lib/routes/foresightnews/article.ts index d9798ab39..7cebf0f7d 100644 --- a/lib/routes/foresightnews/article.ts +++ b/lib/routes/foresightnews/article.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, apiRootUrl, processItems, icon, image } from './util'; +import type { Route } from '@/types'; + +import { apiRootUrl, icon, image, processItems, rootUrl } from './util'; export const route: Route = { path: '/article', diff --git a/lib/routes/foresightnews/column.ts b/lib/routes/foresightnews/column.ts index 04074ccfa..47f68d20a 100644 --- a/lib/routes/foresightnews/column.ts +++ b/lib/routes/foresightnews/column.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, apiRootUrl, processItems, icon, image } from './util'; +import type { Route } from '@/types'; + +import { apiRootUrl, icon, image, processItems, rootUrl } from './util'; export const route: Route = { path: '/column/:id', diff --git a/lib/routes/foresightnews/index.ts b/lib/routes/foresightnews/index.ts index 782340f7c..3c9cbad9b 100644 --- a/lib/routes/foresightnews/index.ts +++ b/lib/routes/foresightnews/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, apiRootUrl, processItems, icon, image } from './util'; +import type { Route } from '@/types'; + +import { apiRootUrl, icon, image, processItems, rootUrl } from './util'; export const route: Route = { path: '/', diff --git a/lib/routes/foresightnews/news.ts b/lib/routes/foresightnews/news.ts index e5587f032..563de1150 100644 --- a/lib/routes/foresightnews/news.ts +++ b/lib/routes/foresightnews/news.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, apiRootUrl, processItems, icon, image } from './util'; +import type { Route } from '@/types'; + +import { apiRootUrl, icon, image, processItems, rootUrl } from './util'; export const route: Route = { path: '/news', diff --git a/lib/routes/foresightnews/util.ts b/lib/routes/foresightnews/util.ts index eec4ebebf..17e3c19d7 100644 --- a/lib/routes/foresightnews/util.ts +++ b/lib/routes/foresightnews/util.ts @@ -1,8 +1,9 @@ +import path from 'node:path'; +import zlib from 'node:zlib'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import zlib from 'node:zlib'; const constants = { labelHot: '热门', @@ -82,4 +83,4 @@ const processItems = async (apiUrl, limit, ...parameters) => { return { items, info }; }; -export { icon, image, rootUrl, apiRootUrl, imgRootUrl, processItems }; +export { apiRootUrl, icon, image, imgRootUrl, processItems, rootUrl }; diff --git a/lib/routes/foreverblog/feeds.ts b/lib/routes/foreverblog/feeds.ts index 39d911344..a3bc2918b 100644 --- a/lib/routes/foreverblog/feeds.ts +++ b/lib/routes/foreverblog/feeds.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/forklog/index.ts b/lib/routes/forklog/index.ts index 63ea7fd38..0c2c2d4d1 100644 --- a/lib/routes/forklog/index.ts +++ b/lib/routes/forklog/index.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/fortnite/news.ts b/lib/routes/fortnite/news.ts index 99022f6a8..057831f57 100644 --- a/lib/routes/fortnite/news.ts +++ b/lib/routes/fortnite/news.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; export const route: Route = { diff --git a/lib/routes/fortunechina/index.ts b/lib/routes/fortunechina/index.ts index 32bcebff0..f5cc29699 100644 --- a/lib/routes/fortunechina/index.ts +++ b/lib/routes/fortunechina/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate, parseRelativeDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { PRESETS } from '@/utils/header-generator'; +import ofetch from '@/utils/ofetch'; +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/fosshub/index.ts b/lib/routes/fosshub/index.ts index 4870daacd..bb71f52df 100644 --- a/lib/routes/fosshub/index.ts +++ b/lib/routes/fosshub/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:id', diff --git a/lib/routes/free/rss.ts b/lib/routes/free/rss.ts index b3d3f9fc7..70842032e 100644 --- a/lib/routes/free/rss.ts +++ b/lib/routes/free/rss.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/', diff --git a/lib/routes/freebuf/index.ts b/lib/routes/freebuf/index.ts index a80637cd6..e3c0b0721 100644 --- a/lib/routes/freebuf/index.ts +++ b/lib/routes/freebuf/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/freecomputerbooks/index.ts b/lib/routes/freecomputerbooks/index.ts index e8de3825d..96fb249d5 100644 --- a/lib/routes/freecomputerbooks/index.ts +++ b/lib/routes/freecomputerbooks/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { art } from '@/utils/render'; diff --git a/lib/routes/freewechat/profile.ts b/lib/routes/freewechat/profile.ts index 836a00406..6fb1dbdc2 100644 --- a/lib/routes/freewechat/profile.ts +++ b/lib/routes/freewechat/profile.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; import { fixArticleContent } from '@/utils/wechat-mp'; -import { config } from '@/config'; + const baseUrl = 'https://freewechat.com'; export const route: Route = { diff --git a/lib/routes/freexcomic/book.ts b/lib/routes/freexcomic/book.ts index 068904eee..a6d62d83a 100644 --- a/lib/routes/freexcomic/book.ts +++ b/lib/routes/freexcomic/book.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; const jjmhw = 'http://www.jjmhw.cc'; diff --git a/lib/routes/ft/myft.ts b/lib/routes/ft/myft.ts index 1d36e2a7f..236b2b8f5 100644 --- a/lib/routes/ft/myft.ts +++ b/lib/routes/ft/myft.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; export const route: Route = { path: '/myft/:key', diff --git a/lib/routes/ftchinese/channel.ts b/lib/routes/ftchinese/channel.ts index fb6bcb22a..e2f1a88cd 100644 --- a/lib/routes/ftchinese/channel.ts +++ b/lib/routes/ftchinese/channel.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/ftchinese/utils.ts b/lib/routes/ftchinese/utils.ts index ce42eb7e8..9ce5be246 100644 --- a/lib/routes/ftchinese/utils.ts +++ b/lib/routes/ftchinese/utils.ts @@ -1,7 +1,8 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; const ProcessFeed = (i, $, link) => { const title = $('h1').text(); diff --git a/lib/routes/ftm/index.ts b/lib/routes/ftm/index.ts index c84033789..408131eb1 100644 --- a/lib/routes/ftm/index.ts +++ b/lib/routes/ftm/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/', diff --git a/lib/routes/fuliba/latest.ts b/lib/routes/fuliba/latest.ts index a5df4df6d..de117786a 100644 --- a/lib/routes/fuliba/latest.ts +++ b/lib/routes/fuliba/latest.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/furaffinity/art.ts b/lib/routes/furaffinity/art.ts index fe4260454..31c6b2d98 100644 --- a/lib/routes/furaffinity/art.ts +++ b/lib/routes/furaffinity/art.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/browse.ts b/lib/routes/furaffinity/browse.ts index 81c9009bf..8ab993012 100644 --- a/lib/routes/furaffinity/browse.ts +++ b/lib/routes/furaffinity/browse.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/commissions.ts b/lib/routes/furaffinity/commissions.ts index 6a8067c67..b2f11db93 100644 --- a/lib/routes/furaffinity/commissions.ts +++ b/lib/routes/furaffinity/commissions.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/home.ts b/lib/routes/furaffinity/home.ts index a8aaf9e67..63cc0fab7 100644 --- a/lib/routes/furaffinity/home.ts +++ b/lib/routes/furaffinity/home.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/journal-comments.ts b/lib/routes/furaffinity/journal-comments.ts index 70495dea6..0fd40d71b 100644 --- a/lib/routes/furaffinity/journal-comments.ts +++ b/lib/routes/furaffinity/journal-comments.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/journals.ts b/lib/routes/furaffinity/journals.ts index 98d59234a..2dea98ac1 100644 --- a/lib/routes/furaffinity/journals.ts +++ b/lib/routes/furaffinity/journals.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/search.ts b/lib/routes/furaffinity/search.ts index 21c722b11..2fabc24d9 100644 --- a/lib/routes/furaffinity/search.ts +++ b/lib/routes/furaffinity/search.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/shouts.ts b/lib/routes/furaffinity/shouts.ts index 6fd539ca6..043055bc7 100644 --- a/lib/routes/furaffinity/shouts.ts +++ b/lib/routes/furaffinity/shouts.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/status.ts b/lib/routes/furaffinity/status.ts index b4554fb91..e9dc5041f 100644 --- a/lib/routes/furaffinity/status.ts +++ b/lib/routes/furaffinity/status.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/submission-comments.ts b/lib/routes/furaffinity/submission-comments.ts index c3f8edf44..985a62864 100644 --- a/lib/routes/furaffinity/submission-comments.ts +++ b/lib/routes/furaffinity/submission-comments.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/user.ts b/lib/routes/furaffinity/user.ts index a152e3317..f7ac1e981 100644 --- a/lib/routes/furaffinity/user.ts +++ b/lib/routes/furaffinity/user.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/watchers.ts b/lib/routes/furaffinity/watchers.ts index 3b28aa5d5..cfe5ad270 100644 --- a/lib/routes/furaffinity/watchers.ts +++ b/lib/routes/furaffinity/watchers.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/watching.ts b/lib/routes/furaffinity/watching.ts index 917e12933..3c689c7b1 100644 --- a/lib/routes/furaffinity/watching.ts +++ b/lib/routes/furaffinity/watching.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furstar/archive.ts b/lib/routes/furstar/archive.ts index ac342e967..17907b564 100644 --- a/lib/routes/furstar/archive.ts +++ b/lib/routes/furstar/archive.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import utils from './utils'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + export const route: Route = { path: '/archive/:lang?', categories: ['shopping'], diff --git a/lib/routes/furstar/artists.ts b/lib/routes/furstar/artists.ts index 06bd98ded..8f6821104 100644 --- a/lib/routes/furstar/artists.ts +++ b/lib/routes/furstar/artists.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import utils from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + export const route: Route = { path: '/artists/:lang?', categories: ['shopping'], diff --git a/lib/routes/furstar/index.ts b/lib/routes/furstar/index.ts index c392e6110..016f469ab 100644 --- a/lib/routes/furstar/index.ts +++ b/lib/routes/furstar/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import utils from './utils'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + export const route: Route = { path: '/characters/:lang?', categories: ['shopping'], diff --git a/lib/routes/furstar/utils.ts b/lib/routes/furstar/utils.ts index c6432ea9f..d63e92a18 100644 --- a/lib/routes/furstar/utils.ts +++ b/lib/routes/furstar/utils.ts @@ -1,7 +1,9 @@ +import path from 'node:path'; + import { load } from 'cheerio'; + import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const base = 'https://furstar.jp'; diff --git a/lib/routes/futunn/live.ts b/lib/routes/futunn/live.ts index eb4f9ba69..fdec6cb2a 100644 --- a/lib/routes/futunn/live.ts +++ b/lib/routes/futunn/live.ts @@ -1,5 +1,4 @@ -import { Route } from '@/types'; - +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/futunn/main.ts b/lib/routes/futunn/main.ts index 66349dc29..d61282025 100644 --- a/lib/routes/futunn/main.ts +++ b/lib/routes/futunn/main.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: ['/main', '/'], diff --git a/lib/routes/futunn/topic.ts b/lib/routes/futunn/topic.ts index 739b117b9..4f9a670ee 100644 --- a/lib/routes/futunn/topic.ts +++ b/lib/routes/futunn/topic.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/topic/:id', diff --git a/lib/routes/futunn/video.ts b/lib/routes/futunn/video.ts index 707b6add6..87de70a71 100644 --- a/lib/routes/futunn/video.ts +++ b/lib/routes/futunn/video.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/video', diff --git a/lib/routes/fx-markets/channel.ts b/lib/routes/fx-markets/channel.ts index 59702b77d..9d8f74994 100644 --- a/lib/routes/fx-markets/channel.ts +++ b/lib/routes/fx-markets/channel.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/fx678/kx.ts b/lib/routes/fx678/kx.ts index 2de1bc8c9..bd6b9d262 100644 --- a/lib/routes/fx678/kx.ts +++ b/lib/routes/fx678/kx.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/fxiaoke/crm.ts b/lib/routes/fxiaoke/crm.ts index 66f42a450..ec386098d 100644 --- a/lib/routes/fxiaoke/crm.ts +++ b/lib/routes/fxiaoke/crm.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://www.fxiaoke.com/crm'; const baseTitle = '纷享销客 CRM'; const titleMap = new Map([ diff --git a/lib/routes/fzmtr/announcements.ts b/lib/routes/fzmtr/announcements.ts index 57375ba57..ebd4aaf01 100644 --- a/lib/routes/fzmtr/announcements.ts +++ b/lib/routes/fzmtr/announcements.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/galxe/index.ts b/lib/routes/galxe/index.ts index e7edeb600..90110bd75 100644 --- a/lib/routes/galxe/index.ts +++ b/lib/routes/galxe/index.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/quest/:alias', diff --git a/lib/routes/gameapps/index.ts b/lib/routes/gameapps/index.ts index b46616b8e..ec64f0b50 100644 --- a/lib/routes/gameapps/index.ts +++ b/lib/routes/gameapps/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import parser from '@/utils/rss-parser'; export const route: Route = { path: '/', diff --git a/lib/routes/gamebase/news.ts b/lib/routes/gamebase/news.ts index 407b6f36b..d6f16350d 100644 --- a/lib/routes/gamebase/news.ts +++ b/lib/routes/gamebase/news.ts @@ -1,15 +1,15 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import cache from '@/utils/cache'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const types = { newslist: 'newsList', diff --git a/lib/routes/gamegene/news.ts b/lib/routes/gamegene/news.ts index 3949781d5..62d01b52f 100644 --- a/lib/routes/gamegene/news.ts +++ b/lib/routes/gamegene/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gamekee/news.ts b/lib/routes/gamekee/news.ts index 20c69d8b3..c3df4677f 100644 --- a/lib/routes/gamekee/news.ts +++ b/lib/routes/gamekee/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/news', diff --git a/lib/routes/gamer/ani/anime.ts b/lib/routes/gamer/ani/anime.ts index 5c5f272f1..d0d8b7e36 100644 --- a/lib/routes/gamer/ani/anime.ts +++ b/lib/routes/gamer/ani/anime.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/gamer/ani/new-anime.ts b/lib/routes/gamer/ani/new-anime.ts index 7b593a1ce..c6e5e72d5 100644 --- a/lib/routes/gamer/ani/new-anime.ts +++ b/lib/routes/gamer/ani/new-anime.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gamer/gnn-index.ts b/lib/routes/gamer/gnn-index.ts index be85e1a55..aa571da31 100644 --- a/lib/routes/gamer/gnn-index.ts +++ b/lib/routes/gamer/gnn-index.ts @@ -1,10 +1,12 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import pMap from 'p-map'; export const route: Route = { path: '/gnn/:category?', diff --git a/lib/routes/gamer/hot.ts b/lib/routes/gamer/hot.ts index e4e4ec513..7438f9568 100644 --- a/lib/routes/gamer/hot.ts +++ b/lib/routes/gamer/hot.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gamer520/index.ts b/lib/routes/gamer520/index.ts index b49d5fe7e..ee8c9096b 100644 --- a/lib/routes/gamer520/index.ts +++ b/lib/routes/gamer520/index.ts @@ -1,8 +1,9 @@ -import { Data, DataItem, Route } from '@/types'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Context } from 'hono'; export const route: Route = { path: '/:category?/:order?', diff --git a/lib/routes/gamersecret/index.ts b/lib/routes/gamersecret/index.ts index b871566eb..4fb5df94f 100644 --- a/lib/routes/gamersecret/index.ts +++ b/lib/routes/gamersecret/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:type?/:category?', diff --git a/lib/routes/gamersky/ent.ts b/lib/routes/gamersky/ent.ts index 9f376c8ec..595370067 100644 --- a/lib/routes/gamersky/ent.ts +++ b/lib/routes/gamersky/ent.ts @@ -1,6 +1,8 @@ -import type { Route } from '@/types'; import type { Context } from 'hono'; -import { getArticleList, parseArticleList, getArticle, mdTableBuilder } from './utils'; + +import type { Route } from '@/types'; + +import { getArticle, getArticleList, mdTableBuilder, parseArticleList } from './utils'; const idNameMap = new Map([ ['all', { title: '热点图文', suffix: 'ent', nodeId: '20107' }], diff --git a/lib/routes/gamersky/news.ts b/lib/routes/gamersky/news.ts index 57b6c5d26..46b0f192f 100644 --- a/lib/routes/gamersky/news.ts +++ b/lib/routes/gamersky/news.ts @@ -1,6 +1,8 @@ -import type { Route } from '@/types'; import type { Context } from 'hono'; -import { getArticleList, parseArticleList, getArticle, mdTableBuilder } from './utils'; + +import type { Route } from '@/types'; + +import { getArticle, getArticleList, mdTableBuilder, parseArticleList } from './utils'; const idNameMap = [ { diff --git a/lib/routes/gamersky/review.ts b/lib/routes/gamersky/review.ts index eb2fd8a64..e5c55ad89 100644 --- a/lib/routes/gamersky/review.ts +++ b/lib/routes/gamersky/review.ts @@ -1,6 +1,9 @@ -import type { Route } from '@/types'; import type { Context } from 'hono'; -import { getArticleList, parseArticleList, getArticle, mdTableBuilder } from './utils'; + +import type { Route } from '@/types'; + +import { getArticle, getArticleList, mdTableBuilder, parseArticleList } from './utils'; + const idNameMap = [ { type: 'pc', diff --git a/lib/routes/gamersky/utils.ts b/lib/routes/gamersky/utils.ts index 1d0f8b1be..c11f631ad 100644 --- a/lib/routes/gamersky/utils.ts +++ b/lib/routes/gamersky/utils.ts @@ -1,8 +1,8 @@ -import type { DataItem } from '@/types'; - -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gamme/category.ts b/lib/routes/gamme/category.ts index e60ab5a84..ad48a2eca 100644 --- a/lib/routes/gamme/category.ts +++ b/lib/routes/gamme/category.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import parser from '@/utils/rss-parser'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/:domain/:category?', diff --git a/lib/routes/gamme/tag.ts b/lib/routes/gamme/tag.ts index b9dbb922e..cd70229d3 100644 --- a/lib/routes/gamme/tag.ts +++ b/lib/routes/gamme/tag.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/:domain/tag/:tag', diff --git a/lib/routes/gaoyu/blog.ts b/lib/routes/gaoyu/blog.ts index 59944c8a3..8705124fe 100644 --- a/lib/routes/gaoyu/blog.ts +++ b/lib/routes/gaoyu/blog.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '20', 10); diff --git a/lib/routes/gc.ca/pm-news.ts b/lib/routes/gc.ca/pm-news.ts index 34073eab4..364389d2a 100644 --- a/lib/routes/gc.ca/pm-news.ts +++ b/lib/routes/gc.ca/pm-news.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; +import type { Context } from 'hono'; + import type { Data, DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import type { Context } from 'hono'; export const route: Route = { path: '/pm/:language?', diff --git a/lib/routes/gcores/articles.ts b/lib/routes/gcores/articles.ts index bc7a1f48e..910b2b5a1 100644 --- a/lib/routes/gcores/articles.ts +++ b/lib/routes/gcores/articles.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/gcores/categories.ts b/lib/routes/gcores/categories.ts index d1fc2637f..68bfe84e7 100644 --- a/lib/routes/gcores/categories.ts +++ b/lib/routes/gcores/categories.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; let viewType: ViewType = ViewType.Articles; diff --git a/lib/routes/gcores/collections.ts b/lib/routes/gcores/collections.ts index 81a4afc6a..e9155bb8b 100644 --- a/lib/routes/gcores/collections.ts +++ b/lib/routes/gcores/collections.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; let viewType: ViewType = ViewType.Articles; diff --git a/lib/routes/gcores/news.ts b/lib/routes/gcores/news.ts index 2a90bc655..4e763776d 100644 --- a/lib/routes/gcores/news.ts +++ b/lib/routes/gcores/news.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/gcores/parser.ts b/lib/routes/gcores/parser.ts index 814c7ee6b..e11f47127 100644 --- a/lib/routes/gcores/parser.ts +++ b/lib/routes/gcores/parser.ts @@ -1,7 +1,7 @@ -import { art } from '@/utils/render'; - import path from 'node:path'; +import { art } from '@/utils/render'; + interface Style { [key: string]: string; } diff --git a/lib/routes/gcores/program-previews.ts b/lib/routes/gcores/program-previews.ts index f8d571070..07e760f1e 100644 --- a/lib/routes/gcores/program-previews.ts +++ b/lib/routes/gcores/program-previews.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/gcores/radio.ts b/lib/routes/gcores/radio.ts index 9383b2e88..e09b3dad3 100644 --- a/lib/routes/gcores/radio.ts +++ b/lib/routes/gcores/radio.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import md5 from '@/utils/md5'; -import path from 'node:path'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/radios/:category?', diff --git a/lib/routes/gcores/tags.ts b/lib/routes/gcores/tags.ts index c68a2e07d..60f86574c 100644 --- a/lib/routes/gcores/tags.ts +++ b/lib/routes/gcores/tags.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; let viewType: ViewType = ViewType.Articles; diff --git a/lib/routes/gcores/topics.ts b/lib/routes/gcores/topics.ts index d5056cc61..6ade81fca 100644 --- a/lib/routes/gcores/topics.ts +++ b/lib/routes/gcores/topics.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/gcores/util.ts b/lib/routes/gcores/util.ts index 85c036fa2..4e90b2278 100644 --- a/lib/routes/gcores/util.ts +++ b/lib/routes/gcores/util.ts @@ -1,11 +1,11 @@ -import { type Data, type DataItem } from '@/types'; - -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; -import path from 'node:path'; + +import { type Data, type DataItem } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import { parseContent } from './parser'; @@ -170,4 +170,4 @@ const processItems = async (limit: number, query: any, apiUrl: string, targetUrl }; }; -export { baseUrl, imageBaseUrl, audioBaseUrl, processItems }; +export { audioBaseUrl, baseUrl, imageBaseUrl, processItems }; diff --git a/lib/routes/gcores/videos.ts b/lib/routes/gcores/videos.ts index 92d44b823..5be5f91e3 100644 --- a/lib/routes/gcores/videos.ts +++ b/lib/routes/gcores/videos.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/gdsrx/index.ts b/lib/routes/gdsrx/index.ts index abbb9e603..50e261afd 100644 --- a/lib/routes/gdsrx/index.ts +++ b/lib/routes/gdsrx/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gdufs/news.ts b/lib/routes/gdufs/news.ts index 49a284d47..031928e6f 100644 --- a/lib/routes/gdufs/news.ts +++ b/lib/routes/gdufs/news.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/gdufs/xwxy/index.ts b/lib/routes/gdufs/xwxy/index.ts index b652c6005..ae9010305 100644 --- a/lib/routes/gdufs/xwxy/index.ts +++ b/lib/routes/gdufs/xwxy/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/gdut/oa-news.ts b/lib/routes/gdut/oa-news.ts index 60d5c3c10..35fba5e34 100644 --- a/lib/routes/gdut/oa-news.ts +++ b/lib/routes/gdut/oa-news.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { CookieJar } from 'tough-cookie'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import pMap from 'p-map'; const site = 'https://oas.gdut.edu.cn/seeyon'; const typeMap = { diff --git a/lib/routes/geekpark/index.ts b/lib/routes/geekpark/index.ts index 39b312498..9fddca5c9 100644 --- a/lib/routes/geekpark/index.ts +++ b/lib/routes/geekpark/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { column } = ctx.req.param(); diff --git a/lib/routes/gelbooru/post.ts b/lib/routes/gelbooru/post.ts index c8977cee8..64a28a5ad 100644 --- a/lib/routes/gelbooru/post.ts +++ b/lib/routes/gelbooru/post.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; -import { Context } from 'hono'; -import { parseDate } from '@/utils/parse-date'; -import { renderDesc, getAPIKeys } from './utils'; - -import got from '@/utils/got'; +import type { Context } from 'hono'; import queryString from 'query-string'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import { getAPIKeys, renderDesc } from './utils'; + export const route: Route = { path: '/post/:tags?/:quality?', categories: ['picture'], diff --git a/lib/routes/gelbooru/utils.ts b/lib/routes/gelbooru/utils.ts index bf74c2fa6..3d59a4e9a 100644 --- a/lib/routes/gelbooru/utils.ts +++ b/lib/routes/gelbooru/utils.ts @@ -1,6 +1,7 @@ import path from 'node:path'; -import { art } from '@/utils/render'; + import { config } from '@/config'; +import { art } from '@/utils/render'; export function renderDesc(post, link, quality: 'sample' | 'orig') { const { id, source, owner, file_url: fileUrl, tags, score } = post; diff --git a/lib/routes/gelonghui/home.ts b/lib/routes/gelonghui/home.ts index 99fbae0da..988ae246c 100644 --- a/lib/routes/gelonghui/home.ts +++ b/lib/routes/gelonghui/home.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/gelonghui/hot-article.ts b/lib/routes/gelonghui/hot-article.ts index 823d2056c..8986ffd66 100644 --- a/lib/routes/gelonghui/hot-article.ts +++ b/lib/routes/gelonghui/hot-article.ts @@ -1,7 +1,10 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/gelonghui/keyword.ts b/lib/routes/gelonghui/keyword.ts index d2cff515f..65091fcab 100644 --- a/lib/routes/gelonghui/keyword.ts +++ b/lib/routes/gelonghui/keyword.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/gelonghui/live.ts b/lib/routes/gelonghui/live.ts index 85336493d..fe52724a5 100644 --- a/lib/routes/gelonghui/live.ts +++ b/lib/routes/gelonghui/live.ts @@ -1,9 +1,10 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const baseUrl = 'https://www.gelonghui.com'; diff --git a/lib/routes/gelonghui/subject.ts b/lib/routes/gelonghui/subject.ts index 66a58253f..368f07a34 100644 --- a/lib/routes/gelonghui/subject.ts +++ b/lib/routes/gelonghui/subject.ts @@ -1,8 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/gelonghui/user.ts b/lib/routes/gelonghui/user.ts index be073674d..968e30d0c 100644 --- a/lib/routes/gelonghui/user.ts +++ b/lib/routes/gelonghui/user.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/gelonghui/utils.ts b/lib/routes/gelonghui/utils.ts index 9a2259fac..2080c7c4a 100644 --- a/lib/routes/gelonghui/utils.ts +++ b/lib/routes/gelonghui/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/genossenschaften/index.ts b/lib/routes/genossenschaften/index.ts index 40d978901..f9ad489e1 100644 --- a/lib/routes/genossenschaften/index.ts +++ b/lib/routes/genossenschaften/index.ts @@ -1,6 +1,7 @@ import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + import type { Data, DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; const FEED_TITLE = 'Genossenschaften.immo' as const; const FEED_LOGO = 'https://genossenschaften.immo/static/gimmo/img/favicon/favicon-128x128.png' as const; diff --git a/lib/routes/geocaching/blogs.ts b/lib/routes/geocaching/blogs.ts index 2917349de..cb4beda0a 100644 --- a/lib/routes/geocaching/blogs.ts +++ b/lib/routes/geocaching/blogs.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/gesiba/index.ts b/lib/routes/gesiba/index.ts index 0a3ec13ad..164cc5a73 100644 --- a/lib/routes/gesiba/index.ts +++ b/lib/routes/gesiba/index.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import ofetch from '@/utils/ofetch'; -import type { Data, DataItem, Route } from '@/types'; const FEED_TITLE = 'Wohnungen - Gesiba' as const; const FEED_LANGUAGE = 'de' as const; diff --git a/lib/routes/gesiba/namespace.ts b/lib/routes/gesiba/namespace.ts index 6d9311035..a75ff0d02 100644 --- a/lib/routes/gesiba/namespace.ts +++ b/lib/routes/gesiba/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'Gesiba', diff --git a/lib/routes/getdr/index.ts b/lib/routes/getdr/index.ts index baedf7b48..03e9c631a 100644 --- a/lib/routes/getdr/index.ts +++ b/lib/routes/getdr/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/getitfree/index.ts b/lib/routes/getitfree/index.ts index 08443ab3f..47998a802 100644 --- a/lib/routes/getitfree/index.ts +++ b/lib/routes/getitfree/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { apiSlug, rootUrl, bakeFilterSearchParams, bakeFiltersWithPair, bakeUrl, fetchData, getFilterNameForTitle, getFilterParamsForUrl, parseFilterStr } from './util'; +import { apiSlug, bakeFilterSearchParams, bakeFiltersWithPair, bakeUrl, fetchData, getFilterNameForTitle, getFilterParamsForUrl, parseFilterStr, rootUrl } from './util'; export const route: Route = { path: '/:filter{.+}?', diff --git a/lib/routes/getitfree/util.ts b/lib/routes/getitfree/util.ts index 2915c11dd..454a946aa 100644 --- a/lib/routes/getitfree/util.ts +++ b/lib/routes/getitfree/util.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + const rootUrl = 'https://getitfree.cn'; const apiSlug = 'wp-json/wp/v2'; @@ -312,4 +313,4 @@ const parseFilterStr = (filterStr) => { return parseStr(filterStr, {}); }; -export { apiSlug, rootUrl, bakeFilterSearchParams, bakeFiltersWithPair, bakeUrl, fetchData, getFilterNameForTitle, getFilterParamsForUrl, parseFilterStr }; +export { apiSlug, bakeFilterSearchParams, bakeFiltersWithPair, bakeUrl, fetchData, getFilterNameForTitle, getFilterParamsForUrl, parseFilterStr, rootUrl }; diff --git a/lib/routes/gettr/user.ts b/lib/routes/gettr/user.ts index 1e1e6d386..06b781637 100644 --- a/lib/routes/gettr/user.ts +++ b/lib/routes/gettr/user.ts @@ -1,9 +1,10 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const actionMap = { pub_pst: 'Published a post: ', diff --git a/lib/routes/gf-cn/news.ts b/lib/routes/gf-cn/news.ts index 1544b6030..46d2bb433 100644 --- a/lib/routes/gf-cn/news.ts +++ b/lib/routes/gf-cn/news.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const titles = { 1: '新闻', diff --git a/lib/routes/gihyo/group.ts b/lib/routes/gihyo/group.ts index e4a435ad2..a3398df68 100644 --- a/lib/routes/gihyo/group.ts +++ b/lib/routes/gihyo/group.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gisreportsonline/index.ts b/lib/routes/gisreportsonline/index.ts index fcf9b2ff4..de27af795 100644 --- a/lib/routes/gisreportsonline/index.ts +++ b/lib/routes/gisreportsonline/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/:path{.*}', diff --git a/lib/routes/gitcode/repos/commits.ts b/lib/routes/gitcode/repos/commits.ts index 13f2e9a90..9d732a1b3 100644 --- a/lib/routes/gitcode/repos/commits.ts +++ b/lib/routes/gitcode/repos/commits.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; const md = MarkdownIt({ html: true, diff --git a/lib/routes/gitee/repos/commits.ts b/lib/routes/gitee/repos/commits.ts index 742d0dca5..d29d47196 100644 --- a/lib/routes/gitee/repos/commits.ts +++ b/lib/routes/gitee/repos/commits.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/gitee/repos/events.ts b/lib/routes/gitee/repos/events.ts index 67f1fc7ba..0057395dd 100644 --- a/lib/routes/gitee/repos/events.ts +++ b/lib/routes/gitee/repos/events.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/gitee/repos/releases.ts b/lib/routes/gitee/repos/releases.ts index 083cb442c..5257dc4b0 100644 --- a/lib/routes/gitee/repos/releases.ts +++ b/lib/routes/gitee/repos/releases.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/gitee/users/events.ts b/lib/routes/gitee/users/events.ts index e68a222a4..6322be0bc 100644 --- a/lib/routes/gitee/users/events.ts +++ b/lib/routes/gitee/users/events.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/github/activity.ts b/lib/routes/github/activity.ts index 04f041511..785a42e37 100644 --- a/lib/routes/github/activity.ts +++ b/lib/routes/github/activity.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; import Parser from 'rss-parser'; import sanitizeHtml from 'sanitize-html'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + const parser = new Parser(); export const route: Route = { diff --git a/lib/routes/github/advisor.ts b/lib/routes/github/advisor.ts index 8a0edd8dc..61446b743 100644 --- a/lib/routes/github/advisor.ts +++ b/lib/routes/github/advisor.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/advisor/data/:type?/:category?', diff --git a/lib/routes/github/branches.ts b/lib/routes/github/branches.ts index 857809ff8..3b19d72d5 100644 --- a/lib/routes/github/branches.ts +++ b/lib/routes/github/branches.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/branches/:user/:repo', diff --git a/lib/routes/github/comments.ts b/lib/routes/github/comments.ts index cfc6148bd..2b6446dc4 100644 --- a/lib/routes/github/comments.ts +++ b/lib/routes/github/comments.ts @@ -1,13 +1,16 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, }); const rootUrl = 'https://github.com'; const apiUrl = 'https://api.github.com'; -import { config } from '@/config'; + const typeDict = { issue: { title: 'Issue', diff --git a/lib/routes/github/contributors.ts b/lib/routes/github/contributors.ts index 5237c6bb5..3e5f63c27 100644 --- a/lib/routes/github/contributors.ts +++ b/lib/routes/github/contributors.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/contributors/:user/:repo/:order?/:anon?', diff --git a/lib/routes/github/discussions.ts b/lib/routes/github/discussions.ts index d9adf5c05..028f17c4f 100644 --- a/lib/routes/github/discussions.ts +++ b/lib/routes/github/discussions.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; +import MarkdownIt from 'markdown-it'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; -import MarkdownIt from 'markdown-it'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const md = MarkdownIt({ html: true, linkify: true, }); -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/discussion/:user/:repo/:state?/:category?', diff --git a/lib/routes/github/file.ts b/lib/routes/github/file.ts index b1c192a0e..9edb79662 100644 --- a/lib/routes/github/file.ts +++ b/lib/routes/github/file.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { config } from '@/config'; import queryString from 'query-string'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/file/:user/:repo/:branch/:filepath{.+}', example: '/github/file/DIYgod/RSSHub/master/README.md', diff --git a/lib/routes/github/follower.ts b/lib/routes/github/follower.ts index 30363b8b2..47941fb95 100644 --- a/lib/routes/github/follower.ts +++ b/lib/routes/github/follower.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/user/followers/:user', diff --git a/lib/routes/github/gist.ts b/lib/routes/github/gist.ts index 15972bec8..85e214e8d 100644 --- a/lib/routes/github/gist.ts +++ b/lib/routes/github/gist.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/github/issue.ts b/lib/routes/github/issue.ts index 7b72acc0f..f0c95a5bd 100644 --- a/lib/routes/github/issue.ts +++ b/lib/routes/github/issue.ts @@ -1,13 +1,16 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; -import { config } from '@/config'; import MarkdownIt from 'markdown-it'; +import queryString from 'query-string'; + +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const md = MarkdownIt({ html: true, linkify: true, }); -import queryString from 'query-string'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/issue/:user/:repo/:state?/:labels?', diff --git a/lib/routes/github/notifications.ts b/lib/routes/github/notifications.ts index e7105b72a..3c658fd2a 100644 --- a/lib/routes/github/notifications.ts +++ b/lib/routes/github/notifications.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; const apiUrl = 'https://api.github.com'; -import { config } from '@/config'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/notifications', diff --git a/lib/routes/github/org-event.ts b/lib/routes/github/org-event.ts index ad016ad60..4ebfb47de 100644 --- a/lib/routes/github/org-event.ts +++ b/lib/routes/github/org-event.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + import { filterEvents } from './eventapi'; export const route: Route = { diff --git a/lib/routes/github/private-feed.ts b/lib/routes/github/private-feed.ts index 7ee7af1f0..3970df680 100644 --- a/lib/routes/github/private-feed.ts +++ b/lib/routes/github/private-feed.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + import { filterEvents } from './eventapi'; export const route: Route = { diff --git a/lib/routes/github/pulls.ts b/lib/routes/github/pulls.ts index a4ccb97f2..1d0c87698 100644 --- a/lib/routes/github/pulls.ts +++ b/lib/routes/github/pulls.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + const md = MarkdownIt({ html: true, linkify: true, }); -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/pull/:user/:repo/:state?/:labels?', diff --git a/lib/routes/github/pulse.ts b/lib/routes/github/pulse.ts index fbcf6326c..ca21eb559 100644 --- a/lib/routes/github/pulse.ts +++ b/lib/routes/github/pulse.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; import { load } from 'cheerio'; -import path from 'node:path'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import md5 from '@/utils/md5'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/github/repo-event.ts b/lib/routes/github/repo-event.ts index 5bdb5bb3f..9d56ffd45 100644 --- a/lib/routes/github/repo-event.ts +++ b/lib/routes/github/repo-event.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + import { filterEvents } from './eventapi'; export const route: Route = { diff --git a/lib/routes/github/repos.ts b/lib/routes/github/repos.ts index 8f4ae671d..b0c8c15cc 100644 --- a/lib/routes/github/repos.ts +++ b/lib/routes/github/repos.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/github/search.ts b/lib/routes/github/search.ts index df3c38f31..d591edea9 100644 --- a/lib/routes/github/search.ts +++ b/lib/routes/github/search.ts @@ -1,7 +1,8 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import * as url from 'node:url'; +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + const host = 'https://github.com'; export const route: Route = { diff --git a/lib/routes/github/star.ts b/lib/routes/github/star.ts index b4cbcdec0..f8b3fb29b 100644 --- a/lib/routes/github/star.ts +++ b/lib/routes/github/star.ts @@ -1,7 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/stars/:user/:repo', diff --git a/lib/routes/github/starred-repos.ts b/lib/routes/github/starred-repos.ts index 707d84e12..2ecefa84f 100644 --- a/lib/routes/github/starred-repos.ts +++ b/lib/routes/github/starred-repos.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import md5 from '@/utils/md5'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/github/topic.ts b/lib/routes/github/topic.ts index 811184ee3..61ef585ed 100644 --- a/lib/routes/github/topic.ts +++ b/lib/routes/github/topic.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/github/trending.ts b/lib/routes/github/trending.ts index 10eb68cc3..d65c88dba 100644 --- a/lib/routes/github/trending.ts +++ b/lib/routes/github/trending.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import { load } from 'cheerio'; -import path from 'node:path'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/trending/:since/:language/:spoken_language?', diff --git a/lib/routes/github/user-event.ts b/lib/routes/github/user-event.ts index 2bc3ec3eb..2082a2e7c 100644 --- a/lib/routes/github/user-event.ts +++ b/lib/routes/github/user-event.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + import { filterEvents } from './eventapi'; export const route: Route = { diff --git a/lib/routes/github/wiki.ts b/lib/routes/github/wiki.ts index f056205c6..379d35dea 100644 --- a/lib/routes/github/wiki.ts +++ b/lib/routes/github/wiki.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://github.com'; diff --git a/lib/routes/gitpod/blog.ts b/lib/routes/gitpod/blog.ts index 4ddf0f0f1..a4c262192 100644 --- a/lib/routes/gitpod/blog.ts +++ b/lib/routes/gitpod/blog.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { rootUrl } from './utils'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import { rootUrl } from './utils'; export const route: Route = { path: '/blog', diff --git a/lib/routes/gitpod/changelog.ts b/lib/routes/gitpod/changelog.ts index 8837cb17b..468567351 100644 --- a/lib/routes/gitpod/changelog.ts +++ b/lib/routes/gitpod/changelog.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/gitstar-ranking/index.ts b/lib/routes/gitstar-ranking/index.ts index b0114a93a..f59b1487a 100644 --- a/lib/routes/gitstar-ranking/index.ts +++ b/lib/routes/gitstar-ranking/index.ts @@ -1,12 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = 'repositories' } = ctx.req.param(); diff --git a/lib/routes/globallawreview/index.ts b/lib/routes/globallawreview/index.ts index 3710e73be..ea64e6d40 100644 --- a/lib/routes/globallawreview/index.ts +++ b/lib/routes/globallawreview/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/', radar: [ diff --git a/lib/routes/gmcmonline/chinacustoms.ts b/lib/routes/gmcmonline/chinacustoms.ts index 9386d1579..d67b7b39c 100644 --- a/lib/routes/gmcmonline/chinacustoms.ts +++ b/lib/routes/gmcmonline/chinacustoms.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/gmu/news.ts b/lib/routes/gmu/news.ts index 4eb50f711..c845908cf 100644 --- a/lib/routes/gmu/news.ts +++ b/lib/routes/gmu/news.ts @@ -1,9 +1,10 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import type { Context } from 'hono'; + import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/news/:type?', diff --git a/lib/routes/gmu/yjs.ts b/lib/routes/gmu/yjs.ts index 3cba8be3c..b5964e1d9 100644 --- a/lib/routes/gmu/yjs.ts +++ b/lib/routes/gmu/yjs.ts @@ -1,9 +1,10 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import type { Route } from '@/types'; import type { Context } from 'hono'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const sections = { zsgz: { diff --git a/lib/routes/go/jihs/idwr.ts b/lib/routes/go/jihs/idwr.ts index 4941e8df9..15d36eced 100644 --- a/lib/routes/go/jihs/idwr.ts +++ b/lib/routes/go/jihs/idwr.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { year = new Date().getFullYear() } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/go/mhlw/pdf.ts b/lib/routes/go/mhlw/pdf.ts index c47ef7179..267916b7a 100644 --- a/lib/routes/go/mhlw/pdf.ts +++ b/lib/routes/go/mhlw/pdf.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const handler = async (ctx) => { const { category = 'stf/seisakunitsuite/bunya/houkokusuunosuii' } = ctx.req.param(); const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30; diff --git a/lib/routes/gocn/jobs.ts b/lib/routes/gocn/jobs.ts index 09a676ef2..46a4cc556 100644 --- a/lib/routes/gocn/jobs.ts +++ b/lib/routes/gocn/jobs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { renderHTML } from './utils'; export const route: Route = { diff --git a/lib/routes/gocn/news.ts b/lib/routes/gocn/news.ts index 6cefd4e04..c84538bd3 100644 --- a/lib/routes/gocn/news.ts +++ b/lib/routes/gocn/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { renderHTML } from './utils'; export const route: Route = { diff --git a/lib/routes/gocn/topics.ts b/lib/routes/gocn/topics.ts index acbf327ea..5226d1704 100644 --- a/lib/routes/gocn/topics.ts +++ b/lib/routes/gocn/topics.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { renderHTML } from './utils'; export const route: Route = { diff --git a/lib/routes/gofans/index.ts b/lib/routes/gofans/index.ts index bdcf83dd8..fb129ee64 100644 --- a/lib/routes/gofans/index.ts +++ b/lib/routes/gofans/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:kind?', diff --git a/lib/routes/gogoanimehd/recent-releases.ts b/lib/routes/gogoanimehd/recent-releases.ts index 769ac7b24..989c2d020 100644 --- a/lib/routes/gogoanimehd/recent-releases.ts +++ b/lib/routes/gogoanimehd/recent-releases.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/recent-releases', categories: ['anime'], diff --git a/lib/routes/google/album.ts b/lib/routes/google/album.ts index e09bb4955..39f15f9a9 100644 --- a/lib/routes/google/album.ts +++ b/lib/routes/google/album.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/google/alerts.ts b/lib/routes/google/alerts.ts index f619bc6ef..c7df26f8a 100644 --- a/lib/routes/google/alerts.ts +++ b/lib/routes/google/alerts.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/alerts/:keyword', categories: ['other'], diff --git a/lib/routes/google/citations.ts b/lib/routes/google/citations.ts index ac0abc0ad..f70bbe226 100644 --- a/lib/routes/google/citations.ts +++ b/lib/routes/google/citations.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/citations/:id', categories: ['journal'], diff --git a/lib/routes/google/developers.ts b/lib/routes/google/developers.ts index 54777fc1b..4322f5f7d 100644 --- a/lib/routes/google/developers.ts +++ b/lib/routes/google/developers.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import type { Context } from 'hono'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://developers.googleblog.com'; export const route: Route = { diff --git a/lib/routes/google/doodles.ts b/lib/routes/google/doodles.ts index 723702b2d..7d695ac59 100644 --- a/lib/routes/google/doodles.ts +++ b/lib/routes/google/doodles.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/google/extension.ts b/lib/routes/google/extension.ts index 5a4b5efae..4a970fd8d 100644 --- a/lib/routes/google/extension.ts +++ b/lib/routes/google/extension.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/google/fonts.ts b/lib/routes/google/fonts.ts index edc6a5669..2d5dcda6f 100644 --- a/lib/routes/google/fonts.ts +++ b/lib/routes/google/fonts.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { parseDate } from '@/utils/parse-date'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const titleMap = { date: 'Newest', diff --git a/lib/routes/google/jules.ts b/lib/routes/google/jules.ts index f3ff756ae..b732404cd 100644 --- a/lib/routes/google/jules.ts +++ b/lib/routes/google/jules.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/google/news.ts b/lib/routes/google/news.ts index 0e519bd0a..2bb0fc25e 100644 --- a/lib/routes/google/news.ts +++ b/lib/routes/google/news.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const baseUrl = 'https://news.google.com'; diff --git a/lib/routes/google/play.ts b/lib/routes/google/play.ts index 07118e01b..7ebd53272 100644 --- a/lib/routes/google/play.ts +++ b/lib/routes/google/play.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import type { Context } from 'hono'; import gPlay from 'google-play-scraper'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/google/research.ts b/lib/routes/google/research.ts index db5acba43..88f36f117 100644 --- a/lib/routes/google/research.ts +++ b/lib/routes/google/research.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://research.google'; diff --git a/lib/routes/google/scholar.ts b/lib/routes/google/scholar.ts index a5bca1a83..23d9f571e 100644 --- a/lib/routes/google/scholar.ts +++ b/lib/routes/google/scholar.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/scholar/:query', categories: ['journal'], diff --git a/lib/routes/google/search.ts b/lib/routes/google/search.ts index fff174e29..82691f941 100644 --- a/lib/routes/google/search.ts +++ b/lib/routes/google/search.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { config } from '@/config'; export const route: Route = { path: '/search/:keyword/:language?', diff --git a/lib/routes/gov/ah/kjt.ts b/lib/routes/gov/ah/kjt.ts index 625fd9f7b..b156a67b7 100644 --- a/lib/routes/gov/ah/kjt.ts +++ b/lib/routes/gov/ah/kjt.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'kjzx/tzgg' } = ctx.req.param(); diff --git a/lib/routes/gov/beijing/bjedu/gh.ts b/lib/routes/gov/beijing/bjedu/gh.ts index 6355d55c8..528387bfa 100644 --- a/lib/routes/gov/beijing/bjedu/gh.ts +++ b/lib/routes/gov/beijing/bjedu/gh.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/beijing/bphc/index.ts b/lib/routes/gov/beijing/bphc/index.ts index ca1553cd0..320711d55 100644 --- a/lib/routes/gov/beijing/bphc/index.ts +++ b/lib/routes/gov/beijing/bphc/index.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/beijing/jw/tzgg.ts b/lib/routes/gov/beijing/jw/tzgg.ts index c72a8147e..dfd3053b6 100644 --- a/lib/routes/gov/beijing/jw/tzgg.ts +++ b/lib/routes/gov/beijing/jw/tzgg.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/beijing/jw/tzgg', diff --git a/lib/routes/gov/beijing/kw/index.ts b/lib/routes/gov/beijing/kw/index.ts index be65a97e2..bab38a33d 100644 --- a/lib/routes/gov/beijing/kw/index.ts +++ b/lib/routes/gov/beijing/kw/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'http://kw.beijing.gov.cn'; diff --git a/lib/routes/gov/caac/cjwt.ts b/lib/routes/gov/caac/cjwt.ts index 48aba151f..54f6c56c1 100644 --- a/lib/routes/gov/caac/cjwt.ts +++ b/lib/routes/gov/caac/cjwt.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/caac/cjwt/:category?', diff --git a/lib/routes/gov/cac/index.ts b/lib/routes/gov/cac/index.ts index 95d46dcbd..1aec93ff5 100644 --- a/lib/routes/gov/cac/index.ts +++ b/lib/routes/gov/cac/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { config } from '@/config'; export const route: Route = { path: '/cac/*', diff --git a/lib/routes/gov/cbirc/index.ts b/lib/routes/gov/cbirc/index.ts index 3b20b4161..dffbc05e3 100644 --- a/lib/routes/gov/cbirc/index.ts +++ b/lib/routes/gov/cbirc/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { id = '915' } = ctx.req.param(); diff --git a/lib/routes/gov/ccdi/index.ts b/lib/routes/gov/ccdi/index.ts index 7f870aa69..9c1f5d7d8 100644 --- a/lib/routes/gov/ccdi/index.ts +++ b/lib/routes/gov/ccdi/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; -import { rootUrl, parseNewsList, parseArticle } from './utils'; + +import { parseArticle, parseNewsList, rootUrl } from './utils'; export const route: Route = { path: '/ccdi/*', diff --git a/lib/routes/gov/ccdi/utils.ts b/lib/routes/gov/ccdi/utils.ts index 667be1a14..ff1366a58 100644 --- a/lib/routes/gov/ccdi/utils.ts +++ b/lib/routes/gov/ccdi/utils.ts @@ -1,10 +1,11 @@ -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; +import { Cookie, CookieJar } from 'tough-cookie'; + +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { CookieJar, Cookie } from 'tough-cookie'; const cookieJar = new CookieJar(); const owner = '中央纪委国家监委网站'; @@ -88,4 +89,4 @@ const parseArticle = async (item) => { }); }; -export { rootUrl, parseNewsList, parseArticle }; +export { parseArticle, parseNewsList, rootUrl }; diff --git a/lib/routes/gov/chinamine-safety/util.ts b/lib/routes/gov/chinamine-safety/util.ts index 1e92aaee2..7a5c3bff1 100644 --- a/lib/routes/gov/chinamine-safety/util.ts +++ b/lib/routes/gov/chinamine-safety/util.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.chinamine-safety.gov.cn'; @@ -69,4 +70,4 @@ const fetchData = ($, currentUrl) => { }; }; -export { rootUrl, processItems, fetchData }; +export { fetchData, processItems, rootUrl }; diff --git a/lib/routes/gov/chinamine-safety/xw.ts b/lib/routes/gov/chinamine-safety/xw.ts index 26c456e95..becd3ff8c 100644 --- a/lib/routes/gov/chinamine-safety/xw.ts +++ b/lib/routes/gov/chinamine-safety/xw.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; -import { rootUrl, processItems, fetchData } from './util'; +import { fetchData, processItems, rootUrl } from './util'; export const route: Route = { path: '/chinamine-safety/xw/:category{.+}?', diff --git a/lib/routes/gov/chinamine-safety/zfxxgk.ts b/lib/routes/gov/chinamine-safety/zfxxgk.ts index 8c7fe865c..2b1fdf3c7 100644 --- a/lib/routes/gov/chinamine-safety/zfxxgk.ts +++ b/lib/routes/gov/chinamine-safety/zfxxgk.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { rootUrl, processItems, fetchData } from './util'; +import { fetchData, processItems, rootUrl } from './util'; export const route: Route = { path: '/chinamine-safety/zfxxgk/:category{.+}?', diff --git a/lib/routes/gov/chinatax/latest.ts b/lib/routes/gov/chinatax/latest.ts index 4e69529ab..a3dabc627 100644 --- a/lib/routes/gov/chinatax/latest.ts +++ b/lib/routes/gov/chinatax/latest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/chinatax/latest', diff --git a/lib/routes/gov/chongqing/gzw.ts b/lib/routes/gov/chongqing/gzw.ts index 7ab0938e8..479d0069d 100644 --- a/lib/routes/gov/chongqing/gzw.ts +++ b/lib/routes/gov/chongqing/gzw.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/chongqing/gzw/:category{.+}?', diff --git a/lib/routes/gov/chongqing/rsks.ts b/lib/routes/gov/chongqing/rsks.ts index 09f6f66be..05934b386 100644 --- a/lib/routes/gov/chongqing/rsks.ts +++ b/lib/routes/gov/chongqing/rsks.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const rsksUrl = 'https://rlsbj.cq.gov.cn/ywzl/rsks/tzgg_109374/'; export const route: Route = { path: '/chongqing/rsks', diff --git a/lib/routes/gov/chongqing/sydwgkzp.ts b/lib/routes/gov/chongqing/sydwgkzp.ts index 7b22e485a..39b3d318e 100644 --- a/lib/routes/gov/chongqing/sydwgkzp.ts +++ b/lib/routes/gov/chongqing/sydwgkzp.ts @@ -1,9 +1,10 @@ -import { Route, Data } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import type { Context } from 'hono'; export const route: Route = { path: '/chongqing/sydwgkzp/:year?', diff --git a/lib/routes/gov/cmse/fxrw.ts b/lib/routes/gov/cmse/fxrw.ts index d138bd1b0..18e025d9a 100644 --- a/lib/routes/gov/cmse/fxrw.ts +++ b/lib/routes/gov/cmse/fxrw.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/cmse/fxrw', diff --git a/lib/routes/gov/cmse/index.ts b/lib/routes/gov/cmse/index.ts index ef0f085bf..299b1e4eb 100644 --- a/lib/routes/gov/cmse/index.ts +++ b/lib/routes/gov/cmse/index.ts @@ -1,12 +1,12 @@ -import { Route } from '@/types'; - -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/cmse/*', diff --git a/lib/routes/gov/cn/news/index.ts b/lib/routes/gov/cn/news/index.ts index 020f11d63..510ec2fd9 100644 --- a/lib/routes/gov/cn/news/index.ts +++ b/lib/routes/gov/cn/news/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/cnnic/index.ts b/lib/routes/gov/cnnic/index.ts index 4a797167a..9f66c6f4a 100644 --- a/lib/routes/gov/cnnic/index.ts +++ b/lib/routes/gov/cnnic/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/cnnic/*', diff --git a/lib/routes/gov/csrc/auditstatus.ts b/lib/routes/gov/csrc/auditstatus.ts index f7f3cf390..8a0161547 100644 --- a/lib/routes/gov/csrc/auditstatus.ts +++ b/lib/routes/gov/csrc/auditstatus.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; +import md5 from '@/utils/md5'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import md5 from '@/utils/md5'; export const route: Route = { path: '/csrc/auditstatus/:apply_id', diff --git a/lib/routes/gov/csrc/csrc.ts b/lib/routes/gov/csrc/csrc.ts index 7491a7ded..b0eee4dfa 100644 --- a/lib/routes/gov/csrc/csrc.ts +++ b/lib/routes/gov/csrc/csrc.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { const { id = 'c101972' } = ctx.req.param(); diff --git a/lib/routes/gov/csrc/news.ts b/lib/routes/gov/csrc/news.ts index f6f2a7757..2db23dd1a 100644 --- a/lib/routes/gov/csrc/news.ts +++ b/lib/routes/gov/csrc/news.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/csrc/news/:suffix{.+}?', diff --git a/lib/routes/gov/customs/list.ts b/lib/routes/gov/customs/list.ts index 27d1b03b1..d28d20200 100644 --- a/lib/routes/gov/customs/list.ts +++ b/lib/routes/gov/customs/list.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { host, puppeteerGet } from './utils'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import puppeteer from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; + +import { host, puppeteerGet } from './utils'; export const route: Route = { path: '/customs/list/:gchannel?', diff --git a/lib/routes/gov/dianbai/dianbai.ts b/lib/routes/gov/dianbai/dianbai.ts index 01851d937..d640188df 100644 --- a/lib/routes/gov/dianbai/dianbai.ts +++ b/lib/routes/gov/dianbai/dianbai.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/forestry/gjlckjdjt.ts b/lib/routes/gov/forestry/gjlckjdjt.ts index 6fefefdd1..8c6baef00 100644 --- a/lib/routes/gov/forestry/gjlckjdjt.ts +++ b/lib/routes/gov/forestry/gjlckjdjt.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/forestry/gjlckjdjt/:category?', diff --git a/lib/routes/gov/gaozhou/gaozhou.ts b/lib/routes/gov/gaozhou/gaozhou.ts index 38f2025ad..8cf0731e2 100644 --- a/lib/routes/gov/gaozhou/gaozhou.ts +++ b/lib/routes/gov/gaozhou/gaozhou.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/general/general.ts b/lib/routes/gov/general/general.ts index 016d21bf7..6f0d4e677 100644 --- a/lib/routes/gov/general/general.ts +++ b/lib/routes/gov/general/general.ts @@ -1,5 +1,7 @@ -import { getSubPath } from '@/utils/common-utils'; +import { load } from 'cheerio'; + import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; // 来人拯救一下啊( >﹏<。) // 待做功能: // 1. 传入和处理 @@ -10,7 +12,6 @@ import cache from '@/utils/cache'; // [] 示例1: http://www.dianbai.gov.cn/ywdt/dbyw/content/post_1091433.html // 4. 处理网站功能 // [] hdjlpt 互动交流 - // 使用方法 // import { gdgov } from '../general/general'; // @@ -36,12 +37,10 @@ import cache from '@/utils/cache'; // }; // await gdgov(info, ctx); // }; - import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; import { finishArticleItem } from '@/utils/wechat-mp'; const gdgov = async (info, ctx) => { diff --git a/lib/routes/gov/guangdong/tqyb/sncsyjxh.ts b/lib/routes/gov/guangdong/tqyb/sncsyjxh.ts index 3c7941f17..8321dfe75 100644 --- a/lib/routes/gov/guangdong/tqyb/sncsyjxh.ts +++ b/lib/routes/gov/guangdong/tqyb/sncsyjxh.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; const rootUrl = 'http://www.tqyb.com.cn'; diff --git a/lib/routes/gov/guangdong/tqyb/tfxtq.ts b/lib/routes/gov/guangdong/tqyb/tfxtq.ts index d03bb0c2d..37f2a96c9 100644 --- a/lib/routes/gov/guangdong/tqyb/tfxtq.ts +++ b/lib/routes/gov/guangdong/tqyb/tfxtq.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const rootUrl = 'http://www.tqyb.com.cn'; diff --git a/lib/routes/gov/gz/index.ts b/lib/routes/gov/gz/index.ts index 3c9a58a14..02f799a0f 100644 --- a/lib/routes/gov/gz/index.ts +++ b/lib/routes/gov/gz/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.gz.gov.cn'; diff --git a/lib/routes/gov/hainan/iitb/tzgg.ts b/lib/routes/gov/hainan/iitb/tzgg.ts index a071279a0..6cb7526dd 100644 --- a/lib/routes/gov/hainan/iitb/tzgg.ts +++ b/lib/routes/gov/hainan/iitb/tzgg.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/hangzhou/zwfw.ts b/lib/routes/gov/hangzhou/zwfw.ts index 6dd7ff1f5..48a3d36c5 100644 --- a/lib/routes/gov/hangzhou/zwfw.ts +++ b/lib/routes/gov/hangzhou/zwfw.ts @@ -1,15 +1,17 @@ -import { Route } from '@/types'; +import path from 'node:path'; + import { load } from 'cheerio'; -import puppeteer from '@/utils/puppeteer'; -import ofetch from '@/utils/ofetch'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { crawler, analyzer } from './zjzwfw'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; +import puppeteer from '@/utils/puppeteer'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + +import { analyzer, crawler } from './zjzwfw'; export const route: Route = { path: '/hangzhou/zwfw', diff --git a/lib/routes/gov/hebei/czt.ts b/lib/routes/gov/hebei/czt.ts index ae9943521..e5a56a30a 100644 --- a/lib/routes/gov/hebei/czt.ts +++ b/lib/routes/gov/hebei/czt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/huazhou/huazhou.ts b/lib/routes/gov/huazhou/huazhou.ts index 69dc3826a..3c4e28aad 100644 --- a/lib/routes/gov/huazhou/huazhou.ts +++ b/lib/routes/gov/huazhou/huazhou.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/huizhou/zwgk/index.ts b/lib/routes/gov/huizhou/zwgk/index.ts index e9bbe8ba6..b9aaebb0a 100644 --- a/lib/routes/gov/huizhou/zwgk/index.ts +++ b/lib/routes/gov/huizhou/zwgk/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/hunan/changsha/major-email.ts b/lib/routes/gov/hunan/changsha/major-email.ts index 258bf336e..641076b26 100644 --- a/lib/routes/gov/hunan/changsha/major-email.ts +++ b/lib/routes/gov/hunan/changsha/major-email.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'http://wlwz.changsha.gov.cn'; export const route: Route = { diff --git a/lib/routes/gov/immiau/news.ts b/lib/routes/gov/immiau/news.ts index efa70ea55..5222ab30c 100644 --- a/lib/routes/gov/immiau/news.ts +++ b/lib/routes/gov/immiau/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/gov/jgjcndrc/index.ts b/lib/routes/gov/jgjcndrc/index.ts index d4ec56c9b..c0a0efaaf 100644 --- a/lib/routes/gov/jgjcndrc/index.ts +++ b/lib/routes/gov/jgjcndrc/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { columnId = '1832739866673426433', subColumnId } = ctx.req.param(); diff --git a/lib/routes/gov/jiangsu/wlt/index.ts b/lib/routes/gov/jiangsu/wlt/index.ts index 14b1957b7..1b6ad453e 100644 --- a/lib/routes/gov/jiangsu/wlt/index.ts +++ b/lib/routes/gov/jiangsu/wlt/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/jiangsu/wlt/:page?', diff --git a/lib/routes/gov/jinan/healthcommission/medical-exam-notice.ts b/lib/routes/gov/jinan/healthcommission/medical-exam-notice.ts index 4e8afa8f9..222fd71ee 100644 --- a/lib/routes/gov/jinan/healthcommission/medical-exam-notice.ts +++ b/lib/routes/gov/jinan/healthcommission/medical-exam-notice.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/jinan/healthcommission/medical_exam_notice', diff --git a/lib/routes/gov/lswz/index.ts b/lib/routes/gov/lswz/index.ts index 69025db06..b712cb519 100644 --- a/lib/routes/gov/lswz/index.ts +++ b/lib/routes/gov/lswz/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'html/xinwen/index' } = ctx.req.param(); diff --git a/lib/routes/gov/maoming/maoming.ts b/lib/routes/gov/maoming/maoming.ts index b92599091..916b21494 100644 --- a/lib/routes/gov/maoming/maoming.ts +++ b/lib/routes/gov/maoming/maoming.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/maonan/maonan.ts b/lib/routes/gov/maonan/maonan.ts index 581adf52d..e9a0ca486 100644 --- a/lib/routes/gov/maonan/maonan.ts +++ b/lib/routes/gov/maonan/maonan.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/mee/nnsa.ts b/lib/routes/gov/mee/nnsa.ts index a4ecf5615..129e62ae3 100644 --- a/lib/routes/gov/mee/nnsa.ts +++ b/lib/routes/gov/mee/nnsa.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'ywdt/hjyw' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '15', 10); diff --git a/lib/routes/gov/mee/ywdt.ts b/lib/routes/gov/mee/ywdt.ts index 86570a51f..b027d7648 100644 --- a/lib/routes/gov/mee/ywdt.ts +++ b/lib/routes/gov/mee/ywdt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/mem/sgcc.ts b/lib/routes/gov/mem/sgcc.ts index 2ddce6a9d..b3574d486 100644 --- a/lib/routes/gov/mem/sgcc.ts +++ b/lib/routes/gov/mem/sgcc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/mem/zfxxgkpt.ts b/lib/routes/gov/mem/zfxxgkpt.ts index 5db799878..5e650ba12 100644 --- a/lib/routes/gov/mem/zfxxgkpt.ts +++ b/lib/routes/gov/mem/zfxxgkpt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/mfa/wjdt.ts b/lib/routes/gov/mfa/wjdt.ts index 3d15cb3ca..ee2375599 100644 --- a/lib/routes/gov/mfa/wjdt.ts +++ b/lib/routes/gov/mfa/wjdt.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const categories = { gjldrhd: 'gjldrhd_674881', diff --git a/lib/routes/gov/mgs/mgs.ts b/lib/routes/gov/mgs/mgs.ts index 9d4db6587..ea1c5256e 100644 --- a/lib/routes/gov/mgs/mgs.ts +++ b/lib/routes/gov/mgs/mgs.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/miit/wjfb.ts b/lib/routes/gov/miit/wjfb.ts index 282a1054e..9d0cadc87 100644 --- a/lib/routes/gov/miit/wjfb.ts +++ b/lib/routes/gov/miit/wjfb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.miit.gov.cn'; diff --git a/lib/routes/gov/miit/wjgs.ts b/lib/routes/gov/miit/wjgs.ts index c6a6c7422..ba9156c15 100644 --- a/lib/routes/gov/miit/wjgs.ts +++ b/lib/routes/gov/miit/wjgs.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const baseUrl = 'https://www.miit.gov.cn'; const siteUrl = `${baseUrl}/zwgk/wjgs/index.html`; diff --git a/lib/routes/gov/miit/yjzj.ts b/lib/routes/gov/miit/yjzj.ts index cd0a90196..a7ac3584f 100644 --- a/lib/routes/gov/miit/yjzj.ts +++ b/lib/routes/gov/miit/yjzj.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.miit.gov.cn'; diff --git a/lib/routes/gov/miit/zcjd.ts b/lib/routes/gov/miit/zcjd.ts index ad966c112..16888942d 100644 --- a/lib/routes/gov/miit/zcjd.ts +++ b/lib/routes/gov/miit/zcjd.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const baseUrl = 'https://www.miit.gov.cn'; const siteUrl = `${baseUrl}/zwgk/zcjd/index.html`; diff --git a/lib/routes/gov/miit/zcwj.ts b/lib/routes/gov/miit/zcwj.ts index 3aac4d5cc..35a92504f 100644 --- a/lib/routes/gov/miit/zcwj.ts +++ b/lib/routes/gov/miit/zcwj.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/miit/zcwj', diff --git a/lib/routes/gov/mmht/mmht.ts b/lib/routes/gov/mmht/mmht.ts index ee5acd9c2..355cf25f8 100644 --- a/lib/routes/gov/mmht/mmht.ts +++ b/lib/routes/gov/mmht/mmht.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/moa/gjs.ts b/lib/routes/gov/moa/gjs.ts index 7b5bd12be..715e542a5 100644 --- a/lib/routes/gov/moa/gjs.ts +++ b/lib/routes/gov/moa/gjs.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'gzdt' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/gov/moa/moa.ts b/lib/routes/gov/moa/moa.ts index fa5b1cdb2..346003717 100644 --- a/lib/routes/gov/moa/moa.ts +++ b/lib/routes/gov/moa/moa.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseRelativeDate } from '@/utils/parse-date'; const hostUrl = 'http://www.moa.gov.cn/'; diff --git a/lib/routes/gov/moa/szcpxx.ts b/lib/routes/gov/moa/szcpxx.ts index b8dff425a..ea83941fe 100644 --- a/lib/routes/gov/moa/szcpxx.ts +++ b/lib/routes/gov/moa/szcpxx.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 6; diff --git a/lib/routes/gov/moa/zdscxx.ts b/lib/routes/gov/moa/zdscxx.ts index 4a5aafb10..efbee0e64 100644 --- a/lib/routes/gov/moa/zdscxx.ts +++ b/lib/routes/gov/moa/zdscxx.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/gov/moe/moe.ts b/lib/routes/gov/moe/moe.ts index 716b8ea2f..6334ebc71 100644 --- a/lib/routes/gov/moe/moe.ts +++ b/lib/routes/gov/moe/moe.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/gov/moe/s78.ts b/lib/routes/gov/moe/s78.ts index e575d2edc..9968fb891 100644 --- a/lib/routes/gov/moe/s78.ts +++ b/lib/routes/gov/moe/s78.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/mof/bond.ts b/lib/routes/gov/mof/bond.ts index a38d34b74..6e703b03a 100644 --- a/lib/routes/gov/mof/bond.ts +++ b/lib/routes/gov/mof/bond.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const domain = 'gks.mof.gov.cn'; const theme = 'guozaiguanli'; diff --git a/lib/routes/gov/mof/gss.ts b/lib/routes/gov/mof/gss.ts index 46a5c40ef..ef91fd99d 100644 --- a/lib/routes/gov/mof/gss.ts +++ b/lib/routes/gov/mof/gss.ts @@ -1,10 +1,11 @@ -import { Data, Route } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import { Context } from 'hono'; +import timezone from '@/utils/timezone'; const DOMAIN = 'gss.mof.gov.cn'; diff --git a/lib/routes/gov/mofcom/article.ts b/lib/routes/gov/mofcom/article.ts index 4e7f66757..6fd06e75f 100644 --- a/lib/routes/gov/mofcom/article.ts +++ b/lib/routes/gov/mofcom/article.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/moj/aac/news.ts b/lib/routes/gov/moj/aac/news.ts index 7eccf2a48..e1676f5e6 100644 --- a/lib/routes/gov/moj/aac/news.ts +++ b/lib/routes/gov/moj/aac/news.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const baseUrl = 'https://www.aac.moj.gov.tw'; export const route: Route = { diff --git a/lib/routes/gov/moj/lfyjzj.ts b/lib/routes/gov/moj/lfyjzj.ts index 1f5a909a1..5e905f883 100644 --- a/lib/routes/gov/moj/lfyjzj.ts +++ b/lib/routes/gov/moj/lfyjzj.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const DOMAIN = 'www.moj.gov.cn'; diff --git a/lib/routes/gov/mot/index.ts b/lib/routes/gov/mot/index.ts index 13944a185..34aaaaa61 100644 --- a/lib/routes/gov/mot/index.ts +++ b/lib/routes/gov/mot/index.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'jiaotongyaowen' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/gov/ndrc/fggz.ts b/lib/routes/gov/ndrc/fggz.ts index 92f248ea6..118edca9e 100644 --- a/lib/routes/gov/ndrc/fggz.ts +++ b/lib/routes/gov/ndrc/fggz.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/ndrc/fggz/:category{.+}?', diff --git a/lib/routes/gov/ndrc/xwdt.ts b/lib/routes/gov/ndrc/xwdt.ts index 3c7050682..ddb1b5167 100644 --- a/lib/routes/gov/ndrc/xwdt.ts +++ b/lib/routes/gov/ndrc/xwdt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/ndrc/zfxxgk.ts b/lib/routes/gov/ndrc/zfxxgk.ts index 72e274ba3..6a6f67e2e 100644 --- a/lib/routes/gov/ndrc/zfxxgk.ts +++ b/lib/routes/gov/ndrc/zfxxgk.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/gov/nea/ghs.ts b/lib/routes/gov/nea/ghs.ts index 3de98e980..adae6b0b7 100644 --- a/lib/routes/gov/nea/ghs.ts +++ b/lib/routes/gov/nea/ghs.ts @@ -1,9 +1,11 @@ -import type { Route, DataItem } from '@/types'; +import { URL } from 'node:url'; + +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { URL } from 'node:url'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/gov/nifdc/index.ts b/lib/routes/gov/nifdc/index.ts index 8f7741889..d3be4dbb1 100644 --- a/lib/routes/gov/nifdc/index.ts +++ b/lib/routes/gov/nifdc/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/nifdc/:path{.+}?', diff --git a/lib/routes/gov/nmpa/generic.ts b/lib/routes/gov/nmpa/generic.ts index aec478957..99d062877 100644 --- a/lib/routes/gov/nmpa/generic.ts +++ b/lib/routes/gov/nmpa/generic.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import { finishArticleItem } from '@/utils/wechat-mp'; + import { config } from '@/config'; -const baseUrl = 'https://www.nmpa.gov.cn'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; +import { finishArticleItem } from '@/utils/wechat-mp'; + +const baseUrl = 'https://www.nmpa.gov.cn'; export const route: Route = { path: '/nmpa/*', diff --git a/lib/routes/gov/nopss/index.ts b/lib/routes/gov/nopss/index.ts index ffc8c3a4e..99a7219d4 100644 --- a/lib/routes/gov/nopss/index.ts +++ b/lib/routes/gov/nopss/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/nopss/*', diff --git a/lib/routes/gov/npc/index.ts b/lib/routes/gov/npc/index.ts index 94cf49676..e4fe2bd0e 100644 --- a/lib/routes/gov/npc/index.ts +++ b/lib/routes/gov/npc/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/nrta/dsj.ts b/lib/routes/gov/nrta/dsj.ts index 275af3afc..667178e14 100644 --- a/lib/routes/gov/nrta/dsj.ts +++ b/lib/routes/gov/nrta/dsj.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import pMap from 'p-map'; export const route: Route = { path: '/nrta/dsj/:category?', diff --git a/lib/routes/gov/nrta/news.ts b/lib/routes/gov/nrta/news.ts index 8607eeb17..8cd9d7ee0 100644 --- a/lib/routes/gov/nrta/news.ts +++ b/lib/routes/gov/nrta/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/nsfc/index.ts b/lib/routes/gov/nsfc/index.ts index cfc790803..1ece4920b 100644 --- a/lib/routes/gov/nsfc/index.ts +++ b/lib/routes/gov/nsfc/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import shortcuts from './shortcuts'; diff --git a/lib/routes/gov/pbc/goutongjiaoliu.ts b/lib/routes/gov/pbc/goutongjiaoliu.ts index 3cfa5365a..76dc0cec4 100644 --- a/lib/routes/gov/pbc/goutongjiaoliu.ts +++ b/lib/routes/gov/pbc/goutongjiaoliu.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import puppeteer from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/pbc/goutongjiaoliu', diff --git a/lib/routes/gov/pbc/gzlw.ts b/lib/routes/gov/pbc/gzlw.ts index e1dd5bc36..7d54b5c9f 100644 --- a/lib/routes/gov/pbc/gzlw.ts +++ b/lib/routes/gov/pbc/gzlw.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import { processItems } from './utils'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { processItems } from './utils'; + const host = 'http://www.pbc.gov.cn'; export const route: Route = { diff --git a/lib/routes/gov/pbc/trade-announcement.ts b/lib/routes/gov/pbc/trade-announcement.ts index 74e39550f..0a3621429 100644 --- a/lib/routes/gov/pbc/trade-announcement.ts +++ b/lib/routes/gov/pbc/trade-announcement.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import puppeteer from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/pbc/tradeAnnouncement', diff --git a/lib/routes/gov/pbc/utils.ts b/lib/routes/gov/pbc/utils.ts index 2e7ed00b6..2fc8468a2 100644 --- a/lib/routes/gov/pbc/utils.ts +++ b/lib/routes/gov/pbc/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; const processItems = (list) => Promise.all( diff --git a/lib/routes/gov/pbc/zcyj.ts b/lib/routes/gov/pbc/zcyj.ts index 27936fa2e..29d8fa34f 100644 --- a/lib/routes/gov/pbc/zcyj.ts +++ b/lib/routes/gov/pbc/zcyj.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import { processItems } from './utils'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { processItems } from './utils'; + const host = 'http://www.pbc.gov.cn'; export const route: Route = { diff --git a/lib/routes/gov/pudong/zwgk.ts b/lib/routes/gov/pudong/zwgk.ts index 4bf720ee1..ba93e5834 100644 --- a/lib/routes/gov/pudong/zwgk.ts +++ b/lib/routes/gov/pudong/zwgk.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; // 解析日期的工具函数 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; // 解析日期的工具函数 export const route: Route = { path: '/pudong/zwgk', diff --git a/lib/routes/gov/safe/business.ts b/lib/routes/gov/safe/business.ts index 4fe4951c6..fc54eef0d 100644 --- a/lib/routes/gov/safe/business.ts +++ b/lib/routes/gov/safe/business.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processZxfkItems } from './util'; export const route: Route = { diff --git a/lib/routes/gov/safe/complaint.ts b/lib/routes/gov/safe/complaint.ts index a03bb0119..c45ef580b 100644 --- a/lib/routes/gov/safe/complaint.ts +++ b/lib/routes/gov/safe/complaint.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processZxfkItems } from './util'; export const route: Route = { diff --git a/lib/routes/gov/safe/util.ts b/lib/routes/gov/safe/util.ts index 19eaed7c5..ab48c67e1 100644 --- a/lib/routes/gov/safe/util.ts +++ b/lib/routes/gov/safe/util.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://www.safe.gov.cn'; diff --git a/lib/routes/gov/samr/xgzlyhd.ts b/lib/routes/gov/samr/xgzlyhd.ts index b61b0776d..70ceb4349 100644 --- a/lib/routes/gov/samr/xgzlyhd.ts +++ b/lib/routes/gov/samr/xgzlyhd.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://xgzlyhd.samr.gov.cn'; const apiUrl = new URL('gjjly/message/getMessageList', rootUrl).href; diff --git a/lib/routes/gov/sasac/generic.ts b/lib/routes/gov/sasac/generic.ts index 461286810..06a1e0117 100644 --- a/lib/routes/gov/sasac/generic.ts +++ b/lib/routes/gov/sasac/generic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/sdb/sdb.ts b/lib/routes/gov/sdb/sdb.ts index f34015a38..20883d6b6 100644 --- a/lib/routes/gov/sdb/sdb.ts +++ b/lib/routes/gov/sdb/sdb.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/sh/fgw/index.ts b/lib/routes/gov/sh/fgw/index.ts index dbecd5785..93e0c4966 100644 --- a/lib/routes/gov/sh/fgw/index.ts +++ b/lib/routes/gov/sh/fgw/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'fgw_zxxxgk' } = ctx.req.param(); diff --git a/lib/routes/gov/sh/rsj/ksxm.ts b/lib/routes/gov/sh/rsj/ksxm.ts index 402b4e4f5..2ed259465 100644 --- a/lib/routes/gov/sh/rsj/ksxm.ts +++ b/lib/routes/gov/sh/rsj/ksxm.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'http://www.rsj.sh.gov.cn'; diff --git a/lib/routes/gov/sh/wgj/wgj.ts b/lib/routes/gov/sh/wgj/wgj.ts index 105efff69..c98257643 100644 --- a/lib/routes/gov/sh/wgj/wgj.ts +++ b/lib/routes/gov/sh/wgj/wgj.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: ['/sh/wgj/:page?', '/shanghai/wgj/:page?'], diff --git a/lib/routes/gov/sh/wsjkw/yqtb/index.ts b/lib/routes/gov/sh/wsjkw/yqtb/index.ts index 298476c1a..003cb60a1 100644 --- a/lib/routes/gov/sh/wsjkw/yqtb/index.ts +++ b/lib/routes/gov/sh/wsjkw/yqtb/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/gov/sh/yjj/index.ts b/lib/routes/gov/sh/yjj/index.ts index 973c2fede..80e209605 100644 --- a/lib/routes/gov/sh/yjj/index.ts +++ b/lib/routes/gov/sh/yjj/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: ['/sh/yjj/*', '/shanghai/yjj/*'], diff --git a/lib/routes/gov/shaanxi/kjt.ts b/lib/routes/gov/shaanxi/kjt.ts index c13763fa7..9988b1153 100644 --- a/lib/routes/gov/shaanxi/kjt.ts +++ b/lib/routes/gov/shaanxi/kjt.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/shaanxi/kjt/:id?', diff --git a/lib/routes/gov/shenzhen/hrss/szksy/index.ts b/lib/routes/gov/shenzhen/hrss/szksy/index.ts index 24653b20e..2aa7aade1 100644 --- a/lib/routes/gov/shenzhen/hrss/szksy/index.ts +++ b/lib/routes/gov/shenzhen/hrss/szksy/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/shenzhen/szlh/index.ts b/lib/routes/gov/shenzhen/szlh/index.ts index 2ff4df784..8f83d37e8 100644 --- a/lib/routes/gov/shenzhen/szlh/index.ts +++ b/lib/routes/gov/shenzhen/szlh/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const config = { tzgg: { diff --git a/lib/routes/gov/shenzhen/xxgk/zfxxgj.ts b/lib/routes/gov/shenzhen/xxgk/zfxxgj.ts index 0c129f15a..85407af13 100644 --- a/lib/routes/gov/shenzhen/xxgk/zfxxgj.ts +++ b/lib/routes/gov/shenzhen/xxgk/zfxxgj.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + const rootUrl = 'http://www.sz.gov.cn/cn/xxgk/zfxxgj/'; const config = { diff --git a/lib/routes/gov/shenzhen/zjj/index.ts b/lib/routes/gov/shenzhen/zjj/index.ts index 86c47cc67..8032e08d3 100644 --- a/lib/routes/gov/shenzhen/zjj/index.ts +++ b/lib/routes/gov/shenzhen/zjj/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const config = { tzgg: { diff --git a/lib/routes/gov/shenzhen/zzb/index.ts b/lib/routes/gov/shenzhen/zzb/index.ts index a3650db5b..6bb742ab2 100644 --- a/lib/routes/gov/shenzhen/zzb/index.ts +++ b/lib/routes/gov/shenzhen/zzb/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/sichuan/deyang/govpublicinfo.ts b/lib/routes/gov/sichuan/deyang/govpublicinfo.ts index 9361ff12b..8d968c058 100644 --- a/lib/routes/gov/sichuan/deyang/govpublicinfo.ts +++ b/lib/routes/gov/sichuan/deyang/govpublicinfo.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import timezone from '@/utils/timezone'; // 各地区url信息 diff --git a/lib/routes/gov/sichuan/deyang/mztoday.ts b/lib/routes/gov/sichuan/deyang/mztoday.ts index f57aed81c..0fa37d6c3 100644 --- a/lib/routes/gov/sichuan/deyang/mztoday.ts +++ b/lib/routes/gov/sichuan/deyang/mztoday.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import timezone from '@/utils/timezone'; const rootUrl = 'http://www.mztoday.gov.cn'; diff --git a/lib/routes/gov/stats/index.ts b/lib/routes/gov/stats/index.ts index 241cebd6a..2036997d7 100644 --- a/lib/routes/gov/stats/index.ts +++ b/lib/routes/gov/stats/index.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/stats/*', diff --git a/lib/routes/gov/suzhou/doc.ts b/lib/routes/gov/suzhou/doc.ts index 13966d233..e3f26e02e 100644 --- a/lib/routes/gov/suzhou/doc.ts +++ b/lib/routes/gov/suzhou/doc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/suzhou/fg.ts b/lib/routes/gov/suzhou/fg.ts index e32c8c570..1d36dd307 100644 --- a/lib/routes/gov/suzhou/fg.ts +++ b/lib/routes/gov/suzhou/fg.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/suzhou/fg/:category{.+}?', diff --git a/lib/routes/gov/suzhou/news.ts b/lib/routes/gov/suzhou/news.ts index 727a06130..e370c9f13 100644 --- a/lib/routes/gov/suzhou/news.ts +++ b/lib/routes/gov/suzhou/news.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/suzhou/news/:uid', diff --git a/lib/routes/gov/taiyuan/rsj.ts b/lib/routes/gov/taiyuan/rsj.ts index 7b49178e6..bdf8bcd1a 100644 --- a/lib/routes/gov/taiyuan/rsj.ts +++ b/lib/routes/gov/taiyuan/rsj.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/tianjin/tjftz.ts b/lib/routes/gov/tianjin/tjftz.ts index d84c7fe15..7a4d69e62 100644 --- a/lib/routes/gov/tianjin/tjftz.ts +++ b/lib/routes/gov/tianjin/tjftz.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/tianjin/tjrcgzw.ts b/lib/routes/gov/tianjin/tjrcgzw.ts index 55af4408c..1c5911296 100644 --- a/lib/routes/gov/tianjin/tjrcgzw.ts +++ b/lib/routes/gov/tianjin/tjrcgzw.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/tianjin/tjrcgzw-notice/:cate/:subCate', categories: ['government'], diff --git a/lib/routes/gov/wuhan/whyw.ts b/lib/routes/gov/wuhan/whyw.ts index b0b0330ee..6f2f4ec94 100644 --- a/lib/routes/gov/wuhan/whyw.ts +++ b/lib/routes/gov/wuhan/whyw.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/xinyi/xinyi.ts b/lib/routes/gov/xinyi/xinyi.ts index b79835f67..496b185a8 100644 --- a/lib/routes/gov/xinyi/xinyi.ts +++ b/lib/routes/gov/xinyi/xinyi.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/xuzhou/hrss.ts b/lib/routes/gov/xuzhou/hrss.ts index 8855ad072..37d4f8ae9 100644 --- a/lib/routes/gov/xuzhou/hrss.ts +++ b/lib/routes/gov/xuzhou/hrss.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/xuzhou/hrss/:category?', diff --git a/lib/routes/gov/zhejiang/gwy.ts b/lib/routes/gov/zhejiang/gwy.ts index e0276fb6d..d041d1027 100644 --- a/lib/routes/gov/zhejiang/gwy.ts +++ b/lib/routes/gov/zhejiang/gwy.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/zhengce/govall.ts b/lib/routes/gov/zhengce/govall.ts index fe3fb7da1..f39868276 100644 --- a/lib/routes/gov/zhengce/govall.ts +++ b/lib/routes/gov/zhengce/govall.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/zhengce/index.ts b/lib/routes/gov/zhengce/index.ts index 1c648fc54..aa9bb6262 100644 --- a/lib/routes/gov/zhengce/index.ts +++ b/lib/routes/gov/zhengce/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: ['/zhengce/zuixin', '/zhengce/:category{.+}?'], diff --git a/lib/routes/gov/zhengce/wenjian.ts b/lib/routes/gov/zhengce/wenjian.ts index 29b407d1c..4d3356b94 100644 --- a/lib/routes/gov/zhengce/wenjian.ts +++ b/lib/routes/gov/zhengce/wenjian.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/zhengce/zhengceku.ts b/lib/routes/gov/zhengce/zhengceku.ts index d72588e11..21149cbd4 100644 --- a/lib/routes/gov/zhengce/zhengceku.ts +++ b/lib/routes/gov/zhengce/zhengceku.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; export const route: Route = { diff --git a/lib/routes/gov/zj/ningbogzw-notice.ts b/lib/routes/gov/zj/ningbogzw-notice.ts index f3454f46c..b78c0f3ed 100644 --- a/lib/routes/gov/zj/ningbogzw-notice.ts +++ b/lib/routes/gov/zj/ningbogzw-notice.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/zj/ningborsjnotice.ts b/lib/routes/gov/zj/ningborsjnotice.ts index 5f3d9202a..a9a73e572 100644 --- a/lib/routes/gov/zj/ningborsjnotice.ts +++ b/lib/routes/gov/zj/ningborsjnotice.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/zj/search.ts b/lib/routes/gov/zj/search.ts index e8c0bd9ef..623579719 100644 --- a/lib/routes/gov/zj/search.ts +++ b/lib/routes/gov/zj/search.ts @@ -1,8 +1,10 @@ -import { Route, DataItem } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; import dayjs from 'dayjs'; + +import type { DataItem, Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/zj/search/:websiteid?/:word/:cateid?', categories: ['government'], diff --git a/lib/routes/gq/news.ts b/lib/routes/gq/news.ts index 3ccba0956..23de73a3e 100644 --- a/lib/routes/gq/news.ts +++ b/lib/routes/gq/news.ts @@ -1,8 +1,11 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import parser from '@/utils/rss-parser'; + const host = 'https://www.gq.com'; export const route: Route = { path: '/news', diff --git a/lib/routes/grainoil/category.ts b/lib/routes/grainoil/category.ts index 801649dcd..180ee384d 100644 --- a/lib/routes/grainoil/category.ts +++ b/lib/routes/grainoil/category.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category, id } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/greasyfork/feedback.ts b/lib/routes/greasyfork/feedback.ts index de5bfa580..d837e5557 100644 --- a/lib/routes/greasyfork/feedback.ts +++ b/lib/routes/greasyfork/feedback.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/greasyfork/scripts.ts b/lib/routes/greasyfork/scripts.ts index 48447e2af..e9ee07e2a 100644 --- a/lib/routes/greasyfork/scripts.ts +++ b/lib/routes/greasyfork/scripts.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/greasyfork/versions.ts b/lib/routes/greasyfork/versions.ts index 5ece426a4..8c42ad56a 100644 --- a/lib/routes/greasyfork/versions.ts +++ b/lib/routes/greasyfork/versions.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/grist/featured.ts b/lib/routes/grist/featured.ts index dcc6f306e..79901e2fe 100644 --- a/lib/routes/grist/featured.ts +++ b/lib/routes/grist/featured.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { getData, getList } from './utils'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { getData, getList } from './utils'; + export const route: Route = { path: '/featured', categories: ['new-media'], diff --git a/lib/routes/grist/index.ts b/lib/routes/grist/index.ts index 2a0232bed..fb9ea7cce 100644 --- a/lib/routes/grist/index.ts +++ b/lib/routes/grist/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getData, getList } from './utils'; export const route: Route = { diff --git a/lib/routes/grist/series.ts b/lib/routes/grist/series.ts index 0425502e0..e0c1c34f3 100644 --- a/lib/routes/grist/series.ts +++ b/lib/routes/grist/series.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getData, getList } from './utils'; export const route: Route = { diff --git a/lib/routes/grist/topic.ts b/lib/routes/grist/topic.ts index ea41be09a..28fa9b655 100644 --- a/lib/routes/grist/topic.ts +++ b/lib/routes/grist/topic.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getData, getList } from './utils'; export const route: Route = { diff --git a/lib/routes/grubstreet/index.ts b/lib/routes/grubstreet/index.ts index 77212aa0d..18709bb0a 100644 --- a/lib/routes/grubstreet/index.ts +++ b/lib/routes/grubstreet/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/grubstreet/utils.ts b/lib/routes/grubstreet/utils.ts index b86687531..c56dece20 100644 --- a/lib/routes/grubstreet/utils.ts +++ b/lib/routes/grubstreet/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; async function loadContent(link) { const response = await got(link); diff --git a/lib/routes/gs/developer/blog.ts b/lib/routes/gs/developer/blog.ts index 36fc4ec29..5f8525236 100644 --- a/lib/routes/gs/developer/blog.ts +++ b/lib/routes/gs/developer/blog.ts @@ -1,7 +1,8 @@ -import { Route, Data } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/developer/blog', categories: ['blog'], diff --git a/lib/routes/guancha/headline.ts b/lib/routes/guancha/headline.ts index 3e09b2615..fcd522e7b 100644 --- a/lib/routes/guancha/headline.ts +++ b/lib/routes/guancha/headline.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/headline', diff --git a/lib/routes/guancha/index.ts b/lib/routes/guancha/index.ts index 33616cbf5..11a338632 100644 --- a/lib/routes/guancha/index.ts +++ b/lib/routes/guancha/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const config = { review: { diff --git a/lib/routes/guancha/member.ts b/lib/routes/guancha/member.ts index 4f943f343..3a893e425 100644 --- a/lib/routes/guancha/member.ts +++ b/lib/routes/guancha/member.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const titles = { recommend: '精选', diff --git a/lib/routes/guancha/personalpage.ts b/lib/routes/guancha/personalpage.ts index 16c8d199c..74f482dde 100644 --- a/lib/routes/guancha/personalpage.ts +++ b/lib/routes/guancha/personalpage.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/guancha/topic.ts b/lib/routes/guancha/topic.ts index 11febb325..f2dc57f51 100644 --- a/lib/routes/guancha/topic.ts +++ b/lib/routes/guancha/topic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/guangdiu/cheaps.ts b/lib/routes/guangdiu/cheaps.ts index 74ed403db..e744269de 100644 --- a/lib/routes/guangdiu/cheaps.ts +++ b/lib/routes/guangdiu/cheaps.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseRelativeDate } from '@/utils/parse-date'; const host = 'https://guangdiu.com'; diff --git a/lib/routes/guangdiu/index.ts b/lib/routes/guangdiu/index.ts index cb0f54358..83bfe2e78 100644 --- a/lib/routes/guangdiu/index.ts +++ b/lib/routes/guangdiu/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseRelativeDate } from '@/utils/parse-date'; const host = 'https://guangdiu.com'; diff --git a/lib/routes/guangdiu/rank.ts b/lib/routes/guangdiu/rank.ts index 622176311..9c880bd42 100644 --- a/lib/routes/guangdiu/rank.ts +++ b/lib/routes/guangdiu/rank.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseRelativeDate } from '@/utils/parse-date'; const host = 'https://guangdiu.com'; diff --git a/lib/routes/guangdiu/search.ts b/lib/routes/guangdiu/search.ts index b04aa025c..3b6e327a6 100644 --- a/lib/routes/guangdiu/search.ts +++ b/lib/routes/guangdiu/search.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseRelativeDate } from '@/utils/parse-date'; const host = 'https://guangdiu.com'; diff --git a/lib/routes/guangzhoumetro/news.ts b/lib/routes/guangzhoumetro/news.ts index 025c2cf12..ef09a42ee 100644 --- a/lib/routes/guangzhoumetro/news.ts +++ b/lib/routes/guangzhoumetro/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/guanhai/index.ts b/lib/routes/guanhai/index.ts index 220dbe8de..ed33d1960 100644 --- a/lib/routes/guanhai/index.ts +++ b/lib/routes/guanhai/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/guduodata/daily.ts b/lib/routes/guduodata/daily.ts index 3aa987b51..ca717ed26 100644 --- a/lib/routes/guduodata/daily.ts +++ b/lib/routes/guduodata/daily.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import dayjs from 'dayjs'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import dayjs from 'dayjs'; import { art } from '@/utils/render'; -import path from 'node:path'; const host = 'http://d.guduodata.com'; diff --git a/lib/routes/gumroad/index.ts b/lib/routes/gumroad/index.ts index bc4789c89..1f348988c 100644 --- a/lib/routes/gumroad/index.ts +++ b/lib/routes/gumroad/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { isValidHost } from '@/utils/valid-host'; + +import { load } from 'cheerio'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; +import { isValidHost } from '@/utils/valid-host'; export const route: Route = { path: '/:username/:products', diff --git a/lib/routes/guokr/channel.ts b/lib/routes/guokr/channel.ts index b70d08631..bac498899 100644 --- a/lib/routes/guokr/channel.ts +++ b/lib/routes/guokr/channel.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { parseList, parseItem } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { parseItem, parseList } from './utils'; const channelMap = { calendar: 'pac', diff --git a/lib/routes/guokr/scientific.ts b/lib/routes/guokr/scientific.ts index 691f1cc4f..4225f069f 100644 --- a/lib/routes/guokr/scientific.ts +++ b/lib/routes/guokr/scientific.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { parseList, parseItem } from './utils'; + +import { parseItem, parseList } from './utils'; export const route: Route = { path: '/scientific', diff --git a/lib/routes/guokr/utils.ts b/lib/routes/guokr/utils.ts index 7fb1a041a..b6bc262ed 100644 --- a/lib/routes/guokr/utils.ts +++ b/lib/routes/guokr/utils.ts @@ -1,7 +1,8 @@ -import { parseDate } from '@/utils/parse-date'; +import * as cheerio from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import * as cheerio from 'cheerio'; +import { parseDate } from '@/utils/parse-date'; export const parseList = (result) => result.map((item) => ({ diff --git a/lib/routes/guozaoke/index.ts b/lib/routes/guozaoke/index.ts index 0e71195b4..8b813f370 100644 --- a/lib/routes/guozaoke/index.ts +++ b/lib/routes/guozaoke/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseRelativeDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import cache from '@/utils/cache'; import pMap from 'p-map'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseRelativeDate } from '@/utils/parse-date'; + export const route: Route = { path: '/default', categories: ['bbs'], diff --git a/lib/routes/gxmzu/ai.ts b/lib/routes/gxmzu/ai.ts index 1dcc4680e..f62b7bf43 100644 --- a/lib/routes/gxmzu/ai.ts +++ b/lib/routes/gxmzu/ai.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getNoticeList } from './utils'; const url = 'https://ai.gxmzu.edu.cn/index/tzgg.htm'; diff --git a/lib/routes/gxmzu/lib.ts b/lib/routes/gxmzu/lib.ts index b73c8e4da..e3091e3d6 100644 --- a/lib/routes/gxmzu/lib.ts +++ b/lib/routes/gxmzu/lib.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; // 使用ofetch库代替got -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gxmzu/utils/index.ts b/lib/routes/gxmzu/utils/index.ts index db107b7b0..b3a8d9c1c 100644 --- a/lib/routes/gxmzu/utils/index.ts +++ b/lib/routes/gxmzu/utils/index.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; // 使用ofetch库代替got -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gxmzu/yjs.ts b/lib/routes/gxmzu/yjs.ts index 33a128167..1ca62e1dc 100644 --- a/lib/routes/gxmzu/yjs.ts +++ b/lib/routes/gxmzu/yjs.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getNoticeList } from './utils'; const url = 'https://yjs.gxmzu.edu.cn/tzgg/zsgg.htm'; diff --git a/lib/routes/gzdaily/app.ts b/lib/routes/gzdaily/app.ts index 1ddfd24df..f226afddb 100644 --- a/lib/routes/gzdaily/app.ts +++ b/lib/routes/gzdaily/app.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/app/:column?', diff --git a/lib/routes/gzhu/yjs.ts b/lib/routes/gzhu/yjs.ts index 957087195..fee27438f 100644 --- a/lib/routes/gzhu/yjs.ts +++ b/lib/routes/gzhu/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hackernews/index.ts b/lib/routes/hackernews/index.ts index 9616011da..da483c90d 100644 --- a/lib/routes/hackernews/index.ts +++ b/lib/routes/hackernews/index.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hackertalk/index.ts b/lib/routes/hackertalk/index.ts index 99b8e4895..6078c7bad 100644 --- a/lib/routes/hackertalk/index.ts +++ b/lib/routes/hackertalk/index.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt(); export const route: Route = { diff --git a/lib/routes/hacking8/index.ts b/lib/routes/hacking8/index.ts index 70ac38a7f..94461f66f 100644 --- a/lib/routes/hacking8/index.ts +++ b/lib/routes/hacking8/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/hacking8/search.ts b/lib/routes/hacking8/search.ts index 1cd2fc6a9..f8ca16d6e 100644 --- a/lib/routes/hacking8/search.ts +++ b/lib/routes/hacking8/search.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/search/:keyword?', diff --git a/lib/routes/hackmd/profile.ts b/lib/routes/hackmd/profile.ts index 8797a5dbb..c993909c5 100644 --- a/lib/routes/hackmd/profile.ts +++ b/lib/routes/hackmd/profile.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/hackyournews/index.ts b/lib/routes/hackyournews/index.ts index 56b0ed6ab..26dcbaa53 100644 --- a/lib/routes/hackyournews/index.ts +++ b/lib/routes/hackyournews/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // an HTML parser with a jQuery-like API + +import type { Route } from '@/types'; // Require necessary modules import got from '@/utils/got'; // a customised got -import { load } from 'cheerio'; // an HTML parser with a jQuery-like API import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hafu/news.ts b/lib/routes/hafu/news.ts index cbc6533eb..bfa9c6c7c 100644 --- a/lib/routes/hafu/news.ts +++ b/lib/routes/hafu/news.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import parseList from './utils'; export const route: Route = { diff --git a/lib/routes/hafu/utils.ts b/lib/routes/hafu/utils.ts index 34f4fae25..75827d57a 100644 --- a/lib/routes/hafu/utils.ts +++ b/lib/routes/hafu/utils.ts @@ -1,10 +1,12 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const typeMap = { ggtz: { url: 'https://www.hafu.edu.cn/index/ggtz.htm', root: 'https://www.hafu.edu.cn/', title: '河南财院 - 公告通知', parseFn: ggtzParse }, diff --git a/lib/routes/hakkatv/type.ts b/lib/routes/hakkatv/type.ts index 7644ad126..c4b638285 100644 --- a/lib/routes/hakkatv/type.ts +++ b/lib/routes/hakkatv/type.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/hamel/index.ts b/lib/routes/hamel/index.ts index 3946e48cb..1b0654c52 100644 --- a/lib/routes/hamel/index.ts +++ b/lib/routes/hamel/index.ts @@ -1,8 +1,9 @@ -import { Route, DataItem } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/blog', diff --git a/lib/routes/hameln/chapter.ts b/lib/routes/hameln/chapter.ts index 8b4c58e32..0fe7ba0b0 100644 --- a/lib/routes/hameln/chapter.ts +++ b/lib/routes/hameln/chapter.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/chapter/:id', diff --git a/lib/routes/hanime1/previews.ts b/lib/routes/hanime1/previews.ts index 2696695dd..d2dcd01e9 100644 --- a/lib/routes/hanime1/previews.ts +++ b/lib/routes/hanime1/previews.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; import { load } from 'cheerio'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/previews/:date?', name: '每月新番', diff --git a/lib/routes/hanime1/search.ts b/lib/routes/hanime1/search.ts index 0652101b5..025354362 100644 --- a/lib/routes/hanime1/search.ts +++ b/lib/routes/hanime1/search.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; import { load } from 'cheerio'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + async function handler(ctx) { const { params } = ctx.req.param(); const baseUrl = 'https://hanime1.me'; diff --git a/lib/routes/harvard/health/blog.ts b/lib/routes/harvard/health/blog.ts index 17cfb3b24..4cb34d06b 100644 --- a/lib/routes/harvard/health/blog.ts +++ b/lib/routes/harvard/health/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hashnode/blog.ts b/lib/routes/hashnode/blog.ts index aa64170c4..dde13dfe4 100644 --- a/lib/routes/hashnode/blog.ts +++ b/lib/routes/hashnode/blog.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const baseApiUrl = 'https://api.hashnode.com'; diff --git a/lib/routes/hbooker/chapter.ts b/lib/routes/hbooker/chapter.ts index 75b2cb4ae..df83e3e5e 100644 --- a/lib/routes/hbooker/chapter.ts +++ b/lib/routes/hbooker/chapter.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hbr/topic.ts b/lib/routes/hbr/topic.ts index 134dacf4c..7bfcaee45 100644 --- a/lib/routes/hbr/topic.ts +++ b/lib/routes/hbr/topic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hdu/auto/notice.ts b/lib/routes/hdu/auto/notice.ts index c28e87bee..b7ae35d78 100644 --- a/lib/routes/hdu/auto/notice.ts +++ b/lib/routes/hdu/auto/notice.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { fetchAutoNews } from './utils'; +import type { Route } from '@/types'; import logger from '@/utils/logger'; +import { fetchAutoNews } from './utils'; + const typeMap = { notice: { name: '通知公告', diff --git a/lib/routes/hdu/auto/utils.ts b/lib/routes/hdu/auto/utils.ts index 7dac71a24..38c6bb743 100644 --- a/lib/routes/hdu/auto/utils.ts +++ b/lib/routes/hdu/auto/utils.ts @@ -1,7 +1,8 @@ -import { Data, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const BASE_URL = 'https://auto.hdu.edu.cn'; diff --git a/lib/routes/hdu/cs/notice.ts b/lib/routes/hdu/cs/notice.ts index 4686573b2..b0a12fa59 100644 --- a/lib/routes/hdu/cs/notice.ts +++ b/lib/routes/hdu/cs/notice.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const link = 'https://computer.hdu.edu.cn'; diff --git a/lib/routes/hdu/cs/pg.ts b/lib/routes/hdu/cs/pg.ts index 07ee8af2a..8adf3419b 100644 --- a/lib/routes/hdu/cs/pg.ts +++ b/lib/routes/hdu/cs/pg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const link = 'https://computer.hdu.edu.cn'; diff --git a/lib/routes/hebtv/nong-bo-shi-zai-xing-dong.ts b/lib/routes/hebtv/nong-bo-shi-zai-xing-dong.ts index 232de22e8..2f46b76f2 100644 --- a/lib/routes/hebtv/nong-bo-shi-zai-xing-dong.ts +++ b/lib/routes/hebtv/nong-bo-shi-zai-xing-dong.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const baseUrl = 'https://web.cmc.hebtv.com/cms/rmt0336/19/19js/st/ds/nmpd/nbszxd/index.shtml'; diff --git a/lib/routes/hedwig/posts.ts b/lib/routes/hedwig/posts.ts index bfdc8b9ad..be4d2b83f 100644 --- a/lib/routes/hedwig/posts.ts +++ b/lib/routes/hedwig/posts.ts @@ -1,12 +1,14 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import MarkdownIt from 'markdown-it'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import MarkdownIt from 'markdown-it'; const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/hellobtc/information.ts b/lib/routes/hellobtc/information.ts index ada41ba37..f6de5ff63 100644 --- a/lib/routes/hellobtc/information.ts +++ b/lib/routes/hellobtc/information.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hellobtc/kepu.ts b/lib/routes/hellobtc/kepu.ts index 01448480b..0607a6f4b 100644 --- a/lib/routes/hellobtc/kepu.ts +++ b/lib/routes/hellobtc/kepu.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; const rootUrl = 'https://www.hellobtc.com'; diff --git a/lib/routes/hellobtc/news.ts b/lib/routes/hellobtc/news.ts index 5c9007a91..0cbc7ba3a 100644 --- a/lib/routes/hellobtc/news.ts +++ b/lib/routes/hellobtc/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hellogithub/article.ts b/lib/routes/hellogithub/article.ts index 7e6329f6e..6151387ef 100644 --- a/lib/routes/hellogithub/article.ts +++ b/lib/routes/hellogithub/article.ts @@ -1,5 +1,4 @@ -import { Route } from '@/types'; - +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/hellogithub/index.ts b/lib/routes/hellogithub/index.ts index 418c8208f..32c742754 100644 --- a/lib/routes/hellogithub/index.ts +++ b/lib/routes/hellogithub/index.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; - import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const sorts = { diff --git a/lib/routes/hellogithub/report.ts b/lib/routes/hellogithub/report.ts index ca315f5ee..81a886f17 100644 --- a/lib/routes/hellogithub/report.ts +++ b/lib/routes/hellogithub/report.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const types = { tiobe: '编程语言', diff --git a/lib/routes/hellogithub/volume.ts b/lib/routes/hellogithub/volume.ts index ebd751877..892577a36 100644 --- a/lib/routes/hellogithub/volume.ts +++ b/lib/routes/hellogithub/volume.ts @@ -1,16 +1,18 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const md = MarkdownIt({ html: true, }); -import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import { config } from '@/config'; -import { parseDate } from '@/utils/parse-date'; art.defaults.imports.render = function (string) { return md.render(string); diff --git a/lib/routes/hex-rays/index.ts b/lib/routes/hex-rays/index.ts index 692d803ed..337a4f4ef 100644 --- a/lib/routes/hex-rays/index.ts +++ b/lib/routes/hex-rays/index.ts @@ -1,7 +1,8 @@ +import { load } from 'cheerio'; + import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hexun/index.ts b/lib/routes/hexun/index.ts index b4860c480..aefd556a7 100644 --- a/lib/routes/hexun/index.ts +++ b/lib/routes/hexun/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const decoder = new TextDecoder('gbk'); diff --git a/lib/routes/hfut/hf/notice.ts b/lib/routes/hfut/hf/notice.ts index d39b935bd..0e5174491 100644 --- a/lib/routes/hfut/hf/notice.ts +++ b/lib/routes/hfut/hf/notice.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import parseList from './utils'; export const route: Route = { diff --git a/lib/routes/hfut/hf/utils.ts b/lib/routes/hfut/hf/utils.ts index 874121db6..51a849dcd 100644 --- a/lib/routes/hfut/hf/utils.ts +++ b/lib/routes/hfut/hf/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const typeMap = { diff --git a/lib/routes/hfut/xc/notice.ts b/lib/routes/hfut/xc/notice.ts index 538867464..aecddbd58 100644 --- a/lib/routes/hfut/xc/notice.ts +++ b/lib/routes/hfut/xc/notice.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import parseList from './utils'; export const route: Route = { diff --git a/lib/routes/hfut/xc/utils.ts b/lib/routes/hfut/xc/utils.ts index 3e2c998fe..d9dabc033 100644 --- a/lib/routes/hfut/xc/utils.ts +++ b/lib/routes/hfut/xc/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const typeMap = { diff --git a/lib/routes/hicairo/rss.ts b/lib/routes/hicairo/rss.ts index 2798fea09..72f89fd3d 100644 --- a/lib/routes/hicairo/rss.ts +++ b/lib/routes/hicairo/rss.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/hinatazaka46/blog.ts b/lib/routes/hinatazaka46/blog.ts index 8439743d5..9be7b64f7 100644 --- a/lib/routes/hinatazaka46/blog.ts +++ b/lib/routes/hinatazaka46/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.hinatazaka46.com'; diff --git a/lib/routes/hinatazaka46/news.ts b/lib/routes/hinatazaka46/news.ts index 785daaec5..262471ab1 100644 --- a/lib/routes/hinatazaka46/news.ts +++ b/lib/routes/hinatazaka46/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hiring.cafe/jobs.ts b/lib/routes/hiring.cafe/jobs.ts index aacd10f58..518da16fb 100644 --- a/lib/routes/hiring.cafe/jobs.ts +++ b/lib/routes/hiring.cafe/jobs.ts @@ -1,8 +1,10 @@ -import ofetch from '@/utils/ofetch'; import path from 'node:path'; + +import type { Context } from 'hono'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import { Context } from 'hono'; -import { Route } from '@/types'; const CONFIG = { DEFAULT_PAGE_SIZE: 20, diff --git a/lib/routes/hit/hitgs.ts b/lib/routes/hit/hitgs.ts index 3ee2675a7..61820e3dc 100644 --- a/lib/routes/hit/hitgs.ts +++ b/lib/routes/hit/hitgs.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { id = 'tzgg' } = ctx.req.param(); diff --git a/lib/routes/hit/today.ts b/lib/routes/hit/today.ts index 62c8aedca..c86681817 100644 --- a/lib/routes/hit/today.ts +++ b/lib/routes/hit/today.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hitcon/zeroday.ts b/lib/routes/hitcon/zeroday.ts index bd7263906..f89505e8f 100644 --- a/lib/routes/hitcon/zeroday.ts +++ b/lib/routes/hitcon/zeroday.ts @@ -1,11 +1,13 @@ -import type { Data, DataItem, Route } from '@/types'; -import type { Context } from 'hono'; -import { load } from 'cheerio'; -import puppeteer from '@/utils/puppeteer'; -import logger from '@/utils/logger'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; +import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; +import puppeteer from '@/utils/puppeteer'; +import { art } from '@/utils/render'; export const route: Route = { name: '漏洞', diff --git a/lib/routes/hitsz/article.ts b/lib/routes/hitsz/article.ts index fe8731a5e..01dfad077 100644 --- a/lib/routes/hitsz/article.ts +++ b/lib/routes/hitsz/article.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hitsz/due-tzgg.ts b/lib/routes/hitsz/due-tzgg.ts index b278ac1af..b4a880386 100644 --- a/lib/routes/hitsz/due-tzgg.ts +++ b/lib/routes/hitsz/due-tzgg.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hitsz/due.ts b/lib/routes/hitsz/due.ts index 98fd12495..db4c65a64 100644 --- a/lib/routes/hitsz/due.ts +++ b/lib/routes/hitsz/due.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hitwh/today.ts b/lib/routes/hitwh/today.ts index 4433eb45c..fa759b865 100644 --- a/lib/routes/hitwh/today.ts +++ b/lib/routes/hitwh/today.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hizu/index.ts b/lib/routes/hizu/index.ts index 3a108f6d0..037b3947e 100644 --- a/lib/routes/hizu/index.ts +++ b/lib/routes/hizu/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const titles = { diff --git a/lib/routes/hk01/channel.ts b/lib/routes/hk01/channel.ts index 70b673a2c..fd3d0b71e 100644 --- a/lib/routes/hk01/channel.ts +++ b/lib/routes/hk01/channel.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiRootUrl, ProcessItems } from './utils'; + +import { apiRootUrl, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/channel/:id?', diff --git a/lib/routes/hk01/hot.ts b/lib/routes/hk01/hot.ts index c69f67282..e58df8ee7 100644 --- a/lib/routes/hk01/hot.ts +++ b/lib/routes/hk01/hot.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiRootUrl, ProcessItems } from './utils'; + +import { apiRootUrl, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/hot', diff --git a/lib/routes/hk01/issue.ts b/lib/routes/hk01/issue.ts index d82db7864..c46ebd34a 100644 --- a/lib/routes/hk01/issue.ts +++ b/lib/routes/hk01/issue.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiRootUrl, ProcessItems } from './utils'; + +import { apiRootUrl, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/issue/:id?', diff --git a/lib/routes/hk01/latest.ts b/lib/routes/hk01/latest.ts index 1c8053184..8b873291e 100644 --- a/lib/routes/hk01/latest.ts +++ b/lib/routes/hk01/latest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiRootUrl, ProcessItems } from './utils'; + +import { apiRootUrl, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/latest', diff --git a/lib/routes/hk01/tag.ts b/lib/routes/hk01/tag.ts index 57d18f2a7..d7a580d97 100644 --- a/lib/routes/hk01/tag.ts +++ b/lib/routes/hk01/tag.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiRootUrl, ProcessItems } from './utils'; + +import { apiRootUrl, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/tag/:id?', diff --git a/lib/routes/hk01/utils.ts b/lib/routes/hk01/utils.ts index cddf434d7..0e47008d4 100644 --- a/lib/routes/hk01/utils.ts +++ b/lib/routes/hk01/utils.ts @@ -1,7 +1,8 @@ +import path from 'node:path'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://hk01.com'; const apiRootUrl = 'https://web-data.api.hk01.com'; @@ -38,4 +39,4 @@ const ProcessItems = (items, limit, tryGet) => ) ); -export { rootUrl, apiRootUrl, ProcessItems }; +export { apiRootUrl, ProcessItems, rootUrl }; diff --git a/lib/routes/hk01/zone.ts b/lib/routes/hk01/zone.ts index 05ef1e891..237a85272 100644 --- a/lib/routes/hk01/zone.ts +++ b/lib/routes/hk01/zone.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiRootUrl, ProcessItems } from './utils'; + +import { apiRootUrl, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/zone/:id?', diff --git a/lib/routes/hkej/index.ts b/lib/routes/hkej/index.ts index 909eeb5c9..1cf2c6fd7 100644 --- a/lib/routes/hkej/index.ts +++ b/lib/routes/hkej/index.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { CookieJar } from 'tough-cookie'; +import timezone from '@/utils/timezone'; const cookieJar = new CookieJar(); diff --git a/lib/routes/hkepc/index.ts b/lib/routes/hkepc/index.ts index 6e64baed4..677e3c0d9 100644 --- a/lib/routes/hkepc/index.ts +++ b/lib/routes/hkepc/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { baseUrl, categoryMap } from './data'; export const route: Route = { diff --git a/lib/routes/hket/index.ts b/lib/routes/hket/index.ts index 0b5ed9563..f466fa41b 100644 --- a/lib/routes/hket/index.ts +++ b/lib/routes/hket/index.ts @@ -1,12 +1,13 @@ -import { DataItem, Route } from '@/types'; +import path from 'node:path'; +import * as cheerio from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const urlMap = { srac: { diff --git a/lib/routes/hkjunkcall/index.ts b/lib/routes/hkjunkcall/index.ts index 21c3de2da..b8b1f9eae 100644 --- a/lib/routes/hkjunkcall/index.ts +++ b/lib/routes/hkjunkcall/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hko/earthquake.ts b/lib/routes/hko/earthquake.ts index 9bccb0c31..6d3e3d001 100644 --- a/lib/routes/hko/earthquake.ts +++ b/lib/routes/hko/earthquake.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hko/weather.ts b/lib/routes/hko/weather.ts index 10145ffd4..0bd934b34 100644 --- a/lib/routes/hko/weather.ts +++ b/lib/routes/hko/weather.ts @@ -1,6 +1,7 @@ +import * as cheerio from 'cheerio'; + import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const handler = async () => { diff --git a/lib/routes/hkushop/vinyl-or-picture-lp.ts b/lib/routes/hkushop/vinyl-or-picture-lp.ts index 5f2a1d0cf..572ca70a3 100644 --- a/lib/routes/hkushop/vinyl-or-picture-lp.ts +++ b/lib/routes/hkushop/vinyl-or-picture-lp.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import puppeteer from '@/utils/puppeteer'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import puppeteer from '@/utils/puppeteer'; + export const route: Route = { path: '/vinyl/:cat?', categories: ['shopping'], diff --git a/lib/routes/hlju/news.ts b/lib/routes/hlju/news.ts index 38ee028bb..82e17b54f 100644 --- a/lib/routes/hlju/news.ts +++ b/lib/routes/hlju/news.ts @@ -1,7 +1,8 @@ -import { Route, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hljucm/yjsy.ts b/lib/routes/hljucm/yjsy.ts index 6873a2181..11b72243b 100644 --- a/lib/routes/hljucm/yjsy.ts +++ b/lib/routes/hljucm/yjsy.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/yjsy/:category?', diff --git a/lib/routes/hnrb/index.ts b/lib/routes/hnrb/index.ts index 821969d0e..cf414c227 100644 --- a/lib/routes/hnrb/index.ts +++ b/lib/routes/hnrb/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/hnu/careers.ts b/lib/routes/hnu/careers.ts index cd3c9ec64..445d4a5b2 100644 --- a/lib/routes/hnu/careers.ts +++ b/lib/routes/hnu/careers.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/home-assistant/hacs.ts b/lib/routes/home-assistant/hacs.ts index 14580fbbb..593b655c9 100644 --- a/lib/routes/home-assistant/hacs.ts +++ b/lib/routes/home-assistant/hacs.ts @@ -1,5 +1,4 @@ -import { Route } from '@/types'; - +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/hongkong/chp.ts b/lib/routes/hongkong/chp.ts index a2d185700..98d4c6ab0 100644 --- a/lib/routes/hongkong/chp.ts +++ b/lib/routes/hongkong/chp.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const titles = { diff --git a/lib/routes/hongkong/dh.ts b/lib/routes/hongkong/dh.ts index 767e6cfed..e92ec10ef 100644 --- a/lib/routes/hongkong/dh.ts +++ b/lib/routes/hongkong/dh.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hostmonit/cloudflareyes.ts b/lib/routes/hostmonit/cloudflareyes.ts index 3d1fd3113..5815578b9 100644 --- a/lib/routes/hostmonit/cloudflareyes.ts +++ b/lib/routes/hostmonit/cloudflareyes.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const lines = { CM: '中国移动', diff --git a/lib/routes/hostmonit/cloudflareyesv6.ts b/lib/routes/hostmonit/cloudflareyesv6.ts index c7d38cbae..ca54d6dc5 100644 --- a/lib/routes/hostmonit/cloudflareyesv6.ts +++ b/lib/routes/hostmonit/cloudflareyesv6.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + export const route: Route = { path: '/cloudflareyesv6', name: 'Unknown', diff --git a/lib/routes/hottoys/index.ts b/lib/routes/hottoys/index.ts index a1cc08f84..7fe63092a 100644 --- a/lib/routes/hottoys/index.ts +++ b/lib/routes/hottoys/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import puppeteer from '@/utils/puppeteer'; export const route: Route = { diff --git a/lib/routes/hotukdeals/hottest.ts b/lib/routes/hotukdeals/hottest.ts index 69a6318bf..9a9c581a0 100644 --- a/lib/routes/hotukdeals/hottest.ts +++ b/lib/routes/hotukdeals/hottest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { JSDOM } from 'jsdom'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/hottest', categories: ['shopping'], diff --git a/lib/routes/hotukdeals/index.ts b/lib/routes/hotukdeals/index.ts index eab022438..ebf8a405a 100644 --- a/lib/routes/hotukdeals/index.ts +++ b/lib/routes/hotukdeals/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/:type', categories: ['shopping'], diff --git a/lib/routes/houxu/events.ts b/lib/routes/houxu/events.ts index ca37a26ae..5793564b9 100644 --- a/lib/routes/houxu/events.ts +++ b/lib/routes/houxu/events.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/events', diff --git a/lib/routes/houxu/index.ts b/lib/routes/houxu/index.ts index 72cea3991..17ca07e39 100644 --- a/lib/routes/houxu/index.ts +++ b/lib/routes/houxu/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { name: '热点', diff --git a/lib/routes/houxu/lives.ts b/lib/routes/houxu/lives.ts index 68fd41c5a..0c8814ff3 100644 --- a/lib/routes/houxu/lives.ts +++ b/lib/routes/houxu/lives.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/houxu/memory.ts b/lib/routes/houxu/memory.ts index 2a807f903..f0944690c 100644 --- a/lib/routes/houxu/memory.ts +++ b/lib/routes/houxu/memory.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/memory', diff --git a/lib/routes/howtoforge/rss.ts b/lib/routes/howtoforge/rss.ts index fe189ef4a..5cce95cb0 100644 --- a/lib/routes/howtoforge/rss.ts +++ b/lib/routes/howtoforge/rss.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/', categories: ['study'], diff --git a/lib/routes/hoyolab/constant.ts b/lib/routes/hoyolab/constant.ts index e1e7f4cee..59405dfc5 100644 --- a/lib/routes/hoyolab/constant.ts +++ b/lib/routes/hoyolab/constant.ts @@ -25,4 +25,4 @@ const OFFICIAL_PAGE_TYPE = { 5: 43, }; -export { PRIVATE_IMG, PUBLIC_IMG, LINK, POST_FULL, HOST, EVENT_LIST, NEW_LIST, OFFICIAL_PAGE_TYPE }; +export { EVENT_LIST, HOST, LINK, NEW_LIST, OFFICIAL_PAGE_TYPE, POST_FULL, PRIVATE_IMG, PUBLIC_IMG }; diff --git a/lib/routes/hoyolab/news.ts b/lib/routes/hoyolab/news.ts index e6ed922e3..5466ae0cb 100644 --- a/lib/routes/hoyolab/news.ts +++ b/lib/routes/hoyolab/news.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { HOST, NEW_LIST, OFFICIAL_PAGE_TYPE, POST_FULL, LINK, PUBLIC_IMG, PRIVATE_IMG } from './constant'; + +import { HOST, LINK, NEW_LIST, OFFICIAL_PAGE_TYPE, POST_FULL, PRIVATE_IMG, PUBLIC_IMG } from './constant'; import { getI18nGameInfo, getI18nType } from './utils'; const getEventList = async ({ type, gids, size, language }) => { diff --git a/lib/routes/hpoi/all.ts b/lib/routes/hpoi/all.ts index 0f8fe53b7..6215456ee 100644 --- a/lib/routes/hpoi/all.ts +++ b/lib/routes/hpoi/all.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/hpoi/banner-item.ts b/lib/routes/hpoi/banner-item.ts index 0382bb119..a91789361 100644 --- a/lib/routes/hpoi/banner-item.ts +++ b/lib/routes/hpoi/banner-item.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/bannerItem', diff --git a/lib/routes/hpoi/character.ts b/lib/routes/hpoi/character.ts index 72682e5a6..13bf595e8 100644 --- a/lib/routes/hpoi/character.ts +++ b/lib/routes/hpoi/character.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/hpoi/info.ts b/lib/routes/hpoi/info.ts index b04c0296f..19e51c686 100644 --- a/lib/routes/hpoi/info.ts +++ b/lib/routes/hpoi/info.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hpoi/user.ts b/lib/routes/hpoi/user.ts index 38ee4584f..aab8364c2 100644 --- a/lib/routes/hpoi/user.ts +++ b/lib/routes/hpoi/user.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const root_url = 'https://www.hpoi.net'; const titleMap = { diff --git a/lib/routes/hpoi/utils.ts b/lib/routes/hpoi/utils.ts index 73b8c6c55..3ca6700c4 100644 --- a/lib/routes/hpoi/utils.ts +++ b/lib/routes/hpoi/utils.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + const host = 'https://www.hpoi.net'; const MAPs = { diff --git a/lib/routes/hpoi/work.ts b/lib/routes/hpoi/work.ts index fbe8f4bd8..6d487c0ac 100644 --- a/lib/routes/hpoi/work.ts +++ b/lib/routes/hpoi/work.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/hrbeu/cec/list.ts b/lib/routes/hrbeu/cec/list.ts index 1c37a38cb..cd6e8c5e8 100644 --- a/lib/routes/hrbeu/cec/list.ts +++ b/lib/routes/hrbeu/cec/list.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'http://cec.hrbeu.edu.cn'; export const route: Route = { diff --git a/lib/routes/hrbeu/gx/card.ts b/lib/routes/hrbeu/gx/card.ts index a854508b8..2fa03e43a 100644 --- a/lib/routes/hrbeu/gx/card.ts +++ b/lib/routes/hrbeu/gx/card.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'http://news.hrbeu.edu.cn'; export const route: Route = { diff --git a/lib/routes/hrbeu/gx/list.ts b/lib/routes/hrbeu/gx/list.ts index c05b5ea9a..dc0ab50fd 100644 --- a/lib/routes/hrbeu/gx/list.ts +++ b/lib/routes/hrbeu/gx/list.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'http://news.hrbeu.edu.cn'; export const route: Route = { diff --git a/lib/routes/hrbeu/job/bigemploy.ts b/lib/routes/hrbeu/job/bigemploy.ts index 95c53fc7c..2d281367f 100644 --- a/lib/routes/hrbeu/job/bigemploy.ts +++ b/lib/routes/hrbeu/job/bigemploy.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hrbeu/job/calendar.ts b/lib/routes/hrbeu/job/calendar.ts index 2ea0d0cb6..ad7631f3f 100644 --- a/lib/routes/hrbeu/job/calendar.ts +++ b/lib/routes/hrbeu/job/calendar.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + const rootUrl = 'http://job.hrbeu.edu.cn'; export const route: Route = { diff --git a/lib/routes/hrbeu/job/list.ts b/lib/routes/hrbeu/job/list.ts index 4c02a1eb6..f5b43a329 100644 --- a/lib/routes/hrbeu/job/list.ts +++ b/lib/routes/hrbeu/job/list.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; + const rootUrl = 'http://job.hrbeu.edu.cn'; const idMap = { diff --git a/lib/routes/hrbeu/sec/list.ts b/lib/routes/hrbeu/sec/list.ts index 795f86190..a9f233b7b 100644 --- a/lib/routes/hrbeu/sec/list.ts +++ b/lib/routes/hrbeu/sec/list.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'http://sec.hrbeu.edu.cn'; export const route: Route = { diff --git a/lib/routes/hrbeu/uae/news.ts b/lib/routes/hrbeu/uae/news.ts index 0f0962088..7019c2716 100644 --- a/lib/routes/hrbeu/uae/news.ts +++ b/lib/routes/hrbeu/uae/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; diff --git a/lib/routes/hrbeu/ugs/news.ts b/lib/routes/hrbeu/ugs/news.ts index 0eeca3dcb..18f5a07aa 100644 --- a/lib/routes/hrbeu/ugs/news.ts +++ b/lib/routes/hrbeu/ugs/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'http://ugs.hrbeu.edu.cn'; diff --git a/lib/routes/hrbeu/yjsy/list.ts b/lib/routes/hrbeu/yjsy/list.ts index d101b101b..053509661 100644 --- a/lib/routes/hrbeu/yjsy/list.ts +++ b/lib/routes/hrbeu/yjsy/list.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'http://yjsy.hrbeu.edu.cn'; export const route: Route = { diff --git a/lib/routes/hrbust/cs.ts b/lib/routes/hrbust/cs.ts index d18659835..0ff7f0468 100644 --- a/lib/routes/hrbust/cs.ts +++ b/lib/routes/hrbust/cs.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/cs/:category?', diff --git a/lib/routes/hrbust/gzc.ts b/lib/routes/hrbust/gzc.ts index cd4d6bee1..bfc2cb5c7 100644 --- a/lib/routes/hrbust/gzc.ts +++ b/lib/routes/hrbust/gzc.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/gzc/:category?', diff --git a/lib/routes/hrbust/jwzx.ts b/lib/routes/hrbust/jwzx.ts index 37f8a57fa..0a4d124f1 100644 --- a/lib/routes/hrbust/jwzx.ts +++ b/lib/routes/hrbust/jwzx.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/jwzx/:type?/:page?', diff --git a/lib/routes/hrbust/lib.ts b/lib/routes/hrbust/lib.ts index 7c737a410..d866b9e35 100644 --- a/lib/routes/hrbust/lib.ts +++ b/lib/routes/hrbust/lib.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/lib/:category?', diff --git a/lib/routes/hrbust/news.ts b/lib/routes/hrbust/news.ts index 8cc2d00ee..af50d4a50 100644 --- a/lib/routes/hrbust/news.ts +++ b/lib/routes/hrbust/news.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/news/:category?', diff --git a/lib/routes/hrbust/nic.ts b/lib/routes/hrbust/nic.ts index f6d0e3bc5..dc2416224 100644 --- a/lib/routes/hrbust/nic.ts +++ b/lib/routes/hrbust/nic.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; export const route: Route = { path: '/nic/:category?', diff --git a/lib/routes/huanqiu/index.ts b/lib/routes/huanqiu/index.ts index 3f4d03a13..5cd64beac 100644 --- a/lib/routes/huanqiu/index.ts +++ b/lib/routes/huanqiu/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; function getKeysRecursive(dic, key, attr, array) { for (const v of Object.values(dic)) { diff --git a/lib/routes/huawei/developer/harmonyos/samplecode.ts b/lib/routes/huawei/developer/harmonyos/samplecode.ts index 6de4a56bb..ff3059435 100644 --- a/lib/routes/huawei/developer/harmonyos/samplecode.ts +++ b/lib/routes/huawei/developer/harmonyos/samplecode.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; const md = MarkdownIt({ html: true, diff --git a/lib/routes/hubu/index.ts b/lib/routes/hubu/index.ts index c8f6998a6..fb64cd7ea 100644 --- a/lib/routes/hubu/index.ts +++ b/lib/routes/hubu/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/hubu/zhxy.ts b/lib/routes/hubu/zhxy.ts index b5e9801a3..93ab0152a 100644 --- a/lib/routes/hubu/zhxy.ts +++ b/lib/routes/hubu/zhxy.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/hudsonrivertrading/index.ts b/lib/routes/hudsonrivertrading/index.ts index 9d07f35d6..fad4ada47 100644 --- a/lib/routes/hudsonrivertrading/index.ts +++ b/lib/routes/hudsonrivertrading/index.ts @@ -1,7 +1,7 @@ -import { Route, type Data } from '@/types'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { type Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; type WordpressPost = { id: number; diff --git a/lib/routes/huggingface/blog-community.ts b/lib/routes/huggingface/blog-community.ts index 1e82d9ce6..4e2bb4190 100644 --- a/lib/routes/huggingface/blog-community.ts +++ b/lib/routes/huggingface/blog-community.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/huggingface/blog-zh.ts b/lib/routes/huggingface/blog-zh.ts index df4117fb3..7db3abc69 100644 --- a/lib/routes/huggingface/blog-zh.ts +++ b/lib/routes/huggingface/blog-zh.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/huggingface/blog.ts b/lib/routes/huggingface/blog.ts index 71b4fc326..868de48d4 100644 --- a/lib/routes/huggingface/blog.ts +++ b/lib/routes/huggingface/blog.ts @@ -1,6 +1,7 @@ -import { Route, type DataItem } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { type DataItem, Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/huggingface/daily-papers.ts b/lib/routes/huggingface/daily-papers.ts index 975056cb4..1a76ef271 100644 --- a/lib/routes/huggingface/daily-papers.ts +++ b/lib/routes/huggingface/daily-papers.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/huijin-inv/news.ts b/lib/routes/huijin-inv/news.ts index 0512cc4fb..7fba291ca 100644 --- a/lib/routes/huijin-inv/news.ts +++ b/lib/routes/huijin-inv/news.ts @@ -1,8 +1,9 @@ -import { type Data, type DataItem, Route } from '@/types'; import { type CheerioAPI, load } from 'cheerio'; + +import type { type Data, type DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const BASE_URL = 'https://www.huijin-inv.cn'; diff --git a/lib/routes/hunanpea/rsks.ts b/lib/routes/hunanpea/rsks.ts index d249c6423..07c3697ff 100644 --- a/lib/routes/hunanpea/rsks.ts +++ b/lib/routes/hunanpea/rsks.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hunau/gfxy/index.ts b/lib/routes/hunau/gfxy/index.ts index 035bae0f9..f399e5f2a 100644 --- a/lib/routes/hunau/gfxy/index.ts +++ b/lib/routes/hunau/gfxy/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import getContent from '../utils/common'; export const route: Route = { diff --git a/lib/routes/hunau/ied.ts b/lib/routes/hunau/ied.ts index 684f033cb..b92f9bac1 100644 --- a/lib/routes/hunau/ied.ts +++ b/lib/routes/hunau/ied.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import getContent from './utils/common'; export const route: Route = { diff --git a/lib/routes/hunau/jwc.ts b/lib/routes/hunau/jwc.ts index b79a46208..dfa8e2478 100644 --- a/lib/routes/hunau/jwc.ts +++ b/lib/routes/hunau/jwc.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import getContent from './utils/common'; export const route: Route = { diff --git a/lib/routes/hunau/utils/common.ts b/lib/routes/hunau/utils/common.ts index b75af647c..4bef4beb4 100644 --- a/lib/routes/hunau/utils/common.ts +++ b/lib/routes/hunau/utils/common.ts @@ -1,10 +1,12 @@ -import cache from '@/utils/cache'; // common.js import { load } from 'cheerio'; + +import cache from '@/utils/cache'; import got from '@/utils/got'; + import categoryTitle from './category-title'; -import newsContent from './news-content'; import indexPage from './index-page'; +import newsContent from './news-content'; async function getContent(ctx, { baseHost, baseCategory, baseType, baseTitle, baseDescription = '', baseDeparment = '', baseClass = 'div.article_list ul li:has(a)' }) { const { category = baseCategory, type = baseType, page = '1' } = ctx.req.param(); diff --git a/lib/routes/hunau/utils/news-content.ts b/lib/routes/hunau/utils/news-content.ts index 88a6ef11b..c455c362d 100644 --- a/lib/routes/hunau/utils/news-content.ts +++ b/lib/routes/hunau/utils/news-content.ts @@ -1,7 +1,8 @@ +import { load } from 'cheerio'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; async function newsContent(link, department = '') { try { diff --git a/lib/routes/hunau/xky/index.ts b/lib/routes/hunau/xky/index.ts index 65024f3c2..f4fdcab4f 100644 --- a/lib/routes/hunau/xky/index.ts +++ b/lib/routes/hunau/xky/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import getContent from '../utils/common'; export const route: Route = { diff --git a/lib/routes/huoxian/zone.ts b/lib/routes/huoxian/zone.ts index 170b3e48c..fc4fcaae5 100644 --- a/lib/routes/huoxian/zone.ts +++ b/lib/routes/huoxian/zone.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/hupu/all.ts b/lib/routes/hupu/all.ts index 2226ae052..041268ac9 100644 --- a/lib/routes/hupu/all.ts +++ b/lib/routes/hupu/all.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/all/:id?', diff --git a/lib/routes/hupu/bbs.ts b/lib/routes/hupu/bbs.ts index 39ca3d457..2d8661258 100644 --- a/lib/routes/hupu/bbs.ts +++ b/lib/routes/hupu/bbs.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: ['/bbs/:id?/:order?', '/bxj/:id?/:order?'], diff --git a/lib/routes/hupu/index.ts b/lib/routes/hupu/index.ts index fc3b9f2ff..58d33618a 100644 --- a/lib/routes/hupu/index.ts +++ b/lib/routes/hupu/index.ts @@ -1,10 +1,12 @@ -import { Route, Data, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; -import { type HupuApiResponse, type HomePostItem, type NewsDataItem, isHomePostItem } from './types'; +import timezone from '@/utils/timezone'; + +import { type HomePostItem, type HupuApiResponse, isHomePostItem, type NewsDataItem } from './types'; const categories = { nba: { diff --git a/lib/routes/hupu/types.ts b/lib/routes/hupu/types.ts index ff6683ba2..8c62dc842 100644 --- a/lib/routes/hupu/types.ts +++ b/lib/routes/hupu/types.ts @@ -160,4 +160,4 @@ export function isNewsDataItem(item: HomePostItem | NewsDataItem): item is NewsD } // 导出具体类型以供外部使用 -export type { Badge, HomePostItem, NewsDataItem, RecommendMatch, HomePageProps, BasketballPageProps, SoccerPageProps, CategoryPageProps, ApiResponseProps }; +export type { ApiResponseProps, Badge, BasketballPageProps, CategoryPageProps, HomePageProps, HomePostItem, NewsDataItem, RecommendMatch, SoccerPageProps }; diff --git a/lib/routes/hust/aia/news.ts b/lib/routes/hust/aia/news.ts index e3d817ff0..d2ee6f208 100755 --- a/lib/routes/hust/aia/news.ts +++ b/lib/routes/hust/aia/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hust/aia/notice.ts b/lib/routes/hust/aia/notice.ts index 9ae3fc32d..f98546ae1 100755 --- a/lib/routes/hust/aia/notice.ts +++ b/lib/routes/hust/aia/notice.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hust/gs.ts b/lib/routes/hust/gs.ts index e42ddfe18..209fdd52b 100644 --- a/lib/routes/hust/gs.ts +++ b/lib/routes/hust/gs.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/hust/mse.ts b/lib/routes/hust/mse.ts index ee4461987..b6bc3ad88 100644 --- a/lib/routes/hust/mse.ts +++ b/lib/routes/hust/mse.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/hust/yjs.ts b/lib/routes/hust/yjs.ts index fd05e334b..9819c4d22 100644 --- a/lib/routes/hust/yjs.ts +++ b/lib/routes/hust/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/huxiu/brief-column.ts b/lib/routes/huxiu/brief-column.ts index ffbca4921..f185c568d 100644 --- a/lib/routes/huxiu/brief-column.ts +++ b/lib/routes/huxiu/brief-column.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { apiBriefRootUrl, processItems, fetchBriefColumnData } from './util'; +import { apiBriefRootUrl, fetchBriefColumnData, processItems } from './util'; export const route: Route = { path: '/briefcolumn/:id', diff --git a/lib/routes/huxiu/channel.ts b/lib/routes/huxiu/channel.ts index e2c669111..71227c461 100644 --- a/lib/routes/huxiu/channel.ts +++ b/lib/routes/huxiu/channel.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiArticleRootUrl, processItems, fetchData } from './util'; +import { apiArticleRootUrl, fetchData, processItems, rootUrl } from './util'; export const route: Route = { path: ['/article', '/channel/:id?'], diff --git a/lib/routes/huxiu/club.ts b/lib/routes/huxiu/club.ts index 2996097e1..0ebfe3724 100644 --- a/lib/routes/huxiu/club.ts +++ b/lib/routes/huxiu/club.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { apiBriefRootUrl, processItems, fetchClubData } from './util'; +import { apiBriefRootUrl, fetchClubData, processItems } from './util'; export const route: Route = { path: '/club/:id', diff --git a/lib/routes/huxiu/collection.ts b/lib/routes/huxiu/collection.ts index 0112c44a5..4fd0f0136 100644 --- a/lib/routes/huxiu/collection.ts +++ b/lib/routes/huxiu/collection.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiArticleRootUrl, processItems, fetchData } from './util'; +import { apiArticleRootUrl, fetchData, processItems, rootUrl } from './util'; export const route: Route = { path: '/collection/:id', diff --git a/lib/routes/huxiu/member.ts b/lib/routes/huxiu/member.ts index 4a2520523..827e1186c 100644 --- a/lib/routes/huxiu/member.ts +++ b/lib/routes/huxiu/member.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiMemberRootUrl, processItems, fetchData } from './util'; +import { apiMemberRootUrl, fetchData, processItems, rootUrl } from './util'; export const route: Route = { path: ['/author/:id/:type?', '/member/:id/:type?'], diff --git a/lib/routes/huxiu/moment.ts b/lib/routes/huxiu/moment.ts index 01336d063..c5a75767f 100644 --- a/lib/routes/huxiu/moment.ts +++ b/lib/routes/huxiu/moment.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiMomentRootUrl, processItems, fetchData } from './util'; +import { apiMomentRootUrl, fetchData, processItems, rootUrl } from './util'; export const route: Route = { path: '/moment', diff --git a/lib/routes/huxiu/search.ts b/lib/routes/huxiu/search.ts index dc7be0514..587f5bf0b 100644 --- a/lib/routes/huxiu/search.ts +++ b/lib/routes/huxiu/search.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiSearchRootUrl, generateSignature, processItems, fetchData } from './util'; +import { apiSearchRootUrl, fetchData, generateSignature, processItems, rootUrl } from './util'; export const route: Route = { path: '/search/:keyword', diff --git a/lib/routes/huxiu/tag.ts b/lib/routes/huxiu/tag.ts index 16e32a306..4b9af9250 100644 --- a/lib/routes/huxiu/tag.ts +++ b/lib/routes/huxiu/tag.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, processItems, fetchData } from './util'; +import { fetchData, processItems, rootUrl } from './util'; export const route: Route = { path: '/tag/:id', diff --git a/lib/routes/huxiu/util.ts b/lib/routes/huxiu/util.ts index 766e587e1..6eebcfe43 100644 --- a/lib/routes/huxiu/util.ts +++ b/lib/routes/huxiu/util.ts @@ -1,9 +1,11 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; +import CryptoJS from 'crypto-js'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import CryptoJS from 'crypto-js'; const domain = 'huxiu.com'; const rootUrl = `https://www.${domain}`; @@ -442,4 +444,4 @@ const processVideoInfo = (info) => { }; }; -export { rootUrl, apiArticleRootUrl, apiBriefRootUrl, apiMemberRootUrl, apiMomentRootUrl, apiSearchRootUrl, fetchBriefColumnData, fetchClubData, fetchData, generateSignature, processItems }; +export { apiArticleRootUrl, apiBriefRootUrl, apiMemberRootUrl, apiMomentRootUrl, apiSearchRootUrl, fetchBriefColumnData, fetchClubData, fetchData, generateSignature, processItems, rootUrl }; diff --git a/lib/routes/hyperdash/top-traders.ts b/lib/routes/hyperdash/top-traders.ts index e1044b707..89232f3c8 100644 --- a/lib/routes/hyperdash/top-traders.ts +++ b/lib/routes/hyperdash/top-traders.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import { fetchTopTraders, formatCurrency, formatPnL } from './utils'; -import { art } from '@/utils/render'; import path from 'node:path'; +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { fetchTopTraders, formatCurrency, formatPnL } from './utils'; + export const route: Route = { path: '/top-traders', categories: ['finance'], diff --git a/lib/routes/hypergryph/arknights/announce.ts b/lib/routes/hypergryph/arknights/announce.ts index f034de435..56a52c5de 100644 --- a/lib/routes/hypergryph/arknights/announce.ts +++ b/lib/routes/hypergryph/arknights/announce.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; type AnnounceItem = { announceId: string; diff --git a/lib/routes/hypergryph/arknights/arktca.ts b/lib/routes/hypergryph/arknights/arktca.ts index 66fec158e..2a53156a8 100644 --- a/lib/routes/hypergryph/arknights/arktca.ts +++ b/lib/routes/hypergryph/arknights/arktca.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const rssDescription = '明日方舟期刊《回归线》 | 泰拉创作者联合会'; const url = 'aneot.arktca.com'; diff --git a/lib/routes/hypergryph/arknights/japan.ts b/lib/routes/hypergryph/arknights/japan.ts index db96cae33..536c24479 100644 --- a/lib/routes/hypergryph/arknights/japan.ts +++ b/lib/routes/hypergryph/arknights/japan.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import type { Context } from 'hono'; type ContentItem = { key: string; diff --git a/lib/routes/hypergryph/arknights/news.ts b/lib/routes/hypergryph/arknights/news.ts index fc5f65fb4..fe01953bb 100644 --- a/lib/routes/hypergryph/arknights/news.ts +++ b/lib/routes/hypergryph/arknights/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import * as cheerio from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; type NewsItem = { cid: string; diff --git a/lib/routes/i-cable/news.ts b/lib/routes/i-cable/news.ts index 6541ba565..a75ecc46f 100644 --- a/lib/routes/i-cable/news.ts +++ b/lib/routes/i-cable/news.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import path from 'node:path'; -import { art } from '@/utils/render'; + import { config } from '@/config'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; export const route: Route = { path: '/news/:category?', diff --git a/lib/routes/ianspriggs/index.ts b/lib/routes/ianspriggs/index.ts index b652cc458..f296e83a2 100644 --- a/lib/routes/ianspriggs/index.ts +++ b/lib/routes/ianspriggs/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/icac/news.ts b/lib/routes/icac/news.ts index eed96e0c3..12d3e7923 100644 --- a/lib/routes/icac/news.ts +++ b/lib/routes/icac/news.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import utils from './utils'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + export const route: Route = { path: '/news/:lang?', categories: ['government'], diff --git a/lib/routes/icbc/whpj.ts b/lib/routes/icbc/whpj.ts index b44761535..f65643ac3 100644 --- a/lib/routes/icbc/whpj.ts +++ b/lib/routes/icbc/whpj.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/idaily/index.ts b/lib/routes/idaily/index.ts index 6fc9c5491..93be08d14 100644 --- a/lib/routes/idaily/index.ts +++ b/lib/routes/idaily/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: ['/:language?'], diff --git a/lib/routes/idolmaster/news.ts b/lib/routes/idolmaster/news.ts index a2e015a54..935034a93 100644 --- a/lib/routes/idolmaster/news.ts +++ b/lib/routes/idolmaster/news.ts @@ -1,11 +1,13 @@ -import { Route, Data, DataItem } from '@/types'; -import type { Context } from 'hono'; -import got from '@/utils/got'; import querystring from 'node:querystring'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; + import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { url: 'idolmaster-official.jp/news', diff --git a/lib/routes/idolypride/news.ts b/lib/routes/idolypride/news.ts index 103d96a07..2698d5c1d 100644 --- a/lib/routes/idolypride/news.ts +++ b/lib/routes/idolypride/news.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ieee-security/sp.ts b/lib/routes/ieee-security/sp.ts index d7627fcf6..1c2cbf523 100644 --- a/lib/routes/ieee-security/sp.ts +++ b/lib/routes/ieee-security/sp.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + const url = 'https://www.ieee-security.org/'; // https://www.ieee-security.org/TC/SP2023/program-papers.html diff --git a/lib/routes/ieee/author.ts b/lib/routes/ieee/author.ts index 6afef6535..289e97363 100644 --- a/lib/routes/ieee/author.ts +++ b/lib/routes/ieee/author.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import path from 'node:path'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; diff --git a/lib/routes/ieee/journal.ts b/lib/routes/ieee/journal.ts index ed1e96abb..7ef3e00c9 100644 --- a/lib/routes/ieee/journal.ts +++ b/lib/routes/ieee/journal.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import path from 'node:path'; import { art } from '@/utils/render'; const ieeeHost = 'https://ieeexplore.ieee.org'; diff --git a/lib/routes/iehou/index.ts b/lib/routes/iehou/index.ts index 675096cfb..2d2ed7d83 100644 --- a/lib/routes/iehou/index.ts +++ b/lib/routes/iehou/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = '' } = ctx.req.param(); diff --git a/lib/routes/ielts/index.ts b/lib/routes/ielts/index.ts index 179210659..1e08c8db6 100644 --- a/lib/routes/ielts/index.ts +++ b/lib/routes/ielts/index.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import got from '@/utils/got'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -const targetUrl = 'https://ielts.neea.cn/allnews?locale=zh_CN'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; + +const targetUrl = 'https://ielts.neea.cn/allnews?locale=zh_CN'; export const route: Route = { path: '/', diff --git a/lib/routes/ifanr/category.ts b/lib/routes/ifanr/category.ts index de587d63f..971baa87c 100644 --- a/lib/routes/ifanr/category.ts +++ b/lib/routes/ifanr/category.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ifanr/digest.ts b/lib/routes/ifanr/digest.ts index 2a1cba8ac..9647b937b 100644 --- a/lib/routes/ifanr/digest.ts +++ b/lib/routes/ifanr/digest.ts @@ -1,8 +1,7 @@ import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ifanr/index.ts b/lib/routes/ifanr/index.ts index 34f942681..a330a8f63 100644 --- a/lib/routes/ifanr/index.ts +++ b/lib/routes/ifanr/index.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ifeng/feng.ts b/lib/routes/ifeng/feng.ts index fc59a2f9a..edea32c3d 100644 --- a/lib/routes/ifeng/feng.ts +++ b/lib/routes/ifeng/feng.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { extractDoc, renderVideo } from './utils'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { extractDoc, renderVideo } from './utils'; + export const route: Route = { path: '/feng/:id/:type', categories: ['new-media'], diff --git a/lib/routes/ifeng/news.ts b/lib/routes/ifeng/news.ts index 70c8d99ab..1134771d0 100644 --- a/lib/routes/ifeng/news.ts +++ b/lib/routes/ifeng/news.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/news/*', diff --git a/lib/routes/ifeng/utils.ts b/lib/routes/ifeng/utils.ts index 387c7c7d9..0ef7347f4 100644 --- a/lib/routes/ifeng/utils.ts +++ b/lib/routes/ifeng/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; +import { art } from '@/utils/render'; + const extractDoc = (data) => data .map((item) => { diff --git a/lib/routes/ifi-audio/download.ts b/lib/routes/ifi-audio/download.ts index 5b82846a8..ed85d9798 100644 --- a/lib/routes/ifi-audio/download.ts +++ b/lib/routes/ifi-audio/download.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const host = 'https://ifi-audio.com'; export const route: Route = { diff --git a/lib/routes/ifun/n/category.ts b/lib/routes/ifun/n/category.ts index b7f78de1f..859e083c9 100644 --- a/lib/routes/ifun/n/category.ts +++ b/lib/routes/ifun/n/category.ts @@ -1,10 +1,9 @@ import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { author, language, rootUrl, processItems } from './util'; +import { author, language, processItems, rootUrl } from './util'; export const handler = async (ctx: Context): Promise => { const { id } = ctx.req.param(); diff --git a/lib/routes/ifun/n/search.ts b/lib/routes/ifun/n/search.ts index bb0ca4772..ab8c25a0d 100644 --- a/lib/routes/ifun/n/search.ts +++ b/lib/routes/ifun/n/search.ts @@ -1,10 +1,9 @@ import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { author, language, rootUrl, processItems } from './util'; +import { author, language, processItems, rootUrl } from './util'; export const handler = async (ctx: Context): Promise => { const { keywords } = ctx.req.param(); diff --git a/lib/routes/ifun/n/tag.ts b/lib/routes/ifun/n/tag.ts index 0577c40fc..23f108463 100644 --- a/lib/routes/ifun/n/tag.ts +++ b/lib/routes/ifun/n/tag.ts @@ -1,10 +1,9 @@ import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { author, language, rootUrl, processItems } from './util'; +import { author, language, processItems, rootUrl } from './util'; export const handler = async (ctx: Context): Promise => { const { name } = ctx.req.param(); diff --git a/lib/routes/ifun/n/util.ts b/lib/routes/ifun/n/util.ts index 5f1bfa14d..44916b372 100644 --- a/lib/routes/ifun/n/util.ts +++ b/lib/routes/ifun/n/util.ts @@ -1,5 +1,4 @@ import { type DataItem } from '@/types'; - import { parseDate } from '@/utils/parse-date'; const author: string = '趣集'; @@ -31,4 +30,4 @@ const processItems: (items: any[], limit: number) => DataItem[] = (items: any[], }; }); -export { author, language, rootUrl, processItems }; +export { author, language, processItems, rootUrl }; diff --git a/lib/routes/iguoguo/index.ts b/lib/routes/iguoguo/index.ts index bb7686ce8..ec6037ec0 100644 --- a/lib/routes/iguoguo/index.ts +++ b/lib/routes/iguoguo/index.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import type { Context } from 'hono'; + const rootUrl = 'https://www.iguoguo.net'; const getCategoryIdFromSlug = (slug) => diff --git a/lib/routes/iheima/index.ts b/lib/routes/iheima/index.ts index 1f105587d..2c231fc7d 100644 --- a/lib/routes/iheima/index.ts +++ b/lib/routes/iheima/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/iiilab/index.ts b/lib/routes/iiilab/index.ts index 3de20ca60..174d2dc09 100644 --- a/lib/routes/iiilab/index.ts +++ b/lib/routes/iiilab/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; + const baseUrl = 'https://www.iiilab.com/'; export const route: Route = { diff --git a/lib/routes/ikea/cn/family-offers.ts b/lib/routes/ikea/cn/family-offers.ts index af5748a72..3003e2e2d 100644 --- a/lib/routes/ikea/cn/family-offers.ts +++ b/lib/routes/ikea/cn/family-offers.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { generateProductItem } from './utils'; const familyPriceProductsRequest = ({ pageIndex = 1 }) => diff --git a/lib/routes/ikea/cn/low-price.ts b/lib/routes/ikea/cn/low-price.ts index 994466f34..43935ac9e 100644 --- a/lib/routes/ikea/cn/low-price.ts +++ b/lib/routes/ikea/cn/low-price.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { generateRequestHeaders, generateProductItem } from './utils'; + +import { generateProductItem, generateRequestHeaders } from './utils'; export const route: Route = { path: '/cn/low_price', diff --git a/lib/routes/ikea/cn/new.ts b/lib/routes/ikea/cn/new.ts index 502882cdc..4ee41ef12 100644 --- a/lib/routes/ikea/cn/new.ts +++ b/lib/routes/ikea/cn/new.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { generateRequestHeaders, generateProductItem } from './utils'; + +import { generateProductItem, generateRequestHeaders } from './utils'; const request = ({ moreToken = '' }) => got({ diff --git a/lib/routes/ikea/cn/utils.ts b/lib/routes/ikea/cn/utils.ts index 75e8af590..1d067a190 100644 --- a/lib/routes/ikea/cn/utils.ts +++ b/lib/routes/ikea/cn/utils.ts @@ -1,7 +1,8 @@ -import { art } from '@/utils/render'; -import md5 from '@/utils/md5'; import path from 'node:path'; +import md5 from '@/utils/md5'; +import { art } from '@/utils/render'; + const generateRequestHeaders = () => { const now = Math.round(Date.now() / 1000); return { @@ -36,4 +37,4 @@ const generateProductItem = (product) => { }; }; -export { generateRequestHeaders, generateProductItem }; +export { generateProductItem, generateRequestHeaders }; diff --git a/lib/routes/ikea/gb/new.ts b/lib/routes/ikea/gb/new.ts index 8ad4219e8..ea374dbec 100644 --- a/lib/routes/ikea/gb/new.ts +++ b/lib/routes/ikea/gb/new.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/gb/new', diff --git a/lib/routes/ikea/gb/offer.ts b/lib/routes/ikea/gb/offer.ts index 8634a1066..10387aae3 100644 --- a/lib/routes/ikea/gb/offer.ts +++ b/lib/routes/ikea/gb/offer.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/gb/offer', categories: ['shopping'], diff --git a/lib/routes/iknowwhatyoudownload/daily.ts b/lib/routes/iknowwhatyoudownload/daily.ts index b305f03e4..635d910d5 100644 --- a/lib/routes/iknowwhatyoudownload/daily.ts +++ b/lib/routes/iknowwhatyoudownload/daily.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; +import path from 'node:path'; + import { load } from 'cheerio'; import dayjs from 'dayjs'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; interface TableData { key: string; diff --git a/lib/routes/imagemagick/changelog.ts b/lib/routes/imagemagick/changelog.ts index 8fc3e219d..b02047493 100644 --- a/lib/routes/imagemagick/changelog.ts +++ b/lib/routes/imagemagick/changelog.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/imdb/chart.ts b/lib/routes/imdb/chart.ts index 056f60ccf..a9e58a4eb 100644 --- a/lib/routes/imdb/chart.ts +++ b/lib/routes/imdb/chart.ts @@ -1,11 +1,15 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; +import path from 'node:path'; + import * as cheerio from 'cheerio'; import type { Context } from 'hono'; -import { ChartTitleSearchConnection } from './types'; -import path from 'node:path'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; +import type { ChartTitleSearchConnection } from './types'; + const render = (data) => art(path.join(__dirname, 'templates/chart.art'), data); export const route: Route = { diff --git a/lib/routes/imhcg/blog.ts b/lib/routes/imhcg/blog.ts index 73cb24f9a..e0fdadf15 100644 --- a/lib/routes/imhcg/blog.ts +++ b/lib/routes/imhcg/blog.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/imiker/jinghua.ts b/lib/routes/imiker/jinghua.ts index ce2aeca23..bbd1f07df 100644 --- a/lib/routes/imiker/jinghua.ts +++ b/lib/routes/imiker/jinghua.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/ask/jinghua', diff --git a/lib/routes/immich/cursed-knowledge.ts b/lib/routes/immich/cursed-knowledge.ts index c148eee3e..93eaffe43 100644 --- a/lib/routes/immich/cursed-knowledge.ts +++ b/lib/routes/immich/cursed-knowledge.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/imop/tianshu.ts b/lib/routes/imop/tianshu.ts index 62b66f7a3..ca90d0e36 100644 --- a/lib/routes/imop/tianshu.ts +++ b/lib/routes/imop/tianshu.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import got from '@/utils/got'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; const baseUrl = 'http://t.imop.com'; diff --git a/lib/routes/index.tsx b/lib/routes/index.tsx index 240e1bbb1..7eb4a9141 100644 --- a/lib/routes/index.tsx +++ b/lib/routes/index.tsx @@ -1,4 +1,5 @@ import type { Handler } from 'hono'; + import Index from '@/views/index'; const handler: Handler = (ctx) => { diff --git a/lib/routes/indianexpress/section.ts b/lib/routes/indianexpress/section.ts index 81ca1edf5..1a0fdebb9 100644 --- a/lib/routes/indianexpress/section.ts +++ b/lib/routes/indianexpress/section.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { id = 'trending' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '50', 10); diff --git a/lib/routes/indiansinkuwait/latest.ts b/lib/routes/indiansinkuwait/latest.ts index f4e31a159..ad58cf8d7 100644 --- a/lib/routes/indiansinkuwait/latest.ts +++ b/lib/routes/indiansinkuwait/latest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://www.indiansinkuwait.com'; diff --git a/lib/routes/indienova/article.ts b/lib/routes/indienova/article.ts index fce76cdbb..d44a011d3 100644 --- a/lib/routes/indienova/article.ts +++ b/lib/routes/indienova/article.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseList, parseItem } from './utils'; + +import { parseItem, parseList } from './utils'; export const route: Route = { path: '/:type', diff --git a/lib/routes/indienova/column.ts b/lib/routes/indienova/column.ts index e0f3e1ece..a159044fb 100644 --- a/lib/routes/indienova/column.ts +++ b/lib/routes/indienova/column.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { baseUrl, parseList, parseItem } from './utils'; + +import { baseUrl, parseItem, parseList } from './utils'; export const route: Route = { path: '/column/:columnId', diff --git a/lib/routes/indienova/gamedb.ts b/lib/routes/indienova/gamedb.ts index e1a155100..dc25cbb62 100644 --- a/lib/routes/indienova/gamedb.ts +++ b/lib/routes/indienova/gamedb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/indienova/usergames.ts b/lib/routes/indienova/usergames.ts index 9e998e77a..33b3b7946 100644 --- a/lib/routes/indienova/usergames.ts +++ b/lib/routes/indienova/usergames.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/indienova/utils.ts b/lib/routes/indienova/utils.ts index 51c8ad6a4..dc6b3e6a1 100644 --- a/lib/routes/indienova/utils.ts +++ b/lib/routes/indienova/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; @@ -36,4 +37,4 @@ const parseItem = async (item) => { return item; }; -export { baseUrl, parseList, parseItem }; +export { baseUrl, parseItem, parseList }; diff --git a/lib/routes/inewsweek/index.ts b/lib/routes/inewsweek/index.ts index f1c2b362e..24233919e 100644 --- a/lib/routes/inewsweek/index.ts +++ b/lib/routes/inewsweek/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import iconv from 'iconv-lite'; const rootUrl = 'http://news.inewsweek.cn'; diff --git a/lib/routes/infoq/presentations.ts b/lib/routes/infoq/presentations.ts index 8cf7ea4bf..dd5f1e7c1 100644 --- a/lib/routes/infoq/presentations.ts +++ b/lib/routes/infoq/presentations.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { conference } = ctx.req.param(); diff --git a/lib/routes/infoq/recommend.ts b/lib/routes/infoq/recommend.ts index b2ec6aa30..830f0a7a3 100644 --- a/lib/routes/infoq/recommend.ts +++ b/lib/routes/infoq/recommend.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/infoq/topic.ts b/lib/routes/infoq/topic.ts index 071f25dbd..b5326f399 100644 --- a/lib/routes/infoq/topic.ts +++ b/lib/routes/infoq/topic.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/informedainews/docs.ts b/lib/routes/informedainews/docs.ts index 4838ee5f9..fbf9646dc 100644 --- a/lib/routes/informedainews/docs.ts +++ b/lib/routes/informedainews/docs.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { load } from 'cheerio'; // 类似 jQuery 的 API HTML 解析器 -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; // 统一使用的请求库 +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/zh-Hans/docs/:type', diff --git a/lib/routes/informs/index.ts b/lib/routes/informs/index.ts index 3f636a525..cfbb0aa74 100644 --- a/lib/routes/informs/index.ts +++ b/lib/routes/informs/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { config } from '@/config'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const rootUrl = 'https://pubsonline.informs.org'; diff --git a/lib/routes/infzm/hot.ts b/lib/routes/infzm/hot.ts index 5801f9c6e..c9757097a 100644 --- a/lib/routes/infzm/hot.ts +++ b/lib/routes/infzm/hot.ts @@ -1,6 +1,7 @@ import type { Data, DataItem, Route } from '@/types'; -import type { ContentsResponse } from './types'; import got from '@/utils/got'; + +import type { ContentsResponse } from './types'; import { fetchArticles } from './utils'; export const route: Route = { diff --git a/lib/routes/infzm/index.ts b/lib/routes/infzm/index.ts index e0beedf5e..753201a21 100644 --- a/lib/routes/infzm/index.ts +++ b/lib/routes/infzm/index.ts @@ -1,6 +1,7 @@ import type { Data, DataItem, Route } from '@/types'; -import type { ContentsResponse } from './types'; import got from '@/utils/got'; + +import type { ContentsResponse } from './types'; import { fetchArticles } from './utils'; export const route: Route = { diff --git a/lib/routes/infzm/utils.ts b/lib/routes/infzm/utils.ts index 83ca75389..43b659e65 100644 --- a/lib/routes/infzm/utils.ts +++ b/lib/routes/infzm/utils.ts @@ -1,8 +1,10 @@ +import { load } from 'cheerio'; + import { config } from '@/config'; import cache from '@/utils/cache'; import got from '@/utils/got'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; + import { baseUrl } from '.'; export async function fetchArticles(data) { diff --git a/lib/routes/inoreader/index.ts b/lib/routes/inoreader/index.ts index 59e52b331..49afdb60f 100644 --- a/lib/routes/inoreader/index.ts +++ b/lib/routes/inoreader/index.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/inoreader/rss.ts b/lib/routes/inoreader/rss.ts index e8a4a4f5f..159e5ccb2 100644 --- a/lib/routes/inoreader/rss.ts +++ b/lib/routes/inoreader/rss.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import parser from '@/utils/rss-parser'; + export const route: Route = { path: '/rss/:user/:tag', categories: ['reading'], diff --git a/lib/routes/inspirehep/author.ts b/lib/routes/inspirehep/author.ts index 768ebea1d..559de49d0 100644 --- a/lib/routes/inspirehep/author.ts +++ b/lib/routes/inspirehep/author.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { AuthorResponse, LiteratureResponse } from './types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import type { AuthorResponse, LiteratureResponse } from './types'; import { baseUrl, parseLiterature } from './utils'; export const route: Route = { diff --git a/lib/routes/inspirehep/literature.ts b/lib/routes/inspirehep/literature.ts index 64a2f1f54..18c542992 100644 --- a/lib/routes/inspirehep/literature.ts +++ b/lib/routes/inspirehep/literature.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { LiteratureResponse } from './types'; +import type { LiteratureResponse } from './types'; import { baseUrl, parseLiterature } from './utils'; export const route: Route = { diff --git a/lib/routes/inspirehep/utils.ts b/lib/routes/inspirehep/utils.ts index fe903b5e9..3279b6387 100644 --- a/lib/routes/inspirehep/utils.ts +++ b/lib/routes/inspirehep/utils.ts @@ -1,6 +1,7 @@ -import { LiteratureResponse } from './types'; import { parseDate } from '@/utils/parse-date'; +import type { LiteratureResponse } from './types'; + export const baseUrl = 'https://inspirehep.net'; export const parseLiterature = (hits: LiteratureResponse['hits']['hits']) => diff --git a/lib/routes/instagram/common-utils.ts b/lib/routes/instagram/common-utils.ts index 11f6be3da..d2339c6bc 100644 --- a/lib/routes/instagram/common-utils.ts +++ b/lib/routes/instagram/common-utils.ts @@ -1,6 +1,7 @@ +import path from 'node:path'; + import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const renderItems = (items) => items.map((item) => { diff --git a/lib/routes/instagram/private-api/index.ts b/lib/routes/instagram/private-api/index.ts index 860c7ad74..bb1d55f48 100644 --- a/lib/routes/instagram/private-api/index.ts +++ b/lib/routes/instagram/private-api/index.ts @@ -1,10 +1,12 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import { ig, login } from './utils'; -import logger from '@/utils/logger'; import { config } from '@/config'; -import { renderItems } from '../common-utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import logger from '@/utils/logger'; + +import { renderItems } from '../common-utils'; +import { ig, login } from './utils'; // loadContent pulls the desired user/tag/etc async function loadContent(category, nameOrId, tryGet) { diff --git a/lib/routes/instagram/private-api/utils.ts b/lib/routes/instagram/private-api/utils.ts index db481f242..7121613a0 100644 --- a/lib/routes/instagram/private-api/utils.ts +++ b/lib/routes/instagram/private-api/utils.ts @@ -1,7 +1,8 @@ import { IgApiClient } from 'instagram-private-api'; -import logger from '@/utils/logger'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import logger from '@/utils/logger'; const ig = new IgApiClient(); diff --git a/lib/routes/instagram/web-api/index.ts b/lib/routes/instagram/web-api/index.ts index cf80edef4..a51b461ab 100644 --- a/lib/routes/instagram/web-api/index.ts +++ b/lib/routes/instagram/web-api/index.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { CookieJar } from 'tough-cookie'; + import { config } from '@/config'; -import { renderItems } from '../common-utils'; -import { baseUrl, COOKIE_URL, checkLogin, getUserInfo, getUserFeedItems, getTagsFeed, renderGuestItems } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { renderItems } from '../common-utils'; +import { baseUrl, checkLogin, COOKIE_URL, getTagsFeed, getUserFeedItems, getUserInfo, renderGuestItems } from './utils'; export const route: Route = { path: '/2/:category/:key', diff --git a/lib/routes/instagram/web-api/utils.ts b/lib/routes/instagram/web-api/utils.ts index 062025ff7..62b48eba1 100644 --- a/lib/routes/instagram/web-api/utils.ts +++ b/lib/routes/instagram/web-api/utils.ts @@ -1,10 +1,11 @@ -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const baseUrl = 'https://www.instagram.com'; const COOKIE_URL = baseUrl; @@ -195,4 +196,4 @@ const renderGuestItems = (items) => { }); }; -export { baseUrl, COOKIE_URL, checkLogin, getUserInfo, getUserFeedItems, getTagsFeed, renderGuestItems }; +export { baseUrl, checkLogin, COOKIE_URL, getTagsFeed, getUserFeedItems, getUserInfo, renderGuestItems }; diff --git a/lib/routes/instructables/projects.ts b/lib/routes/instructables/projects.ts index 5708fd6ed..bf2b13374 100644 --- a/lib/routes/instructables/projects.ts +++ b/lib/routes/instructables/projects.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/investor/index.ts b/lib/routes/investor/index.ts index e1e3841b1..b482af2b0 100644 --- a/lib/routes/investor/index.ts +++ b/lib/routes/investor/index.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { id = 'home/zxdt' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '20', 10); diff --git a/lib/routes/iplaysoft/category.ts b/lib/routes/iplaysoft/category.ts index 2fe4fe496..de211f0c3 100644 --- a/lib/routes/iplaysoft/category.ts +++ b/lib/routes/iplaysoft/category.ts @@ -1,5 +1,7 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; -import { fetchNewsItems, fetchCategory } from './utils'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; + +import { fetchCategory, fetchNewsItems } from './utils'; export const handler = async (ctx): Promise => { const slug = ctx.req.param('slug'); diff --git a/lib/routes/iplaysoft/index.ts b/lib/routes/iplaysoft/index.ts index 301569071..1a5253b38 100644 --- a/lib/routes/iplaysoft/index.ts +++ b/lib/routes/iplaysoft/index.ts @@ -1,9 +1,11 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; +import { load } from 'cheerio'; // html parser + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import parser from '@/utils/rss-parser'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; // html parser +import parser from '@/utils/rss-parser'; export const handler = async (ctx): Promise => { const feed = await parser.parseURL('https://feed.iplaysoft.com'); diff --git a/lib/routes/iplaysoft/tag.ts b/lib/routes/iplaysoft/tag.ts index 16c889471..803b3c6b8 100644 --- a/lib/routes/iplaysoft/tag.ts +++ b/lib/routes/iplaysoft/tag.ts @@ -1,4 +1,6 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchNewsItems, fetchTag } from './utils'; export const handler = async (ctx): Promise => { diff --git a/lib/routes/iplaysoft/utils.ts b/lib/routes/iplaysoft/utils.ts index 0dec7ef6b..a107ba993 100644 --- a/lib/routes/iplaysoft/utils.ts +++ b/lib/routes/iplaysoft/utils.ts @@ -1,5 +1,5 @@ -import ofetch from '@/utils/ofetch'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; const rootUrl = 'https://www.iplaysoft.com/'; @@ -31,4 +31,4 @@ async function fetchNewsItems(apiUrl: string) { })); } -export { fetchCategory, fetchTag, fetchNewsItems }; +export { fetchCategory, fetchNewsItems, fetchTag }; diff --git a/lib/routes/ippa/rss.ts b/lib/routes/ippa/rss.ts index db65ffaf5..6b2e5b631 100644 --- a/lib/routes/ippa/rss.ts +++ b/lib/routes/ippa/rss.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/', diff --git a/lib/routes/ipsw.dev/index.ts b/lib/routes/ipsw.dev/index.ts index 7c8261835..d499cde88 100644 --- a/lib/routes/ipsw.dev/index.ts +++ b/lib/routes/ipsw.dev/index.ts @@ -1,9 +1,11 @@ -import { Data, Route } from '@/types'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/index/:productID', categories: ['program-update'], diff --git a/lib/routes/ipsw.dev/namespace.ts b/lib/routes/ipsw.dev/namespace.ts index 3beb11a3b..c6aa0c69b 100644 --- a/lib/routes/ipsw.dev/namespace.ts +++ b/lib/routes/ipsw.dev/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'IPSW.dev', diff --git a/lib/routes/ipsw/index.ts b/lib/routes/ipsw/index.ts index fd6bed4d3..3834f7932 100644 --- a/lib/routes/ipsw/index.ts +++ b/lib/routes/ipsw/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; const host = 'https://ipsw.me/'; diff --git a/lib/routes/iqilu/program.ts b/lib/routes/iqilu/program.ts index f6adb066c..931cee632 100644 --- a/lib/routes/iqilu/program.ts +++ b/lib/routes/iqilu/program.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/v/:category{.+}?', diff --git a/lib/routes/iqiyi/album.ts b/lib/routes/iqiyi/album.ts index 58a3e233b..b3f6393af 100644 --- a/lib/routes/iqiyi/album.ts +++ b/lib/routes/iqiyi/album.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/album/:id', diff --git a/lib/routes/iqiyi/video.ts b/lib/routes/iqiyi/video.ts index 218b118cf..e4bab38a5 100644 --- a/lib/routes/iqiyi/video.ts +++ b/lib/routes/iqiyi/video.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + import { config } from '@/config'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; // /iqiyi/user/video/:uid diff --git a/lib/routes/iqnew/latest.ts b/lib/routes/iqnew/latest.ts index dff3fb2f7..e8c18a223 100644 --- a/lib/routes/iqnew/latest.ts +++ b/lib/routes/iqnew/latest.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/iresearch/report.ts b/lib/routes/iresearch/report.ts index 6820cf65c..90dff3cc1 100644 --- a/lib/routes/iresearch/report.ts +++ b/lib/routes/iresearch/report.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type Context } from 'hono'; -import path from 'node:path'; - const types = { 1: { label: '最新报告', diff --git a/lib/routes/iresearch/weekly.ts b/lib/routes/iresearch/weekly.ts index 3eacd9001..70cd0163d 100644 --- a/lib/routes/iresearch/weekly.ts +++ b/lib/routes/iresearch/weekly.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + export const handler = (ctx: Context): Data | undefined => { const { id } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '20', 10); diff --git a/lib/routes/isct/news.ts b/lib/routes/isct/news.ts index 9d0e86773..6dbbc63eb 100644 --- a/lib/routes/isct/news.ts +++ b/lib/routes/isct/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { decode } from 'entities'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { decode } from 'entities'; interface MediaItem { ID: string; diff --git a/lib/routes/issuehunt/funded.ts b/lib/routes/issuehunt/funded.ts index 792029abd..0c110e51f 100644 --- a/lib/routes/issuehunt/funded.ts +++ b/lib/routes/issuehunt/funded.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import MarkdownIt from 'markdown-it'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/funded/:username/:repo', categories: ['programming'], diff --git a/lib/routes/itc/collection.ts b/lib/routes/itc/collection.ts index 9487149d3..b92190757 100644 --- a/lib/routes/itc/collection.ts +++ b/lib/routes/itc/collection.ts @@ -1,7 +1,8 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + /** * OpenGithub - Github开源项目精选 * colType:0 | 1 | 2 | 3 diff --git a/lib/routes/itch/devlog.ts b/lib/routes/itch/devlog.ts index bf3b167a8..b82cb7136 100644 --- a/lib/routes/itch/devlog.ts +++ b/lib/routes/itch/devlog.ts @@ -1,14 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/devlog/:user/:id', diff --git a/lib/routes/itch/index.ts b/lib/routes/itch/index.ts index 539b9f6ff..4dc4bbc71 100644 --- a/lib/routes/itch/index.ts +++ b/lib/routes/itch/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '*', name: 'Unknown', diff --git a/lib/routes/itch/posts.ts b/lib/routes/itch/posts.ts index f453acbfe..515f9542a 100644 --- a/lib/routes/itch/posts.ts +++ b/lib/routes/itch/posts.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ithome/index.ts b/lib/routes/ithome/index.ts index 1064ce216..425343467 100644 --- a/lib/routes/ithome/index.ts +++ b/lib/routes/ithome/index.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; const get_url = (caty) => `https://${caty}.ithome.com/`; diff --git a/lib/routes/ithome/ranking.ts b/lib/routes/ithome/ranking.ts index a1b948a21..2ca38d824 100644 --- a/lib/routes/ithome/ranking.ts +++ b/lib/routes/ithome/ranking.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/ranking/:type', diff --git a/lib/routes/ithome/tag.ts b/lib/routes/ithome/tag.ts index e04e15c68..024d577d0 100644 --- a/lib/routes/ithome/tag.ts +++ b/lib/routes/ithome/tag.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.ithome.com/'; diff --git a/lib/routes/ithome/tw/feeds.ts b/lib/routes/ithome/tw/feeds.ts index 7d4fbd94d..ce34c88e7 100644 --- a/lib/routes/ithome/tw/feeds.ts +++ b/lib/routes/ithome/tw/feeds.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ithome/zt.ts b/lib/routes/ithome/zt.ts index ebeb20ae3..68a44745c 100644 --- a/lib/routes/ithome/zt.ts +++ b/lib/routes/ithome/zt.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { id = 'xijiayi' } = ctx.req.param(); diff --git a/lib/routes/iwara/index.ts b/lib/routes/iwara/index.ts index 4f80ac364..d54718be8 100644 --- a/lib/routes/iwara/index.ts +++ b/lib/routes/iwara/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; const rootUrl = 'https://www.iwara.tv'; const apiRootUrl = 'https://api.iwara.tv'; diff --git a/lib/routes/iwara/subscriptions.ts b/lib/routes/iwara/subscriptions.ts index cd372a0ab..d45e4a037 100644 --- a/lib/routes/iwara/subscriptions.ts +++ b/lib/routes/iwara/subscriptions.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; -import MarkdownIt from 'markdown-it'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; +import { art } from '@/utils/render'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/ixigua/user-video.ts b/lib/routes/ixigua/user-video.ts index 71031fd0b..86af9560f 100644 --- a/lib/routes/ixigua/user-video.ts +++ b/lib/routes/ixigua/user-video.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const host = 'https://www.ixigua.com'; diff --git a/lib/routes/j-test/news.ts b/lib/routes/j-test/news.ts index ab102eac1..a49aea97f 100644 --- a/lib/routes/j-test/news.ts +++ b/lib/routes/j-test/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/jamesclear/book-summaries.ts b/lib/routes/jamesclear/book-summaries.ts index 9fa662a23..91dcfb91f 100644 --- a/lib/routes/jamesclear/book-summaries.ts +++ b/lib/routes/jamesclear/book-summaries.ts @@ -1,5 +1,7 @@ -import { Data, Route, ViewType } from '@/types'; -import { rootUrl, fetchContent, processItem } from './utils'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + +import { fetchContent, processItem, rootUrl } from './utils'; export const route: Route = { path: '/book-summaries', diff --git a/lib/routes/jamesclear/great-speeches.ts b/lib/routes/jamesclear/great-speeches.ts index 46d6aa462..8af078cbe 100644 --- a/lib/routes/jamesclear/great-speeches.ts +++ b/lib/routes/jamesclear/great-speeches.ts @@ -1,5 +1,7 @@ -import { Data, Route, ViewType } from '@/types'; -import { rootUrl, fetchContent, processItem } from './utils'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + +import { fetchContent, processItem, rootUrl } from './utils'; export const route: Route = { path: '/great-speeches', diff --git a/lib/routes/jamesclear/quotes.ts b/lib/routes/jamesclear/quotes.ts index 52e231ee5..bdf6ac7ab 100644 --- a/lib/routes/jamesclear/quotes.ts +++ b/lib/routes/jamesclear/quotes.ts @@ -1,5 +1,7 @@ -import { Data, Route, ViewType } from '@/types'; -import { rootUrl, fetchContent, processItem } from './utils'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + +import { fetchContent, processItem, rootUrl } from './utils'; export const route: Route = { path: '/quotes', diff --git a/lib/routes/jamesclear/three-two-one.ts b/lib/routes/jamesclear/three-two-one.ts index a3f0c9ed9..b32af1c73 100644 --- a/lib/routes/jamesclear/three-two-one.ts +++ b/lib/routes/jamesclear/three-two-one.ts @@ -1,5 +1,7 @@ -import { Data, Route, ViewType } from '@/types'; -import { rootUrl, fetchContent, processItem } from './utils'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + +import { fetchContent, processItem, rootUrl } from './utils'; export const route: Route = { path: '/3-2-1', diff --git a/lib/routes/jamesclear/utils.ts b/lib/routes/jamesclear/utils.ts index 47d7fed56..b43a36df3 100644 --- a/lib/routes/jamesclear/utils.ts +++ b/lib/routes/jamesclear/utils.ts @@ -1,6 +1,6 @@ +import type { DataItem } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { DataItem } from '@/types'; export const rootUrl = 'https://jamesclear.com'; export const apiUrl = `${rootUrl}/wp-json/wp/v2`; diff --git a/lib/routes/jandan/index.ts b/lib/routes/jandan/index.ts index 217da9e60..6da1571f2 100644 --- a/lib/routes/jandan/index.ts +++ b/lib/routes/jandan/index.ts @@ -1,7 +1,8 @@ -import { Route, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import parser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/jandan/section.ts b/lib/routes/jandan/section.ts index cb1b6c391..bb9432cc3 100644 --- a/lib/routes/jandan/section.ts +++ b/lib/routes/jandan/section.ts @@ -1,5 +1,6 @@ -import { Route, DataItem } from '@/types'; -import { handleTopSection, handleForumSection, handleCommentSection } from './utils'; +import type { DataItem, Route } from '@/types'; + +import { handleCommentSection, handleForumSection, handleTopSection } from './utils'; export const route: Route = { path: '/:category/:type?', diff --git a/lib/routes/jandan/utils.ts b/lib/routes/jandan/utils.ts index ecdf9d3c3..1b37789c0 100644 --- a/lib/routes/jandan/utils.ts +++ b/lib/routes/jandan/utils.ts @@ -1,6 +1,7 @@ -import { DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36'; diff --git a/lib/routes/japanpost/router.ts b/lib/routes/japanpost/router.ts index 616116dcf..1449e8da2 100644 --- a/lib/routes/japanpost/router.ts +++ b/lib/routes/japanpost/router.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { track } from './track'; export const route: Route = { diff --git a/lib/routes/japanpost/track.ts b/lib/routes/japanpost/track.ts index d8d014e9f..0022fcfa3 100644 --- a/lib/routes/japanpost/track.ts +++ b/lib/routes/japanpost/track.ts @@ -1,7 +1,10 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import got from '@/utils/got'; import { art } from '@/utils/render'; -import { load } from 'cheerio'; -import path from 'node:path'; + import utils from './utils'; let baseTitle = '日本郵便'; diff --git a/lib/routes/japanpost/utils.ts b/lib/routes/japanpost/utils.ts index a7261bd1b..fe8fec433 100644 --- a/lib/routes/japanpost/utils.ts +++ b/lib/routes/japanpost/utils.ts @@ -3,8 +3,9 @@ import crypto from 'node:crypto'; import cityTimezones from 'city-timezones'; import dayjs from 'dayjs'; import customParseFormat from 'dayjs/plugin/customParseFormat.js'; -import utc from 'dayjs/plugin/utc.js'; import timezone from 'dayjs/plugin/timezone.js'; +import utc from 'dayjs/plugin/utc.js'; + dayjs.extend(customParseFormat); dayjs.extend(utc); dayjs.extend(timezone); diff --git a/lib/routes/javbus/index.ts b/lib/routes/javbus/index.ts index f42579d97..1c9e975c1 100644 --- a/lib/routes/javbus/index.ts +++ b/lib/routes/javbus/index.ts @@ -1,14 +1,16 @@ -import { Route, ViewType } from '@/types'; - -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const toSize = (raw) => { const matches = raw.match(/(\d+(\.\d+)?)(\w+)/); diff --git a/lib/routes/javdb/actors.ts b/lib/routes/javdb/actors.ts index 0bee34cde..6f90acbd8 100644 --- a/lib/routes/javdb/actors.ts +++ b/lib/routes/javdb/actors.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/index.ts b/lib/routes/javdb/index.ts index c8629a50a..33ee637d3 100644 --- a/lib/routes/javdb/index.ts +++ b/lib/routes/javdb/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/lists.ts b/lib/routes/javdb/lists.ts index dd065b421..83a09d64f 100644 --- a/lib/routes/javdb/lists.ts +++ b/lib/routes/javdb/lists.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/makers.ts b/lib/routes/javdb/makers.ts index eb2e20781..4fd03a830 100644 --- a/lib/routes/javdb/makers.ts +++ b/lib/routes/javdb/makers.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/rankings.ts b/lib/routes/javdb/rankings.ts index 1eb21db21..48f5d0172 100644 --- a/lib/routes/javdb/rankings.ts +++ b/lib/routes/javdb/rankings.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/search.ts b/lib/routes/javdb/search.ts index 910f71fbb..f02cfa756 100644 --- a/lib/routes/javdb/search.ts +++ b/lib/routes/javdb/search.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/series.ts b/lib/routes/javdb/series.ts index de8bb45b6..9fac1055b 100644 --- a/lib/routes/javdb/series.ts +++ b/lib/routes/javdb/series.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/tags.ts b/lib/routes/javdb/tags.ts index 3e8c7cc5d..ac77eccb8 100644 --- a/lib/routes/javdb/tags.ts +++ b/lib/routes/javdb/tags.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/utils.ts b/lib/routes/javdb/utils.ts index fc4b0b617..133a22a14 100644 --- a/lib/routes/javdb/utils.ts +++ b/lib/routes/javdb/utils.ts @@ -1,11 +1,12 @@ -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; import { Cookie, CookieJar } from 'tough-cookie'; +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const allowDomain = new Set(['javdb.com', 'javdb36.com', 'javdb007.com', 'javdb521.com']); const ProcessItems = async (ctx, currentUrl, title) => { diff --git a/lib/routes/javdb/videocodes.ts b/lib/routes/javdb/videocodes.ts index bd8acccec..b1d58d994 100644 --- a/lib/routes/javdb/videocodes.ts +++ b/lib/routes/javdb/videocodes.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javlibrary/bestrated.ts b/lib/routes/javlibrary/bestrated.ts index 1d26c643b..e34f905b0 100644 --- a/lib/routes/javlibrary/bestrated.ts +++ b/lib/routes/javlibrary/bestrated.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultMode, defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, defaultMode, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: ['/videos/bestrated/:language?/:mode?', '/bestrated/:language?/:mode?'], diff --git a/lib/routes/javlibrary/bestreviews.ts b/lib/routes/javlibrary/bestreviews.ts index 2982af67f..38b060de5 100644 --- a/lib/routes/javlibrary/bestreviews.ts +++ b/lib/routes/javlibrary/bestreviews.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultMode, defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, defaultMode, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/bestreviews/:language?/:mode?', diff --git a/lib/routes/javlibrary/genre.ts b/lib/routes/javlibrary/genre.ts index 2919c51d2..d02c0bdfa 100644 --- a/lib/routes/javlibrary/genre.ts +++ b/lib/routes/javlibrary/genre.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultMode, defaultGenre, defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultGenre, defaultLanguage, defaultMode, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: ['/videos/genre/:genre?/:language?/:mode?', '/genre/:genre?/:language?/:mode?'], diff --git a/lib/routes/javlibrary/maker.ts b/lib/routes/javlibrary/maker.ts index f1f081eba..1428158d3 100644 --- a/lib/routes/javlibrary/maker.ts +++ b/lib/routes/javlibrary/maker.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultMode, defaultLanguage, defaultMaker, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, defaultMaker, defaultMode, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/videos/maker/:maker?/:language?/:mode?', diff --git a/lib/routes/javlibrary/mostwanted.ts b/lib/routes/javlibrary/mostwanted.ts index 974a2e3e6..7474ec434 100644 --- a/lib/routes/javlibrary/mostwanted.ts +++ b/lib/routes/javlibrary/mostwanted.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultMode, defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, defaultMode, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: ['/videos/mostwanted/:language?/:mode?', '/mostwanted/:language?/:mode?'], diff --git a/lib/routes/javlibrary/newentries.ts b/lib/routes/javlibrary/newentries.ts index e7ce07d02..6bc22aca1 100644 --- a/lib/routes/javlibrary/newentries.ts +++ b/lib/routes/javlibrary/newentries.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: ['/videos/newentries/:language?', '/newentries/:language?'], diff --git a/lib/routes/javlibrary/newrelease.ts b/lib/routes/javlibrary/newrelease.ts index b3a0f9d98..0bad12e3f 100644 --- a/lib/routes/javlibrary/newrelease.ts +++ b/lib/routes/javlibrary/newrelease.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultMode, defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, defaultMode, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: ['/videos/newrelease/:language?/:mode?', '/newrelease/:language?/:mode?'], diff --git a/lib/routes/javlibrary/star.ts b/lib/routes/javlibrary/star.ts index 1ef2d2d3e..32eca89f0 100644 --- a/lib/routes/javlibrary/star.ts +++ b/lib/routes/javlibrary/star.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultMode, defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, defaultMode, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/star/:id/:language?/:mode?', diff --git a/lib/routes/javlibrary/update.ts b/lib/routes/javlibrary/update.ts index f545d0735..5b75ed512 100644 --- a/lib/routes/javlibrary/update.ts +++ b/lib/routes/javlibrary/update.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: ['/videos/update/:language?', '/update/:language?'], diff --git a/lib/routes/javlibrary/user.ts b/lib/routes/javlibrary/user.ts index 4fa6105a0..d64bb7f55 100644 --- a/lib/routes/javlibrary/user.ts +++ b/lib/routes/javlibrary/user.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: ['/users/:id/:type/:language?', '/:type/:id/:language?'], diff --git a/lib/routes/javlibrary/utils.ts b/lib/routes/javlibrary/utils.ts index 7c473b00f..fbd5d8a76 100644 --- a/lib/routes/javlibrary/utils.ts +++ b/lib/routes/javlibrary/utils.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://www.javlibrary.com'; const defaultMode = '1'; @@ -91,4 +93,4 @@ const ProcessItems = async (language, currentUrl, tryGet) => { }; }; -export { rootUrl, defaultMode, defaultGenre, defaultMaker, defaultLanguage, ProcessItems }; +export { defaultGenre, defaultLanguage, defaultMaker, defaultMode, ProcessItems, rootUrl }; diff --git a/lib/routes/javtiful/actress.ts b/lib/routes/javtiful/actress.ts index 053473f88..b9d013c7b 100644 --- a/lib/routes/javtiful/actress.ts +++ b/lib/routes/javtiful/actress.ts @@ -1,6 +1,8 @@ -import { Route, Data, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { parseItems } from './utils'; export const route: Route = { diff --git a/lib/routes/javtiful/channel.ts b/lib/routes/javtiful/channel.ts index f2b2f9380..1aa1a2e51 100644 --- a/lib/routes/javtiful/channel.ts +++ b/lib/routes/javtiful/channel.ts @@ -1,6 +1,8 @@ -import { Route, Data, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { parseItems } from './utils'; export const route: Route = { diff --git a/lib/routes/javtiful/utils.ts b/lib/routes/javtiful/utils.ts index 9408224d9..01c1ec4dd 100644 --- a/lib/routes/javtiful/utils.ts +++ b/lib/routes/javtiful/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; + import { parseRelativeDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const renderDescription = (data) => art(path.join(__dirname, 'templates/description.art'), data); diff --git a/lib/routes/javtrailers/casts.ts b/lib/routes/javtrailers/casts.ts index 822d8c550..efc342027 100644 --- a/lib/routes/javtrailers/casts.ts +++ b/lib/routes/javtrailers/casts.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, getItem, headers, parseList } from './utils'; export const route: Route = { diff --git a/lib/routes/javtrailers/categories.ts b/lib/routes/javtrailers/categories.ts index bf1dd2f5b..929d6533e 100644 --- a/lib/routes/javtrailers/categories.ts +++ b/lib/routes/javtrailers/categories.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, getItem, headers, parseList } from './utils'; export const route: Route = { diff --git a/lib/routes/javtrailers/studios.ts b/lib/routes/javtrailers/studios.ts index b92cb2fb2..66788017a 100644 --- a/lib/routes/javtrailers/studios.ts +++ b/lib/routes/javtrailers/studios.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, getItem, headers, parseList } from './utils'; export const route: Route = { diff --git a/lib/routes/javtrailers/utils.ts b/lib/routes/javtrailers/utils.ts index d4f05430a..528302622 100644 --- a/lib/routes/javtrailers/utils.ts +++ b/lib/routes/javtrailers/utils.ts @@ -1,9 +1,10 @@ -import { Video } from './types'; +import path from 'node:path'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import type { Video } from './types'; export const baseUrl = 'https://javtrailers.com'; export const headers = { diff --git a/lib/routes/jbma/report.ts b/lib/routes/jbma/report.ts index d5a06a84d..3a1238c6a 100644 --- a/lib/routes/jbma/report.ts +++ b/lib/routes/jbma/report.ts @@ -1,11 +1,10 @@ -import { type Data, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { filter } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '50', 10); diff --git a/lib/routes/jd/price.ts b/lib/routes/jd/price.ts index 95e664e25..aab4545cf 100644 --- a/lib/routes/jd/price.ts +++ b/lib/routes/jd/price.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/price/:id', diff --git a/lib/routes/jetbrains/comments.ts b/lib/routes/jetbrains/comments.ts index 285cbac78..154532ce4 100644 --- a/lib/routes/jetbrains/comments.ts +++ b/lib/routes/jetbrains/comments.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; const md = MarkdownIt({ html: true }); diff --git a/lib/routes/jewishmuseum/exhibitions.ts b/lib/routes/jewishmuseum/exhibitions.ts index 47caa13fd..e92b79931 100644 --- a/lib/routes/jewishmuseum/exhibitions.ts +++ b/lib/routes/jewishmuseum/exhibitions.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; export const route: Route = { diff --git a/lib/routes/jianshu/collection.ts b/lib/routes/jianshu/collection.ts index 0c31627f9..d33a0d62c 100644 --- a/lib/routes/jianshu/collection.ts +++ b/lib/routes/jianshu/collection.ts @@ -1,7 +1,10 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/jianshu/home.ts b/lib/routes/jianshu/home.ts index faeb1e8a3..2e3bcaff8 100644 --- a/lib/routes/jianshu/home.ts +++ b/lib/routes/jianshu/home.ts @@ -1,7 +1,10 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/jianshu/user.ts b/lib/routes/jianshu/user.ts index 7224ad340..8f3ee3c0f 100644 --- a/lib/routes/jianshu/user.ts +++ b/lib/routes/jianshu/user.ts @@ -1,7 +1,10 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/jianshu/utils.ts b/lib/routes/jianshu/utils.ts index f08c80aba..0b96cc1db 100644 --- a/lib/routes/jianshu/utils.ts +++ b/lib/routes/jianshu/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/jiaoliudao/index.ts b/lib/routes/jiaoliudao/index.ts index 25495d07f..8c45adc12 100644 --- a/lib/routes/jiaoliudao/index.ts +++ b/lib/routes/jiaoliudao/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/jiemian/account.ts b/lib/routes/jiemian/account.ts index 641ada837..fc12165f6 100644 --- a/lib/routes/jiemian/account.ts +++ b/lib/routes/jiemian/account.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { handler } from './common'; diff --git a/lib/routes/jiemian/common.ts b/lib/routes/jiemian/common.ts index 8625e4497..d34a0208c 100644 --- a/lib/routes/jiemian/common.ts +++ b/lib/routes/jiemian/common.ts @@ -1,11 +1,12 @@ -import { Data } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Data } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx): Promise => { const { category = '' } = ctx.req.param(); diff --git a/lib/routes/jiemian/lists.ts b/lib/routes/jiemian/lists.ts index 638d605f8..49909a574 100644 --- a/lib/routes/jiemian/lists.ts +++ b/lib/routes/jiemian/lists.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { handler } from './common'; diff --git a/lib/routes/jiemian/special.ts b/lib/routes/jiemian/special.ts index 0cbb13937..44aca401e 100644 --- a/lib/routes/jiemian/special.ts +++ b/lib/routes/jiemian/special.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { handler } from './common'; diff --git a/lib/routes/jiemian/video.ts b/lib/routes/jiemian/video.ts index 357992003..6c6fa0619 100644 --- a/lib/routes/jiemian/video.ts +++ b/lib/routes/jiemian/video.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { handler } from './common'; diff --git a/lib/routes/jiemian/vip.ts b/lib/routes/jiemian/vip.ts index f0a7949c1..a044a9ca5 100644 --- a/lib/routes/jiemian/vip.ts +++ b/lib/routes/jiemian/vip.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { handler } from './common'; diff --git a/lib/routes/jike/topic-text.ts b/lib/routes/jike/topic-text.ts index 10300f218..893559a93 100644 --- a/lib/routes/jike/topic-text.ts +++ b/lib/routes/jike/topic-text.ts @@ -1,5 +1,7 @@ -import { Route } from '@/types'; import dayjs from 'dayjs'; + +import type { Route } from '@/types'; + import { constructTopicEntry } from './utils'; export const route: Route = { diff --git a/lib/routes/jike/topic.ts b/lib/routes/jike/topic.ts index 7b98add5a..507fc94fc 100644 --- a/lib/routes/jike/topic.ts +++ b/lib/routes/jike/topic.ts @@ -1,10 +1,13 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { topicDataHanding, constructTopicEntry } from './utils'; import { load } from 'cheerio'; import dayjs from 'dayjs'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { constructTopicEntry, topicDataHanding } from './utils'; + const urlRegex = /(https?:\/\/[^\s"'<>]+)/g; export const route: Route = { diff --git a/lib/routes/jike/user.ts b/lib/routes/jike/user.ts index c90e45ae2..ec50350d0 100644 --- a/lib/routes/jike/user.ts +++ b/lib/routes/jike/user.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/jike/utils.ts b/lib/routes/jike/utils.ts index 747e0deca..9fbe7b082 100644 --- a/lib/routes/jike/utils.ts +++ b/lib/routes/jike/utils.ts @@ -1,8 +1,9 @@ -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const videoAPI = 'https://api.ruguoapp.com/1.0/mediaMeta/play?type=ORIGINAL_POST'; const topicDataHanding = (data, ctx) => @@ -193,4 +194,4 @@ const constructTopicEntry = async (ctx, url) => { return data; }; -export { topicDataHanding, constructTopicEntry }; +export { constructTopicEntry, topicDataHanding }; diff --git a/lib/routes/jimmyspa/books.ts b/lib/routes/jimmyspa/books.ts index 42f0fefd2..fd7ba0c64 100644 --- a/lib/routes/jimmyspa/books.ts +++ b/lib/routes/jimmyspa/books.ts @@ -1,11 +1,14 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; -import cache from '@/utils/cache'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/books/:language', categories: ['design'], diff --git a/lib/routes/jimmyspa/news.ts b/lib/routes/jimmyspa/news.ts index 3ea920c17..fa30c5879 100644 --- a/lib/routes/jimmyspa/news.ts +++ b/lib/routes/jimmyspa/news.ts @@ -1,10 +1,13 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/news/:language', categories: ['design'], diff --git a/lib/routes/jin10/category.ts b/lib/routes/jin10/category.ts index 752493f1c..f71df3d0f 100644 --- a/lib/routes/jin10/category.ts +++ b/lib/routes/jin10/category.ts @@ -1,12 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/category/:id', diff --git a/lib/routes/jin10/index.ts b/lib/routes/jin10/index.ts index 637f9b962..0e91283cf 100644 --- a/lib/routes/jin10/index.ts +++ b/lib/routes/jin10/index.ts @@ -1,12 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:important?', diff --git a/lib/routes/jin10/topic.ts b/lib/routes/jin10/topic.ts index 6b292dbf4..4d2ead2d0 100644 --- a/lib/routes/jin10/topic.ts +++ b/lib/routes/jin10/topic.ts @@ -1,9 +1,10 @@ -import { Route, ViewType } from '@/types'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { config } from '@/config'; export const route: Route = { path: '/topic/:id', diff --git a/lib/routes/jingzhengu/news.ts b/lib/routes/jingzhengu/news.ts index 6f434f9ce..8b32d905c 100644 --- a/lib/routes/jingzhengu/news.ts +++ b/lib/routes/jingzhengu/news.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; -import { NewsInfo, NewsDetail } from './types'; - +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + +import type { NewsDetail, NewsInfo } from './types'; import { sign } from './utils'; export const route: Route = { diff --git a/lib/routes/jinritemai/docs.ts b/lib/routes/jinritemai/docs.ts index daffd9c41..4cffa0a46 100644 --- a/lib/routes/jinritemai/docs.ts +++ b/lib/routes/jinritemai/docs.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/jinse/catalogue.ts b/lib/routes/jinse/catalogue.ts index 94c5961d6..166fceca3 100644 --- a/lib/routes/jinse/catalogue.ts +++ b/lib/routes/jinse/catalogue.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const categories = { zhengce: '政策', diff --git a/lib/routes/jinse/lives.ts b/lib/routes/jinse/lives.ts index 6c6bf773c..3e47a5fc8 100644 --- a/lib/routes/jinse/lives.ts +++ b/lib/routes/jinse/lives.ts @@ -1,10 +1,12 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const categories = { 0: '全部', diff --git a/lib/routes/jinse/timeline.ts b/lib/routes/jinse/timeline.ts index 62cef9d0e..99b313337 100644 --- a/lib/routes/jinse/timeline.ts +++ b/lib/routes/jinse/timeline.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/timeline/:category?', diff --git a/lib/routes/jisilu/category.ts b/lib/routes/jisilu/category.ts index 528b8f090..e90c12a78 100644 --- a/lib/routes/jisilu/category.ts +++ b/lib/routes/jisilu/category.ts @@ -1,12 +1,11 @@ import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { rootUrl, processItems } from './util'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { processItems, rootUrl } from './util'; export const handler = async (ctx: Context): Promise => { const { id } = ctx.req.param(); diff --git a/lib/routes/jisilu/explore.ts b/lib/routes/jisilu/explore.ts index e88d2e869..47c8637d8 100644 --- a/lib/routes/jisilu/explore.ts +++ b/lib/routes/jisilu/explore.ts @@ -1,11 +1,10 @@ import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { rootUrl, processItems } from './util'; +import { processItems, rootUrl } from './util'; export const handler = async (ctx: Context): Promise => { const { filter } = ctx.req.param(); diff --git a/lib/routes/jisilu/people.ts b/lib/routes/jisilu/people.ts index 875789e09..ed9f2bb35 100644 --- a/lib/routes/jisilu/people.ts +++ b/lib/routes/jisilu/people.ts @@ -1,12 +1,11 @@ import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { rootUrl, processItems } from './util'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { processItems, rootUrl } from './util'; const actions: { [key: string]: string } = { questions: '101', diff --git a/lib/routes/jisilu/topic.ts b/lib/routes/jisilu/topic.ts index 9c66af1e0..7520ae9c8 100644 --- a/lib/routes/jisilu/topic.ts +++ b/lib/routes/jisilu/topic.ts @@ -1,11 +1,10 @@ import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { rootUrl, processItems } from './util'; +import { processItems, rootUrl } from './util'; export const handler = async (ctx: Context): Promise => { const { id } = ctx.req.param(); diff --git a/lib/routes/jisilu/util.ts b/lib/routes/jisilu/util.ts index fba4e3600..099f7b1d6 100644 --- a/lib/routes/jisilu/util.ts +++ b/lib/routes/jisilu/util.ts @@ -1,8 +1,7 @@ -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type DataItem } from '@/types'; - import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; @@ -109,4 +108,4 @@ const processItems: ($: CheerioAPI, targetEl: Cheerio, limit: number) = .slice(0, limit); }; -export { rootUrl, processItems }; +export { processItems, rootUrl }; diff --git a/lib/routes/jiuyangongshe/community.ts b/lib/routes/jiuyangongshe/community.ts index 4b8d5a573..c4426baa1 100644 --- a/lib/routes/jiuyangongshe/community.ts +++ b/lib/routes/jiuyangongshe/community.ts @@ -1,11 +1,14 @@ -import { Data, Route, ViewType } from '@/types'; +import path from 'node:path'; + import type { Context } from 'hono'; + +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; +import md5 from '@/utils/md5'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import md5 from '@/utils/md5'; -import path from 'node:path'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; interface User { follow_type: number; diff --git a/lib/routes/jjwxc/author.ts b/lib/routes/jjwxc/author.ts index 99d32e746..161715711 100644 --- a/lib/routes/jjwxc/author.ts +++ b/lib/routes/jjwxc/author.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/author/:id?', diff --git a/lib/routes/jjwxc/book.ts b/lib/routes/jjwxc/book.ts index 152660b0a..c8a773ec8 100644 --- a/lib/routes/jjwxc/book.ts +++ b/lib/routes/jjwxc/book.ts @@ -1,13 +1,15 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/book/:id?', diff --git a/lib/routes/jl1mall/forum.ts b/lib/routes/jl1mall/forum.ts index 977d3c340..63be480ab 100644 --- a/lib/routes/jl1mall/forum.ts +++ b/lib/routes/jl1mall/forum.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type Context } from 'hono'; - type MainIdsResult = { name: string | undefined; racer2: string | undefined; diff --git a/lib/routes/jlu/ccst/xwzx/index.ts b/lib/routes/jlu/ccst/xwzx/index.ts index c46566b90..0105f006a 100644 --- a/lib/routes/jlu/ccst/xwzx/index.ts +++ b/lib/routes/jlu/ccst/xwzx/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; // Custom got instance import { load } from 'cheerio'; // HTML parser with jQuery-like API +import type { Route } from '@/types'; +import got from '@/utils/got'; // Custom got instance + export const route: Route = { path: '/ccst/xwzx/:category', categories: ['university'], diff --git a/lib/routes/jlu/jwc.ts b/lib/routes/jlu/jwc.ts index b3056275e..885aad094 100644 --- a/lib/routes/jlu/jwc.ts +++ b/lib/routes/jlu/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; // 自订的 got import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 +import type { Route } from '@/types'; +import got from '@/utils/got'; // 自订的 got + export const route: Route = { path: '/jwc', categories: ['university'], diff --git a/lib/routes/jlu/phy/index.ts b/lib/routes/jlu/phy/index.ts index 4b0ed4ad4..e0e71f812 100644 --- a/lib/routes/jlu/phy/index.ts +++ b/lib/routes/jlu/phy/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/phy/:category/:column/:subcolumn?', categories: ['university'], diff --git a/lib/routes/joins/chinese.ts b/lib/routes/joins/chinese.ts index de858ad1e..330250502 100644 --- a/lib/routes/joins/chinese.ts +++ b/lib/routes/joins/chinese.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = '' } = ctx.req.param(); diff --git a/lib/routes/joneslanglasalle/index.ts b/lib/routes/joneslanglasalle/index.ts index df4e59cd4..fcf275aea 100644 --- a/lib/routes/joneslanglasalle/index.ts +++ b/lib/routes/joneslanglasalle/index.ts @@ -1,15 +1,14 @@ import path from 'node:path'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - -import { art } from '@/utils/render'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const cleanHtml = (html: string, preservedTags: string[]): string => { const $ = load(html); diff --git a/lib/routes/jornada/index.ts b/lib/routes/jornada/index.ts index f833b25fa..30703d43c 100644 --- a/lib/routes/jornada/index.ts +++ b/lib/routes/jornada/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/joshwcomeau/latest.ts b/lib/routes/joshwcomeau/latest.ts index 248340336..cafbe26b0 100644 --- a/lib/routes/joshwcomeau/latest.ts +++ b/lib/routes/joshwcomeau/latest.ts @@ -1,4 +1,5 @@ -import { Data, Route } from '@/types'; +import type { Data, Route } from '@/types'; + import { getRelativeUrlList, processList, rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/joshwcomeau/popular.ts b/lib/routes/joshwcomeau/popular.ts index dd5c352ce..ae4194f09 100644 --- a/lib/routes/joshwcomeau/popular.ts +++ b/lib/routes/joshwcomeau/popular.ts @@ -1,4 +1,5 @@ -import { Data, Route } from '@/types'; +import type { Data, Route } from '@/types'; + import { getRelativeUrlList, processList, rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/joshwcomeau/utils.ts b/lib/routes/joshwcomeau/utils.ts index 90a71a73e..b864e9355 100644 --- a/lib/routes/joshwcomeau/utils.ts +++ b/lib/routes/joshwcomeau/utils.ts @@ -1,8 +1,9 @@ -import { DataItem } from '@/types'; import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; export const rootUrl = 'https://www.joshwcomeau.com'; diff --git a/lib/routes/jou/home.ts b/lib/routes/jou/home.ts index 599b87f66..7c9d147eb 100644 --- a/lib/routes/jou/home.ts +++ b/lib/routes/jou/home.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getItems } from './utils'; const url = 'https://www.jou.edu.cn/index/tzgg.htm'; diff --git a/lib/routes/jou/utils/index.ts b/lib/routes/jou/utils/index.ts index ce72716b2..6e1a09759 100644 --- a/lib/routes/jou/utils/index.ts +++ b/lib/routes/jou/utils/index.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; // 使用ofetch库 -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/jou/yz.ts b/lib/routes/jou/yz.ts index eb2eeb11d..031c0c031 100644 --- a/lib/routes/jou/yz.ts +++ b/lib/routes/jou/yz.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getItems } from './utils'; const url = 'https://yz.jou.edu.cn/index/zxgg.htm'; diff --git a/lib/routes/jpmorganchase/research.ts b/lib/routes/jpmorganchase/research.ts index 19f93b329..ece655603 100644 --- a/lib/routes/jpmorganchase/research.ts +++ b/lib/routes/jpmorganchase/research.ts @@ -1,7 +1,8 @@ -import { Data, DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; const base = 'https://www.jpmorganchase.com'; diff --git a/lib/routes/jpxgmn/search.ts b/lib/routes/jpxgmn/search.ts index 14367c85a..c558535bd 100644 --- a/lib/routes/jpxgmn/search.ts +++ b/lib/routes/jpxgmn/search.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import { getOriginUrl, getArticleDesc } from './utils'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; +import { getArticleDesc, getOriginUrl } from './utils'; + export const route: Route = { path: '/search/:kw', categories: ['picture'], diff --git a/lib/routes/jpxgmn/tab.ts b/lib/routes/jpxgmn/tab.ts index c2c051a3a..ccd5bbfd9 100644 --- a/lib/routes/jpxgmn/tab.ts +++ b/lib/routes/jpxgmn/tab.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import { getOriginUrl, getArticleDesc } from './utils'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; +import { getArticleDesc, getOriginUrl } from './utils'; + export const route: Route = { path: '/tab/:tab?', categories: ['picture'], diff --git a/lib/routes/jpxgmn/utils.ts b/lib/routes/jpxgmn/utils.ts index 79fde9964..97e370faf 100644 --- a/lib/routes/jpxgmn/utils.ts +++ b/lib/routes/jpxgmn/utils.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + +import cache from '@/utils/cache'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import path from 'node:path'; const indexUrl = 'http://mei8.vip/'; @@ -38,4 +40,4 @@ const getArticleDesc = async (articleUrl) => { }); }; -export { getOriginUrl, getArticleDesc }; +export { getArticleDesc, getOriginUrl }; diff --git a/lib/routes/jpxgmn/weekly.ts b/lib/routes/jpxgmn/weekly.ts index e8f76ea39..51e727cd5 100644 --- a/lib/routes/jpxgmn/weekly.ts +++ b/lib/routes/jpxgmn/weekly.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import { getOriginUrl, getArticleDesc } from './utils'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; +import { getArticleDesc, getOriginUrl } from './utils'; + export const route: Route = { path: '/weekly', categories: ['picture'], diff --git a/lib/routes/jrj/index.ts b/lib/routes/jrj/index.ts index 6d3caa1ae..6162727de 100644 --- a/lib/routes/jrj/index.ts +++ b/lib/routes/jrj/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const options = { '103': '财经资讯', diff --git a/lib/routes/jseea/news.ts b/lib/routes/jseea/news.ts index 3df23bcba..aba745372 100644 --- a/lib/routes/jseea/news.ts +++ b/lib/routes/jseea/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/jsu/cxzx.ts b/lib/routes/jsu/cxzx.ts index a2a0dd240..9b65d748d 100644 --- a/lib/routes/jsu/cxzx.ts +++ b/lib/routes/jsu/cxzx.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 导入必要的模组 import got from '@/utils/got'; // 自订的 got -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; + import { getPageItemAndDate } from './utils/index'; export const route: Route = { diff --git a/lib/routes/jsu/jwc.ts b/lib/routes/jsu/jwc.ts index 2fad40add..a0c48e68b 100644 --- a/lib/routes/jsu/jwc.ts +++ b/lib/routes/jsu/jwc.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 导入必要的模组 import got from '@/utils/got'; // 自订的 got -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; + import { getPageItemAndDate } from './utils'; export const route: Route = { diff --git a/lib/routes/jsu/math.ts b/lib/routes/jsu/math.ts index f1f0d0d4f..2c9d719ab 100644 --- a/lib/routes/jsu/math.ts +++ b/lib/routes/jsu/math.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 导入必要的模组 import got from '@/utils/got'; // 自订的 got -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; + import { getPageItemAndDate } from './utils'; export const route: Route = { diff --git a/lib/routes/jsu/rjxy.ts b/lib/routes/jsu/rjxy.ts index 206d04487..bc455368f 100644 --- a/lib/routes/jsu/rjxy.ts +++ b/lib/routes/jsu/rjxy.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 导入必要的模组 import got from '@/utils/got'; // 自订的 got -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; + import { getPageItemAndDate } from './utils'; export const route: Route = { diff --git a/lib/routes/jsu/universityindex.ts b/lib/routes/jsu/universityindex.ts index 80f5df07c..d6b022cc7 100644 --- a/lib/routes/jsu/universityindex.ts +++ b/lib/routes/jsu/universityindex.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 导入必要的模组 import got from '@/utils/got'; // 自订的 got -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; + import { getPageItemAndDate } from './utils'; export const route: Route = { diff --git a/lib/routes/jsu/utils/index.ts b/lib/routes/jsu/utils/index.ts index 82594e747..cb228ec0a 100644 --- a/lib/routes/jsu/utils/index.ts +++ b/lib/routes/jsu/utils/index.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; // 自订的 got import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 +import got from '@/utils/got'; // 自订的 got + /** * 获取页面内容 * @param selector 正文CSS选择器 diff --git a/lib/routes/juejin/aicoding.ts b/lib/routes/juejin/aicoding.ts index c5300f526..22a394422 100644 --- a/lib/routes/juejin/aicoding.ts +++ b/lib/routes/juejin/aicoding.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + +import type { Tag } from './types'; import { getTagList, parseList, ProcessFeed } from './utils'; -import { Tag } from './types'; export const route: Route = { path: '/aicoding/:tag?/:sort?', diff --git a/lib/routes/juejin/books.ts b/lib/routes/juejin/books.ts index 8bd1dccbe..160563932 100644 --- a/lib/routes/juejin/books.ts +++ b/lib/routes/juejin/books.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/juejin/category.ts b/lib/routes/juejin/category.ts index 15252a5d7..2bef6d0e0 100644 --- a/lib/routes/juejin/category.ts +++ b/lib/routes/juejin/category.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { getCategoryBrief, parseList, ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/juejin/collection.ts b/lib/routes/juejin/collection.ts index bfac80377..6cd863075 100644 --- a/lib/routes/juejin/collection.ts +++ b/lib/routes/juejin/collection.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getCollection, parseList, ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/juejin/collections.ts b/lib/routes/juejin/collections.ts index b28f1c2e0..04ae5395b 100644 --- a/lib/routes/juejin/collections.ts +++ b/lib/routes/juejin/collections.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + +import type { Article } from './types'; import { getCollection, parseList, ProcessFeed } from './utils'; -import { Article } from './types'; export const route: Route = { path: '/collections/:userId', diff --git a/lib/routes/juejin/column.ts b/lib/routes/juejin/column.ts index 2f8a89494..5d6d142a6 100644 --- a/lib/routes/juejin/column.ts +++ b/lib/routes/juejin/column.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { parseList, ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/juejin/dynamic.ts b/lib/routes/juejin/dynamic.ts index d37bebcc8..e0a000fe6 100644 --- a/lib/routes/juejin/dynamic.ts +++ b/lib/routes/juejin/dynamic.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/juejin/pins.ts b/lib/routes/juejin/pins.ts index 98dbd699a..dc9187a95 100644 --- a/lib/routes/juejin/pins.ts +++ b/lib/routes/juejin/pins.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/juejin/posts.ts b/lib/routes/juejin/posts.ts index a35a4031d..82366af7f 100644 --- a/lib/routes/juejin/posts.ts +++ b/lib/routes/juejin/posts.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + +import type { Article, AuthorUserInfo } from './types'; import { parseList, ProcessFeed } from './utils'; -import { Article, AuthorUserInfo } from './types'; export const route: Route = { path: '/posts/:id', diff --git a/lib/routes/juejin/tag.ts b/lib/routes/juejin/tag.ts index 072ce3cb7..85df1f3cb 100644 --- a/lib/routes/juejin/tag.ts +++ b/lib/routes/juejin/tag.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { getTag, parseList, ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/juejin/trending.ts b/lib/routes/juejin/trending.ts index e4460ca4d..282b57614 100644 --- a/lib/routes/juejin/trending.ts +++ b/lib/routes/juejin/trending.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { getCategoryBrief, parseList, ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/juejin/utils.ts b/lib/routes/juejin/utils.ts index 4581fe3d7..6e7a836f2 100644 --- a/lib/routes/juejin/utils.ts +++ b/lib/routes/juejin/utils.ts @@ -1,9 +1,12 @@ -import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import crypto from 'node:crypto'; + +import * as cheerio from 'cheerio'; + import cache from '@/utils/cache'; -import { Category, Collection, Tag } from './types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import type { Category, Collection, Tag } from './types'; const b64tou8a = (str) => Uint8Array.from(Buffer.from(str, 'base64')); const b64tohex = (str) => Buffer.from(str, 'base64').toString('hex'); diff --git a/lib/routes/jumeili/home.ts b/lib/routes/jumeili/home.ts index 96a7a1ce4..7f9861943 100644 --- a/lib/routes/jumeili/home.ts +++ b/lib/routes/jumeili/home.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + import { config } from '@/config'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; export const route: Route = { path: '/home/:column?', diff --git a/lib/routes/jump/discount.ts b/lib/routes/jump/discount.ts index da3082dc5..2622c41a3 100644 --- a/lib/routes/jump/discount.ts +++ b/lib/routes/jump/discount.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const discountUrl = 'https://switch.jumpvg.com/jump/discount/find4Discount/5/v2'; // const detailUrl = 'https://switch.jumpvg.com/jump/game/detail'; diff --git a/lib/routes/junhe/legal-updates.ts b/lib/routes/junhe/legal-updates.ts index 70f5e4a91..cd65ad896 100644 --- a/lib/routes/junhe/legal-updates.ts +++ b/lib/routes/junhe/legal-updates.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/kadokawa/blog.ts b/lib/routes/kadokawa/blog.ts index 1ea17d02c..33b35ba04 100644 --- a/lib/routes/kadokawa/blog.ts +++ b/lib/routes/kadokawa/blog.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 10; diff --git a/lib/routes/kakuyomu/works.ts b/lib/routes/kakuyomu/works.ts index 6bedc75c5..9056767cb 100644 --- a/lib/routes/kakuyomu/works.ts +++ b/lib/routes/kakuyomu/works.ts @@ -1,11 +1,13 @@ -import type { Data, DataItem, Route } from '@/types'; import { load } from 'cheerio'; import type { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; -import type { NextDataEpisode } from './types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import type { NextDataEpisode } from './types'; + export const route: Route = { name: '投稿', categories: ['reading'], diff --git a/lib/routes/kamen-rider-official/news.ts b/lib/routes/kamen-rider-official/news.ts index 7f2d79241..d2222b1c1 100644 --- a/lib/routes/kamen-rider-official/news.ts +++ b/lib/routes/kamen-rider-official/news.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/news/:category?', diff --git a/lib/routes/kantarworldpanel/index.ts b/lib/routes/kantarworldpanel/index.ts index 1efe29082..aea7380b7 100644 --- a/lib/routes/kantarworldpanel/index.ts +++ b/lib/routes/kantarworldpanel/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:region?/:category{.+}?', diff --git a/lib/routes/kanxue/topic.ts b/lib/routes/kanxue/topic.ts index fa7797bbc..a4613d536 100644 --- a/lib/routes/kanxue/topic.ts +++ b/lib/routes/kanxue/topic.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseRelativeDate, parseDate } from '@/utils/parse-date'; +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; const baseUrl = 'https://bbs.kanxue.com/'; const categoryId = { diff --git a/lib/routes/kaopu/news.ts b/lib/routes/kaopu/news.ts index 7cc12c9fe..e673801e1 100644 --- a/lib/routes/kaopu/news.ts +++ b/lib/routes/kaopu/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/kbs/news.ts b/lib/routes/kbs/news.ts index 690516ba2..cbce5f26d 100644 --- a/lib/routes/kbs/news.ts +++ b/lib/routes/kbs/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/news/:category?/:language?', diff --git a/lib/routes/kbs/today.ts b/lib/routes/kbs/today.ts index c1ab171eb..d8df62d9d 100644 --- a/lib/routes/kbs/today.ts +++ b/lib/routes/kbs/today.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/today/:language?', diff --git a/lib/routes/kcna/news.ts b/lib/routes/kcna/news.ts index 2e0bc0b6c..d56b22ab3 100644 --- a/lib/routes/kcna/news.ts +++ b/lib/routes/kcna/news.ts @@ -1,16 +1,18 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import pMap from 'p-map'; -import { art } from '@/utils/render'; -import { fixDesc, fetchPhoto, fetchVideo } from './utils'; -import path from 'node:path'; import sanitizeHtml from 'sanitize-html'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; +import { fetchPhoto, fetchVideo, fixDesc } from './utils'; + export const route: Route = { path: '/:lang/:category?', categories: ['traditional-media'], diff --git a/lib/routes/kcna/utils.ts b/lib/routes/kcna/utils.ts index fa7d3224a..daac0df10 100644 --- a/lib/routes/kcna/utils.ts +++ b/lib/routes/kcna/utils.ts @@ -1,8 +1,9 @@ -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'http://www.kcna.kp'; const parseJucheDate = (dateString) => { @@ -57,4 +58,4 @@ const fetchVideo = (ctx, url) => return ``; }); -export { parseJucheDate, fixDesc, fetchPhoto, fetchVideo }; +export { fetchPhoto, fetchVideo, fixDesc, parseJucheDate }; diff --git a/lib/routes/ke/results.ts b/lib/routes/ke/results.ts index 5c5acb2dd..70b4e8cf6 100644 --- a/lib/routes/ke/results.ts +++ b/lib/routes/ke/results.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/researchResults', diff --git a/lib/routes/keep/user.ts b/lib/routes/keep/user.ts index 03658e8cf..9255155fa 100644 --- a/lib/routes/keep/user.ts +++ b/lib/routes/keep/user.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/user/:id', diff --git a/lib/routes/keepass/news.ts b/lib/routes/keepass/news.ts index 6bd468d54..a3fb705f0 100644 --- a/lib/routes/keepass/news.ts +++ b/lib/routes/keepass/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/kelownacapnews/news.ts b/lib/routes/kelownacapnews/news.ts index 71b1d680c..8c5b761f3 100644 --- a/lib/routes/kelownacapnews/news.ts +++ b/lib/routes/kelownacapnews/news.ts @@ -1,7 +1,8 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/kemono/index.ts b/lib/routes/kemono/index.ts index 04fa7ecc3..81625c629 100644 --- a/lib/routes/kemono/index.ts +++ b/lib/routes/kemono/index.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { KEMONO_API_URL, KEMONO_ROOT_URL, MIME_TYPE_MAP } from './const'; -import { KemonoPost, KemonoFile, DiscordMessage } from './types'; +import type { DiscordMessage, KemonoFile, KemonoPost } from './types'; const headers = { Accept: 'text/css' }; diff --git a/lib/routes/kemono/types.ts b/lib/routes/kemono/types.ts index e640b0418..7f2b8c3d0 100644 --- a/lib/routes/kemono/types.ts +++ b/lib/routes/kemono/types.ts @@ -28,4 +28,4 @@ interface DiscordMessage { attachments?: any[]; } -export type { KemonoPost, KemonoFile, DiscordMessage }; +export type { DiscordMessage, KemonoFile, KemonoPost }; diff --git a/lib/routes/kepu/live.ts b/lib/routes/kepu/live.ts index dad47ff24..b18531d8b 100644 --- a/lib/routes/kepu/live.ts +++ b/lib/routes/kepu/live.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/live', diff --git a/lib/routes/keylol/index.ts b/lib/routes/keylol/index.ts index a77ce0299..826be4186 100644 --- a/lib/routes/keylol/index.ts +++ b/lib/routes/keylol/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { config } from '@/config'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; +import queryString from 'query-string'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import parser from '@/utils/rss-parser'; -import queryString from 'query-string'; +import timezone from '@/utils/timezone'; const threadIdRegex = /(\d+)-\d+-\d+/; const header = { diff --git a/lib/routes/kimlaw/thesis.ts b/lib/routes/kimlaw/thesis.ts index 78e49dc14..428cc460d 100644 --- a/lib/routes/kimlaw/thesis.ts +++ b/lib/routes/kimlaw/thesis.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/kiro/blog.ts b/lib/routes/kiro/blog.ts index d34ef5dc3..ca9602e04 100644 --- a/lib/routes/kiro/blog.ts +++ b/lib/routes/kiro/blog.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/kiro/changelog.ts b/lib/routes/kiro/changelog.ts index a5edcd370..747a6cec8 100644 --- a/lib/routes/kiro/changelog.ts +++ b/lib/routes/kiro/changelog.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/kisskiss/blog.ts b/lib/routes/kisskiss/blog.ts index 15e0888a1..83891a695 100644 --- a/lib/routes/kisskiss/blog.ts +++ b/lib/routes/kisskiss/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/komiic/comic.ts b/lib/routes/komiic/comic.ts index 6f08fffda..8f71776e6 100644 --- a/lib/routes/komiic/comic.ts +++ b/lib/routes/komiic/comic.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/comic/:id', diff --git a/lib/routes/konachan/post.ts b/lib/routes/konachan/post.ts index b9db01647..9c0559f76 100644 --- a/lib/routes/konachan/post.ts +++ b/lib/routes/konachan/post.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import queryString from 'query-string'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: [ '/post/popular_recent/:period?', // 对应 konachan.com diff --git a/lib/routes/konghq/blog-posts.ts b/lib/routes/konghq/blog-posts.ts index 9ba27898b..7b33c5ddc 100644 --- a/lib/routes/konghq/blog-posts.ts +++ b/lib/routes/konghq/blog-posts.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // Get the lastest blog posts of https://konghq.com/ import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const BASE_URL = 'https://konghq.com'; diff --git a/lib/routes/koreaherald/index.ts b/lib/routes/koreaherald/index.ts index 95263bd12..d03bb4da6 100644 --- a/lib/routes/koreaherald/index.ts +++ b/lib/routes/koreaherald/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/kovidgoyal/kitty/changelog.ts b/lib/routes/kovidgoyal/kitty/changelog.ts index 983acbb11..0b6febdec 100644 --- a/lib/routes/kovidgoyal/kitty/changelog.ts +++ b/lib/routes/kovidgoyal/kitty/changelog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/koyso/index.ts b/lib/routes/koyso/index.ts index 1bb18b0aa..207fcdf40 100644 --- a/lib/routes/koyso/index.ts +++ b/lib/routes/koyso/index.ts @@ -1,13 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = '0', sort = 'latest' } = ctx.req.param(); diff --git a/lib/routes/kpmg/insights.ts b/lib/routes/kpmg/insights.ts index 087185af8..07f608dc0 100644 --- a/lib/routes/kpmg/insights.ts +++ b/lib/routes/kpmg/insights.ts @@ -1,12 +1,14 @@ +import path from 'node:path'; + +import * as cheerio from 'cheerio'; +import type { Context } from 'hono'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; -import { Context } from 'hono'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const baseUrl = 'https://kpmg.com'; const payload = { diff --git a/lib/routes/kpopping/kpics.ts b/lib/routes/kpopping/kpics.ts index a0e2c632d..f83494671 100644 --- a/lib/routes/kpopping/kpics.ts +++ b/lib/routes/kpopping/kpics.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { filter } = ctx.req.param(); diff --git a/lib/routes/kpopping/news.ts b/lib/routes/kpopping/news.ts index 64a10eb3c..4cec2f530 100644 --- a/lib/routes/kpopping/news.ts +++ b/lib/routes/kpopping/news.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const { filter } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '2', 10); diff --git a/lib/routes/ktown4u/artist-brandlist.ts b/lib/routes/ktown4u/artist-brandlist.ts index f488becbe..4ada52cbc 100644 --- a/lib/routes/ktown4u/artist-brandlist.ts +++ b/lib/routes/ktown4u/artist-brandlist.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/kuaidi100/index.ts b/lib/routes/kuaidi100/index.ts index 434c1e6af..6777a323b 100644 --- a/lib/routes/kuaidi100/index.ts +++ b/lib/routes/kuaidi100/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/kuaidi100/supported-company.ts b/lib/routes/kuaidi100/supported-company.ts index 06562000f..568101b9c 100644 --- a/lib/routes/kuaidi100/supported-company.ts +++ b/lib/routes/kuaidi100/supported-company.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/kuaidi100/utils.ts b/lib/routes/kuaidi100/utils.ts index af1449b66..7d6bd38ac 100644 --- a/lib/routes/kuaidi100/utils.ts +++ b/lib/routes/kuaidi100/utils.ts @@ -1,5 +1,6 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; + const wwwid_key = 'kuaidi100-wwwid'; const csrf_key = 'kuaidi100-csrf'; const globacsrftoken_key = 'kuaidi100-globacsrftoken'; diff --git a/lib/routes/kuaishou/profile.ts b/lib/routes/kuaishou/profile.ts index fac8dfeed..e0eaf9e29 100644 --- a/lib/routes/kuaishou/profile.ts +++ b/lib/routes/kuaishou/profile.ts @@ -1,6 +1,7 @@ -import { Route, Data } from '@/types'; -import puppeteer from '@/utils/puppeteer'; import { config } from '@/config'; +import type { Data, Route } from '@/types'; +import puppeteer from '@/utils/puppeteer'; + export const route: Route = { name: 'Profile', path: '/profile/:principalId', diff --git a/lib/routes/kunchengblog/essay.ts b/lib/routes/kunchengblog/essay.ts index 7161c508b..3bb85f90f 100644 --- a/lib/routes/kunchengblog/essay.ts +++ b/lib/routes/kunchengblog/essay.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import { SourceMapConsumer } from 'source-map'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/essay', categories: ['blog'], diff --git a/lib/routes/kurogames/namespace.ts b/lib/routes/kurogames/namespace.ts index ec104a46c..56bdd3ad8 100644 --- a/lib/routes/kurogames/namespace.ts +++ b/lib/routes/kurogames/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: '库洛游戏 | Kuro Games', diff --git a/lib/routes/kurogames/wutheringwaves/news.ts b/lib/routes/kurogames/wutheringwaves/news.ts index 0a734a6d7..aee57ca0b 100644 --- a/lib/routes/kurogames/wutheringwaves/news.ts +++ b/lib/routes/kurogames/wutheringwaves/news.ts @@ -1,10 +1,13 @@ -import { DataItem, Route } from '@/types'; +import * as cheerio from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import * as cheerio from 'cheerio'; -import ofetch from '@/utils/ofetch'; -import { Article, Language, Parameter, SUPPORTED_LANGUAGES } from './constants'; + +import type { Article} from './constants'; +import { Language, Parameter, SUPPORTED_LANGUAGES } from './constants'; import { fetchArticles, getArticleContentLink, getArticleLink, getHandlerLanguage, isValidLanguage, parseInteger } from './utils'; export const route: Route = { diff --git a/lib/routes/kurogames/wutheringwaves/utils.ts b/lib/routes/kurogames/wutheringwaves/utils.ts index 0faaa4d17..fd70f315e 100644 --- a/lib/routes/kurogames/wutheringwaves/utils.ts +++ b/lib/routes/kurogames/wutheringwaves/utils.ts @@ -1,6 +1,8 @@ +import type { Data } from '@/types'; import ofetch from '@/utils/ofetch'; -import { Data } from '@/types'; -import { Article, Language, SUPPORTED_LANGUAGES } from './constants'; + +import type { Article} from './constants'; +import { Language, SUPPORTED_LANGUAGES } from './constants'; /** * Parse a number or a number as string.\ diff --git a/lib/routes/kuwaitlocal/index.ts b/lib/routes/kuwaitlocal/index.ts index c17f3fa90..a48480eb0 100644 --- a/lib/routes/kuwaitlocal/index.ts +++ b/lib/routes/kuwaitlocal/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/kyodonews/index.ts b/lib/routes/kyodonews/index.ts index f7a552f36..328bfb121 100644 --- a/lib/routes/kyodonews/index.ts +++ b/lib/routes/kyodonews/index.ts @@ -1,14 +1,15 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import ConfigNotFoundError from '@/errors/types/config-not-found'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const resolveRelativeLink = (link, baseUrl) => (link.startsWith('http') ? link : `${baseUrl}${link}`); diff --git a/lib/routes/laimanhua/index.ts b/lib/routes/laimanhua/index.ts index c680c145e..6e854f399 100644 --- a/lib/routes/laimanhua/index.ts +++ b/lib/routes/laimanhua/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import iconv from 'iconv-lite'; import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/lala/rss.ts b/lib/routes/lala/rss.ts index add332e3f..992b03dd9 100644 --- a/lib/routes/lala/rss.ts +++ b/lib/routes/lala/rss.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/landiannews/category.ts b/lib/routes/landiannews/category.ts index b660184a7..1235ea3fa 100644 --- a/lib/routes/landiannews/category.ts +++ b/lib/routes/landiannews/category.ts @@ -1,5 +1,7 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; -import { fetchNewsItems, fetchCategory } from './utils'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; + +import { fetchCategory, fetchNewsItems } from './utils'; export const handler = async (ctx): Promise => { const slug = ctx.req.param('slug'); diff --git a/lib/routes/landiannews/index.ts b/lib/routes/landiannews/index.ts index 641829ccd..78f276096 100644 --- a/lib/routes/landiannews/index.ts +++ b/lib/routes/landiannews/index.ts @@ -1,4 +1,6 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchNewsItems } from './utils'; export const handler = async (): Promise => { diff --git a/lib/routes/landiannews/tag.ts b/lib/routes/landiannews/tag.ts index f7d225b83..0b30ee6b5 100644 --- a/lib/routes/landiannews/tag.ts +++ b/lib/routes/landiannews/tag.ts @@ -1,4 +1,6 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchNewsItems, fetchTag } from './utils'; export const handler = async (ctx): Promise => { diff --git a/lib/routes/landiannews/utils.ts b/lib/routes/landiannews/utils.ts index 99f213714..7507eed68 100644 --- a/lib/routes/landiannews/utils.ts +++ b/lib/routes/landiannews/utils.ts @@ -1,5 +1,5 @@ -import ofetch from '@/utils/ofetch'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; const rootUrl = 'https://www.landiannews.com/'; @@ -31,4 +31,4 @@ async function fetchNewsItems(apiUrl: string) { })); } -export { fetchCategory, fetchTag, fetchNewsItems }; +export { fetchCategory, fetchNewsItems, fetchTag }; diff --git a/lib/routes/lang/room.ts b/lib/routes/lang/room.ts index ba0ca0e85..046490eb0 100644 --- a/lib/routes/lang/room.ts +++ b/lib/routes/lang/room.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/live/room/:id', diff --git a/lib/routes/langchain/index.ts b/lib/routes/langchain/index.ts index 7dc1bf1ac..4fc0038c6 100644 --- a/lib/routes/langchain/index.ts +++ b/lib/routes/langchain/index.ts @@ -1,7 +1,8 @@ -import { Route, DataItem } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; export const route: Route = { path: '/blog', diff --git a/lib/routes/lanqiao/author.ts b/lib/routes/lanqiao/author.ts index b1388938c..ae94ac53c 100644 --- a/lib/routes/lanqiao/author.ts +++ b/lib/routes/lanqiao/author.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import utils from './utils'; -import MarkdownIt from 'markdown-it'; async function getUserName(uid) { // 获取用户信息 diff --git a/lib/routes/lanqiao/courses.ts b/lib/routes/lanqiao/courses.ts index f05b5d187..d8b4998c1 100644 --- a/lib/routes/lanqiao/courses.ts +++ b/lib/routes/lanqiao/courses.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import utils from './utils'; -import MarkdownIt from 'markdown-it'; export const route: Route = { path: '/courses/:sort/:tag', diff --git a/lib/routes/lanqiao/questions.ts b/lib/routes/lanqiao/questions.ts index e74aa2b6a..fef0c6ffa 100644 --- a/lib/routes/lanqiao/questions.ts +++ b/lib/routes/lanqiao/questions.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; export const route: Route = { path: '/questions/:id', diff --git a/lib/routes/lanqiao/utils.ts b/lib/routes/lanqiao/utils.ts index 13e34d316..2d53043a6 100644 --- a/lib/routes/lanqiao/utils.ts +++ b/lib/routes/lanqiao/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; +import { art } from '@/utils/render'; + const courseDesc = (picurl, desc) => art(path.join(__dirname, 'templates/courseDesc.art'), { picurl, diff --git a/lib/routes/laohu8/personal.ts b/lib/routes/laohu8/personal.ts index 6ec6af91b..0e102c7b4 100644 --- a/lib/routes/laohu8/personal.ts +++ b/lib/routes/laohu8/personal.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.laohu8.com'; diff --git a/lib/routes/last-origin/news.ts b/lib/routes/last-origin/news.ts index 6dacb38c9..16ed495c1 100644 --- a/lib/routes/last-origin/news.ts +++ b/lib/routes/last-origin/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/latepost/index.ts b/lib/routes/latepost/index.ts index 8d0144040..2ac594cf8 100644 --- a/lib/routes/latepost/index.ts +++ b/lib/routes/latepost/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; /** * Convert an array into a dictionary object. diff --git a/lib/routes/layoffs/index.ts b/lib/routes/layoffs/index.ts index b3abfa689..ab3e53100 100644 --- a/lib/routes/layoffs/index.ts +++ b/lib/routes/layoffs/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const ROW_COUNT = 100; diff --git a/lib/routes/leagueoflegends/patch-notes.ts b/lib/routes/leagueoflegends/patch-notes.ts index 4a32a07dd..b57d295f0 100644 --- a/lib/routes/leagueoflegends/patch-notes.ts +++ b/lib/routes/leagueoflegends/patch-notes.ts @@ -1,6 +1,7 @@ -import { DataItem, Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/learnblockchain/posts.ts b/lib/routes/learnblockchain/posts.ts index 6498548fe..1dc455d53 100644 --- a/lib/routes/learnblockchain/posts.ts +++ b/lib/routes/learnblockchain/posts.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseRelativeDate } from '@/utils/parse-date'; diff --git a/lib/routes/learnku/topic.ts b/lib/routes/learnku/topic.ts index 938fcb883..0285d6684 100644 --- a/lib/routes/learnku/topic.ts +++ b/lib/routes/learnku/topic.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; -import path from 'node:path'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/:community/:category?', diff --git a/lib/routes/leetcode/articles.ts b/lib/routes/leetcode/articles.ts index 2c6708231..81ea8ab78 100644 --- a/lib/routes/leetcode/articles.ts +++ b/lib/routes/leetcode/articles.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, breaks: true, diff --git a/lib/routes/leetcode/dailyquestion-cn.ts b/lib/routes/leetcode/dailyquestion-cn.ts index 34335a1bd..40632c3b0 100644 --- a/lib/routes/leetcode/dailyquestion-cn.ts +++ b/lib/routes/leetcode/dailyquestion-cn.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const host = 'https://leetcode.cn'; diff --git a/lib/routes/leetcode/dailyquestion-en.ts b/lib/routes/leetcode/dailyquestion-en.ts index f0eddacbc..02a014bb4 100644 --- a/lib/routes/leetcode/dailyquestion-en.ts +++ b/lib/routes/leetcode/dailyquestion-en.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const host = 'https://leetcode.com'; diff --git a/lib/routes/leetcode/dailyquestion-solution-cn.ts b/lib/routes/leetcode/dailyquestion-solution-cn.ts index 66de788e1..8e573b10e 100644 --- a/lib/routes/leetcode/dailyquestion-solution-cn.ts +++ b/lib/routes/leetcode/dailyquestion-solution-cn.ts @@ -1,12 +1,15 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + const md = MarkdownIt({ html: true, breaks: true, }); -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; + export const route: Route = { path: '/dailyquestion/solution/cn', radar: [ diff --git a/lib/routes/leetcode/dailyquestion-solution-en.ts b/lib/routes/leetcode/dailyquestion-solution-en.ts index 3405ec689..478af48ba 100644 --- a/lib/routes/leetcode/dailyquestion-solution-en.ts +++ b/lib/routes/leetcode/dailyquestion-solution-en.ts @@ -1,13 +1,16 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; +import path from 'node:path'; + import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + const md = MarkdownIt({ html: true, breaks: true, }); -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; export const route: Route = { path: '/dailyquestion/solution/en', radar: [ diff --git a/lib/routes/leiphone/index.ts b/lib/routes/leiphone/index.ts index 48502a42e..07c0262f2 100644 --- a/lib/routes/leiphone/index.ts +++ b/lib/routes/leiphone/index.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/leiphone/newsflash.ts b/lib/routes/leiphone/newsflash.ts index 13be02c1d..0b8467e39 100644 --- a/lib/routes/leiphone/newsflash.ts +++ b/lib/routes/leiphone/newsflash.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import utils from './utils'; // import { load } from 'cheerio'; diff --git a/lib/routes/leiphone/utils.ts b/lib/routes/leiphone/utils.ts index 7fdaed9dc..f219995f0 100644 --- a/lib/routes/leiphone/utils.ts +++ b/lib/routes/leiphone/utils.ts @@ -1,7 +1,9 @@ +import * as url from 'node:url'; + import { load } from 'cheerio'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import * as url from 'node:url'; const ProcessFeed = async (list, cache) => { const host = 'https://www.leiphone.com'; diff --git a/lib/routes/lemmy/index.ts b/lib/routes/lemmy/index.ts index b83b17f52..5fa000cba 100644 --- a/lib/routes/lemmy/index.ts +++ b/lib/routes/lemmy/index.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true }); -import { config } from '@/config'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/:community/:sort?', diff --git a/lib/routes/lenovo/drive.ts b/lib/routes/lenovo/drive.ts index bbeb45652..cf2cb94fb 100644 --- a/lib/routes/lenovo/drive.ts +++ b/lib/routes/lenovo/drive.ts @@ -1,9 +1,10 @@ -import { Route, Data, DataItem } from '@/types'; import path from 'node:path'; -import { art } from '@/utils/render'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/drive/:selName', diff --git a/lib/routes/lens/profile.ts b/lib/routes/lens/profile.ts index ec7cb42f4..ac77628d1 100644 --- a/lib/routes/lens/profile.ts +++ b/lib/routes/lens/profile.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/letterboxd/index.ts b/lib/routes/letterboxd/index.ts index 37fbc3584..a1575decc 100644 --- a/lib/routes/letterboxd/index.ts +++ b/lib/routes/letterboxd/index.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import { namespace } from './namespace'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; import type { Context } from 'hono'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { namespace } from './namespace'; + const baseUrl = `https://${namespace.url}`; export const route: Route = { diff --git a/lib/routes/lfsyd/home.ts b/lib/routes/lfsyd/home.ts index 0b0f221b5..00035ed7e 100644 --- a/lib/routes/lfsyd/home.ts +++ b/lib/routes/lfsyd/home.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { ProcessForm, ProcessFeed } from './utils'; + +import { ProcessFeed, ProcessForm } from './utils'; export const route: Route = { path: '/home', diff --git a/lib/routes/lfsyd/old-home.ts b/lib/routes/lfsyd/old-home.ts index b75e8e3c6..d22f0caac 100644 --- a/lib/routes/lfsyd/old-home.ts +++ b/lib/routes/lfsyd/old-home.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/lfsyd/tag.ts b/lib/routes/lfsyd/tag.ts index cc0834af1..05ba52a51 100644 --- a/lib/routes/lfsyd/tag.ts +++ b/lib/routes/lfsyd/tag.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { ProcessForm, ProcessFeed } from './utils'; + +import { ProcessFeed, ProcessForm } from './utils'; export const route: Route = { path: '/tag/:tagId?', diff --git a/lib/routes/lfsyd/user.ts b/lib/routes/lfsyd/user.ts index 1e3b0dea0..16a335a0e 100644 --- a/lib/routes/lfsyd/user.ts +++ b/lib/routes/lfsyd/user.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { ProcessForm, ProcessFeed } from './utils'; + +import { ProcessFeed, ProcessForm } from './utils'; export const route: Route = { path: '/user/:id?', diff --git a/lib/routes/lfsyd/utils.ts b/lib/routes/lfsyd/utils.ts index d2cf59ae9..0c98e0d15 100644 --- a/lib/routes/lfsyd/utils.ts +++ b/lib/routes/lfsyd/utils.ts @@ -1,7 +1,9 @@ +import path from 'node:path'; + import { load } from 'cheerio'; + import got from '@/utils/got'; import md5 from '@/utils/md5'; -import path from 'node:path'; import { art } from '@/utils/render'; const rootUrl = 'https://www.iyingdi.com'; @@ -97,4 +99,4 @@ const cleanHtml = (htmlString) => { return $.html(); }; -export { ProcessForm, ProcessFeed }; +export { ProcessFeed, ProcessForm }; diff --git a/lib/routes/lhratings/research.ts b/lib/routes/lhratings/research.ts index 6a298a4c6..e36c26afb 100644 --- a/lib/routes/lhratings/research.ts +++ b/lib/routes/lhratings/research.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { type = '1' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '20', 10); diff --git a/lib/routes/lianxh/index.ts b/lib/routes/lianxh/index.ts index 2b5bf096f..033fc2837 100644 --- a/lib/routes/lianxh/index.ts +++ b/lib/routes/lianxh/index.ts @@ -1,11 +1,12 @@ -import { DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; import * as cheerio from 'cheerio'; import type { Context } from 'hono'; import markdownit from 'markdown-it'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + const md = markdownit({ html: true, breaks: true, diff --git a/lib/routes/lifeweek/channel.ts b/lib/routes/lifeweek/channel.ts index 62451ca4e..347234d7d 100644 --- a/lib/routes/lifeweek/channel.ts +++ b/lib/routes/lifeweek/channel.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import getRssItem from './utils'; const rootApiUrl = 'https://www.lifeweek.com.cn/api/userWebFollow/getFollowTagContentList?type=3&sort=2&tagId'; diff --git a/lib/routes/lifeweek/tag.ts b/lib/routes/lifeweek/tag.ts index 9506c37e5..30b08d439 100644 --- a/lib/routes/lifeweek/tag.ts +++ b/lib/routes/lifeweek/tag.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import getRssItem from './utils'; + const rootApiUrl = 'https://www.lifeweek.com.cn/api/userWebFollow/getFollowTagContentList?type=4&sort=2&tagId'; const rootUrl = 'https://www.lifeweek.com.cn/articleList'; const articleRootUrl = 'https://www.lifeweek.com.cn/article'; diff --git a/lib/routes/lifeweek/utils.ts b/lib/routes/lifeweek/utils.ts index b8eb6793b..66fe313ec 100644 --- a/lib/routes/lifeweek/utils.ts +++ b/lib/routes/lifeweek/utils.ts @@ -1,6 +1,7 @@ import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + const articleApiRootUrl = 'https://www.lifeweek.com.cn/api/article'; async function getRssItem(item, articleLink) { diff --git a/lib/routes/lightnovel/light-novel.ts b/lib/routes/lightnovel/light-novel.ts index db1c2bfba..ea154ee98 100644 --- a/lib/routes/lightnovel/light-novel.ts +++ b/lib/routes/lightnovel/light-novel.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/:keywords/:security_key?', diff --git a/lib/routes/likeshop/index.ts b/lib/routes/likeshop/index.ts index 71e13756b..b287ec8bf 100644 --- a/lib/routes/likeshop/index.ts +++ b/lib/routes/likeshop/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/line/publisher.ts b/lib/routes/line/publisher.ts index 9307d761d..b3cb2ede0 100644 --- a/lib/routes/line/publisher.ts +++ b/lib/routes/line/publisher.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { baseUrl, parseList, parseItems } from './utils'; + +import { baseUrl, parseItems, parseList } from './utils'; export const route: Route = { path: '/today/:edition/publisher/:id', diff --git a/lib/routes/line/today.ts b/lib/routes/line/today.ts index 0488b91c0..fe5635e0e 100644 --- a/lib/routes/line/today.ts +++ b/lib/routes/line/today.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { baseUrl as rootUrl, parseList, parseItems } from './utils'; + +import { baseUrl as rootUrl, parseItems, parseList } from './utils'; export const route: Route = { path: '/today/:edition?/:tab?', diff --git a/lib/routes/line/utils.ts b/lib/routes/line/utils.ts index 2d4fde721..087ddc365 100644 --- a/lib/routes/line/utils.ts +++ b/lib/routes/line/utils.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import logger from '@/utils/logger'; + import cache from '@/utils/cache'; +import got from '@/utils/got'; +import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://today.line.me'; const parseList = (items) => @@ -53,4 +55,4 @@ const parseItems = (list) => ) ); -export { baseUrl, parseList, parseItems }; +export { baseUrl, parseItems, parseList }; diff --git a/lib/routes/lineageos/changes.ts b/lib/routes/lineageos/changes.ts index c841fb313..df761d66c 100644 --- a/lib/routes/lineageos/changes.ts +++ b/lib/routes/lineageos/changes.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/link3/events.ts b/lib/routes/link3/events.ts index 00cfcf1bb..9bb4ac501 100644 --- a/lib/routes/link3/events.ts +++ b/lib/routes/link3/events.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/events', diff --git a/lib/routes/link3/profile.ts b/lib/routes/link3/profile.ts index 906c810bc..ec9a69206 100644 --- a/lib/routes/link3/profile.ts +++ b/lib/routes/link3/profile.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/profile/:handle', diff --git a/lib/routes/linkedin/cn/index.ts b/lib/routes/linkedin/cn/index.ts index 15916d8c2..ef3e42555 100644 --- a/lib/routes/linkedin/cn/index.ts +++ b/lib/routes/linkedin/cn/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { parseSearchHit, parseJobPosting } from './utils'; +import type { Route } from '@/types'; + +import { parseJobPosting, parseSearchHit } from './utils'; const siteUrl = 'https://www.linkedin.cn/incareer/jobs/search'; diff --git a/lib/routes/linkedin/cn/utils.ts b/lib/routes/linkedin/cn/utils.ts index db63db021..8ed987c56 100644 --- a/lib/routes/linkedin/cn/utils.ts +++ b/lib/routes/linkedin/cn/utils.ts @@ -1,8 +1,10 @@ -import cache from '@/utils/cache'; import crypto from 'node:crypto'; import path from 'node:path'; -import { art } from '@/utils/render'; + +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { art } from '@/utils/render'; + import { parseAttr } from './renderer'; const apiUrl = 'https://www.linkedin.cn/karpos/api/graphql'; @@ -117,4 +119,4 @@ const parseJobPosting = (ctx, jobPosting) => { }); }; -export { parseSearchHit, parseJobPosting }; +export { parseJobPosting, parseSearchHit }; diff --git a/lib/routes/linkedin/jobs.ts b/lib/routes/linkedin/jobs.ts index 0f8b79fa5..f733cc8ab 100644 --- a/lib/routes/linkedin/jobs.ts +++ b/lib/routes/linkedin/jobs.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + import { EXP_LEVELS, EXP_LEVELS_QUERY_KEY, JOB_TYPES, JOB_TYPES_QUERY_KEY, KEYWORDS_QUERY_KEY, parseJobSearch, parseParamsToSearchParams, parseParamsToString, parseRouteParam } from './utils'; const BASE_URL = 'https://www.linkedin.com/'; diff --git a/lib/routes/linkedin/posts.ts b/lib/routes/linkedin/posts.ts index 2f324fd19..def1e88e5 100644 --- a/lib/routes/linkedin/posts.ts +++ b/lib/routes/linkedin/posts.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import puppeteer from '@/utils/puppeteer'; import { load } from 'cheerio'; -import { parseCompanyName, parseCompanyPosts, BASE_URL } from './utils'; + +import type { Route } from '@/types'; import logger from '@/utils/logger'; +import puppeteer from '@/utils/puppeteer'; + +import { BASE_URL, parseCompanyName, parseCompanyPosts } from './utils'; export const route: Route = { path: '/company/:company_id/posts', diff --git a/lib/routes/linkedin/utils.ts b/lib/routes/linkedin/utils.ts index 33a8bf7ed..9f698823c 100644 --- a/lib/routes/linkedin/utils.ts +++ b/lib/routes/linkedin/utils.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; -import { Job } from './models'; import dayjs from 'dayjs'; +import { Job } from './models'; + /** * Constants */ @@ -184,17 +185,17 @@ function parseRelativeShorthandDate(shorthand) { } export { - parseCompanyPosts, - parseCompanyName, - parseParamsToSearchParams, - parseParamsToString, - parseJobDetail, - parseJobSearch, - parseRouteParam, BASE_URL, - JOB_TYPES, - JOB_TYPES_QUERY_KEY, EXP_LEVELS, EXP_LEVELS_QUERY_KEY, + JOB_TYPES, + JOB_TYPES_QUERY_KEY, KEYWORDS_QUERY_KEY, + parseCompanyName, + parseCompanyPosts, + parseJobDetail, + parseJobSearch, + parseParamsToSearchParams, + parseParamsToString, + parseRouteParam, }; diff --git a/lib/routes/linkresearcher/index.ts b/lib/routes/linkresearcher/index.ts index a08136c34..7e7be473d 100644 --- a/lib/routes/linkresearcher/index.ts +++ b/lib/routes/linkresearcher/index.ts @@ -1,13 +1,16 @@ -import { ViewType, type Data, type DataItem, type Route } from '@/types'; +import crypto from 'node:crypto'; +import path from 'node:path'; + +import type { Context } from 'hono'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import crypto from 'node:crypto'; -import type { Context } from 'hono'; -import type { DetailResponse, SearchResultItem } from './types'; -import cache from '@/utils/cache'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import type { DetailResponse, SearchResultItem } from './types'; const templatePath = path.join(__dirname, 'templates/bilingual.art'); diff --git a/lib/routes/linovelib/novel.ts b/lib/routes/linovelib/novel.ts index e335917f2..503b82f1a 100644 --- a/lib/routes/linovelib/novel.ts +++ b/lib/routes/linovelib/novel.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/novel/:id', categories: ['reading'], diff --git a/lib/routes/linovelib/volume.ts b/lib/routes/linovelib/volume.ts index be962f55e..3134b153e 100644 --- a/lib/routes/linovelib/volume.ts +++ b/lib/routes/linovelib/volume.ts @@ -1,7 +1,8 @@ -import type { Route, Data } from '@/types'; -import type { Context } from 'hono'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/volume/:id', diff --git a/lib/routes/liquipedia/cs-matches.ts b/lib/routes/liquipedia/cs-matches.ts index 7b57b5b10..0c0100725 100644 --- a/lib/routes/liquipedia/cs-matches.ts +++ b/lib/routes/liquipedia/cs-matches.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/counterstrike/matches/:team', radar: [ diff --git a/lib/routes/liquipedia/dota2-matches.ts b/lib/routes/liquipedia/dota2-matches.ts index 1867165b5..90b7cc069 100644 --- a/lib/routes/liquipedia/dota2-matches.ts +++ b/lib/routes/liquipedia/dota2-matches.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/literotica/category.ts b/lib/routes/literotica/category.ts index 7831b4a75..dc4ade89e 100644 --- a/lib/routes/literotica/category.ts +++ b/lib/routes/literotica/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/literotica/new.ts b/lib/routes/literotica/new.ts index d3d58f625..fd1c10d55 100644 --- a/lib/routes/literotica/new.ts +++ b/lib/routes/literotica/new.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/liulinblog/index.ts b/lib/routes/liulinblog/index.ts index 5556aa97a..5ac49c397 100644 --- a/lib/routes/liulinblog/index.ts +++ b/lib/routes/liulinblog/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/liulinblog/itnews.ts b/lib/routes/liulinblog/itnews.ts index 155ad9060..649e4adde 100644 --- a/lib/routes/liulinblog/itnews.ts +++ b/lib/routes/liulinblog/itnews.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + export const route: Route = { path: '/itnews/:channel', name: 'Unknown', diff --git a/lib/routes/liveuamap/index.ts b/lib/routes/liveuamap/index.ts index cfa1ea48b..b944e55ed 100644 --- a/lib/routes/liveuamap/index.ts +++ b/lib/routes/liveuamap/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { isValidHost } from '@/utils/valid-host'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { isValidHost } from '@/utils/valid-host'; export const route: Route = { path: '/:region?', diff --git a/lib/routes/lkong/forum.ts b/lib/routes/lkong/forum.ts index df31bbe15..d79f313ce 100644 --- a/lib/routes/lkong/forum.ts +++ b/lib/routes/lkong/forum.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import { viewForum, viewThread } from './query'; diff --git a/lib/routes/lkong/query.ts b/lib/routes/lkong/query.ts index 6435583ac..af0c0cf39 100644 --- a/lib/routes/lkong/query.ts +++ b/lib/routes/lkong/query.ts @@ -80,4 +80,4 @@ const countReplies = (id) => ({ }, }); -export { viewForum, viewThread, countReplies }; +export { countReplies, viewForum, viewThread }; diff --git a/lib/routes/lkong/thread.ts b/lib/routes/lkong/thread.ts index b6ac57172..ff458c64a 100644 --- a/lib/routes/lkong/thread.ts +++ b/lib/routes/lkong/thread.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { viewThread, countReplies } from './query'; +import { countReplies, viewThread } from './query'; export const route: Route = { path: '/thread/:id', diff --git a/lib/routes/lmu/jobs.ts b/lib/routes/lmu/jobs.ts index 33c38f598..5d8403407 100644 --- a/lib/routes/lmu/jobs.ts +++ b/lib/routes/lmu/jobs.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const apiUrl = 'https://jobs.b-ite.com/api/v1/postings/search'; diff --git a/lib/routes/lofter/collection.ts b/lib/routes/lofter/collection.ts index 7ec2784d8..adf90b2e0 100644 --- a/lib/routes/lofter/collection.ts +++ b/lib/routes/lofter/collection.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/lofter/tag.ts b/lib/routes/lofter/tag.ts index 0d6fba7aa..d6ba12461 100644 --- a/lib/routes/lofter/tag.ts +++ b/lib/routes/lofter/tag.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { config } from '@/config'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import { JSDOM } from 'jsdom'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/tag/:name?/:type?', diff --git a/lib/routes/lofter/user.ts b/lib/routes/lofter/user.ts index c8547dd8e..111268981 100644 --- a/lib/routes/lofter/user.ts +++ b/lib/routes/lofter/user.ts @@ -1,5 +1,6 @@ import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { isValidHost } from '@/utils/valid-host'; diff --git a/lib/routes/logclub/index.ts b/lib/routes/logclub/index.ts index a3b114717..9636f287a 100644 --- a/lib/routes/logclub/index.ts +++ b/lib/routes/logclub/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category{.+}?', diff --git a/lib/routes/logclub/report.ts b/lib/routes/logclub/report.ts index 7ee2b4925..62e1a54f2 100644 --- a/lib/routes/logclub/report.ts +++ b/lib/routes/logclub/report.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: ['/lc_report/:id?', '/report/:id?'], diff --git a/lib/routes/logonews/index.ts b/lib/routes/logonews/index.ts index 0302e81b5..1aeafe518 100644 --- a/lib/routes/logonews/index.ts +++ b/lib/routes/logonews/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: ['/work/tags/:tag', '/tag/:tag', '*'], diff --git a/lib/routes/logrocket/index.ts b/lib/routes/logrocket/index.ts index 6c90e506c..de91a6b2a 100644 --- a/lib/routes/logrocket/index.ts +++ b/lib/routes/logrocket/index.ts @@ -1,8 +1,9 @@ -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { load } from 'cheerio'; // 类似 jQuery 的 API HTML 解析器 -import { Route } from '@/types'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; // 统一使用的请求库 +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/:type', diff --git a/lib/routes/loltw/news.ts b/lib/routes/loltw/news.ts index 3827a7fe2..af261ce9f 100644 --- a/lib/routes/loltw/news.ts +++ b/lib/routes/loltw/news.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/news/:category?', diff --git a/lib/routes/loongarch/post.ts b/lib/routes/loongarch/post.ts index a0e1ad32a..c1febec73 100644 --- a/lib/routes/loongarch/post.ts +++ b/lib/routes/loongarch/post.ts @@ -1,6 +1,6 @@ -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/post/:type?', diff --git a/lib/routes/lorientlejour/index.ts b/lib/routes/lorientlejour/index.ts index 4a1a5d4c7..faee81760 100644 --- a/lib/routes/lorientlejour/index.ts +++ b/lib/routes/lorientlejour/index.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; +import { FetchError } from 'ofetch'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; -import { FetchError } from 'ofetch'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; -import path from 'node:path'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const key = '3d5_f6A(S$G_FD=2S(Dr6%7BW_h37@rE'; diff --git a/lib/routes/lovelive-anime/news.ts b/lib/routes/lovelive-anime/news.ts index d8fbed395..7e85ac6a4 100644 --- a/lib/routes/lovelive-anime/news.ts +++ b/lib/routes/lovelive-anime/news.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import path from 'node:path'; -import { art } from '@/utils/render'; import ofetch from '@/utils/ofetch'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + const renderDescription = (desc) => art(path.join(__dirname, 'templates/description.art'), desc); export const route: Route = { diff --git a/lib/routes/lrepacks/index.ts b/lib/routes/lrepacks/index.ts index 2d54432c9..220c9ebf7 100644 --- a/lib/routes/lrepacks/index.ts +++ b/lib/routes/lrepacks/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { category = '' } = ctx.req.param(); diff --git a/lib/routes/lsnu/jiaowc/tzgg.ts b/lib/routes/lsnu/jiaowc/tzgg.ts index 55c72b6f1..d8f653650 100644 --- a/lib/routes/lsnu/jiaowc/tzgg.ts +++ b/lib/routes/lsnu/jiaowc/tzgg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/jiaowc/tzgg/:category?', diff --git a/lib/routes/ltaaa/article.ts b/lib/routes/ltaaa/article.ts index 54100997b..3b7687fb2 100644 --- a/lib/routes/ltaaa/article.ts +++ b/lib/routes/ltaaa/article.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/luma/index.ts b/lib/routes/luma/index.ts index 795e34c98..0de68ca9a 100644 --- a/lib/routes/luma/index.ts +++ b/lib/routes/luma/index.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/:url', diff --git a/lib/routes/luogu/contest.ts b/lib/routes/luogu/contest.ts index a50f39801..50d0bbbaa 100644 --- a/lib/routes/luogu/contest.ts +++ b/lib/routes/luogu/contest.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import MarkdownIt from 'markdown-it'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt(); -import pMap from 'p-map'; const baseUrl = 'https://www.luogu.com.cn'; diff --git a/lib/routes/luogu/daily.ts b/lib/routes/luogu/daily.ts index 09be4c19b..552f76f9b 100644 --- a/lib/routes/luogu/daily.ts +++ b/lib/routes/luogu/daily.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/luogu/user-article.ts b/lib/routes/luogu/user-article.ts index 401d59b03..733716ab7 100644 --- a/lib/routes/luogu/user-article.ts +++ b/lib/routes/luogu/user-article.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; -import { getUserInfoFromUID } from './utils'; import { parseDate } from '@/utils/parse-date'; +import { getUserInfoFromUID } from './utils'; + export const route: Route = { path: '/user/article/:uid', categories: ['programming'], diff --git a/lib/routes/luogu/user-blog.ts b/lib/routes/luogu/user-blog.ts index 51538cb45..6330cf4db 100644 --- a/lib/routes/luogu/user-blog.ts +++ b/lib/routes/luogu/user-blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; export const route: Route = { path: '/user/blog/:name', diff --git a/lib/routes/luogu/user-feed.ts b/lib/routes/luogu/user-feed.ts index bde1cd462..6c139e462 100644 --- a/lib/routes/luogu/user-feed.ts +++ b/lib/routes/luogu/user-feed.ts @@ -1,8 +1,11 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + import { getUserInfoFromUID } from './utils'; + const md = MarkdownIt(); export const route: Route = { diff --git a/lib/routes/luolei/index.ts b/lib/routes/luolei/index.ts index 21ced6a7f..91ffaf3d3 100644 --- a/lib/routes/luolei/index.ts +++ b/lib/routes/luolei/index.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { CheerioAPI, load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const unblurImages = ($: CheerioAPI) => { $('img[data-original-src]').each((_, el) => { diff --git a/lib/routes/luxiangdong/archive.ts b/lib/routes/luxiangdong/archive.ts index 0b24b1c59..5fa54dc01 100644 --- a/lib/routes/luxiangdong/archive.ts +++ b/lib/routes/luxiangdong/archive.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/lvv2/news.ts b/lib/routes/lvv2/news.ts index d48269713..f2c2eb4ca 100644 --- a/lib/routes/lvv2/news.ts +++ b/lib/routes/lvv2/news.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://lvv2.com'; diff --git a/lib/routes/lvv2/top.ts b/lib/routes/lvv2/top.ts index 41d791e6b..b1f12b073 100644 --- a/lib/routes/lvv2/top.ts +++ b/lib/routes/lvv2/top.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://lvv2.com'; diff --git a/lib/routes/lxixsxa/discography.ts b/lib/routes/lxixsxa/discography.ts index fab9f7d3c..fdba89bb9 100644 --- a/lib/routes/lxixsxa/discography.ts +++ b/lib/routes/lxixsxa/discography.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { parseJSONP } from './jsonp-helper'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import { parseJSONP } from './jsonp-helper'; export const route: Route = { path: '/disco', diff --git a/lib/routes/lxixsxa/information.ts b/lib/routes/lxixsxa/information.ts index 4967a7658..761a7fe22 100644 --- a/lib/routes/lxixsxa/information.ts +++ b/lib/routes/lxixsxa/information.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { parseJSONP } from './jsonp-helper'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import { parseJSONP } from './jsonp-helper'; export const route: Route = { path: '/info', diff --git a/lib/routes/m-78/news.ts b/lib/routes/m-78/news.ts index 5eed7b6b8..7074d5c8c 100644 --- a/lib/routes/m-78/news.ts +++ b/lib/routes/m-78/news.ts @@ -1,10 +1,12 @@ +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; import { type Data, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import type { Context } from 'hono'; -import type { Post } from './types'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import type { Post } from './types'; export const route: Route = { name: 'ニュース', diff --git a/lib/routes/m4/index.ts b/lib/routes/m4/index.ts index f10b132ab..434245e4b 100644 --- a/lib/routes/m4/index.ts +++ b/lib/routes/m4/index.ts @@ -1,14 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { isValidHost } from '@/utils/valid-host'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; +import timezone from '@/utils/timezone'; +import { isValidHost } from '@/utils/valid-host'; export const route: Route = { path: '/:id?/:category{.+}?', diff --git a/lib/routes/maccms/index.ts b/lib/routes/maccms/index.ts index 37ea01924..ddc794a04 100644 --- a/lib/routes/maccms/index.ts +++ b/lib/routes/maccms/index.ts @@ -1,7 +1,8 @@ -import { Result, Vod } from '@/routes/maccms/type'; -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import path from 'node:path'; + +import type { Result, Vod } from '@/routes/maccms/type'; +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/macfilos/blog.ts b/lib/routes/macfilos/blog.ts index f79c4e530..524bb2dc7 100644 --- a/lib/routes/macfilos/blog.ts +++ b/lib/routes/macfilos/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/macmenubar/recently.ts b/lib/routes/macmenubar/recently.ts index 685afdf83..ca71e5f3f 100644 --- a/lib/routes/macmenubar/recently.ts +++ b/lib/routes/macmenubar/recently.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; async function getCategoryId(categories) { diff --git a/lib/routes/macupdate/app.ts b/lib/routes/macupdate/app.ts index c7da81eec..275e17659 100644 --- a/lib/routes/macupdate/app.ts +++ b/lib/routes/macupdate/app.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/magazinelib/latest-magazine.ts b/lib/routes/magazinelib/latest-magazine.ts index 7f50e5e84..39ddb9d3a 100644 --- a/lib/routes/magazinelib/latest-magazine.ts +++ b/lib/routes/magazinelib/latest-magazine.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const host = 'https://magazinelib.com'; export const route: Route = { path: '/latest-magazine/:query?', diff --git a/lib/routes/magnumphotos/magazine.ts b/lib/routes/magnumphotos/magazine.ts index a0ae09f8e..375785a2b 100644 --- a/lib/routes/magnumphotos/magazine.ts +++ b/lib/routes/magnumphotos/magazine.ts @@ -1,8 +1,11 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import parser from '@/utils/rss-parser'; + const host = 'https://www.magnumphotos.com'; export const route: Route = { path: '/magazine', diff --git a/lib/routes/mail/imap.ts b/lib/routes/mail/imap.ts index 4f476198b..5ba9e0159 100644 --- a/lib/routes/mail/imap.ts +++ b/lib/routes/mail/imap.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { ImapFlow } from 'imapflow'; -import { config } from '@/config'; import { simpleParser } from 'mailparser'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/imap/:email/:folder{.+}?', diff --git a/lib/routes/makerworld/contest.ts b/lib/routes/makerworld/contest.ts index 60f477047..5633f9cee 100644 --- a/lib/routes/makerworld/contest.ts +++ b/lib/routes/makerworld/contest.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { baseUrl, getNextBuildId } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import { baseUrl, getNextBuildId } from './utils'; export const route: Route = { path: '/contests', diff --git a/lib/routes/makerworld/trending.ts b/lib/routes/makerworld/trending.ts index cd01d2656..8ce6364c5 100644 --- a/lib/routes/makerworld/trending.ts +++ b/lib/routes/makerworld/trending.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { baseUrl, getNextBuildId } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import { baseUrl, getNextBuildId } from './utils'; export const route: Route = { path: '/trending', diff --git a/lib/routes/makerworld/user-upload.ts b/lib/routes/makerworld/user-upload.ts index 881193a33..2bb0f09a9 100644 --- a/lib/routes/makerworld/user-upload.ts +++ b/lib/routes/makerworld/user-upload.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { baseUrl, getNextBuildId } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import { baseUrl, getNextBuildId } from './utils'; export const route: Route = { path: '/user/:handle/upload', diff --git a/lib/routes/makerworld/utils.ts b/lib/routes/makerworld/utils.ts index a9b02819a..4930e6381 100644 --- a/lib/routes/makerworld/utils.ts +++ b/lib/routes/makerworld/utils.ts @@ -1,7 +1,8 @@ -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; export const baseUrl = 'https://makerworld.com'; diff --git a/lib/routes/malaysiakini/index.ts b/lib/routes/malaysiakini/index.ts index 666de39f0..e70ed9770 100644 --- a/lib/routes/malaysiakini/index.ts +++ b/lib/routes/malaysiakini/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { FetchError } from 'ofetch'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import parser from '@/utils/rss-parser'; -import { config } from '@/config'; -import { FetchError } from 'ofetch'; export const route: Route = { path: '/:lang/:category?', diff --git a/lib/routes/mangadex/_access.ts b/lib/routes/mangadex/_access.ts index f57f8b21e..bcdf050d5 100644 --- a/lib/routes/mangadex/_access.ts +++ b/lib/routes/mangadex/_access.ts @@ -1,10 +1,11 @@ -import got from '@/utils/got'; -import cache from '@/utils/cache'; +import { FetchError } from 'ofetch'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import constants from './_constants'; -import { FetchError } from 'ofetch'; /** * Retrieves an access token. diff --git a/lib/routes/mangadex/_feed.ts b/lib/routes/mangadex/_feed.ts index b0b09705b..9e8d72940 100644 --- a/lib/routes/mangadex/_feed.ts +++ b/lib/routes/mangadex/_feed.ts @@ -1,10 +1,11 @@ -import got from '@/utils/got'; import { config } from '@/config'; import cache from '@/utils/cache'; +import got from '@/utils/got'; import md5 from '@/utils/md5'; -import { getFilteredLanguages } from './_profile'; -import { toQueryString, firstMatch } from './_utils'; + import constants from './_constants'; +import { getFilteredLanguages } from './_profile'; +import { firstMatch, toQueryString } from './_utils'; /** * Retrieves the title, description, and cover of a manga. @@ -181,4 +182,4 @@ const getMangaDetails = async (id: string, needCover: boolean = true, lang?: str return { ...meta, chapters }; }; -export { getMangaMeta, getMangaChapters, getMangaDetails }; +export { getMangaChapters, getMangaDetails, getMangaMeta }; diff --git a/lib/routes/mangadex/_profile.ts b/lib/routes/mangadex/_profile.ts index 975c3d18f..0f6a0e439 100644 --- a/lib/routes/mangadex/_profile.ts +++ b/lib/routes/mangadex/_profile.ts @@ -1,9 +1,9 @@ -import got from '@/utils/got'; import { config } from '@/config'; -import cache from '@/utils/cache'; import ConfigNotFoundError from '@/errors/types/config-not-found'; -import getToken from './_access'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import getToken from './_access'; import constants from './_constants'; const getSetting = async () => { diff --git a/lib/routes/mangadex/index.ts b/lib/routes/mangadex/index.ts index 5f880b761..787d22b6f 100644 --- a/lib/routes/mangadex/index.ts +++ b/lib/routes/mangadex/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getMangaDetails } from './_feed'; export const route: Route = { diff --git a/lib/routes/mangadex/mdlist/feed.ts b/lib/routes/mangadex/mdlist/feed.ts index 69e1ac96a..7d157deeb 100644 --- a/lib/routes/mangadex/mdlist/feed.ts +++ b/lib/routes/mangadex/mdlist/feed.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import getToken from '../_access'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import getToken from '../_access'; import constants from '../_constants'; -import { getFilteredLanguages } from '../_profile'; import { getMangaMetaByIds } from '../_feed'; +import { getFilteredLanguages } from '../_profile'; import { toQueryString } from '../_utils'; const DEFAULT_LIMIT = 25; diff --git a/lib/routes/mangadex/user/feed.ts b/lib/routes/mangadex/user/feed.ts index 0e88607af..749312b0c 100644 --- a/lib/routes/mangadex/user/feed.ts +++ b/lib/routes/mangadex/user/feed.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import getToken from '../_access'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import getToken from '../_access'; import constants from '../_constants'; import { getMangaMetaByIds } from '../_feed'; import { getFilteredLanguages } from '../_profile'; diff --git a/lib/routes/mangadex/user/follows.ts b/lib/routes/mangadex/user/follows.ts index 6f2723149..e049deab7 100644 --- a/lib/routes/mangadex/user/follows.ts +++ b/lib/routes/mangadex/user/follows.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import getToken from '../_access'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import getToken from '../_access'; import { getMangaChapters, getMangaMetaByIds } from '../_feed'; type FollowType = 'reading' | 'plan-to-read' | 'completed' | 'on-hold' | 're-reading' | 'dropped'; diff --git a/lib/routes/manhuagui/comic.ts b/lib/routes/manhuagui/comic.ts index ee4241169..55e99631f 100644 --- a/lib/routes/manhuagui/comic.ts +++ b/lib/routes/manhuagui/comic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import got from '@/utils/got'; import LZString from 'lz-string'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; let baseUrl = ''; diff --git a/lib/routes/manhuagui/subscribe.ts b/lib/routes/manhuagui/subscribe.ts index 79399b7d1..efce8d8a9 100644 --- a/lib/routes/manhuagui/subscribe.ts +++ b/lib/routes/manhuagui/subscribe.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { parseRelativeDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseRelativeDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const web_url = 'https://www.manhuagui.com/user/book/shelf/1'; export const route: Route = { diff --git a/lib/routes/manus/blog.ts b/lib/routes/manus/blog.ts index 780e8e968..d34eea351 100644 --- a/lib/routes/manus/blog.ts +++ b/lib/routes/manus/blog.ts @@ -1,7 +1,9 @@ -import { Route, DataItem, Data, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; export const route: Route = { path: '/blog', diff --git a/lib/routes/manus/namespace.ts b/lib/routes/manus/namespace.ts index 76b027846..23788399e 100644 --- a/lib/routes/manus/namespace.ts +++ b/lib/routes/manus/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'Manus', diff --git a/lib/routes/manyvids/video.ts b/lib/routes/manyvids/video.ts index d442e4216..810f24808 100644 --- a/lib/routes/manyvids/video.ts +++ b/lib/routes/manyvids/video.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; -import { UserProfile, Videos } from './types'; -import { art } from '@/utils/render'; import path from 'node:path'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + +import type { UserProfile, Videos } from './types'; + export const route: Route = { path: '/profile/vids/:uid', radar: [ diff --git a/lib/routes/mashiro/index.ts b/lib/routes/mashiro/index.ts index 0c55ef832..1a92e4686 100644 --- a/lib/routes/mashiro/index.ts +++ b/lib/routes/mashiro/index.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import { namespace } from './namespace'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { namespace } from './namespace'; + const baseUrl = `https://${namespace.url}`; export const route: Route = { diff --git a/lib/routes/mastodon/account-id.ts b/lib/routes/mastodon/account-id.ts index 39c5ce0de..cbeb949bd 100644 --- a/lib/routes/mastodon/account-id.ts +++ b/lib/routes/mastodon/account-id.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import utils from './utils'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + +import utils from './utils'; export const route: Route = { path: '/account_id/:site/:account_id/statuses/:only_media?', diff --git a/lib/routes/mastodon/acct.ts b/lib/routes/mastodon/acct.ts index be46c6cfc..1edd69730 100644 --- a/lib/routes/mastodon/acct.ts +++ b/lib/routes/mastodon/acct.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/mastodon/tag.ts b/lib/routes/mastodon/tag.ts index 35d5a92aa..f1164d197 100644 --- a/lib/routes/mastodon/tag.ts +++ b/lib/routes/mastodon/tag.ts @@ -1,10 +1,12 @@ -import { Route, ViewType, Data } from '@/types'; +import type { Context } from 'hono'; -import got from '@/utils/got'; -import { Context } from 'hono'; -import utils from './utils'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, Route } from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/tag/:site/:hashtag/:only_media?', diff --git a/lib/routes/mastodon/timeline-local.ts b/lib/routes/mastodon/timeline-local.ts index e671bca21..9dee87c6e 100644 --- a/lib/routes/mastodon/timeline-local.ts +++ b/lib/routes/mastodon/timeline-local.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/timeline/:site/:only_media?', diff --git a/lib/routes/mastodon/timeline-remote.ts b/lib/routes/mastodon/timeline-remote.ts index 756b3382a..5c8d3d4a4 100644 --- a/lib/routes/mastodon/timeline-remote.ts +++ b/lib/routes/mastodon/timeline-remote.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/remote/:site/:only_media?', diff --git a/lib/routes/mastodon/utils.ts b/lib/routes/mastodon/utils.ts index d2beb9e33..0bebaab81 100644 --- a/lib/routes/mastodon/utils.ts +++ b/lib/routes/mastodon/utils.ts @@ -1,8 +1,8 @@ +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; const allowSiteList = ['mastodon.social', 'pawoo.net', 'fosstodon.org', config.mastodon.apiHost].filter(Boolean); diff --git a/lib/routes/mathpix/blog.ts b/lib/routes/mathpix/blog.ts index dffa0e5c9..6ba391dc8 100644 --- a/lib/routes/mathpix/blog.ts +++ b/lib/routes/mathpix/blog.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/matters/author.ts b/lib/routes/matters/author.ts index 0526f437b..60b73d924 100644 --- a/lib/routes/matters/author.ts +++ b/lib/routes/matters/author.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { baseUrl, gqlEndpoint, parseItem } from './utils'; const handler = async (ctx) => { diff --git a/lib/routes/matters/latest.ts b/lib/routes/matters/latest.ts index 86fb4260f..3bfd12d70 100644 --- a/lib/routes/matters/latest.ts +++ b/lib/routes/matters/latest.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { baseUrl, gqlEndpoint, parseItem } from './utils'; const handler = async (ctx) => { diff --git a/lib/routes/matters/tags.ts b/lib/routes/matters/tags.ts index 73d96f114..1ecc26c7e 100644 --- a/lib/routes/matters/tags.ts +++ b/lib/routes/matters/tags.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, gqlEndpoint, parseItem } from './utils'; interface Tag { diff --git a/lib/routes/mckinsey/cn/index.ts b/lib/routes/mckinsey/cn/index.ts index b858818cc..faaab5f5b 100644 --- a/lib/routes/mckinsey/cn/index.ts +++ b/lib/routes/mckinsey/cn/index.ts @@ -1,9 +1,12 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + import { categories } from './category-map'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; const baseUrl = 'https://www.mckinsey.com.cn'; diff --git a/lib/routes/mcmod/index.ts b/lib/routes/mcmod/index.ts index 2e1632f87..f7ab6af52 100644 --- a/lib/routes/mcmod/index.ts +++ b/lib/routes/mcmod/index.ts @@ -1,11 +1,13 @@ -import { DataItem, Route } from '@/types'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; -import timezone from '@/utils/timezone'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const render = (mod) => art(path.join(__dirname, 'templates/mod.art'), { mod }); diff --git a/lib/routes/mdpi/journal.ts b/lib/routes/mdpi/journal.ts index 8845b63d8..ff92cbab5 100644 --- a/lib/routes/mdpi/journal.ts +++ b/lib/routes/mdpi/journal.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; import path from 'node:path'; + +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { art } from '@/utils/render'; -import { CookieJar } from 'tough-cookie'; const cookieJar = new CookieJar(); export const route: Route = { diff --git a/lib/routes/medieval-china/post.ts b/lib/routes/medieval-china/post.ts index 63b036ad8..c7ab792c8 100644 --- a/lib/routes/medieval-china/post.ts +++ b/lib/routes/medieval-china/post.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/medium/feed.ts b/lib/routes/medium/feed.ts index c1ab790f1..c289a75e6 100644 --- a/lib/routes/medium/feed.ts +++ b/lib/routes/medium/feed.ts @@ -1,7 +1,8 @@ -import { Route, ViewType } from '@/types'; -import parser from '@/utils/rss-parser'; -import { parseDate } from '@/utils/parse-date'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; export const route: Route = { path: '/feed/:user', diff --git a/lib/routes/medium/following.ts b/lib/routes/medium/following.ts index 59bade582..1664a2fe0 100644 --- a/lib/routes/medium/following.ts +++ b/lib/routes/medium/following.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; import { config } from '@/config'; - -import parseArticle from './parse-article.js'; -import { getFollowingFeedQuery } from './graphql.js'; import ConfigNotFoundError from '@/errors/types/config-not-found.js'; +import type { Route } from '@/types'; + +import { getFollowingFeedQuery } from './graphql.js'; +import parseArticle from './parse-article.js'; export const route: Route = { path: '/following/:user', diff --git a/lib/routes/medium/for-you.ts b/lib/routes/medium/for-you.ts index ddb8b4140..0326e51d3 100644 --- a/lib/routes/medium/for-you.ts +++ b/lib/routes/medium/for-you.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; import { config } from '@/config'; - -import parseArticle from './parse-article.js'; -import { getWebInlineRecommendedFeedQuery } from './graphql.js'; import ConfigNotFoundError from '@/errors/types/config-not-found.js'; +import type { Route } from '@/types'; + +import { getWebInlineRecommendedFeedQuery } from './graphql.js'; +import parseArticle from './parse-article.js'; export const route: Route = { path: '/for-you/:user', diff --git a/lib/routes/medium/graphql.ts b/lib/routes/medium/graphql.ts index 13b825de7..4043e1f06 100644 --- a/lib/routes/medium/graphql.ts +++ b/lib/routes/medium/graphql.ts @@ -47,7 +47,7 @@ async function getUserCatalogMainContentQuery(user, catalogId, cookie, pagingLim return (await graphqlRequest(newUserCatalogMainContentQuery(catalogId, pagingLimit), cookie))?.catalogById; } -export { getWebInlineRecommendedFeedQuery, getFollowingFeedQuery, getWebInlineTopicFeedQuery, getUserCatalogMainContentQuery }; +export { getFollowingFeedQuery, getUserCatalogMainContentQuery, getWebInlineRecommendedFeedQuery, getWebInlineTopicFeedQuery }; function newFollowingFeedQuery(pagingLimit = 5) { return { diff --git a/lib/routes/medium/list.ts b/lib/routes/medium/list.ts index 3c5b95f59..15c116f51 100644 --- a/lib/routes/medium/list.ts +++ b/lib/routes/medium/list.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; import { config } from '@/config'; - -import parseArticle from './parse-article.js'; -import { getUserCatalogMainContentQuery } from './graphql.js'; import ConfigNotFoundError from '@/errors/types/config-not-found.js'; import InvalidParameterError from '@/errors/types/invalid-parameter.js'; +import type { Route } from '@/types'; + +import { getUserCatalogMainContentQuery } from './graphql.js'; +import parseArticle from './parse-article.js'; export const route: Route = { path: '/list/:user/:catalogId', diff --git a/lib/routes/medium/parse-article.ts b/lib/routes/medium/parse-article.ts index 450eead6d..cf9236060 100644 --- a/lib/routes/medium/parse-article.ts +++ b/lib/routes/medium/parse-article.ts @@ -1,8 +1,8 @@ -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import { config } from '@/config'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; async function parse(url, cookie = '') { const { data } = await got(url, { diff --git a/lib/routes/medium/tag.ts b/lib/routes/medium/tag.ts index 0f6472a61..40eddb11c 100644 --- a/lib/routes/medium/tag.ts +++ b/lib/routes/medium/tag.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; import { config } from '@/config'; - -import parseArticle from './parse-article.js'; -import { getWebInlineTopicFeedQuery } from './graphql.js'; import ConfigNotFoundError from '@/errors/types/config-not-found.js'; +import type { Route } from '@/types'; + +import { getWebInlineTopicFeedQuery } from './graphql.js'; +import parseArticle from './parse-article.js'; export const route: Route = { path: '/tag/:user/:tag', diff --git a/lib/routes/medsci/index.ts b/lib/routes/medsci/index.ts index d1ab5a757..93e0c498f 100644 --- a/lib/routes/medsci/index.ts +++ b/lib/routes/medsci/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/meishichina/index.ts b/lib/routes/meishichina/index.ts index b4b24b618..4456d0716 100644 --- a/lib/routes/meishichina/index.ts +++ b/lib/routes/meishichina/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const isChinese = (text: string): boolean => /^[\u4E00-\u9FA5]+$/.test(text); diff --git a/lib/routes/meituan/tech.ts b/lib/routes/meituan/tech.ts index a41d0d942..7e1a05c49 100644 --- a/lib/routes/meituan/tech.ts +++ b/lib/routes/meituan/tech.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import parser from '@/utils/rss-parser'; -import ofetch from '@/utils/ofetch'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import parser from '@/utils/rss-parser'; const rootUrl = 'https://tech.meituan.com/'; diff --git a/lib/routes/melonbooks/parser.ts b/lib/routes/melonbooks/parser.ts index 9cad45a2f..fffb35d59 100644 --- a/lib/routes/melonbooks/parser.ts +++ b/lib/routes/melonbooks/parser.ts @@ -1,5 +1,7 @@ +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; + import { type DataItem } from '@/types'; -import { CheerioAPI, load } from 'cheerio'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/melonbooks/search.ts b/lib/routes/melonbooks/search.ts index 52502bb44..59b26a550 100644 --- a/lib/routes/melonbooks/search.ts +++ b/lib/routes/melonbooks/search.ts @@ -1,10 +1,13 @@ -import { Data, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { parseItems } from './parser'; -import { Context } from 'hono'; import querystring from 'node:querystring'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { parseItems } from './parser'; + export const handler = async (ctx: Context): Promise => { const baseUrl = 'https://www.melonbooks.co.jp'; const query = ctx.req.param('query') ?? ''; diff --git a/lib/routes/mercari/keyword.ts b/lib/routes/mercari/keyword.ts index 195b41105..50d5f80c1 100644 --- a/lib/routes/mercari/keyword.ts +++ b/lib/routes/mercari/keyword.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { fetchSearchItems, fetchItemDetail, MercariSort, MercariOrder, MercariStatus, formatItemDetail } from './util'; + +import { fetchItemDetail, fetchSearchItems, formatItemDetail, MercariOrder, MercariSort, MercariStatus } from './util'; export const route: Route = { path: '/:sort/:order/:status/:keyword', diff --git a/lib/routes/mercari/search.ts b/lib/routes/mercari/search.ts index 46ae42f85..69bb153bd 100644 --- a/lib/routes/mercari/search.ts +++ b/lib/routes/mercari/search.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { fetchSearchItems, fetchItemDetail, formatItemDetail, MercariSort, MercariOrder, MercariStatus } from './util'; + +import { fetchItemDetail, fetchSearchItems, formatItemDetail, MercariOrder, MercariSort, MercariStatus } from './util'; export const route: Route = { path: '/search/:query', diff --git a/lib/routes/mercari/util.ts b/lib/routes/mercari/util.ts index ee2e4e234..4389fa343 100644 --- a/lib/routes/mercari/util.ts +++ b/lib/routes/mercari/util.ts @@ -1,12 +1,14 @@ -import crypto from 'node:crypto'; import { Buffer } from 'node:buffer'; +import crypto from 'node:crypto'; +import path from 'node:path'; + +import type { DataItem } from '@/types'; +import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; -import { SearchResponse, ItemDetail, ShopItemDetail } from './types'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { DataItem } from '@/types'; -import logger from '@/utils/logger'; + +import type { ItemDetail, SearchResponse, ShopItemDetail } from './types'; const rootURL = 'https://api.mercari.jp/'; const rootProductURL = 'https://jp.mercari.com/item/'; @@ -319,4 +321,4 @@ const formatItemDetail = (detail: ItemDetail | ShopItemDetail): DataItem => { }; }; -export { fetchSearchItems, fetchItemDetail, formatItemDetail, MercariSort, MercariOrder, MercariStatus }; +export { fetchItemDetail, fetchSearchItems, formatItemDetail, MercariOrder, MercariSort, MercariStatus }; diff --git a/lib/routes/meta/ai-blog.ts b/lib/routes/meta/ai-blog.ts index 83949e74c..ab308d562 100644 --- a/lib/routes/meta/ai-blog.ts +++ b/lib/routes/meta/ai-blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/metacritic/index.ts b/lib/routes/metacritic/index.ts index 4763f6e26..3193d46da 100644 --- a/lib/routes/metacritic/index.ts +++ b/lib/routes/metacritic/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import { sorts, types } from './util'; diff --git a/lib/routes/metacritic/release.ts b/lib/routes/metacritic/release.ts index b6e7a0f2b..a5f2f37e3 100644 --- a/lib/routes/metacritic/release.ts +++ b/lib/routes/metacritic/release.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; -import { toTitleCase } from '@/utils/common-utils'; import { load } from 'cheerio'; +import { toTitleCase } from '@/utils/common-utils'; +import got from '@/utils/got'; + const handler = async (ctx) => { let type = 'new-releases'; let title = 'New Releases'; diff --git a/lib/routes/meteoblue/weathernews.ts b/lib/routes/meteoblue/weathernews.ts index 42a9003fe..e960b6452 100644 --- a/lib/routes/meteoblue/weathernews.ts +++ b/lib/routes/meteoblue/weathernews.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/meteor/boards.ts b/lib/routes/meteor/boards.ts index a8835f5b4..3a7181e0f 100644 --- a/lib/routes/meteor/boards.ts +++ b/lib/routes/meteor/boards.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; + import { baseUrl, getBoards } from './utils'; export const route: Route = { diff --git a/lib/routes/meteor/index.ts b/lib/routes/meteor/index.ts index 5d83fdd40..a543db383 100644 --- a/lib/routes/meteor/index.ts +++ b/lib/routes/meteor/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, getBoards, renderDesc } from './utils'; export const route: Route = { diff --git a/lib/routes/meteor/utils.ts b/lib/routes/meteor/utils.ts index 55a9529ee..4facb1f54 100644 --- a/lib/routes/meteor/utils.ts +++ b/lib/routes/meteor/utils.ts @@ -1,6 +1,8 @@ +import path from 'node:path'; + import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; + const baseUrl = 'https://meteor.today'; const getBoards = (tryGet) => diff --git a/lib/routes/metmuseum/exhibitions.ts b/lib/routes/metmuseum/exhibitions.ts index e2d2594ee..7f1253552 100644 --- a/lib/routes/metmuseum/exhibitions.ts +++ b/lib/routes/metmuseum/exhibitions.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/metrics.ts b/lib/routes/metrics.ts index c76249748..1e17aa8cb 100644 --- a/lib/routes/metrics.ts +++ b/lib/routes/metrics.ts @@ -1,4 +1,5 @@ import type { Handler } from 'hono'; + import { getContext } from '@/utils/otel'; const handler: Handler = (ctx) => diff --git a/lib/routes/mi/crowdfunding.ts b/lib/routes/mi/crowdfunding.ts index eeb805a6b..487bbcd58 100644 --- a/lib/routes/mi/crowdfunding.ts +++ b/lib/routes/mi/crowdfunding.ts @@ -1,5 +1,7 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; -import { CrowdfundingDetailInfo, CrowdfundingList } from './types'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; + +import type { CrowdfundingDetailInfo, CrowdfundingList } from './types'; import utils from './utils'; export const route: Route = { diff --git a/lib/routes/mi/golden.ts b/lib/routes/mi/golden.ts index 46ebb3006..14d59029f 100644 --- a/lib/routes/mi/golden.ts +++ b/lib/routes/mi/golden.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/mi/utils.ts b/lib/routes/mi/utils.ts index 99ea22646..f5c3859bb 100644 --- a/lib/routes/mi/utils.ts +++ b/lib/routes/mi/utils.ts @@ -1,13 +1,17 @@ -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { art } from '@/utils/render'; -import dayjs from 'dayjs'; import 'dayjs/locale/zh-cn.js'; + +import path from 'node:path'; + +import dayjs from 'dayjs'; import localizedFormat from 'dayjs/plugin/localizedFormat.js'; import timezone from 'dayjs/plugin/timezone.js'; import utc from 'dayjs/plugin/utc.js'; -import path from 'node:path'; -import { CrowdfundingData, CrowdfundingDetailData, CrowdfundingDetailInfo, CrowdfundingItem, CrowdfundingList, DataResponse } from './types'; + +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + +import type { CrowdfundingData, CrowdfundingDetailData, CrowdfundingDetailInfo, CrowdfundingItem, CrowdfundingList, DataResponse } from './types'; dayjs.extend(localizedFormat); dayjs.extend(timezone); diff --git a/lib/routes/microsoft/addon.ts b/lib/routes/microsoft/addon.ts index f10d9595c..11d9080be 100644 --- a/lib/routes/microsoft/addon.ts +++ b/lib/routes/microsoft/addon.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/microsoft/mcr.ts b/lib/routes/microsoft/mcr.ts index da1247291..7307a2ec8 100644 --- a/lib/routes/microsoft/mcr.ts +++ b/lib/routes/microsoft/mcr.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/mihoyo/bbs/cache.ts b/lib/routes/mihoyo/bbs/cache.ts index 7c986a673..1b7e8d4b1 100644 --- a/lib/routes/mihoyo/bbs/cache.ts +++ b/lib/routes/mihoyo/bbs/cache.ts @@ -1,7 +1,7 @@ -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; const getUserFullInfo = (ctx, uid) => { if (!uid && !config.mihoyo.cookie) { diff --git a/lib/routes/mihoyo/bbs/follow-list.ts b/lib/routes/mihoyo/bbs/follow-list.ts index d2d6e5d7b..e5e3a86cb 100644 --- a/lib/routes/mihoyo/bbs/follow-list.ts +++ b/lib/routes/mihoyo/bbs/follow-list.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; + import cache from './cache'; const renderDescription = (description, images) => art(path.join(__dirname, '../templates/description.art'), { description, images }); diff --git a/lib/routes/mihoyo/bbs/img-ranking.ts b/lib/routes/mihoyo/bbs/img-ranking.ts index 75bc1abc8..89100492d 100644 --- a/lib/routes/mihoyo/bbs/img-ranking.ts +++ b/lib/routes/mihoyo/bbs/img-ranking.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { DATA_MAP, RANKING_TYPE_MAP } from './static-data'; import { post2item } from './utils'; diff --git a/lib/routes/mihoyo/bbs/official.ts b/lib/routes/mihoyo/bbs/official.ts index 48c28e907..180f5489c 100644 --- a/lib/routes/mihoyo/bbs/official.ts +++ b/lib/routes/mihoyo/bbs/official.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { art } from '@/utils/render'; -import path from 'node:path'; -import { parseDate } from '@/utils/parse-date'; import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; // 游戏id const GITS_MAP = { diff --git a/lib/routes/mihoyo/bbs/timeline.ts b/lib/routes/mihoyo/bbs/timeline.ts index c390636f1..8826d620a 100644 --- a/lib/routes/mihoyo/bbs/timeline.ts +++ b/lib/routes/mihoyo/bbs/timeline.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; import { config } from '@/config'; -import { post2item } from './utils'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import cache from './cache'; +import { post2item } from './utils'; export const route: Route = { path: '/bbs/timeline', diff --git a/lib/routes/mihoyo/bbs/user-post.ts b/lib/routes/mihoyo/bbs/user-post.ts index 75793a90f..f6361e815 100644 --- a/lib/routes/mihoyo/bbs/user-post.ts +++ b/lib/routes/mihoyo/bbs/user-post.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { post2item } from './utils'; export const route: Route = { diff --git a/lib/routes/mihoyo/bbs/utils.ts b/lib/routes/mihoyo/bbs/utils.ts index 745c5c46c..f170fbe19 100644 --- a/lib/routes/mihoyo/bbs/utils.ts +++ b/lib/routes/mihoyo/bbs/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; + import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const renderDescription = (description, images) => art(path.join(__dirname, '../templates/description.art'), { description, images }); diff --git a/lib/routes/mihoyo/sr/news.ts b/lib/routes/mihoyo/sr/news.ts index b187e57aa..0a158fa01 100644 --- a/lib/routes/mihoyo/sr/news.ts +++ b/lib/routes/mihoyo/sr/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/mihoyo/ys/news.ts b/lib/routes/mihoyo/ys/news.ts index 2ac35fb5c..051918df7 100644 --- a/lib/routes/mihoyo/ys/news.ts +++ b/lib/routes/mihoyo/ys/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/mihoyo/zzz/news.ts b/lib/routes/mihoyo/zzz/news.ts index f70471f79..0b99197d4 100644 --- a/lib/routes/mihoyo/zzz/news.ts +++ b/lib/routes/mihoyo/zzz/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/mindmeister/example.ts b/lib/routes/mindmeister/example.ts index 842101642..069d61028 100644 --- a/lib/routes/mindmeister/example.ts +++ b/lib/routes/mindmeister/example.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const baseUrl = 'https://www.mindmeister.com'; export const route: Route = { diff --git a/lib/routes/minecraft/blockedservers.ts b/lib/routes/minecraft/blockedservers.ts index f787b6a13..aaa898ad5 100644 --- a/lib/routes/minecraft/blockedservers.ts +++ b/lib/routes/minecraft/blockedservers.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/minecraft/java-runtime.ts b/lib/routes/minecraft/java-runtime.ts index 87bcbe7f8..72be6ad09 100644 --- a/lib/routes/minecraft/java-runtime.ts +++ b/lib/routes/minecraft/java-runtime.ts @@ -1,6 +1,7 @@ -import { DataItem, Route } from '@/types'; +import type { Context } from 'hono'; + +import type { DataItem, Route } from '@/types'; import got from '@/utils/got'; -import { Context } from 'hono'; export const route: Route = { path: '/java-runtime/:arch?/:javaType?', diff --git a/lib/routes/minecraft/version.ts b/lib/routes/minecraft/version.ts index 901054919..bc445aabc 100644 --- a/lib/routes/minecraft/version.ts +++ b/lib/routes/minecraft/version.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; import got from '@/utils/got'; -import { Context } from 'hono'; export const route: Route = { path: '/version/:versionType?/:linkType?', diff --git a/lib/routes/mingpao/index.ts b/lib/routes/mingpao/index.ts index 161766ea4..b79613afb 100644 --- a/lib/routes/mingpao/index.ts +++ b/lib/routes/mingpao/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import parser from '@/utils/rss-parser'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import parser from '@/utils/rss-parser'; const renderFanBox = (media) => art(path.join(__dirname, 'templates/fancybox.art'), { diff --git a/lib/routes/miniflux/entry.ts b/lib/routes/miniflux/entry.ts index 8fffd2c04..ce6585787 100644 --- a/lib/routes/miniflux/entry.ts +++ b/lib/routes/miniflux/entry.ts @@ -1,7 +1,7 @@ -import { Route, Data } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/entry/:feeds/:parameters?', diff --git a/lib/routes/miniflux/subscription.ts b/lib/routes/miniflux/subscription.ts index 1085bbac1..cca382345 100644 --- a/lib/routes/miniflux/subscription.ts +++ b/lib/routes/miniflux/subscription.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/subscription/:parameters?', diff --git a/lib/routes/mirror/index.ts b/lib/routes/mirror/index.ts index 902564779..658715621 100644 --- a/lib/routes/mirror/index.ts +++ b/lib/routes/mirror/index.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; +import { isValidHost } from '@/utils/valid-host'; + const md = MarkdownIt({ html: true, linkify: true, }); -import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/:id', diff --git a/lib/routes/mirrormedia/category.ts b/lib/routes/mirrormedia/category.ts index b9f2e67f8..cb08c0bc4 100644 --- a/lib/routes/mirrormedia/category.ts +++ b/lib/routes/mirrormedia/category.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + import { getArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/mirrormedia/index.ts b/lib/routes/mirrormedia/index.ts index 75d14b6d2..759823683 100644 --- a/lib/routes/mirrormedia/index.ts +++ b/lib/routes/mirrormedia/index.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + import { getArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/mirrormedia/utils.ts b/lib/routes/mirrormedia/utils.ts index 6af24b14b..47a1b20d0 100644 --- a/lib/routes/mirrormedia/utils.ts +++ b/lib/routes/mirrormedia/utils.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/missav/new.ts b/lib/routes/missav/new.ts index 88a2e1fb5..d8c170654 100644 --- a/lib/routes/missav/new.ts +++ b/lib/routes/missav/new.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; // import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; -import { art } from '@/utils/render'; -import path from 'node:path'; + +import type { Route } from '@/types'; // import { config } from '@/config'; import puppeteer from '@/utils/puppeteer'; +import { art } from '@/utils/render'; const urlPath = 'dm514/new'; diff --git a/lib/routes/misskey/featured-notes.ts b/lib/routes/misskey/featured-notes.ts index 085081f0d..03f317595 100644 --- a/lib/routes/misskey/featured-notes.ts +++ b/lib/routes/misskey/featured-notes.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/notes/featured/:site', diff --git a/lib/routes/misskey/home-timeline.ts b/lib/routes/misskey/home-timeline.ts index c869e9359..c80bb7502 100644 --- a/lib/routes/misskey/home-timeline.ts +++ b/lib/routes/misskey/home-timeline.ts @@ -1,9 +1,12 @@ +import querystring from 'node:querystring'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { queryToBoolean } from '@/utils/readable-social'; -import querystring from 'node:querystring'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/misskey/user-timeline.ts b/lib/routes/misskey/user-timeline.ts index 703e90a8b..3c69ff495 100644 --- a/lib/routes/misskey/user-timeline.ts +++ b/lib/routes/misskey/user-timeline.ts @@ -1,9 +1,12 @@ +import querystring from 'node:querystring'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; import { fallback, queryToBoolean } from '@/utils/readable-social'; -import querystring from 'node:querystring'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/misskey/utils.ts b/lib/routes/misskey/utils.ts index 9ad087eb5..db788ab6d 100644 --- a/lib/routes/misskey/utils.ts +++ b/lib/routes/misskey/utils.ts @@ -1,10 +1,11 @@ +import path from 'node:path'; + import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { MisskeyNote, MisskeyUser } from './types'; +import type { MisskeyNote, MisskeyUser } from './types'; const allowSiteList = ['misskey.io', 'madost.one', 'mk.nixnet.social']; diff --git a/lib/routes/misskon/posts.ts b/lib/routes/misskon/posts.ts index 0df94fb28..ebd6b43b9 100644 --- a/lib/routes/misskon/posts.ts +++ b/lib/routes/misskon/posts.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { ENDPOINT, getPosts } from './utils'; export const route: Route = { diff --git a/lib/routes/misskon/tag.ts b/lib/routes/misskon/tag.ts index 5a59855ac..923425f27 100644 --- a/lib/routes/misskon/tag.ts +++ b/lib/routes/misskon/tag.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getPosts, getTags } from './utils'; export const route: Route = { diff --git a/lib/routes/misskon/top.ts b/lib/routes/misskon/top.ts index 7b9ba020c..bb117dff0 100644 --- a/lib/routes/misskon/top.ts +++ b/lib/routes/misskon/top.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { getPosts } from './utils'; export const route: Route = { diff --git a/lib/routes/misskon/utils.ts b/lib/routes/misskon/utils.ts index 7445fa20a..ad01798d4 100644 --- a/lib/routes/misskon/utils.ts +++ b/lib/routes/misskon/utils.ts @@ -1,5 +1,6 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/mit/hanlab.ts b/lib/routes/mit/hanlab.ts index fc0c21da0..41472da30 100644 --- a/lib/routes/mit/hanlab.ts +++ b/lib/routes/mit/hanlab.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/hanlab/blog', diff --git a/lib/routes/mittrchina/index.ts b/lib/routes/mittrchina/index.ts index 3c9631f78..b4fba8b5c 100644 --- a/lib/routes/mittrchina/index.ts +++ b/lib/routes/mittrchina/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:type?', diff --git a/lib/routes/miui/community/user.ts b/lib/routes/miui/community/user.ts index 49f47bb75..958f75c52 100644 --- a/lib/routes/miui/community/user.ts +++ b/lib/routes/miui/community/user.ts @@ -1,4 +1,4 @@ -import { Route, Data } from '@/types'; +import type { Data, Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/miui/firmware/index.ts b/lib/routes/miui/firmware/index.ts index df911f549..d330712c2 100644 --- a/lib/routes/miui/firmware/index.ts +++ b/lib/routes/miui/firmware/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import queryString from 'query-string'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/firmware/:device/:type?/:region?', categories: ['program-update'], diff --git a/lib/routes/mixcloud/index.ts b/lib/routes/mixcloud/index.ts index 07517ca2b..9dd16235e 100644 --- a/lib/routes/mixcloud/index.ts +++ b/lib/routes/mixcloud/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import CryptoJS from 'crypto-js'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { MIXCLOUD_CONFIG, TYPE_CONFIG, TYPE_NAMES, getObjectFields } from './config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import { getObjectFields, MIXCLOUD_CONFIG, TYPE_CONFIG, TYPE_NAMES } from './config'; export const route: Route = { path: '/:username/:type?', diff --git a/lib/routes/mixcloud/user-playlist.ts b/lib/routes/mixcloud/user-playlist.ts index e68c1fbdc..dcb6fa7b4 100644 --- a/lib/routes/mixcloud/user-playlist.ts +++ b/lib/routes/mixcloud/user-playlist.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './index'; export const route: Route = { diff --git a/lib/routes/mixi2/community.ts b/lib/routes/mixi2/community.ts index cd053668c..69759d2b3 100644 --- a/lib/routes/mixi2/community.ts +++ b/lib/routes/mixi2/community.ts @@ -1,5 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; import type { Context } from 'hono'; + +import { type Data, type Route, ViewType } from '@/types'; + import { CONFIG_OPTIONS, generatePostDataItem, getClient, postFilter } from './utils'; const handler = async (ctx: Context) => { diff --git a/lib/routes/mixi2/discovery.ts b/lib/routes/mixi2/discovery.ts index 8c2e9ede2..32157d0ec 100644 --- a/lib/routes/mixi2/discovery.ts +++ b/lib/routes/mixi2/discovery.ts @@ -1,5 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; import type { Context } from 'hono'; + +import { type Data, type Route, ViewType } from '@/types'; + import { CONFIG_OPTIONS, generatePostDataItem, getClient, postFilter } from './utils'; const handler = async (ctx: Context) => { diff --git a/lib/routes/mixi2/home.ts b/lib/routes/mixi2/home.ts index ec2d31f04..579780264 100644 --- a/lib/routes/mixi2/home.ts +++ b/lib/routes/mixi2/home.ts @@ -1,5 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; import type { Context } from 'hono'; + +import { type Data, type Route, ViewType } from '@/types'; + import { CONFIG_OPTIONS, generatePostDataItem, getClient, postFilter } from './utils'; const handler = async (ctx: Context) => { diff --git a/lib/routes/mixi2/user.ts b/lib/routes/mixi2/user.ts index 1594beb62..538c34ea6 100644 --- a/lib/routes/mixi2/user.ts +++ b/lib/routes/mixi2/user.ts @@ -1,8 +1,10 @@ -import { type Data, type Route, ViewType } from '@/types'; import type { Context } from 'hono'; -import { CONFIG_OPTIONS, getClient, parsePost, postFilter } from './utils'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { type Data, type Route, ViewType } from '@/types'; +import { parseDate } from '@/utils/parse-date'; + +import { CONFIG_OPTIONS, getClient, parsePost, postFilter } from './utils'; const handler = async (ctx: Context) => { const limit = Number.parseInt(ctx.req.query('limit') ?? '20', 10); diff --git a/lib/routes/mixi2/utils.ts b/lib/routes/mixi2/utils.ts index fa3a01fae..934be9e1a 100644 --- a/lib/routes/mixi2/utils.ts +++ b/lib/routes/mixi2/utils.ts @@ -1,4 +1,5 @@ -import { Category, MixiClient, Persona, type Post } from 'mixi2'; +import type { Category, MixiClient, Persona, type Post } from 'mixi2'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/miyuki/news.ts b/lib/routes/miyuki/news.ts index 0be106f92..3ed4b50c1 100644 --- a/lib/routes/miyuki/news.ts +++ b/lib/routes/miyuki/news.ts @@ -1,7 +1,8 @@ -import type { DataItem, Route } from '@/types'; import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/modb/topic.ts b/lib/routes/modb/topic.ts index d577d71bd..30e003905 100644 --- a/lib/routes/modb/topic.ts +++ b/lib/routes/modb/topic.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; -import timezone from '@/utils/timezone'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/topic/:id', diff --git a/lib/routes/modelscope/community.ts b/lib/routes/modelscope/community.ts index c0db0a977..5f0db5747 100644 --- a/lib/routes/modelscope/community.ts +++ b/lib/routes/modelscope/community.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import got from '@/utils/got'; import path from 'node:path'; -import timezone from '@/utils/timezone'; -import { art } from '@/utils/render'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/community', diff --git a/lib/routes/modelscope/datasets.ts b/lib/routes/modelscope/datasets.ts index eae2c4294..e8910596c 100644 --- a/lib/routes/modelscope/datasets.ts +++ b/lib/routes/modelscope/datasets.ts @@ -1,15 +1,17 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import MarkdownIt from 'markdown-it'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const md = MarkdownIt({ html: true, linkify: true, }); -import path from 'node:path'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/datasets', diff --git a/lib/routes/modelscope/learn.ts b/lib/routes/modelscope/learn.ts index 395dca2fe..3d1c780ba 100644 --- a/lib/routes/modelscope/learn.ts +++ b/lib/routes/modelscope/learn.ts @@ -1,5 +1,4 @@ -import { Route } from '@/types'; - +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/modelscope/models.ts b/lib/routes/modelscope/models.ts index d23ccd954..c3c3d6df1 100644 --- a/lib/routes/modelscope/models.ts +++ b/lib/routes/modelscope/models.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import MarkdownIt from 'markdown-it'; +import { parseDate } from '@/utils/parse-date'; + const md = MarkdownIt({ html: true, linkify: true, }); -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/models', diff --git a/lib/routes/modelscope/studios.ts b/lib/routes/modelscope/studios.ts index 5262cf1e9..46b5faacb 100644 --- a/lib/routes/modelscope/studios.ts +++ b/lib/routes/modelscope/studios.ts @@ -1,15 +1,17 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import MarkdownIt from 'markdown-it'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const md = MarkdownIt({ html: true, linkify: true, }); -import path from 'node:path'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/studios', diff --git a/lib/routes/modian/zhongchou.ts b/lib/routes/modian/zhongchou.ts index bb5559a85..eece4feca 100644 --- a/lib/routes/modian/zhongchou.ts +++ b/lib/routes/modian/zhongchou.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/zhongchou/:category?/:sort?/:status?', diff --git a/lib/routes/modrinth/versions.ts b/lib/routes/modrinth/versions.ts index 97880bb29..887be99bb 100644 --- a/lib/routes/modrinth/versions.ts +++ b/lib/routes/modrinth/versions.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import type { Context } from 'hono'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Author, Project, Version } from '@/routes/modrinth/api'; +import type { Route } from '@/types'; +import _ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; -import _ofetch from '@/utils/ofetch'; -import MarkdownIt from 'markdown-it'; -import type { Author, Project, Version } from '@/routes/modrinth/api'; -import type { Context } from 'hono'; const ofetch = _ofetch.create({ headers: { diff --git a/lib/routes/mohw/clarification.ts b/lib/routes/mohw/clarification.ts index 627847973..3152fb69c 100644 --- a/lib/routes/mohw/clarification.ts +++ b/lib/routes/mohw/clarification.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/moodysmismicrosite/report.ts b/lib/routes/moodysmismicrosite/report.ts index 2cc1caa9f..6b956e937 100644 --- a/lib/routes/moodysmismicrosite/report.ts +++ b/lib/routes/moodysmismicrosite/report.ts @@ -1,6 +1,7 @@ -import { Route, ViewType } from '@/types'; -import { parseRelativeDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; +import { parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { path: '/report/:industry?', diff --git a/lib/routes/mox/index.ts b/lib/routes/mox/index.ts index ce3afb137..784e10a26 100644 --- a/lib/routes/mox/index.ts +++ b/lib/routes/mox/index.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { config } from '@/config'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/mpaypass/main.ts b/lib/routes/mpaypass/main.ts index 73f069e63..345574a64 100644 --- a/lib/routes/mpaypass/main.ts +++ b/lib/routes/mpaypass/main.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/mpaypass/news.ts b/lib/routes/mpaypass/news.ts index c656f31b8..955102333 100644 --- a/lib/routes/mpaypass/news.ts +++ b/lib/routes/mpaypass/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/mrdx/daily.ts b/lib/routes/mrdx/daily.ts index e5861efe5..a75b1b207 100644 --- a/lib/routes/mrdx/daily.ts +++ b/lib/routes/mrdx/daily.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { getElementChildrenInnerText } from './utils'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc.js'; -dayjs.extend(utc); +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import { getElementChildrenInnerText } from './utils'; + +dayjs.extend(utc); export const route: Route = { path: '/today', diff --git a/lib/routes/mrm/index.ts b/lib/routes/mrm/index.ts index 913ae0db8..fd3e6dbf0 100644 --- a/lib/routes/mrm/index.ts +++ b/lib/routes/mrm/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/msn/index.ts b/lib/routes/msn/index.ts index edbd54212..67349229d 100644 --- a/lib/routes/msn/index.ts +++ b/lib/routes/msn/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; -import { load } from 'cheerio'; const apiKey = '0QfOX3Vn51YCzitbLaRkTTBadtWpgTN8NZLW0C1SEM'; const fetchedArticleContentHtmlImgRegex = //; diff --git a/lib/routes/musify/index.ts b/lib/routes/musify/index.ts index 491359374..4accf4d68 100644 --- a/lib/routes/musify/index.ts +++ b/lib/routes/musify/index.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const handler = async (ctx: Context): Promise => { const { language = '' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/musikguru/news.ts b/lib/routes/musikguru/news.ts index 4ad1141e3..864b142d9 100644 --- a/lib/routes/musikguru/news.ts +++ b/lib/routes/musikguru/news.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '10', 10); diff --git a/lib/routes/mwm/index.ts b/lib/routes/mwm/index.ts index 3847b3708..a3747b47c 100644 --- a/lib/routes/mwm/index.ts +++ b/lib/routes/mwm/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/my-formosa/index.ts b/lib/routes/my-formosa/index.ts index 231f414fb..dcddb5794 100644 --- a/lib/routes/my-formosa/index.ts +++ b/lib/routes/my-formosa/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/mycard520/news.ts b/lib/routes/mycard520/news.ts index 7ecf503c5..241f656dc 100644 --- a/lib/routes/mycard520/news.ts +++ b/lib/routes/mycard520/news.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'cardgame' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '18', 10); diff --git a/lib/routes/mydrivers/cid.ts b/lib/routes/mydrivers/cid.ts index 028dbeb08..f68f28c34 100644 --- a/lib/routes/mydrivers/cid.ts +++ b/lib/routes/mydrivers/cid.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import parser from '@/utils/rss-parser'; -import { rootUrl, rootRSSUrl, title, categories, getInfo, processItems } from './util'; +import { categories, getInfo, processItems, rootRSSUrl, rootUrl, title } from './util'; export const route: Route = { path: '/cid/:id?', diff --git a/lib/routes/mydrivers/index.ts b/lib/routes/mydrivers/index.ts index 5e7859c7c..ef18a3721 100644 --- a/lib/routes/mydrivers/index.ts +++ b/lib/routes/mydrivers/index.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { rootUrl, title, categories, convertToQueryString, getInfo, processItems } from './util'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + +import { categories, convertToQueryString, getInfo, processItems, rootUrl, title } from './util'; export const route: Route = { path: '/:category{.+}?', diff --git a/lib/routes/mydrivers/rank.ts b/lib/routes/mydrivers/rank.ts index 95c3fc081..7f5f115cc 100644 --- a/lib/routes/mydrivers/rank.ts +++ b/lib/routes/mydrivers/rank.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, getInfo, processItems } from './util'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { getInfo, processItems, rootUrl } from './util'; export const route: Route = { path: '/rank/:range?', diff --git a/lib/routes/mydrivers/util.ts b/lib/routes/mydrivers/util.ts index e24f6a9d7..49da4ddd6 100644 --- a/lib/routes/mydrivers/util.ts +++ b/lib/routes/mydrivers/util.ts @@ -1,8 +1,9 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; + import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const domain = 'mydrivers.com'; const rootUrl = `https://m.${domain}`; @@ -110,4 +111,4 @@ const processItems = async (items) => ) ); -export { rootUrl, rootRSSUrl, title, categories, convertToQueryString, getInfo, processItems }; +export { categories, convertToQueryString, getInfo, processItems, rootRSSUrl, rootUrl, title }; diff --git a/lib/routes/myfans/post.ts b/lib/routes/myfans/post.ts index 74bb9a392..14aafa7c7 100644 --- a/lib/routes/myfans/post.ts +++ b/lib/routes/myfans/post.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import { showByUsername, getPostByAccountId, baseUrl } from './utils'; import path from 'node:path'; + +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; +import { baseUrl, getPostByAccountId, showByUsername } from './utils'; + export const route: Route = { path: '/user/:username', categories: ['multimedia'], diff --git a/lib/routes/myfans/utils.ts b/lib/routes/myfans/utils.ts index df49d22a5..e2b4c9b1b 100644 --- a/lib/routes/myfans/utils.ts +++ b/lib/routes/myfans/utils.ts @@ -1,7 +1,8 @@ -import ofetch from '@/utils/ofetch'; import InvalidParameterError from '@/errors/types/invalid-parameter'; import cache from '@/utils/cache'; -import { Post, UserProfile } from './types'; +import ofetch from '@/utils/ofetch'; + +import type { Post, UserProfile } from './types'; const apiBaseUrl = 'https://api.myfans.jp'; export const baseUrl = 'https://myfans.jp'; diff --git a/lib/routes/myfigurecollection/activity.ts b/lib/routes/myfigurecollection/activity.ts index f09101c4d..8a488e60c 100644 --- a/lib/routes/myfigurecollection/activity.ts +++ b/lib/routes/myfigurecollection/activity.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/activity/:category?/:language?/:latestAdditions?/:latestEdits?/:latestAlerts?/:latestPictures?', diff --git a/lib/routes/myfigurecollection/index.ts b/lib/routes/myfigurecollection/index.ts index b2278b663..3c81d92a4 100644 --- a/lib/routes/myfigurecollection/index.ts +++ b/lib/routes/myfigurecollection/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const shortcuts = { potd: 'picture/browse/potd/', diff --git a/lib/routes/mygopen/index.ts b/lib/routes/mygopen/index.ts index d53212369..8c227784d 100644 --- a/lib/routes/mygopen/index.ts +++ b/lib/routes/mygopen/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/mymusicsheet/usersheets.ts b/lib/routes/mymusicsheet/usersheets.ts index 1cfc0a5e9..caaa5b8f6 100644 --- a/lib/routes/mymusicsheet/usersheets.ts +++ b/lib/routes/mymusicsheet/usersheets.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/user/sheets/:username/:iso?/:freeOnly?', diff --git a/lib/routes/mysql/release.ts b/lib/routes/mysql/release.ts index 29bb81030..10b279170 100644 --- a/lib/routes/mysql/release.ts +++ b/lib/routes/mysql/release.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; -import { load } from 'cheerio'; export const route: Route = { path: '/release/:version?', diff --git a/lib/routes/nankai/ai-notice.ts b/lib/routes/nankai/ai-notice.ts index f04bf8a7f..f922af5a2 100644 --- a/lib/routes/nankai/ai-notice.ts +++ b/lib/routes/nankai/ai-notice.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/nankai/cc-notice.ts b/lib/routes/nankai/cc-notice.ts index 992da52b7..3b216b057 100644 --- a/lib/routes/nankai/cc-notice.ts +++ b/lib/routes/nankai/cc-notice.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/nankai/graduate-notice.ts b/lib/routes/nankai/graduate-notice.ts index 1dd8896ee..26fc68bbe 100644 --- a/lib/routes/nankai/graduate-notice.ts +++ b/lib/routes/nankai/graduate-notice.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/nankai/jwc.ts b/lib/routes/nankai/jwc.ts index e2c9ce523..16598e8e2 100644 --- a/lib/routes/nankai/jwc.ts +++ b/lib/routes/nankai/jwc.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/nankai/notice.ts b/lib/routes/nankai/notice.ts index 582d0303d..68cc1e3fd 100644 --- a/lib/routes/nankai/notice.ts +++ b/lib/routes/nankai/notice.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/nankai/yzb.ts b/lib/routes/nankai/yzb.ts index 85551817c..cb6b2e6be 100644 --- a/lib/routes/nankai/yzb.ts +++ b/lib/routes/nankai/yzb.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/nasa/apod-cn.ts b/lib/routes/nasa/apod-cn.ts index 508168591..cb372a8ea 100644 --- a/lib/routes/nasa/apod-cn.ts +++ b/lib/routes/nasa/apod-cn.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/nasa/apod-ncku.ts b/lib/routes/nasa/apod-ncku.ts index c16e9ed66..0b31acad6 100644 --- a/lib/routes/nasa/apod-ncku.ts +++ b/lib/routes/nasa/apod-ncku.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/nasa/apod.ts b/lib/routes/nasa/apod.ts index 07409441b..1d676743f 100644 --- a/lib/routes/nasa/apod.ts +++ b/lib/routes/nasa/apod.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/natgeo/dailyphoto.ts b/lib/routes/natgeo/dailyphoto.ts index c87253b2a..e313daf1c 100644 --- a/lib/routes/natgeo/dailyphoto.ts +++ b/lib/routes/natgeo/dailyphoto.ts @@ -1,12 +1,14 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; export const route: Route = { path: '/dailyphoto', diff --git a/lib/routes/natgeo/dailyselection.ts b/lib/routes/natgeo/dailyselection.ts index 49977d845..9e4a94ab4 100644 --- a/lib/routes/natgeo/dailyselection.ts +++ b/lib/routes/natgeo/dailyselection.ts @@ -1,7 +1,8 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/dailyselection', diff --git a/lib/routes/natgeo/natgeo.ts b/lib/routes/natgeo/natgeo.ts index 3de183334..b2bd3811a 100644 --- a/lib/routes/natgeo/natgeo.ts +++ b/lib/routes/natgeo/natgeo.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/nationalgeographic/latest-stories.ts b/lib/routes/nationalgeographic/latest-stories.ts index fb29acb1e..27bdd3793 100644 --- a/lib/routes/nationalgeographic/latest-stories.ts +++ b/lib/routes/nationalgeographic/latest-stories.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const findNatgeo = ($) => JSON.parse( diff --git a/lib/routes/naturalism/new.ts b/lib/routes/naturalism/new.ts index 189e41a74..4a1c5ccc1 100644 --- a/lib/routes/naturalism/new.ts +++ b/lib/routes/naturalism/new.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; export const route: Route = { path: '/', diff --git a/lib/routes/nature/cover.ts b/lib/routes/nature/cover.ts index cb6458f49..1ad509eb1 100644 --- a/lib/routes/nature/cover.ts +++ b/lib/routes/nature/cover.ts @@ -1,4 +1,7 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // The content is generateed by undocumentated API of nature journals // This router has **just** been tested in: @@ -15,12 +18,10 @@ import cache from '@/utils/cache'; // nplants: Nature Plants // natastron: Nature Astronomy // nphys Nature Physics - import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, journalMap } from './utils'; -import { CookieJar } from 'tough-cookie'; export const route: Route = { path: '/cover', diff --git a/lib/routes/nature/highlight.ts b/lib/routes/nature/highlight.ts index fe2b843ed..d42e1ac23 100644 --- a/lib/routes/nature/highlight.ts +++ b/lib/routes/nature/highlight.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; -import { baseUrl, cookieJar, getArticleList, getArticle } from './utils'; + +import { baseUrl, cookieJar, getArticle, getArticleList } from './utils'; export const route: Route = { path: '/highlight/:journal?', diff --git a/lib/routes/nature/news-and-comment.ts b/lib/routes/nature/news-and-comment.ts index 7a2103099..71c6d3ff0 100644 --- a/lib/routes/nature/news-and-comment.ts +++ b/lib/routes/nature/news-and-comment.ts @@ -1,4 +1,3 @@ -import { Route } from '@/types'; // example usage: `/nature/news-and-comment/ng` // The journals from NPG are run by different group of people, // and the website of may not be consitent for all the journals @@ -12,10 +11,12 @@ import { Route } from '@/types'; // nchem: Nature Chemistry // nmat: Nature Materials // natmachintell: Nature Machine Intelligence - import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; -import { baseUrl, cookieJar, getArticleList, getArticle } from './utils'; + +import { baseUrl, cookieJar, getArticle, getArticleList } from './utils'; export const route: Route = { path: '/news-and-comment/:journal?', diff --git a/lib/routes/nature/news.ts b/lib/routes/nature/news.ts index 953ea2c4c..73a4533c5 100644 --- a/lib/routes/nature/news.ts +++ b/lib/routes/nature/news.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, cookieJar, getArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/nature/research.ts b/lib/routes/nature/research.ts index 9a7b05fe9..f95bbaae7 100644 --- a/lib/routes/nature/research.ts +++ b/lib/routes/nature/research.ts @@ -1,4 +1,3 @@ -import { Route } from '@/types'; // example usage: `/nature/research/ng` // The journals from NPG are run by different group of people, // and the website of may not be consitent for all the journals @@ -13,10 +12,12 @@ import { Route } from '@/types'; // nchem: Nature Chemistry // nmat: Nature Materials // natmachintell: Nature Machine Intelligence - import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; -import { baseUrl, cookieJar, getArticleList, getDataLayer, getArticle } from './utils'; + +import { baseUrl, cookieJar, getArticle, getArticleList, getDataLayer } from './utils'; export const route: Route = { path: '/research/:journal?', diff --git a/lib/routes/nature/siteindex.ts b/lib/routes/nature/siteindex.ts index d927800dd..0666710d2 100644 --- a/lib/routes/nature/siteindex.ts +++ b/lib/routes/nature/siteindex.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { baseUrl, cookieJar } from './utils'; export const route: Route = { diff --git a/lib/routes/nature/utils.ts b/lib/routes/nature/utils.ts index cf7709432..bebefabc0 100644 --- a/lib/routes/nature/utils.ts +++ b/lib/routes/nature/utils.ts @@ -1,8 +1,10 @@ +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { CookieJar } from 'tough-cookie'; + const baseUrl = 'https://www.nature.com'; const fixFigure = (html) => { diff --git a/lib/routes/nautil/topics.ts b/lib/routes/nautil/topics.ts index b635eb941..437f8b6e7 100644 --- a/lib/routes/nautil/topics.ts +++ b/lib/routes/nautil/topics.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + const baseUrl = 'https://nautil.us'; export const route: Route = { diff --git a/lib/routes/nautiljon/manga-releases.ts b/lib/routes/nautiljon/manga-releases.ts index 7eb6974ef..0a7d65a3c 100644 --- a/lib/routes/nautiljon/manga-releases.ts +++ b/lib/routes/nautiljon/manga-releases.ts @@ -1,6 +1,7 @@ import { load } from 'cheerio'; + import { config } from '@/config'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/nbd/daily.ts b/lib/routes/nbd/daily.ts index 49c554967..325b645e3 100644 --- a/lib/routes/nbd/daily.ts +++ b/lib/routes/nbd/daily.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + export const route: Route = { path: '/daily', categories: ['finance'], diff --git a/lib/routes/nbd/index.ts b/lib/routes/nbd/index.ts index 854ce8c4d..4257ea1f7 100644 --- a/lib/routes/nbd/index.ts +++ b/lib/routes/nbd/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/nber/all.ts b/lib/routes/nber/all.ts index 93c438691..28fae6334 100644 --- a/lib/routes/nber/all.ts +++ b/lib/routes/nber/all.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/nber/common.ts b/lib/routes/nber/common.ts index cf4789970..dc57d5eef 100644 --- a/lib/routes/nber/common.ts +++ b/lib/routes/nber/common.ts @@ -1,11 +1,13 @@ -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import path from 'node:path'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; + +import { load } from 'cheerio'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; async function getData(url) { const response = await ofetch(url); diff --git a/lib/routes/nber/new.ts b/lib/routes/nber/new.ts index 0fe6d061b..102885a66 100644 --- a/lib/routes/nber/new.ts +++ b/lib/routes/nber/new.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/ncc-cma/cmdp.ts b/lib/routes/ncc-cma/cmdp.ts index 6f38836c6..2dafbe79f 100644 --- a/lib/routes/ncc-cma/cmdp.ts +++ b/lib/routes/ncc-cma/cmdp.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import iconv from 'iconv-lite'; export const handler = async (ctx) => { const { id = 'RPJQWQYZ' } = ctx.req.param(); diff --git a/lib/routes/ncepu/master/masterinfo.ts b/lib/routes/ncepu/master/masterinfo.ts index 8e96d26f3..858156bc5 100644 --- a/lib/routes/ncepu/master/masterinfo.ts +++ b/lib/routes/ncepu/master/masterinfo.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const title_map = { tzgg: '通知公告', diff --git a/lib/routes/ncku/csie.ts b/lib/routes/ncku/csie.ts index a8178d74a..327808632 100644 --- a/lib/routes/ncku/csie.ts +++ b/lib/routes/ncku/csie.ts @@ -1,5 +1,7 @@ +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; + import type { Route } from '@/types'; -import { CheerioAPI, load } from 'cheerio'; import ofetch from '@/utils/ofetch'; const currentURL = (catagory: string, page: number) => (catagory === '_all' ? `https://www.csie.ncku.edu.tw/zh-hant/news?page=${page}` : `https://www.csie.ncku.edu.tw/zh-hant/news/${catagory}?page=${page}`); diff --git a/lib/routes/ncku/phys.ts b/lib/routes/ncku/phys.ts index 1230d0cd7..dcffc513d 100644 --- a/lib/routes/ncku/phys.ts +++ b/lib/routes/ncku/phys.ts @@ -1,5 +1,7 @@ +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; + import type { Route } from '@/types'; -import { CheerioAPI, load } from 'cheerio'; import ofetch from '@/utils/ofetch'; const currentURL = (catagory: string) => `https://phys.ncku.edu.tw/news/${catagory === '_all' ? '' : catagory}`; diff --git a/lib/routes/ncpssd/newlist.ts b/lib/routes/ncpssd/newlist.ts index f90d80c18..8201212a2 100644 --- a/lib/routes/ncpssd/newlist.ts +++ b/lib/routes/ncpssd/newlist.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { Route } from '@/types'; export const route: Route = { path: '/newlist', diff --git a/lib/routes/ncu/jwc.ts b/lib/routes/ncu/jwc.ts index 9d03e549f..7da9318a1 100644 --- a/lib/routes/ncu/jwc.ts +++ b/lib/routes/ncu/jwc.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; // 自订的 got import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; +import got from '@/utils/got'; // 自订的 got import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ncwu/notice.ts b/lib/routes/ncwu/notice.ts index 09e49c1e8..45477174e 100644 --- a/lib/routes/ncwu/notice.ts +++ b/lib/routes/ncwu/notice.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; + const baseUrl = 'https://www.ncwu.edu.cn/xxtz.htm'; export const route: Route = { diff --git a/lib/routes/ndss-symposium/ndss.ts b/lib/routes/ndss-symposium/ndss.ts index 598194c6e..1634bf225 100644 --- a/lib/routes/ndss-symposium/ndss.ts +++ b/lib/routes/ndss-symposium/ndss.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -const url = 'https://www.ndss-symposium.org'; import { parseDate } from '@/utils/parse-date'; +const url = 'https://www.ndss-symposium.org'; + export const route: Route = { path: '/ndss', categories: ['journal'], diff --git a/lib/routes/neatdownloadmanager/download.ts b/lib/routes/neatdownloadmanager/download.ts index f7bf6b948..5e6575b77 100644 --- a/lib/routes/neatdownloadmanager/download.ts +++ b/lib/routes/neatdownloadmanager/download.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/download/:os?', categories: ['program-update'], diff --git a/lib/routes/neea/index.ts b/lib/routes/neea/index.ts index e3245da0e..5a0c95c59 100644 --- a/lib/routes/neea/index.ts +++ b/lib/routes/neea/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/neea/jlpt.ts b/lib/routes/neea/jlpt.ts index 27618481e..c54452e2a 100644 --- a/lib/routes/neea/jlpt.ts +++ b/lib/routes/neea/jlpt.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/nenu/sohac.ts b/lib/routes/nenu/sohac.ts index 4181dc335..b9eb34cbf 100644 --- a/lib/routes/nenu/sohac.ts +++ b/lib/routes/nenu/sohac.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/nenu/yjsy.ts b/lib/routes/nenu/yjsy.ts index 498b96d3e..8b60a548d 100644 --- a/lib/routes/nenu/yjsy.ts +++ b/lib/routes/nenu/yjsy.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/netflav/index.ts b/lib/routes/netflav/index.ts index 9951994fd..d8db0403e 100644 --- a/lib/routes/netflav/index.ts +++ b/lib/routes/netflav/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/', diff --git a/lib/routes/netflix/newsroom.ts b/lib/routes/netflix/newsroom.ts index 2956719c7..5799099d7 100644 --- a/lib/routes/netflix/newsroom.ts +++ b/lib/routes/netflix/newsroom.ts @@ -1,7 +1,6 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/netflix/research.ts b/lib/routes/netflix/research.ts index 6500ca109..a39825417 100644 --- a/lib/routes/netflix/research.ts +++ b/lib/routes/netflix/research.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/neu/bmie.ts b/lib/routes/neu/bmie.ts index 1e16b5c6e..66d8c7243 100644 --- a/lib/routes/neu/bmie.ts +++ b/lib/routes/neu/bmie.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'http://www.bmie.neu.edu.cn'; diff --git a/lib/routes/neu/news.ts b/lib/routes/neu/news.ts index 9948c64d0..62104890f 100644 --- a/lib/routes/neu/news.ts +++ b/lib/routes/neu/news.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://neunews.neu.edu.cn'; export const route: Route = { diff --git a/lib/routes/neu/yz.ts b/lib/routes/neu/yz.ts index b0811e4ae..3bfb13a48 100644 --- a/lib/routes/neu/yz.ts +++ b/lib/routes/neu/yz.ts @@ -1,7 +1,8 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/newmuseum/exhibitions.ts b/lib/routes/newmuseum/exhibitions.ts index c72aded67..975dac84a 100644 --- a/lib/routes/newmuseum/exhibitions.ts +++ b/lib/routes/newmuseum/exhibitions.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; export const route: Route = { diff --git a/lib/routes/newrank/douyin.ts b/lib/routes/newrank/douyin.ts index 6e799e77e..f6692be1d 100644 --- a/lib/routes/newrank/douyin.ts +++ b/lib/routes/newrank/douyin.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/douyin/:dyid', diff --git a/lib/routes/newrank/utils.ts b/lib/routes/newrank/utils.ts index 6abdf1169..1a5f09315 100644 --- a/lib/routes/newrank/utils.ts +++ b/lib/routes/newrank/utils.ts @@ -1,7 +1,8 @@ -import cache from '@/utils/cache'; -import md5 from '@/utils/md5'; -import got from '@/utils/got'; import { config } from '@/config'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import md5 from '@/utils/md5'; + const newrank_cookie_token = 'newrank_cookie_token'; const query_count = 'newrank_cookie_count'; const max_query_count = 30; diff --git a/lib/routes/newrank/wechat.ts b/lib/routes/newrank/wechat.ts index a87822aef..9704e6860 100644 --- a/lib/routes/newrank/wechat.ts +++ b/lib/routes/newrank/wechat.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { finishArticleItem } from '@/utils/wechat-mp'; import { load } from 'cheerio'; -import utils from './utils'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { finishArticleItem } from '@/utils/wechat-mp'; + +import utils from './utils'; export const route: Route = { path: '/wechat/:wxid', diff --git a/lib/routes/news/xhsxw.ts b/lib/routes/news/xhsxw.ts index bc80aee0e..85d7a074c 100644 --- a/lib/routes/news/xhsxw.ts +++ b/lib/routes/news/xhsxw.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: ['/xhsxw', '/whxw'], diff --git a/lib/routes/newseed/index.ts b/lib/routes/newseed/index.ts index 03b4906d6..9e3c79af9 100644 --- a/lib/routes/newseed/index.ts +++ b/lib/routes/newseed/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/latest', diff --git a/lib/routes/newslaundry/explainer.ts b/lib/routes/newslaundry/explainer.ts index dfa4f3bdd..5cc2240ab 100644 --- a/lib/routes/newslaundry/explainer.ts +++ b/lib/routes/newslaundry/explainer.ts @@ -1,4 +1,6 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchCollection, rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/newslaundry/nl-cheatsheet.ts b/lib/routes/newslaundry/nl-cheatsheet.ts index 416dfb72d..bff21586d 100644 --- a/lib/routes/newslaundry/nl-cheatsheet.ts +++ b/lib/routes/newslaundry/nl-cheatsheet.ts @@ -1,4 +1,6 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchCollection, rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/newslaundry/nl-collaborations.ts b/lib/routes/newslaundry/nl-collaborations.ts index 7c661b0b8..6c453641e 100644 --- a/lib/routes/newslaundry/nl-collaborations.ts +++ b/lib/routes/newslaundry/nl-collaborations.ts @@ -1,4 +1,6 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchCollection, rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/newslaundry/podcast.ts b/lib/routes/newslaundry/podcast.ts index fa6422de5..85ea43e90 100644 --- a/lib/routes/newslaundry/podcast.ts +++ b/lib/routes/newslaundry/podcast.ts @@ -1,4 +1,6 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchCollection, rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/newslaundry/reports.ts b/lib/routes/newslaundry/reports.ts index f0d9e59bf..7906f519c 100644 --- a/lib/routes/newslaundry/reports.ts +++ b/lib/routes/newslaundry/reports.ts @@ -1,4 +1,6 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchCollection } from './utils'; export const route: Route = { diff --git a/lib/routes/newslaundry/shot.ts b/lib/routes/newslaundry/shot.ts index b25943a55..44be2aff0 100644 --- a/lib/routes/newslaundry/shot.ts +++ b/lib/routes/newslaundry/shot.ts @@ -1,4 +1,6 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchCollection } from './utils'; export const route: Route = { diff --git a/lib/routes/newslaundry/subscriber-only.ts b/lib/routes/newslaundry/subscriber-only.ts index 3218cffa4..f0c815fff 100644 --- a/lib/routes/newslaundry/subscriber-only.ts +++ b/lib/routes/newslaundry/subscriber-only.ts @@ -1,4 +1,6 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchCollection } from './utils'; export const route: Route = { diff --git a/lib/routes/newslaundry/utils.ts b/lib/routes/newslaundry/utils.ts index 479e7db31..c8843657b 100644 --- a/lib/routes/newslaundry/utils.ts +++ b/lib/routes/newslaundry/utils.ts @@ -1,8 +1,9 @@ -import { Data, DataItem } from '@/types'; +import path from 'node:path'; + +import type { Data, DataItem } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const rootUrl = 'https://www.newslaundry.com'; diff --git a/lib/routes/newsmarket/index.ts b/lib/routes/newsmarket/index.ts index a8625c628..835502b06 100644 --- a/lib/routes/newsmarket/index.ts +++ b/lib/routes/newsmarket/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/newswav/latest.ts b/lib/routes/newswav/latest.ts index 954024ce4..f0a35072e 100644 --- a/lib/routes/newswav/latest.ts +++ b/lib/routes/newswav/latest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/newyorker/news.ts b/lib/routes/newyorker/news.ts index 57bfb9e58..b56781788 100644 --- a/lib/routes/newyorker/news.ts +++ b/lib/routes/newyorker/news.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; const host = 'https://www.newyorker.com'; export const route: Route = { diff --git a/lib/routes/newzmz/index.ts b/lib/routes/newzmz/index.ts index 647339359..30aad5800 100644 --- a/lib/routes/newzmz/index.ts +++ b/lib/routes/newzmz/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, getItems, getItemInfo, processItems } from './util'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { getItemInfo, getItems, processItems, rootUrl } from './util'; export const route: Route = { path: '/:id?/:downLinkType?', diff --git a/lib/routes/newzmz/util.ts b/lib/routes/newzmz/util.ts index a8fadfe2b..8dfc1405c 100644 --- a/lib/routes/newzmz/util.ts +++ b/lib/routes/newzmz/util.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://nzmz.xyz'; @@ -157,4 +159,4 @@ const processItems = async (i, downLinkType, itemSelector, categorySelector, dow }); }; -export { rootUrl, getItems, getItemInfo, processItems }; +export { getItemInfo, getItems, processItems, rootUrl }; diff --git a/lib/routes/nextapple/realtime.ts b/lib/routes/nextapple/realtime.ts index 607268152..281789c1f 100644 --- a/lib/routes/nextapple/realtime.ts +++ b/lib/routes/nextapple/realtime.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import pMap from 'p-map'; export const route: Route = { path: '/realtime/:category?', diff --git a/lib/routes/nextjs/blog.ts b/lib/routes/nextjs/blog.ts index 00b5c6ffe..2bf401cb3 100644 --- a/lib/routes/nextjs/blog.ts +++ b/lib/routes/nextjs/blog.ts @@ -1,8 +1,9 @@ -import type { DataItem, Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const handler: Route['handler'] = async () => { const data = await ofetch('https://nextjs.org/blog'); diff --git a/lib/routes/nga/forum.ts b/lib/routes/nga/forum.ts index 25db7eb0e..9588c7fa0 100644 --- a/lib/routes/nga/forum.ts +++ b/lib/routes/nga/forum.ts @@ -1,7 +1,8 @@ -import { Route, ViewType } from '@/types'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; const X_UA = 'NGA_skull/6.0.5(iPhone10,3;iOS 12.0.1)'; diff --git a/lib/routes/nga/post.ts b/lib/routes/nga/post.ts index ae4dd72af..6f0a7782f 100644 --- a/lib/routes/nga/post.ts +++ b/lib/routes/nga/post.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { config } from '@/config'; export const route: Route = { path: '/post/:tid/:authorId?', diff --git a/lib/routes/ngocn2/index.ts b/lib/routes/ngocn2/index.ts index 1741c30ff..7a1ea5819 100644 --- a/lib/routes/ngocn2/index.ts +++ b/lib/routes/ngocn2/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/nhentai/index.ts b/lib/routes/nhentai/index.ts index 3464c5ef8..043f0fe10 100644 --- a/lib/routes/nhentai/index.ts +++ b/lib/routes/nhentai/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { getSimple, getDetails, getTorrents } from './util'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { getDetails, getSimple, getTorrents } from './util'; const supportedKeys = new Set(['parody', 'character', 'tag', 'artist', 'group', 'language', 'category']); diff --git a/lib/routes/nhentai/search.ts b/lib/routes/nhentai/search.ts index 7e17a50fa..9d354e225 100644 --- a/lib/routes/nhentai/search.ts +++ b/lib/routes/nhentai/search.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { getSimple, getDetails, getTorrents } from './util'; + +import { getDetails, getSimple, getTorrents } from './util'; export const route: Route = { path: '/search/:keyword/:mode?', diff --git a/lib/routes/nhentai/util.ts b/lib/routes/nhentai/util.ts index 6c068b922..3bd5d9bb4 100644 --- a/lib/routes/nhentai/util.ts +++ b/lib/routes/nhentai/util.ts @@ -1,11 +1,13 @@ +import path from 'node:path'; + import { load } from 'cheerio'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; import got from '@/utils/got'; import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; const baseUrl = 'https://nhentai.net'; @@ -145,4 +147,4 @@ const getDetail = async (simple) => { }; }; -export { baseUrl, getSimple, getDetails, getTorrents }; +export { baseUrl, getDetails, getSimple, getTorrents }; diff --git a/lib/routes/nhk/news-web-easy.ts b/lib/routes/nhk/news-web-easy.ts index ba642e19f..da6912faa 100644 --- a/lib/routes/nhk/news-web-easy.ts +++ b/lib/routes/nhk/news-web-easy.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/news_web_easy', diff --git a/lib/routes/nhk/news.ts b/lib/routes/nhk/news.ts index cc33dcb89..4c5be8d30 100644 --- a/lib/routes/nhk/news.ts +++ b/lib/routes/nhk/news.ts @@ -1,10 +1,12 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + const baseUrl = 'https://www3.nhk.or.jp'; const apiUrl = 'https://api.nhkworld.jp'; diff --git a/lib/routes/niaogebiji/cat.ts b/lib/routes/niaogebiji/cat.ts index 0058f059b..a6e1e6e69 100644 --- a/lib/routes/niaogebiji/cat.ts +++ b/lib/routes/niaogebiji/cat.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/niaogebiji/index.ts b/lib/routes/niaogebiji/index.ts index ded707e0b..121418e7e 100644 --- a/lib/routes/niaogebiji/index.ts +++ b/lib/routes/niaogebiji/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/niaogebiji/today.ts b/lib/routes/niaogebiji/today.ts index 5f6e02c33..c5d8175e4 100644 --- a/lib/routes/niaogebiji/today.ts +++ b/lib/routes/niaogebiji/today.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/nicovideo/mylist.ts b/lib/routes/nicovideo/mylist.ts index 2b47b8d37..6dd697e94 100644 --- a/lib/routes/nicovideo/mylist.ts +++ b/lib/routes/nicovideo/mylist.ts @@ -1,7 +1,7 @@ -import { DataItem, Route } from '@/types'; +import type { DataItem, Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; import { getMylist, renderVideo } from './utils'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { name: 'Mylist', diff --git a/lib/routes/nicovideo/utils.ts b/lib/routes/nicovideo/utils.ts index 2761ebc9e..d23fe8ae0 100644 --- a/lib/routes/nicovideo/utils.ts +++ b/lib/routes/nicovideo/utils.ts @@ -1,11 +1,12 @@ -import { Essential, Mylist, UserInfo, VideoItem } from './types'; - -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; -import { config } from '@/config'; import path from 'node:path'; + +import { config } from '@/config'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; +import type { Essential, Mylist, UserInfo, VideoItem } from './types'; + export const getUserInfoById = (id: string) => cache.tryGet(`nicovideo:user:${id}`, () => ofetch(`https://embed.nicovideo.jp/users/${id}`)) as Promise; export const getUserVideosById = (id: string) => diff --git a/lib/routes/nicovideo/video.ts b/lib/routes/nicovideo/video.ts index d09959386..80184d3fd 100644 --- a/lib/routes/nicovideo/video.ts +++ b/lib/routes/nicovideo/video.ts @@ -1,8 +1,9 @@ import type { Context } from 'hono'; -import { DataItem, Route } from '@/types'; -import { UserInfo, VideoItem } from './types'; +import type { DataItem, Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; + +import type { UserInfo, VideoItem } from './types'; import { getUserInfoById, getUserVideosById, renderVideo } from './utils'; const handler = async (ctx: Context) => { diff --git a/lib/routes/nielsberglund/index.ts b/lib/routes/nielsberglund/index.ts index 5f4122948..0ffab274e 100644 --- a/lib/routes/nielsberglund/index.ts +++ b/lib/routes/nielsberglund/index.ts @@ -1,8 +1,9 @@ -import { Route, DataItem } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/blog', diff --git a/lib/routes/nifd/research.ts b/lib/routes/nifd/research.ts index 9759210eb..cbd28b540 100644 --- a/lib/routes/nifd/research.ts +++ b/lib/routes/nifd/research.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'http://www.nifd.cn'; diff --git a/lib/routes/nikkei/asia/index.ts b/lib/routes/nikkei/asia/index.ts index 0c705551f..90209de9c 100644 --- a/lib/routes/nikkei/asia/index.ts +++ b/lib/routes/nikkei/asia/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/nikkei/cn/index.ts b/lib/routes/nikkei/cn/index.ts index 8b6bc4f2e..4489347f7 100644 --- a/lib/routes/nikkei/cn/index.ts +++ b/lib/routes/nikkei/cn/index.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; import Parser from 'rss-parser'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + const parser = new Parser({ customFields: { item: ['magnet'], diff --git a/lib/routes/nikkei/index.ts b/lib/routes/nikkei/index.ts index ae0cb2f57..d031da259 100644 --- a/lib/routes/nikkei/index.ts +++ b/lib/routes/nikkei/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/index', name: 'Home', diff --git a/lib/routes/nikkei/news.ts b/lib/routes/nikkei/news.ts index 5b5fed324..a1415723d 100644 --- a/lib/routes/nikkei/news.ts +++ b/lib/routes/nikkei/news.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/news/:category/:article_type?', diff --git a/lib/routes/nintendo/direct.ts b/lib/routes/nintendo/direct.ts index 587d71edd..f725c3d9c 100644 --- a/lib/routes/nintendo/direct.ts +++ b/lib/routes/nintendo/direct.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/direct', diff --git a/lib/routes/nintendo/eshop-cn.ts b/lib/routes/nintendo/eshop-cn.ts index 1ad97ada3..cebe08c06 100644 --- a/lib/routes/nintendo/eshop-cn.ts +++ b/lib/routes/nintendo/eshop-cn.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import util from './utils'; -const software_url = 'https://www.nintendoswitch.com.cn/software/'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import util from './utils'; + +const software_url = 'https://www.nintendoswitch.com.cn/software/'; export const route: Route = { path: '/eshop/cn', diff --git a/lib/routes/nintendo/eshop-hk.ts b/lib/routes/nintendo/eshop-hk.ts index 3c1166301..5a34d4d53 100644 --- a/lib/routes/nintendo/eshop-hk.ts +++ b/lib/routes/nintendo/eshop-hk.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/eshop/hk', diff --git a/lib/routes/nintendo/eshop-jp.ts b/lib/routes/nintendo/eshop-jp.ts index 70e85451e..fe5d94e0f 100644 --- a/lib/routes/nintendo/eshop-jp.ts +++ b/lib/routes/nintendo/eshop-jp.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/eshop/jp', diff --git a/lib/routes/nintendo/eshop-us.ts b/lib/routes/nintendo/eshop-us.ts index 322ff668b..24665098d 100644 --- a/lib/routes/nintendo/eshop-us.ts +++ b/lib/routes/nintendo/eshop-us.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import { art } from '@/utils/render'; -import got from '@/utils/got'; import path from 'node:path'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/eshop/us', radar: [ diff --git a/lib/routes/nintendo/news-china.ts b/lib/routes/nintendo/news-china.ts index ba30267ff..45c4a42c4 100644 --- a/lib/routes/nintendo/news-china.ts +++ b/lib/routes/nintendo/news-china.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import util from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + const news_url = 'https://www.nintendoswitch.com.cn'; export const route: Route = { diff --git a/lib/routes/nintendo/news.ts b/lib/routes/nintendo/news.ts index 49169ce9a..f45071df3 100644 --- a/lib/routes/nintendo/news.ts +++ b/lib/routes/nintendo/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import util from './utils'; import { parseDate } from '@/utils/parse-date'; +import util from './utils'; + export const route: Route = { path: '/news', categories: ['game'], diff --git a/lib/routes/nintendo/system-update.ts b/lib/routes/nintendo/system-update.ts index dff78f753..c4fdb2766 100644 --- a/lib/routes/nintendo/system-update.ts +++ b/lib/routes/nintendo/system-update.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/system-update', categories: ['game'], diff --git a/lib/routes/nintendo/utils.ts b/lib/routes/nintendo/utils.ts index 8d87323d0..c05e4222b 100644 --- a/lib/routes/nintendo/utils.ts +++ b/lib/routes/nintendo/utils.ts @@ -1,12 +1,16 @@ -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { JSDOM } from 'jsdom'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; +import 'dayjs/locale/zh-cn.js'; + import path from 'node:path'; + +import { load } from 'cheerio'; import dayjs from 'dayjs'; import localizedFormat from 'dayjs/plugin/localizedFormat.js'; -import 'dayjs/locale/zh-cn.js'; +import { JSDOM } from 'jsdom'; + +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + dayjs.extend(localizedFormat); function nuxtReader(data) { diff --git a/lib/routes/nio/nioradio.ts b/lib/routes/nio/nioradio.ts index 4c03173d3..1adc7c38f 100644 --- a/lib/routes/nio/nioradio.ts +++ b/lib/routes/nio/nioradio.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { URLSearchParams } from 'node:url'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { URLSearchParams } from 'node:url'; export const route: Route = { path: '/nioradio/:albumid', diff --git a/lib/routes/nippon/index.ts b/lib/routes/nippon/index.ts index f66fe927f..7b0db2dfd 100644 --- a/lib/routes/nippon/index.ts +++ b/lib/routes/nippon/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/njglyy/utils/index.ts b/lib/routes/njglyy/utils/index.ts index 0aef709fe..1dbb4d81e 100644 --- a/lib/routes/njglyy/utils/index.ts +++ b/lib/routes/njglyy/utils/index.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/njglyy/ygbjypx.ts b/lib/routes/njglyy/ygbjypx.ts index 7c758b35c..3c752dcd0 100644 --- a/lib/routes/njglyy/ygbjypx.ts +++ b/lib/routes/njglyy/ygbjypx.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getNoticeList } from './utils'; const url = 'https://njglyy.com/ygb/jypx/jypx.aspx'; diff --git a/lib/routes/njit/jwc.ts b/lib/routes/njit/jwc.ts index 9ac34831e..f1e1656be 100644 --- a/lib/routes/njit/jwc.ts +++ b/lib/routes/njit/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://jwc.njit.edu.cn'; diff --git a/lib/routes/njit/tzgg.ts b/lib/routes/njit/tzgg.ts index 875110559..66a7ef61d 100644 --- a/lib/routes/njit/tzgg.ts +++ b/lib/routes/njit/tzgg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const url = 'https://www.njit.edu.cn/index/tzgg.htm'; diff --git a/lib/routes/njnu/ceai/ceai.ts b/lib/routes/njnu/ceai/ceai.ts index a7f181296..fc9b6af10 100644 --- a/lib/routes/njnu/ceai/ceai.ts +++ b/lib/routes/njnu/ceai/ceai.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/njnu/ceai/utils.ts b/lib/routes/njnu/ceai/utils.ts index 33f931a15..06aad5b0c 100644 --- a/lib/routes/njnu/ceai/utils.ts +++ b/lib/routes/njnu/ceai/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/njnu/jwc/jwc.ts b/lib/routes/njnu/jwc/jwc.ts index e43b68f41..63141e6bc 100644 --- a/lib/routes/njnu/jwc/jwc.ts +++ b/lib/routes/njnu/jwc/jwc.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/njnu/jwc/utils.ts b/lib/routes/njnu/jwc/utils.ts index 86eba25e3..d727ed95e 100644 --- a/lib/routes/njnu/jwc/utils.ts +++ b/lib/routes/njnu/jwc/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/admission.ts b/lib/routes/nju/admission.ts index dcf9e1e24..4fecc0a4a 100644 --- a/lib/routes/nju/admission.ts +++ b/lib/routes/nju/admission.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/nju/dafls.ts b/lib/routes/nju/dafls.ts index 57b4faa52..3b188f0f7 100644 --- a/lib/routes/nju/dafls.ts +++ b/lib/routes/nju/dafls.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/exchangesys.ts b/lib/routes/nju/exchangesys.ts index 8583be71b..f4a2d2c74 100644 --- a/lib/routes/nju/exchangesys.ts +++ b/lib/routes/nju/exchangesys.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import dayjs from 'dayjs'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/exchangesys/:type', categories: ['university'], diff --git a/lib/routes/nju/gra.ts b/lib/routes/nju/gra.ts index 731b788f8..5fbfe5d38 100644 --- a/lib/routes/nju/gra.ts +++ b/lib/routes/nju/gra.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/hosptial.ts b/lib/routes/nju/hosptial.ts index 3b244217f..c8b20e757 100644 --- a/lib/routes/nju/hosptial.ts +++ b/lib/routes/nju/hosptial.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/nju/hqjt.ts b/lib/routes/nju/hqjt.ts index dc3bdad10..3b7dd8c10 100644 --- a/lib/routes/nju/hqjt.ts +++ b/lib/routes/nju/hqjt.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/itsc.ts b/lib/routes/nju/itsc.ts index 4b9d7661d..fa280aa45 100644 --- a/lib/routes/nju/itsc.ts +++ b/lib/routes/nju/itsc.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/jjc.ts b/lib/routes/nju/jjc.ts index 6d29f0424..8e33e8380 100644 --- a/lib/routes/nju/jjc.ts +++ b/lib/routes/nju/jjc.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/jw.ts b/lib/routes/nju/jw.ts index c5f200ce2..aeb43cd90 100644 --- a/lib/routes/nju/jw.ts +++ b/lib/routes/nju/jw.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import queryString from 'query-string'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import queryString from 'query-string'; export const route: Route = { path: '/jw/:type', diff --git a/lib/routes/nju/rczp.ts b/lib/routes/nju/rczp.ts index 74f3762e5..5260cade6 100644 --- a/lib/routes/nju/rczp.ts +++ b/lib/routes/nju/rczp.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; export const route: Route = { path: '/rczp/:type', diff --git a/lib/routes/nju/scit.ts b/lib/routes/nju/scit.ts index 8665db756..99290a5e6 100644 --- a/lib/routes/nju/scit.ts +++ b/lib/routes/nju/scit.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/zbb.ts b/lib/routes/nju/zbb.ts index f717d601b..cf3a1e707 100644 --- a/lib/routes/nju/zbb.ts +++ b/lib/routes/nju/zbb.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/zcc.ts b/lib/routes/nju/zcc.ts index 4937a6e90..96a7043a0 100644 --- a/lib/routes/nju/zcc.ts +++ b/lib/routes/nju/zcc.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/zcc', categories: ['university'], diff --git a/lib/routes/njucm/grabs.ts b/lib/routes/njucm/grabs.ts index f87fa8e47..d9b2271eb 100644 --- a/lib/routes/njucm/grabs.ts +++ b/lib/routes/njucm/grabs.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getNoticeList } from './utils'; const url = 'https://gra.njucm.edu.cn/2899/list.htm'; diff --git a/lib/routes/njucm/utils/index.ts b/lib/routes/njucm/utils/index.ts index 80ab76af4..2b10053e0 100644 --- a/lib/routes/njucm/utils/index.ts +++ b/lib/routes/njucm/utils/index.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/njuferret/blog.ts b/lib/routes/njuferret/blog.ts index 1014f6515..2dc1e0193 100644 --- a/lib/routes/njuferret/blog.ts +++ b/lib/routes/njuferret/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/njupt/jwc.ts b/lib/routes/njupt/jwc.ts index 385e6df19..bc14d79c1 100644 --- a/lib/routes/njupt/jwc.ts +++ b/lib/routes/njupt/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://jwc.njupt.edu.cn'; diff --git a/lib/routes/njust/cs.ts b/lib/routes/njust/cs.ts index 69de3542c..da5346ad8 100644 --- a/lib/routes/njust/cs.ts +++ b/lib/routes/njust/cs.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getContent } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['xyxw', { title: '南京理工大学计算机学院 -- 学院新闻', id: '/1817' }], diff --git a/lib/routes/njust/cwc.ts b/lib/routes/njust/cwc.ts index 45ac542c3..075847a7c 100644 --- a/lib/routes/njust/cwc.ts +++ b/lib/routes/njust/cwc.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getContent } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['tzgg', { title: '南京理工大学财务处 -- 通知公告', id: '/12432' }], diff --git a/lib/routes/njust/dgxg.ts b/lib/routes/njust/dgxg.ts index f5db81b53..df18fe8cb 100644 --- a/lib/routes/njust/dgxg.ts +++ b/lib/routes/njust/dgxg.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getContent } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['gstz', { title: '南京理工大学电光学院研学网 -- 公示通知', id: '/6509' }], diff --git a/lib/routes/njust/eo.ts b/lib/routes/njust/eo.ts index 828ad5e45..7031f84d4 100644 --- a/lib/routes/njust/eo.ts +++ b/lib/routes/njust/eo.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getContent } from './utils'; const map = new Map([ diff --git a/lib/routes/njust/eoe.ts b/lib/routes/njust/eoe.ts index 7f7771a98..3d8227698 100644 --- a/lib/routes/njust/eoe.ts +++ b/lib/routes/njust/eoe.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getContent } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['tzgg', { title: '南京理工大学电子工程与光电技术学院 -- 通知公告', id: '/1920' }], diff --git a/lib/routes/njust/gs.ts b/lib/routes/njust/gs.ts index 40fd55027..5e430eb92 100644 --- a/lib/routes/njust/gs.ts +++ b/lib/routes/njust/gs.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getContent } from './utils'; const host = 'https://gs.njust.edu.cn'; diff --git a/lib/routes/njust/jwc.ts b/lib/routes/njust/jwc.ts index 1df1697ce..a17722002 100644 --- a/lib/routes/njust/jwc.ts +++ b/lib/routes/njust/jwc.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getContent } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['jstz', { title: '南京理工大学教务处 -- 教师通知', id: '/1216' }], diff --git a/lib/routes/njxzc/home.ts b/lib/routes/njxzc/home.ts index edccce1f3..5975c6f22 100644 --- a/lib/routes/njxzc/home.ts +++ b/lib/routes/njxzc/home.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getNoticeList } from './utils'; const url = 'https://www.njxzc.edu.cn/89/list.htm'; diff --git a/lib/routes/njxzc/lib.ts b/lib/routes/njxzc/lib.ts index 962e5ff6b..986c17659 100644 --- a/lib/routes/njxzc/lib.ts +++ b/lib/routes/njxzc/lib.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getNoticeList } from './utils'; const url = 'https://lib.njxzc.edu.cn/pxyhd/list.htm'; diff --git a/lib/routes/njxzc/utils/index.ts b/lib/routes/njxzc/utils/index.ts index cd75ff25f..0d2cdeeb5 100644 --- a/lib/routes/njxzc/utils/index.ts +++ b/lib/routes/njxzc/utils/index.ts @@ -1,8 +1,9 @@ -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; // 使用默认导出的方式导入ofetch import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import ofetch from '@/utils/ofetch'; // 使用默认导出的方式导入ofetch async function getNoticeList(ctx, url, host, titleSelector, dateSelector, contentSelector, listSelector) { const response = await ofetch(url); diff --git a/lib/routes/nlc/read.ts b/lib/routes/nlc/read.ts index 1e4483211..1a63b960b 100644 --- a/lib/routes/nlc/read.ts +++ b/lib/routes/nlc/read.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/read/:type?', categories: ['other'], diff --git a/lib/routes/nltimes/news.ts b/lib/routes/nltimes/news.ts index 0d361183e..7bb18f0b3 100644 --- a/lib/routes/nltimes/news.ts +++ b/lib/routes/nltimes/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nmc/weatheralarm.ts b/lib/routes/nmc/weatheralarm.ts index e568606b4..61d9e58f0 100644 --- a/lib/routes/nmc/weatheralarm.ts +++ b/lib/routes/nmc/weatheralarm.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import * as cheerio from 'cheerio'; export const route: Route = { path: '/weatheralarm/:province?', diff --git a/lib/routes/nmtv/column.ts b/lib/routes/nmtv/column.ts index 8545e979b..4a23a2cda 100644 --- a/lib/routes/nmtv/column.ts +++ b/lib/routes/nmtv/column.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/column/:id?', diff --git a/lib/routes/nodejs/blog.ts b/lib/routes/nodejs/blog.ts index 54b5340d1..15ddf8582 100644 --- a/lib/routes/nodejs/blog.ts +++ b/lib/routes/nodejs/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/nogizaka46/blog.ts b/lib/routes/nogizaka46/blog.ts index 1d42cad8c..394a81c37 100644 --- a/lib/routes/nogizaka46/blog.ts +++ b/lib/routes/nogizaka46/blog.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/nogizaka46/news.ts b/lib/routes/nogizaka46/news.ts index e145302ae..e6c80ae5c 100644 --- a/lib/routes/nogizaka46/news.ts +++ b/lib/routes/nogizaka46/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/nosec/index.ts b/lib/routes/nosec/index.ts index 4b69098a5..75751dac4 100644 --- a/lib/routes/nosec/index.ts +++ b/lib/routes/nosec/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; const baseUrl = 'https://nosec.org/home/ajaxindexdata'; const keykinds = { diff --git a/lib/routes/notateslaapp/update.ts b/lib/routes/notateslaapp/update.ts index 8d76ce199..fb3c17c5d 100644 --- a/lib/routes/notateslaapp/update.ts +++ b/lib/routes/notateslaapp/update.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/ota', categories: ['program-update'], diff --git a/lib/routes/notefolio/search.ts b/lib/routes/notefolio/search.ts index 8e5e3afba..b041a7ec3 100644 --- a/lib/routes/notefolio/search.ts +++ b/lib/routes/notefolio/search.ts @@ -1,10 +1,12 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import dayjs from 'dayjs'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; // 导入所需模组 import got from '@/utils/got'; // 自订的 got import { parseDate } from '@/utils/parse-date'; -import dayjs from 'dayjs'; -import path from 'node:path'; import { art } from '@/utils/render'; // 分类 diff --git a/lib/routes/notion/database.ts b/lib/routes/notion/database.ts index cd83c0753..5ab8597c9 100644 --- a/lib/routes/notion/database.ts +++ b/lib/routes/notion/database.ts @@ -1,15 +1,17 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { Client, isNotionClientError, APIErrorCode } from '@notionhq/client'; -import logger from '@/utils/logger'; -import { config } from '@/config'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; -import { NotionToMarkdown } from 'notion-to-md'; +import { APIErrorCode, Client, isNotionClientError } from '@notionhq/client'; import { load } from 'cheerio'; import MarkdownIt from 'markdown-it'; +import { NotionToMarkdown } from 'notion-to-md'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; + const md = MarkdownIt({ html: true, linkify: true, diff --git a/lib/routes/notion/release.ts b/lib/routes/notion/release.ts index 840afbc68..06324cb84 100644 --- a/lib/routes/notion/release.ts +++ b/lib/routes/notion/release.ts @@ -1,9 +1,10 @@ -import type { DataItem, Route } from '@/types'; import { load } from 'cheerio'; +import day from 'dayjs'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; -import day from 'dayjs'; const handler: Route['handler'] = async () => { const data = await ofetch('https://notion.so/releases', { diff --git a/lib/routes/now/news.ts b/lib/routes/now/news.ts index 7d306c6ae..916c30f99 100644 --- a/lib/routes/now/news.ts +++ b/lib/routes/now/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const mainCategories = { diff --git a/lib/routes/nowcoder/discuss.ts b/lib/routes/nowcoder/discuss.ts index 9bfe9cede..458af0926 100644 --- a/lib/routes/nowcoder/discuss.ts +++ b/lib/routes/nowcoder/discuss.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nowcoder/experience.ts b/lib/routes/nowcoder/experience.ts index 68f3f2827..b44e74726 100644 --- a/lib/routes/nowcoder/experience.ts +++ b/lib/routes/nowcoder/experience.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nowcoder/jobcenter.ts b/lib/routes/nowcoder/jobcenter.ts index 8571e9cc1..b07544680 100644 --- a/lib/routes/nowcoder/jobcenter.ts +++ b/lib/routes/nowcoder/jobcenter.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import * as url from 'node:url'; -import got from '@/utils/got'; + import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + export const route: Route = { path: '/jobcenter/:recruitType?/:city?/:type?/:order?/:latest?', categories: ['bbs'], diff --git a/lib/routes/nowcoder/recommend.ts b/lib/routes/nowcoder/recommend.ts index ffcd0ea14..267f3403d 100644 --- a/lib/routes/nowcoder/recommend.ts +++ b/lib/routes/nowcoder/recommend.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/nowcoder/schedule.ts b/lib/routes/nowcoder/schedule.ts index f392d5d19..fa67bc84e 100644 --- a/lib/routes/nowcoder/schedule.ts +++ b/lib/routes/nowcoder/schedule.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/npm/package.ts b/lib/routes/npm/package.ts index 15b3f1b4a..6afb0fc57 100644 --- a/lib/routes/npm/package.ts +++ b/lib/routes/npm/package.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/package/:name{(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*}', diff --git a/lib/routes/npr/full.ts b/lib/routes/npr/full.ts index 700399c9c..0cbdb2cf0 100644 --- a/lib/routes/npr/full.ts +++ b/lib/routes/npr/full.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import parser from '@/utils/rss-parser'; + const getArticleDetail = (link) => cache.tryGet(link, async () => { const response = await got(link); diff --git a/lib/routes/ntdm/video.ts b/lib/routes/ntdm/video.ts index 53188ffc4..13c3e1985 100644 --- a/lib/routes/ntdm/video.ts +++ b/lib/routes/ntdm/video.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { rootUrl } from './utils'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { rootUrl } from './utils'; + export const route: Route = { path: '/video/:id', categories: ['anime'], diff --git a/lib/routes/ntdtv/channel.ts b/lib/routes/ntdtv/channel.ts index f5556390f..f10c1f5cb 100644 --- a/lib/routes/ntdtv/channel.ts +++ b/lib/routes/ntdtv/channel.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ntrblog/articles.ts b/lib/routes/ntrblog/articles.ts index 5ffe9360b..94baad8f9 100644 --- a/lib/routes/ntrblog/articles.ts +++ b/lib/routes/ntrblog/articles.ts @@ -1,9 +1,10 @@ -import { Route, Data, DataItem } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import Parser from 'rss-parser'; +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + type CustomItem = { issued: string }; const parser = new Parser({ customFields: { diff --git a/lib/routes/nua/dc.ts b/lib/routes/nua/dc.ts index e7ab373d2..9b0fe244e 100644 --- a/lib/routes/nua/dc.ts +++ b/lib/routes/nua/dc.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import util from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; + +import util from './utils'; export const route: Route = { path: '/dc/:type', diff --git a/lib/routes/nua/gra.ts b/lib/routes/nua/gra.ts index c7e48e7cd..76c7ee595 100644 --- a/lib/routes/nua/gra.ts +++ b/lib/routes/nua/gra.ts @@ -1,5 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import util from './utils'; + const baseUrl = 'https://grad.nua.edu.cn'; export const route: Route = { diff --git a/lib/routes/nua/index.ts b/lib/routes/nua/index.ts index 48fffe9c4..0e8f39d21 100644 --- a/lib/routes/nua/index.ts +++ b/lib/routes/nua/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/nua/lib.ts b/lib/routes/nua/lib.ts index 12711f073..f2656110c 100644 --- a/lib/routes/nua/lib.ts +++ b/lib/routes/nua/lib.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import util from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; + +import util from './utils'; + const baseUrl = 'https://lib.nua.edu.cn'; export const route: Route = { diff --git a/lib/routes/nua/sxw.ts b/lib/routes/nua/sxw.ts index e5cf7f81a..133d20814 100644 --- a/lib/routes/nua/sxw.ts +++ b/lib/routes/nua/sxw.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/nua/utils.ts b/lib/routes/nua/utils.ts index dedfc9682..9e00603a9 100644 --- a/lib/routes/nua/utils.ts +++ b/lib/routes/nua/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; import { fetchArticle } from '@/utils/wechat-mp'; diff --git a/lib/routes/nuaa/college/cae.ts b/lib/routes/nuaa/college/cae.ts index 44469ecc8..0fa65fb8a 100644 --- a/lib/routes/nuaa/college/cae.ts +++ b/lib/routes/nuaa/college/cae.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import getCookie from '../utils/pypasswaf'; + const host = 'https://cae.nuaa.edu.cn/'; const map = new Map([ diff --git a/lib/routes/nuaa/college/cs.ts b/lib/routes/nuaa/college/cs.ts index f83504bd0..8a95f767c 100644 --- a/lib/routes/nuaa/college/cs.ts +++ b/lib/routes/nuaa/college/cs.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import getCookie from '../utils/pypasswaf'; + const host = 'https://cs.nuaa.edu.cn/'; const map = new Map([ diff --git a/lib/routes/nuaa/jwc/jwc.ts b/lib/routes/nuaa/jwc/jwc.ts index d83b09fd1..afc8b4ef2 100644 --- a/lib/routes/nuaa/jwc/jwc.ts +++ b/lib/routes/nuaa/jwc/jwc.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import getCookie from '../utils/pypasswaf'; + const host = 'http://aao.nuaa.edu.cn/'; const map = new Map([ diff --git a/lib/routes/nuaa/utils/pypasswaf.ts b/lib/routes/nuaa/utils/pypasswaf.ts index 0c38881d8..b10bbfcfb 100644 --- a/lib/routes/nuaa/utils/pypasswaf.ts +++ b/lib/routes/nuaa/utils/pypasswaf.ts @@ -1,5 +1,5 @@ -import { getCookies } from '@/utils/puppeteer-utils'; import puppeteer from '@/utils/puppeteer'; +import { getCookies } from '@/utils/puppeteer-utils'; /** * async function 获取cookie diff --git a/lib/routes/nuaa/yjsy/yjsy.ts b/lib/routes/nuaa/yjsy/yjsy.ts index 066279f0f..3a2e63050 100644 --- a/lib/routes/nuaa/yjsy/yjsy.ts +++ b/lib/routes/nuaa/yjsy/yjsy.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import getCookie from '../utils/pypasswaf'; + const host = 'http://www.graduate.nuaa.edu.cn/'; const map = new Map([ diff --git a/lib/routes/nudt/yjszs.ts b/lib/routes/nudt/yjszs.ts index db2eb0ce1..d75d82e57 100644 --- a/lib/routes/nudt/yjszs.ts +++ b/lib/routes/nudt/yjszs.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; /* 研究生院 */ diff --git a/lib/routes/nuist/bulletin.ts b/lib/routes/nuist/bulletin.ts index 86ff30751..5904c7a87 100644 --- a/lib/routes/nuist/bulletin.ts +++ b/lib/routes/nuist/bulletin.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const baseTitle = '南信大信息公告栏'; diff --git a/lib/routes/nuist/cas.ts b/lib/routes/nuist/cas.ts index a45054916..21f788ad2 100644 --- a/lib/routes/nuist/cas.ts +++ b/lib/routes/nuist/cas.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nuist/jwc.ts b/lib/routes/nuist/jwc.ts index c0101b459..38c9c9607 100644 --- a/lib/routes/nuist/jwc.ts +++ b/lib/routes/nuist/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseTitle = '南京信息工程大学-教务处'; diff --git a/lib/routes/nuist/library/lib.ts b/lib/routes/nuist/library/lib.ts index 03f9262fc..d037faeb8 100644 --- a/lib/routes/nuist/library/lib.ts +++ b/lib/routes/nuist/library/lib.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseTitle = '南京信息工程大学图书馆通知'; const baseUrl = 'https://lib.nuist.edu.cn'; diff --git a/lib/routes/nuist/scs.ts b/lib/routes/nuist/scs.ts index 9981cfd9f..e96f43b8e 100644 --- a/lib/routes/nuist/scs.ts +++ b/lib/routes/nuist/scs.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseTitle = 'NUIST CS(南信大计软院)'; const baseUrl = 'https://scs.nuist.edu.cn'; diff --git a/lib/routes/nuist/sese.ts b/lib/routes/nuist/sese.ts index b2e3956a5..98cea23d1 100644 --- a/lib/routes/nuist/sese.ts +++ b/lib/routes/nuist/sese.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseTitle = 'NUIST ESE(南信大环科院)'; diff --git a/lib/routes/nuist/xgc.ts b/lib/routes/nuist/xgc.ts index 2b7037792..501316a90 100644 --- a/lib/routes/nuist/xgc.ts +++ b/lib/routes/nuist/xgc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseTitle = '南信大学生工作处'; diff --git a/lib/routes/nuist/yjs.ts b/lib/routes/nuist/yjs.ts index c3306fc48..5bd9f1330 100644 --- a/lib/routes/nuist/yjs.ts +++ b/lib/routes/nuist/yjs.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/yjs/*', diff --git a/lib/routes/nwafu/all.ts b/lib/routes/nwafu/all.ts index 641ae5d65..40d71767f 100644 --- a/lib/routes/nwafu/all.ts +++ b/lib/routes/nwafu/all.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { nwafuMap } from './utils'; export const route: Route = { diff --git a/lib/routes/nwnu/routes/college/csse.ts b/lib/routes/nwnu/routes/college/csse.ts index 4822aa5ef..bb2ee5df7 100644 --- a/lib/routes/nwnu/routes/college/csse.ts +++ b/lib/routes/nwnu/routes/college/csse.ts @@ -1,9 +1,11 @@ +import { load } from 'cheerio'; + import NotFoundError from '@/errors/types/not-found'; -import { DataItem, Route } from '@/types'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; + import { processEmbedPDF } from '../lib/embed-resource'; const WEBSITE_LOGO = 'https://jsj.nwnu.edu.cn/_upload/tpl/02/2e/558/template558/favicon.ico'; diff --git a/lib/routes/nwnu/routes/department/academic-affairs.ts b/lib/routes/nwnu/routes/department/academic-affairs.ts index 30a75b9d2..eba3dcc81 100644 --- a/lib/routes/nwnu/routes/department/academic-affairs.ts +++ b/lib/routes/nwnu/routes/department/academic-affairs.ts @@ -1,9 +1,11 @@ +import { load } from 'cheerio'; + import NotFoundError from '@/errors/types/not-found'; -import { DataItem, Route } from '@/types'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; + import { processEmbedPDF } from '../lib/embed-resource'; const WEBSITE_LOGO = 'https://www.nwnu.edu.cn/_upload/tpl/02/d9/729/template729/favicon.ico'; diff --git a/lib/routes/nwnu/routes/department/postgraduate.ts b/lib/routes/nwnu/routes/department/postgraduate.ts index 25fae3bc4..668c72987 100644 --- a/lib/routes/nwnu/routes/department/postgraduate.ts +++ b/lib/routes/nwnu/routes/department/postgraduate.ts @@ -1,9 +1,11 @@ +import { load } from 'cheerio'; + import NotFoundError from '@/errors/types/not-found'; -import { DataItem, Route } from '@/types'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; + import { processEmbedPDF } from '../lib/embed-resource'; const WEBSITE_LOGO = 'https://www.nwnu.edu.cn/_upload/tpl/02/d9/729/template729/favicon.ico'; diff --git a/lib/routes/nyaa/main.ts b/lib/routes/nyaa/main.ts index a8032a6e7..24b46705b 100644 --- a/lib/routes/nyaa/main.ts +++ b/lib/routes/nyaa/main.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { config } from '@/config'; import Parser from 'rss-parser'; +import { config } from '@/config'; +import type { Route } from '@/types'; + export const route: Route = { path: ['/search/:query?', '/user/:username?', '/user/:username/search/:query?', '/sukebei/search/:query?', '/sukebei/user/:username?', '/sukebei/user/:username/search/:query?'], categories: ['multimedia'], diff --git a/lib/routes/nycu/aa.ts b/lib/routes/nycu/aa.ts index 03d85a811..55b244a74 100644 --- a/lib/routes/nycu/aa.ts +++ b/lib/routes/nycu/aa.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import timezone from '@/utils/timezone'; -import { CheerioAPI, load } from 'cheerio'; -import { Context } from 'hono'; +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import timezone from '@/utils/timezone'; function ROCDate(dateStr: string | Date): Date { const date = new Date(dateStr); diff --git a/lib/routes/nycu/announcement.ts b/lib/routes/nycu/announcement.ts index 79dfa9aef..3ff96aeb1 100644 --- a/lib/routes/nycu/announcement.ts +++ b/lib/routes/nycu/announcement.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import timezone from '@/utils/timezone'; -import { CheerioAPI, load } from 'cheerio'; -import { Context } from 'hono'; +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import timezone from '@/utils/timezone'; async function handler(ctx: Context): Promise { const type = ctx.req.param('type') ?? '5'; diff --git a/lib/routes/nycu/cs.ts b/lib/routes/nycu/cs.ts index f4741d108..d497edbe0 100644 --- a/lib/routes/nycu/cs.ts +++ b/lib/routes/nycu/cs.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import timezone from '@/utils/timezone'; -import { CheerioAPI, load } from 'cheerio'; -import { Context } from 'hono'; +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import timezone from '@/utils/timezone'; async function handler(ctx: Context): Promise { const catagory = ctx.req.param('category') ?? 'all'; diff --git a/lib/routes/nycu/osa.ts b/lib/routes/nycu/osa.ts index d1cff00df..46dfa5154 100644 --- a/lib/routes/nycu/osa.ts +++ b/lib/routes/nycu/osa.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import timezone from '@/utils/timezone'; -import { CheerioAPI, load } from 'cheerio'; -import { Context } from 'hono'; +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import timezone from '@/utils/timezone'; function ROCDate(dateStr: string | Date): Date { const date = new Date(dateStr); diff --git a/lib/routes/nymity/censorbib.ts b/lib/routes/nymity/censorbib.ts index d88122962..b48d4743f 100644 --- a/lib/routes/nymity/censorbib.ts +++ b/lib/routes/nymity/censorbib.ts @@ -1,6 +1,8 @@ -import { DataItem, Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import got from '@/utils/got'; + const url = 'https://censorbib.nymity.ch/'; export const route: Route = { diff --git a/lib/routes/nytimes/book.ts b/lib/routes/nytimes/book.ts index 134a1cd38..d258c6f14 100644 --- a/lib/routes/nytimes/book.ts +++ b/lib/routes/nytimes/book.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + const categoryList = { 'combined-print-and-e-book-nonfiction': 'Combined Print & E-Book Nonfiction', 'hardcover-nonfiction': 'Hardcover Nonfiction', diff --git a/lib/routes/nytimes/daily-briefing-chinese.ts b/lib/routes/nytimes/daily-briefing-chinese.ts index 363065b74..f41dbc03d 100644 --- a/lib/routes/nytimes/daily-briefing-chinese.ts +++ b/lib/routes/nytimes/daily-briefing-chinese.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/daily_briefing_chinese', diff --git a/lib/routes/nytimes/index.ts b/lib/routes/nytimes/index.ts index 9154dd917..3b6aad7f3 100644 --- a/lib/routes/nytimes/index.ts +++ b/lib/routes/nytimes/index.ts @@ -1,10 +1,13 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import parser from '@/utils/rss-parser'; -import utils from './utils'; -import { load } from 'cheerio'; import puppeteer from '@/utils/puppeteer'; +import parser from '@/utils/rss-parser'; + +import utils from './utils'; export const route: Route = { path: '/:lang?', diff --git a/lib/routes/nytimes/rss.ts b/lib/routes/nytimes/rss.ts index 3ae702c39..13c1fb6f7 100644 --- a/lib/routes/nytimes/rss.ts +++ b/lib/routes/nytimes/rss.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import parser from '@/utils/rss-parser'; export const route: Route = { path: '/rss/:cat?', diff --git a/lib/routes/nytimes/utils.ts b/lib/routes/nytimes/utils.ts index 36cf67f08..2db5209d5 100644 --- a/lib/routes/nytimes/utils.ts +++ b/lib/routes/nytimes/utils.ts @@ -1,5 +1,6 @@ -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; const ProcessImage = ($, e) => { diff --git a/lib/routes/obsidian/plugins.ts b/lib/routes/obsidian/plugins.ts index 83198bfac..2d09a56e8 100644 --- a/lib/routes/obsidian/plugins.ts +++ b/lib/routes/obsidian/plugins.ts @@ -1,5 +1,4 @@ -import { Route } from '@/types'; - +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/obsidian/publish.ts b/lib/routes/obsidian/publish.ts index c0f237c60..90a564b2f 100644 --- a/lib/routes/obsidian/publish.ts +++ b/lib/routes/obsidian/publish.ts @@ -1,10 +1,12 @@ -import { Route, DataItem } from '@/types'; import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; -import { getTitle } from './utils'; + import { config } from '@/config'; +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { getTitle } from './utils'; + export const route: Route = { path: '/publish/:id', categories: ['blog'], diff --git a/lib/routes/oceanengine/arithmetic-index.ts b/lib/routes/oceanengine/arithmetic-index.ts index b93e1cf5c..e07116501 100644 --- a/lib/routes/oceanengine/arithmetic-index.ts +++ b/lib/routes/oceanengine/arithmetic-index.ts @@ -1,15 +1,16 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import dayjs from 'dayjs'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; -import { config } from '@/config'; -import puppeteer from '@/utils/puppeteer'; import { createDecipheriv } from 'node:crypto'; +import path from 'node:path'; + +import dayjs from 'dayjs'; + +import { config } from '@/config'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; +import puppeteer from '@/utils/puppeteer'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; // Parameters const CACHE_MAX_AGE = config.cache.contentExpire; diff --git a/lib/routes/oct0pu5/rss.ts b/lib/routes/oct0pu5/rss.ts index a57892a72..c597bc20b 100644 --- a/lib/routes/oct0pu5/rss.ts +++ b/lib/routes/oct0pu5/rss.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; const baseUrl = 'https://oct0pu5.cn/'; diff --git a/lib/routes/odaily/activity.ts b/lib/routes/odaily/activity.ts index 806061c6f..b414ba934 100644 --- a/lib/routes/odaily/activity.ts +++ b/lib/routes/odaily/activity.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + import { rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/odaily/newsflash.ts b/lib/routes/odaily/newsflash.ts index a1834f3d7..4d0e519de 100644 --- a/lib/routes/odaily/newsflash.ts +++ b/lib/routes/odaily/newsflash.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + import { rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/odaily/post.ts b/lib/routes/odaily/post.ts index 735568be6..c2cef7b46 100644 --- a/lib/routes/odaily/post.ts +++ b/lib/routes/odaily/post.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + import { rootUrl } from './utils'; const titles = { diff --git a/lib/routes/odaily/search-news.ts b/lib/routes/odaily/search-news.ts index 8a9e3159c..5eac2c387 100644 --- a/lib/routes/odaily/search-news.ts +++ b/lib/routes/odaily/search-news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + import { rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/odaily/user.ts b/lib/routes/odaily/user.ts index 84704c8ce..b0ec1cf11 100644 --- a/lib/routes/odaily/user.ts +++ b/lib/routes/odaily/user.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + import { rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/oeeee/app/channel.ts b/lib/routes/oeeee/app/channel.ts index 2c8bd0809..a35932058 100644 --- a/lib/routes/oeeee/app/channel.ts +++ b/lib/routes/oeeee/app/channel.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import { parseArticle } from '../utils'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; + +import { parseArticle } from '../utils'; export const route: Route = { path: '/app/channel/:id', diff --git a/lib/routes/oeeee/app/reporter.ts b/lib/routes/oeeee/app/reporter.ts index d02180ca0..da2a5f33c 100644 --- a/lib/routes/oeeee/app/reporter.ts +++ b/lib/routes/oeeee/app/reporter.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { parseArticle } from '../utils'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import { parseArticle } from '../utils'; export const route: Route = { path: '/app/reporter/:id', diff --git a/lib/routes/oeeee/utils.ts b/lib/routes/oeeee/utils.ts index 2200bc008..706dc335f 100644 --- a/lib/routes/oeeee/utils.ts +++ b/lib/routes/oeeee/utils.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const parseArticle = (item, tryGet) => tryGet(item.link, async () => { diff --git a/lib/routes/oeeee/web.ts b/lib/routes/oeeee/web.ts index 1e55e33c0..81ee21e04 100644 --- a/lib/routes/oeeee/web.ts +++ b/lib/routes/oeeee/web.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import { parseArticle } from './utils'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; + +import { parseArticle } from './utils'; export const route: Route = { path: '/web/:channel', diff --git a/lib/routes/oesw/index.ts b/lib/routes/oesw/index.ts index deae42438..b49e6a076 100644 --- a/lib/routes/oesw/index.ts +++ b/lib/routes/oesw/index.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import ofetch from '@/utils/ofetch'; -import type { Data, DataItem, Route } from '@/types'; const FEED_LANGUAGE = 'de' as const; const FEED_LOGO = 'https://www.oesw.at/fileadmin/Logos/OeSW_AG/OeSW-Logo2024-RGB.png'; diff --git a/lib/routes/oesw/namespace.ts b/lib/routes/oesw/namespace.ts index e43418c78..aed586fde 100644 --- a/lib/routes/oesw/namespace.ts +++ b/lib/routes/oesw/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'ÖSW', diff --git a/lib/routes/oilchem/index.ts b/lib/routes/oilchem/index.ts index a98e69b83..0b3081b58 100644 --- a/lib/routes/oilchem/index.ts +++ b/lib/routes/oilchem/index.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import routes from './routes'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + +import routes from './routes'; export const route: Route = { path: '/:type?/:category?/:subCategory?', diff --git a/lib/routes/okx/index.ts b/lib/routes/okx/index.ts index d04d5c6c7..ab909d6cf 100644 --- a/lib/routes/okx/index.ts +++ b/lib/routes/okx/index.ts @@ -1,9 +1,10 @@ -import { DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; -import { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/:section?', diff --git a/lib/routes/olevod/vod.ts b/lib/routes/olevod/vod.ts index 89b5ba825..35d467f62 100644 --- a/lib/routes/olevod/vod.ts +++ b/lib/routes/olevod/vod.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/olevod/vodlist.ts b/lib/routes/olevod/vodlist.ts index e911be1a8..c25546d25 100644 --- a/lib/routes/olevod/vodlist.ts +++ b/lib/routes/olevod/vodlist.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/ollama/blog.ts b/lib/routes/ollama/blog.ts index 36e88e9e0..7f393e1e0 100644 --- a/lib/routes/ollama/blog.ts +++ b/lib/routes/ollama/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ollama/models.ts b/lib/routes/ollama/models.ts index 3e6b4aedf..f1638b997 100644 --- a/lib/routes/ollama/models.ts +++ b/lib/routes/ollama/models.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/oncc/index.ts b/lib/routes/oncc/index.ts index 5416bad8a..07198123d 100644 --- a/lib/routes/oncc/index.ts +++ b/lib/routes/oncc/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; import { art } from '@/utils/render'; const rootUrl = 'https://hk.on.cc'; diff --git a/lib/routes/oncc/money18.ts b/lib/routes/oncc/money18.ts index fb14a35f6..436b70643 100644 --- a/lib/routes/oncc/money18.ts +++ b/lib/routes/oncc/money18.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import dayjs from 'dayjs'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const sections = { exp: '新聞總覽', diff --git a/lib/routes/onehu/common.ts b/lib/routes/onehu/common.ts index 76c109be3..cf1a8ae21 100644 --- a/lib/routes/onehu/common.ts +++ b/lib/routes/onehu/common.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/', diff --git a/lib/routes/onet/news.ts b/lib/routes/onet/news.ts index 45cc597df..fc456648a 100644 --- a/lib/routes/onet/news.ts +++ b/lib/routes/onet/news.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import parser from '@/utils/rss-parser'; + import { parseArticleContent, parseMainImage } from './utils'; export const route: Route = { diff --git a/lib/routes/onet/utils.ts b/lib/routes/onet/utils.ts index 4188281d0..3db03167c 100644 --- a/lib/routes/onet/utils.ts +++ b/lib/routes/onet/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; +import { art } from '@/utils/render'; + const parseMainImage = ($) => { const mainImage = $('figure.mainPhoto'); const img = mainImage.find('img'); diff --git a/lib/routes/oo-software/changelog.ts b/lib/routes/oo-software/changelog.ts index 44632d500..db97a7408 100644 --- a/lib/routes/oo-software/changelog.ts +++ b/lib/routes/oo-software/changelog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/openai/chatgpt.ts b/lib/routes/openai/chatgpt.ts index 2724b9ac2..0bf80d500 100644 --- a/lib/routes/openai/chatgpt.ts +++ b/lib/routes/openai/chatgpt.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import dayjs from 'dayjs'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { config } from '@/config'; - +import dayjs from 'dayjs'; import isSameOrBefore from 'dayjs/plugin/isSameOrBefore.js'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + dayjs.extend(isSameOrBefore); export const route: Route = { diff --git a/lib/routes/openai/common.ts b/lib/routes/openai/common.ts index 30723d385..daf84c936 100644 --- a/lib/routes/openai/common.ts +++ b/lib/routes/openai/common.ts @@ -1,11 +1,13 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import ofetch from '@/utils/ofetch'; -import { DataItem } from '@/types'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; export const BASE_URL = new URL('https://openai.com'); diff --git a/lib/routes/openai/cookbook.ts b/lib/routes/openai/cookbook.ts index b61c18d35..d07fd7812 100644 --- a/lib/routes/openai/cookbook.ts +++ b/lib/routes/openai/cookbook.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/openai/news.ts b/lib/routes/openai/news.ts index 2f399bdeb..e8983b134 100644 --- a/lib/routes/openai/news.ts +++ b/lib/routes/openai/news.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import { fetchArticles, BASE_URL } from './common'; -import { Context } from 'hono'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; + +import { BASE_URL, fetchArticles } from './common'; export const route: Route = { path: '/news', diff --git a/lib/routes/openai/research.ts b/lib/routes/openai/research.ts index b0a0b0e6f..cedcf0998 100644 --- a/lib/routes/openai/research.ts +++ b/lib/routes/openai/research.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { getApiUrl, parseArticle } from './common'; export const route: Route = { diff --git a/lib/routes/openrice/chart.ts b/lib/routes/openrice/chart.ts index c56026d3d..390e8d9c5 100644 --- a/lib/routes/openrice/chart.ts +++ b/lib/routes/openrice/chart.ts @@ -1,8 +1,11 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + const baseUrl = 'https://www.openrice.com'; export const route: Route = { diff --git a/lib/routes/openrice/offers.ts b/lib/routes/openrice/offers.ts index a41b49290..5eccbff19 100644 --- a/lib/routes/openrice/offers.ts +++ b/lib/routes/openrice/offers.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import path from 'node:path'; + const baseUrl = 'https://www.openrice.com'; export const route: Route = { diff --git a/lib/routes/openrice/promos.ts b/lib/routes/openrice/promos.ts index 161fbefab..05f0e1bf5 100644 --- a/lib/routes/openrice/promos.ts +++ b/lib/routes/openrice/promos.ts @@ -1,8 +1,11 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + const baseUrl = 'https://www.openrice.com'; export const route: Route = { diff --git a/lib/routes/openrice/voting.ts b/lib/routes/openrice/voting.ts index 40cddfde0..6ffef817e 100644 --- a/lib/routes/openrice/voting.ts +++ b/lib/routes/openrice/voting.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + const baseUrl = 'https://www.openrice.com'; export const route: Route = { diff --git a/lib/routes/openwrt/releases.ts b/lib/routes/openwrt/releases.ts index aa1af7cda..f20223a9d 100644 --- a/lib/routes/openwrt/releases.ts +++ b/lib/routes/openwrt/releases.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/releases/:brand/:model', radar: [ diff --git a/lib/routes/orcid/index.ts b/lib/routes/orcid/index.ts index dcad980e6..1d928cb0a 100644 --- a/lib/routes/orcid/index.ts +++ b/lib/routes/orcid/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:id', diff --git a/lib/routes/oreno3d/get-sec-page-data.ts b/lib/routes/oreno3d/get-sec-page-data.ts index 54fceed38..a99feda25 100644 --- a/lib/routes/oreno3d/get-sec-page-data.ts +++ b/lib/routes/oreno3d/get-sec-page-data.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + const rootUrl = 'https://oreno3d.com'; async function sync_detail(link) { diff --git a/lib/routes/oreno3d/main.ts b/lib/routes/oreno3d/main.ts index 1ddb10000..ff3403434 100644 --- a/lib/routes/oreno3d/main.ts +++ b/lib/routes/oreno3d/main.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; + import get_sec_page_data from './get-sec-page-data'; const rootUrl = 'https://oreno3d.com'; diff --git a/lib/routes/ornl/all-news.ts b/lib/routes/ornl/all-news.ts index 64f07fca6..c0d62c529 100644 --- a/lib/routes/ornl/all-news.ts +++ b/lib/routes/ornl/all-news.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '10', 10); diff --git a/lib/routes/oschina/column.ts b/lib/routes/oschina/column.ts index 124b2aff1..c90c37c82 100644 --- a/lib/routes/oschina/column.ts +++ b/lib/routes/oschina/column.ts @@ -1,15 +1,14 @@ import path from 'node:path'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - -import { art } from '@/utils/render'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/oschina/event.ts b/lib/routes/oschina/event.ts index 7bac7aa21..ac331520c 100644 --- a/lib/routes/oschina/event.ts +++ b/lib/routes/oschina/event.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = 'latest' } = ctx.req.param(); diff --git a/lib/routes/oschina/news.ts b/lib/routes/oschina/news.ts index 29ad7c154..78bae6eb5 100644 --- a/lib/routes/oschina/news.ts +++ b/lib/routes/oschina/news.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; import { fetchArticle } from '@/utils/wechat-mp'; -import { config } from '@/config'; const configs = { all: { diff --git a/lib/routes/oschina/topic.ts b/lib/routes/oschina/topic.ts index 4f77b16c5..4774873e4 100644 --- a/lib/routes/oschina/topic.ts +++ b/lib/routes/oschina/topic.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; async function loadContent(link) { const res = await got(link); diff --git a/lib/routes/oschina/user.ts b/lib/routes/oschina/user.ts index c5069c72e..26ade55ea 100644 --- a/lib/routes/oschina/user.ts +++ b/lib/routes/oschina/user.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/oshwhub/explore.ts b/lib/routes/oshwhub/explore.ts index fc505089d..5dd003962 100644 --- a/lib/routes/oshwhub/explore.ts +++ b/lib/routes/oshwhub/explore.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; import MarkdownIt from 'markdown-it'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const originOptions = [ { diff --git a/lib/routes/osu/beatmaps/latest-ranked.ts b/lib/routes/osu/beatmaps/latest-ranked.ts index e5b4c084f..e860eee78 100644 --- a/lib/routes/osu/beatmaps/latest-ranked.ts +++ b/lib/routes/osu/beatmaps/latest-ranked.ts @@ -1,10 +1,12 @@ -import { Data, DataItem, Route } from '@/types'; import path from 'node:path'; -import got from '@/utils/got'; + import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; + import { config } from '@/config'; +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const actualParametersDescTable = ` diff --git a/lib/routes/osu/beatmaps/packs.ts b/lib/routes/osu/beatmaps/packs.ts index e48bc2b96..afef25ec4 100644 --- a/lib/routes/osu/beatmaps/packs.ts +++ b/lib/routes/osu/beatmaps/packs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/otobanana/cast.ts b/lib/routes/otobanana/cast.ts index cd2b0c438..42c17cb5a 100644 --- a/lib/routes/otobanana/cast.ts +++ b/lib/routes/otobanana/cast.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { apiBase, baseUrl, getUserInfo, renderCast } from './utils'; export const route: Route = { diff --git a/lib/routes/otobanana/livestream.ts b/lib/routes/otobanana/livestream.ts index f4c9c20c9..341d529a1 100644 --- a/lib/routes/otobanana/livestream.ts +++ b/lib/routes/otobanana/livestream.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { apiBase, baseUrl, getUserInfo, renderLive } from './utils'; export const route: Route = { diff --git a/lib/routes/otobanana/timeline.ts b/lib/routes/otobanana/timeline.ts index 59652ad7d..e5cd0bb24 100644 --- a/lib/routes/otobanana/timeline.ts +++ b/lib/routes/otobanana/timeline.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { apiBase, baseUrl, getUserInfo, renderPost } from './utils'; export const route: Route = { diff --git a/lib/routes/otobanana/utils.ts b/lib/routes/otobanana/utils.ts index 6138b14ab..b1cb2fc25 100644 --- a/lib/routes/otobanana/utils.ts +++ b/lib/routes/otobanana/utils.ts @@ -1,7 +1,8 @@ +import path from 'node:path'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const domain = 'otobanana.com'; const apiBase = `https://api.${domain}`; diff --git a/lib/routes/ouc/hqsz.ts b/lib/routes/ouc/hqsz.ts index 9c7fc635c..233b44b81 100644 --- a/lib/routes/ouc/hqsz.ts +++ b/lib/routes/ouc/hqsz.ts @@ -1,8 +1,9 @@ -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; import CryptoJS from 'crypto-js/crypto-js'; -import { Route } from '@/types'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/hqsz', diff --git a/lib/routes/ouc/it-postgraduate.ts b/lib/routes/ouc/it-postgraduate.ts index e3e6893eb..49af3d162 100644 --- a/lib/routes/ouc/it-postgraduate.ts +++ b/lib/routes/ouc/it-postgraduate.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ouc/it-tx.ts b/lib/routes/ouc/it-tx.ts index c63c228b2..56cfb5f27 100644 --- a/lib/routes/ouc/it-tx.ts +++ b/lib/routes/ouc/it-tx.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ouc/it.ts b/lib/routes/ouc/it.ts index 23bacb0aa..e283c5a85 100644 --- a/lib/routes/ouc/it.ts +++ b/lib/routes/ouc/it.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ouc/jwc.ts b/lib/routes/ouc/jwc.ts index 0b101b9e9..5c182cb53 100644 --- a/lib/routes/ouc/jwc.ts +++ b/lib/routes/ouc/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ouc/jwgl.ts b/lib/routes/ouc/jwgl.ts index bdeb5a02d..8dd05dade 100644 --- a/lib/routes/ouc/jwgl.ts +++ b/lib/routes/ouc/jwgl.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ouc/yjs.ts b/lib/routes/ouc/yjs.ts index 9777e9536..be668c865 100644 --- a/lib/routes/ouc/yjs.ts +++ b/lib/routes/ouc/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/oup/index.ts b/lib/routes/oup/index.ts index 4c4ce2b6e..8d76cec88 100644 --- a/lib/routes/oup/index.ts +++ b/lib/routes/oup/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; import { art } from '@/utils/render'; const rootUrl = 'https://academic.oup.com'; diff --git a/lib/routes/outagereport/index.ts b/lib/routes/outagereport/index.ts index 6585dc39b..0dc6628b8 100644 --- a/lib/routes/outagereport/index.ts +++ b/lib/routes/outagereport/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; const baseUrl = 'https://outage.report/'; diff --git a/lib/routes/p-articles/contributors.ts b/lib/routes/p-articles/contributors.ts index e9bfec6b8..888009662 100644 --- a/lib/routes/p-articles/contributors.ts +++ b/lib/routes/p-articles/contributors.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, ProcessFeed } from './utils'; +import ofetch from '@/utils/ofetch'; + +import { ProcessFeed, rootUrl } from './utils'; export const route: Route = { path: '/contributors/:author', diff --git a/lib/routes/p-articles/section.ts b/lib/routes/p-articles/section.ts index ffd96f349..ae53abd38 100644 --- a/lib/routes/p-articles/section.ts +++ b/lib/routes/p-articles/section.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, ProcessFeed } from './utils'; +import ofetch from '@/utils/ofetch'; + +import { ProcessFeed, rootUrl } from './utils'; export const route: Route = { path: '/section/:section', diff --git a/lib/routes/p-articles/utils.ts b/lib/routes/p-articles/utils.ts index 6645ad6c1..3a9810419 100644 --- a/lib/routes/p-articles/utils.ts +++ b/lib/routes/p-articles/utils.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; @@ -18,4 +19,4 @@ const ProcessFeed = (info, data) => { return info; }; -export { rootUrl, ProcessFeed }; +export { ProcessFeed, rootUrl }; diff --git a/lib/routes/pacilution/latest.ts b/lib/routes/pacilution/latest.ts index fa65b069c..e52281270 100644 --- a/lib/routes/pacilution/latest.ts +++ b/lib/routes/pacilution/latest.ts @@ -1,9 +1,10 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import iconv from 'iconv-lite'; const BASE_URL = 'http://www.pacilution.com/'; diff --git a/lib/routes/panewslab/author.ts b/lib/routes/panewslab/author.ts index d4c66eb32..eda869678 100644 --- a/lib/routes/panewslab/author.ts +++ b/lib/routes/panewslab/author.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/panewslab/news.ts b/lib/routes/panewslab/news.ts index 23ae5f5db..f3070ba7a 100644 --- a/lib/routes/panewslab/news.ts +++ b/lib/routes/panewslab/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/panewslab/profundity.ts b/lib/routes/panewslab/profundity.ts index 5fe19509f..7035955ab 100644 --- a/lib/routes/panewslab/profundity.ts +++ b/lib/routes/panewslab/profundity.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const categories = { diff --git a/lib/routes/panewslab/topic.ts b/lib/routes/panewslab/topic.ts index 46909c8d8..268e37518 100644 --- a/lib/routes/panewslab/topic.ts +++ b/lib/routes/panewslab/topic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/papers/category.ts b/lib/routes/papers/category.ts index a01fd31f7..ba4fb8162 100644 --- a/lib/routes/papers/category.ts +++ b/lib/routes/papers/category.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; export const handler = async (ctx: Context): Promise => { const { id } = ctx.req.param(); diff --git a/lib/routes/papers/query.ts b/lib/routes/papers/query.ts index 0212638a4..4adad380a 100644 --- a/lib/routes/papers/query.ts +++ b/lib/routes/papers/query.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import parser from '@/utils/rss-parser'; const pdfUrlGenerators = { diff --git a/lib/routes/paradigm/writing.ts b/lib/routes/paradigm/writing.ts index ab9bf221b..129ae71f6 100644 --- a/lib/routes/paradigm/writing.ts +++ b/lib/routes/paradigm/writing.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://www.paradigm.xyz'; diff --git a/lib/routes/parliament.uk/commonslibrary.ts b/lib/routes/parliament.uk/commonslibrary.ts index 41fa182b7..a9c4dab66 100644 --- a/lib/routes/parliament.uk/commonslibrary.ts +++ b/lib/routes/parliament.uk/commonslibrary.ts @@ -1,5 +1,6 @@ import { load } from 'cheerio'; -import { Route } from '@/types'; + +import type { Route } from '@/types'; import puppeteer from '@/utils/puppeteer'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/parliament.uk/lordslibrary.ts b/lib/routes/parliament.uk/lordslibrary.ts index f0f07beda..9a6d7c414 100644 --- a/lib/routes/parliament.uk/lordslibrary.ts +++ b/lib/routes/parliament.uk/lordslibrary.ts @@ -1,5 +1,6 @@ import { load } from 'cheerio'; -import { Route } from '@/types'; + +import type { Route } from '@/types'; import puppeteer from '@/utils/puppeteer'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/parliament.uk/petitions.ts b/lib/routes/parliament.uk/petitions.ts index 31110b7cd..62dec5cb0 100644 --- a/lib/routes/parliament.uk/petitions.ts +++ b/lib/routes/parliament.uk/petitions.ts @@ -1,12 +1,12 @@ import path from 'node:path'; +import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { load, type CheerioAPI } from 'cheerio'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; export const handler = async (ctx: Context): Promise => { const { state = 'all' } = ctx.req.param(); diff --git a/lib/routes/parliament/section77.ts b/lib/routes/parliament/section77.ts index dcc140e27..753fdd9b9 100644 --- a/lib/routes/parliament/section77.ts +++ b/lib/routes/parliament/section77.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import timezone from '@/utils/timezone'; -import { CookieJar } from 'tough-cookie'; export const route: Route = { path: '/section77/:type?', diff --git a/lib/routes/patagonia/new-arrivals.ts b/lib/routes/patagonia/new-arrivals.ts index 406d8e0cd..a20cd4b58 100644 --- a/lib/routes/patagonia/new-arrivals.ts +++ b/lib/routes/patagonia/new-arrivals.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; + const host = 'https://www.patagonia.com'; const categoryMap = { mens: ['mens-new', 'mens-new-arrivals'], diff --git a/lib/routes/patreon/feed.ts b/lib/routes/patreon/feed.ts index 26a143a41..8c9a7ff54 100644 --- a/lib/routes/patreon/feed.ts +++ b/lib/routes/patreon/feed.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; -import { CreatorData, MediaRelation, PostData } from './types'; +import path from 'node:path'; +import * as cheerio from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; import { art } from '@/utils/render'; -import { config } from '@/config'; + +import type { CreatorData, MediaRelation, PostData } from './types'; export const route: Route = { path: '/:creator', diff --git a/lib/routes/paulgraham/article.ts b/lib/routes/paulgraham/article.ts index a6a21caf0..ef13e112b 100644 --- a/lib/routes/paulgraham/article.ts +++ b/lib/routes/paulgraham/article.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/pconline/focus.ts b/lib/routes/pconline/focus.ts index e818ff34b..54db04046 100644 --- a/lib/routes/pconline/focus.ts +++ b/lib/routes/pconline/focus.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.pconline.com.cn'; diff --git a/lib/routes/pencilnews/index.ts b/lib/routes/pencilnews/index.ts index f39f9a687..c8d0e625e 100644 --- a/lib/routes/pencilnews/index.ts +++ b/lib/routes/pencilnews/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/penguin-random-house/articles.ts b/lib/routes/penguin-random-house/articles.ts index 05d58bf35..0c7771668 100644 --- a/lib/routes/penguin-random-house/articles.ts +++ b/lib/routes/penguin-random-house/articles.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import utils from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; +import utils from './utils'; + export const route: Route = { path: '/articles', categories: ['reading'], diff --git a/lib/routes/penguin-random-house/thereaddown.ts b/lib/routes/penguin-random-house/thereaddown.ts index fed6056e2..941d8c1b1 100644 --- a/lib/routes/penguin-random-house/thereaddown.ts +++ b/lib/routes/penguin-random-house/thereaddown.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import utils from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; +import utils from './utils'; + export const route: Route = { path: '/the-read-down', categories: ['reading'], diff --git a/lib/routes/penguin-random-house/utils.ts b/lib/routes/penguin-random-house/utils.ts index 89e274914..a1303943d 100644 --- a/lib/routes/penguin-random-house/utils.ts +++ b/lib/routes/penguin-random-house/utils.ts @@ -1,9 +1,11 @@ -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const parseBookInList = (element) => { const $ = load(element); diff --git a/lib/routes/people/index.ts b/lib/routes/people/index.ts index 2915b09c9..e9040ebdf 100644 --- a/lib/routes/people/index.ts +++ b/lib/routes/people/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import { isValidHost } from '@/utils/valid-host'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; +import { isValidHost } from '@/utils/valid-host'; export const route: Route = { path: '/:site?/:category{.+}?', diff --git a/lib/routes/people/liuyan.ts b/lib/routes/people/liuyan.ts index ab3cbb6f7..4d1487315 100644 --- a/lib/routes/people/liuyan.ts +++ b/lib/routes/people/liuyan.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/people/xjpjh.ts b/lib/routes/people/xjpjh.ts index ed899cf16..0aa1f01a4 100644 --- a/lib/routes/people/xjpjh.ts +++ b/lib/routes/people/xjpjh.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import * as url from 'node:url'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import * as url from 'node:url'; const host = 'http://jhsjk.people.cn'; diff --git a/lib/routes/peopo/topic.ts b/lib/routes/peopo/topic.ts index 1043ac759..2fcf23f70 100644 --- a/lib/routes/peopo/topic.ts +++ b/lib/routes/peopo/topic.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const baseUrl = 'https://www.peopo.org'; export const route: Route = { diff --git a/lib/routes/phoronix/index.ts b/lib/routes/phoronix/index.ts index 0438af8c5..d4b869742 100644 --- a/lib/routes/phoronix/index.ts +++ b/lib/routes/phoronix/index.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; -import got from '@/utils/got'; import dayjs from 'dayjs'; -import utc from 'dayjs/plugin/utc.js'; import timezone from 'dayjs/plugin/timezone.js'; +import utc from 'dayjs/plugin/utc.js'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import ofetch from '@/utils/ofetch'; +import parser from '@/utils/rss-parser'; + dayjs.extend(utc); dayjs.extend(timezone); diff --git a/lib/routes/pianyivps/rss.ts b/lib/routes/pianyivps/rss.ts index 1649363cd..fdfa1a981 100644 --- a/lib/routes/pianyivps/rss.ts +++ b/lib/routes/pianyivps/rss.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/', diff --git a/lib/routes/pianyuan/app.ts b/lib/routes/pianyuan/app.ts index c77c3e1f5..0b1aae91e 100644 --- a/lib/routes/pianyuan/app.ts +++ b/lib/routes/pianyuan/app.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/pianyuan/search.ts b/lib/routes/pianyuan/search.ts index e56121824..faefcf800 100644 --- a/lib/routes/pianyuan/search.ts +++ b/lib/routes/pianyuan/search.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/pianyuan/utils.ts b/lib/routes/pianyuan/utils.ts index de18c2fcd..35e1cf694 100644 --- a/lib/routes/pianyuan/utils.ts +++ b/lib/routes/pianyuan/utils.ts @@ -1,7 +1,9 @@ import { load } from 'cheerio'; -import got from '@/utils/got'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import got from '@/utils/got'; + const security_key = 'pianyuan-security_session_verify'; const PHPSESSID_key = 'pianyuan-PHPSESSID'; const loginauth_key = 'pianyuan-py_loginauth'; diff --git a/lib/routes/picnob.info/user.ts b/lib/routes/picnob.info/user.ts index 62bd457e1..f4b08df47 100644 --- a/lib/routes/picnob.info/user.ts +++ b/lib/routes/picnob.info/user.ts @@ -1,11 +1,14 @@ -import { config } from '@/config'; -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; -import { Post, Profile, Pull, Status, Story } from './types'; import xxhash from 'xxhash-wasm'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import type { Post, Profile, Pull, Status, Story } from './types'; + export const route: Route = { path: '/user/:id/:type?', categories: ['social-media'], diff --git a/lib/routes/picnob/user.ts b/lib/routes/picnob/user.ts index 1a5731535..42af225ee 100644 --- a/lib/routes/picnob/user.ts +++ b/lib/routes/picnob/user.ts @@ -1,9 +1,12 @@ +import { load } from 'cheerio'; +import type { ConnectResult, Options } from 'puppeteer-real-browser'; +import { connect } from 'puppeteer-real-browser'; + import { config } from '@/config'; -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import { parseRelativeDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import { connect, Options, ConnectResult } from 'puppeteer-real-browser'; const realBrowserOption: Options = { args: ['--start-maximized'], diff --git a/lib/routes/picuki/profile.ts b/lib/routes/picuki/profile.ts index 7b1f01b0e..5525cbf0b 100644 --- a/lib/routes/picuki/profile.ts +++ b/lib/routes/picuki/profile.ts @@ -1,13 +1,14 @@ -import { DataItem, Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import { config } from '@/config'; -import { getPuppeteerPage } from '@/utils/puppeteer'; import NotFoundError from '@/errors/types/not-found'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { getPuppeteerPage } from '@/utils/puppeteer'; +import { art } from '@/utils/render'; export const route: Route = { path: '/profile/:id/:type?/:functionalFlag?', diff --git a/lib/routes/pikabu/community.ts b/lib/routes/pikabu/community.ts index e656943ac..da009163d 100644 --- a/lib/routes/pikabu/community.ts +++ b/lib/routes/pikabu/community.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, fixImage, fixVideo } from './utils'; export const route: Route = { diff --git a/lib/routes/pikabu/user.ts b/lib/routes/pikabu/user.ts index 34f054f74..6f78330ca 100644 --- a/lib/routes/pikabu/user.ts +++ b/lib/routes/pikabu/user.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, fixImage, fixVideo } from './utils'; export const route: Route = { diff --git a/lib/routes/pikabu/utils.ts b/lib/routes/pikabu/utils.ts index 4bbb4c243..6664a291f 100644 --- a/lib/routes/pikabu/utils.ts +++ b/lib/routes/pikabu/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; +import { art } from '@/utils/render'; + const baseUrl = 'https://pikabu.ru'; const fixImage = (element) => { diff --git a/lib/routes/pincong/hot.ts b/lib/routes/pincong/hot.ts index 643577d62..5ddc38ed2 100644 --- a/lib/routes/pincong/hot.ts +++ b/lib/routes/pincong/hot.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, puppeteerGet } from './utils'; export const route: Route = { diff --git a/lib/routes/pincong/index.ts b/lib/routes/pincong/index.ts index 8160dc482..0efbd7f63 100644 --- a/lib/routes/pincong/index.ts +++ b/lib/routes/pincong/index.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, puppeteerGet } from './utils'; export const route: Route = { diff --git a/lib/routes/pincong/topic.ts b/lib/routes/pincong/topic.ts index 54418ef1d..3bbbb3a6e 100644 --- a/lib/routes/pincong/topic.ts +++ b/lib/routes/pincong/topic.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, puppeteerGet } from './utils'; export const route: Route = { diff --git a/lib/routes/pingwest/status.ts b/lib/routes/pingwest/status.ts index 9031f3895..132e413ea 100644 --- a/lib/routes/pingwest/status.ts +++ b/lib/routes/pingwest/status.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/pingwest/tag.ts b/lib/routes/pingwest/tag.ts index 173093ff3..89fb9f3d0 100644 --- a/lib/routes/pingwest/tag.ts +++ b/lib/routes/pingwest/tag.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/pingwest/user.ts b/lib/routes/pingwest/user.ts index 65b5ace35..83bace538 100644 --- a/lib/routes/pingwest/user.ts +++ b/lib/routes/pingwest/user.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/pingwest/utils.ts b/lib/routes/pingwest/utils.ts index 2c5733fbc..d713cae84 100644 --- a/lib/routes/pingwest/utils.ts +++ b/lib/routes/pingwest/utils.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import got from '@/utils/got'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/pinterest/user.ts b/lib/routes/pinterest/user.ts index 568e64146..66376f4c4 100644 --- a/lib/routes/pinterest/user.ts +++ b/lib/routes/pinterest/user.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { BoardsFeedResource, UserActivityPinsResource, UserProfile } from './types'; + +import type { BoardsFeedResource, UserActivityPinsResource, UserProfile } from './types'; export const route: Route = { path: '/user/:username/:type?', diff --git a/lib/routes/pixabay/search.ts b/lib/routes/pixabay/search.ts index 6f117315d..68d4fb8fa 100644 --- a/lib/routes/pixabay/search.ts +++ b/lib/routes/pixabay/search.ts @@ -1,10 +1,11 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/search/:q/:order?', diff --git a/lib/routes/pixelstech/index.ts b/lib/routes/pixelstech/index.ts index 63d14f744..b74e5a0eb 100644 --- a/lib/routes/pixelstech/index.ts +++ b/lib/routes/pixelstech/index.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { topic } = ctx.req.param(); diff --git a/lib/routes/pixiv/api/get-bookmarks.ts b/lib/routes/pixiv/api/get-bookmarks.ts index 3250e0576..30f1f3ce2 100644 --- a/lib/routes/pixiv/api/get-bookmarks.ts +++ b/lib/routes/pixiv/api/get-bookmarks.ts @@ -1,7 +1,8 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + /** * 获取用户的收藏 * diff --git a/lib/routes/pixiv/api/get-illust-detail.ts b/lib/routes/pixiv/api/get-illust-detail.ts index 64f524f1f..543e0895f 100644 --- a/lib/routes/pixiv/api/get-illust-detail.ts +++ b/lib/routes/pixiv/api/get-illust-detail.ts @@ -1,7 +1,8 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + /** * 获取插画详细信息 * @param {string} illust_id 插画作品 id diff --git a/lib/routes/pixiv/api/get-illust-follows.ts b/lib/routes/pixiv/api/get-illust-follows.ts index 404ce3512..af4f15734 100644 --- a/lib/routes/pixiv/api/get-illust-follows.ts +++ b/lib/routes/pixiv/api/get-illust-follows.ts @@ -1,7 +1,8 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + /** * 获取用户关注的画师们的最新插画 * @param {string} token pixiv oauth token diff --git a/lib/routes/pixiv/api/get-illusts.ts b/lib/routes/pixiv/api/get-illusts.ts index 409dde729..266bda9ef 100644 --- a/lib/routes/pixiv/api/get-illusts.ts +++ b/lib/routes/pixiv/api/get-illusts.ts @@ -1,7 +1,8 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + /** * 获取用户插画作品 * @param {string} user_id 目标用户id diff --git a/lib/routes/pixiv/api/get-ranking.ts b/lib/routes/pixiv/api/get-ranking.ts index b7fd154d7..e91889a1f 100644 --- a/lib/routes/pixiv/api/get-ranking.ts +++ b/lib/routes/pixiv/api/get-ranking.ts @@ -1,8 +1,10 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import assert from 'node:assert'; + import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + const allowMode = new Set(['day', 'week', 'month', 'day_male', 'day_female', 'day_ai', 'week_original', 'week_rookie', 'day_r18', 'day_r18_ai', 'day_male_r18', 'day_female_r18', 'week_r18', 'week_r18g']); /** diff --git a/lib/routes/pixiv/api/get-user-detail.ts b/lib/routes/pixiv/api/get-user-detail.ts index 6fd24e909..e06ff6b74 100644 --- a/lib/routes/pixiv/api/get-user-detail.ts +++ b/lib/routes/pixiv/api/get-user-detail.ts @@ -1,7 +1,8 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + /** * pixiv 用户 * @typedef {{user: {id: number, name: string, account: string, profile_image_urls: any, comment: string}, profile: any} userDetail diff --git a/lib/routes/pixiv/api/search-illust.ts b/lib/routes/pixiv/api/search-illust.ts index 064769d79..93e7e7d4e 100644 --- a/lib/routes/pixiv/api/search-illust.ts +++ b/lib/routes/pixiv/api/search-illust.ts @@ -1,7 +1,8 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + /** * 按时间排序搜索内容 * @param {string} keyword 关键词 diff --git a/lib/routes/pixiv/api/search-popular-illust.ts b/lib/routes/pixiv/api/search-popular-illust.ts index a75cf3e15..e2486d302 100644 --- a/lib/routes/pixiv/api/search-popular-illust.ts +++ b/lib/routes/pixiv/api/search-popular-illust.ts @@ -1,7 +1,8 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + /** * 按热门排序搜索内容 * @param {string} keyword 关键词 diff --git a/lib/routes/pixiv/bookmarks.ts b/lib/routes/pixiv/bookmarks.ts index 0220b0981..dd86b2a02 100644 --- a/lib/routes/pixiv/bookmarks.ts +++ b/lib/routes/pixiv/bookmarks.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { getToken } from './token'; +import { parseDate } from '@/utils/parse-date'; + import getBookmarks from './api/get-bookmarks'; import getUserDetail from './api/get-user-detail'; -import { config } from '@/config'; +import { getToken } from './token'; import pixivUtils from './utils'; -import { parseDate } from '@/utils/parse-date'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/user/bookmarks/:id', diff --git a/lib/routes/pixiv/illustfollow.ts b/lib/routes/pixiv/illustfollow.ts index d4e3f7dcf..6e9028519 100644 --- a/lib/routes/pixiv/illustfollow.ts +++ b/lib/routes/pixiv/illustfollow.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { getToken } from './token'; -import getIllustFollows from './api/get-illust-follows'; import { config } from '@/config'; -import pixivUtils from './utils'; -import { parseDate } from '@/utils/parse-date'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; + +import getIllustFollows from './api/get-illust-follows'; +import { getToken } from './token'; +import pixivUtils from './utils'; export const route: Route = { path: '/user/illustfollows', diff --git a/lib/routes/pixiv/novel-api/content/nsfw.ts b/lib/routes/pixiv/novel-api/content/nsfw.ts index 86eab24e6..721ae9ab0 100644 --- a/lib/routes/pixiv/novel-api/content/nsfw.ts +++ b/lib/routes/pixiv/novel-api/content/nsfw.ts @@ -1,12 +1,14 @@ import { JSDOM, VirtualConsole } from 'jsdom'; -import cache from '@/utils/cache'; -import got from '../../pixiv-got'; -import { maskHeader } from '../../constants'; import queryString from 'query-string'; -import { parseNovelContent } from './utils'; -import type { NovelContent, NSFWNovelDetail } from './types'; + +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; +import { maskHeader } from '../../constants'; +import got from '../../pixiv-got'; +import type { NovelContent, NSFWNovelDetail } from './types'; +import { parseNovelContent } from './utils'; + export async function getNSFWNovelContent(novelId: string, token: string): Promise { return (await cache.tryGet(`https://app-api.pixiv.net/webview/v2/novel:${novelId}`, async () => { const response = await got('https://app-api.pixiv.net/webview/v2/novel', { diff --git a/lib/routes/pixiv/novel-api/content/sfw.ts b/lib/routes/pixiv/novel-api/content/sfw.ts index c58d2489d..cec316999 100644 --- a/lib/routes/pixiv/novel-api/content/sfw.ts +++ b/lib/routes/pixiv/novel-api/content/sfw.ts @@ -1,10 +1,11 @@ -import got from '@/utils/got'; import cache from '@/utils/cache'; -import pixivUtils from '../../utils'; -import { parseNovelContent } from './utils'; -import { NovelContent, SFWNovelDetail } from './types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import pixivUtils from '../../utils'; +import type { NovelContent, SFWNovelDetail } from './types'; +import { parseNovelContent } from './utils'; + const baseUrl = 'https://www.pixiv.net'; export async function getSFWNovelContent(novelId: string): Promise { diff --git a/lib/routes/pixiv/novel-api/content/utils.ts b/lib/routes/pixiv/novel-api/content/utils.ts index cbb0d4e0a..b440798dd 100644 --- a/lib/routes/pixiv/novel-api/content/utils.ts +++ b/lib/routes/pixiv/novel-api/content/utils.ts @@ -1,7 +1,9 @@ import { load } from 'cheerio'; + +import logger from '@/utils/logger'; + import getIllustDetail from '../../api/get-illust-detail'; import pixivUtils from '../../utils'; -import logger from '@/utils/logger'; export function convertPixivProtocolExtended(caption: string): string { const protocolMap = new Map([ diff --git a/lib/routes/pixiv/novel-api/series/nsfw.ts b/lib/routes/pixiv/novel-api/series/nsfw.ts index bb230fe19..cb8db0832 100644 --- a/lib/routes/pixiv/novel-api/series/nsfw.ts +++ b/lib/routes/pixiv/novel-api/series/nsfw.ts @@ -1,14 +1,16 @@ -import got from '../../pixiv-got'; -import { maskHeader } from '../../constants'; -import { getNSFWNovelContent } from '../content/nsfw'; -import pixivUtils from '../../utils'; -import { AppNovelSeries, SeriesDetail, SeriesFeed } from './types'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; -import { getToken } from '../../token'; -import { config } from '@/config'; -import cache from '@/utils/cache'; import queryString from 'query-string'; +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import cache from '@/utils/cache'; + +import { maskHeader } from '../../constants'; +import got from '../../pixiv-got'; +import { getToken } from '../../token'; +import pixivUtils from '../../utils'; +import { getNSFWNovelContent } from '../content/nsfw'; +import type { AppNovelSeries, SeriesDetail, SeriesFeed } from './types'; + const baseUrl = 'https://www.pixiv.net'; async function getNovelSeries(seriesId: string, offset: number, token: string): Promise { diff --git a/lib/routes/pixiv/novel-api/series/sfw.ts b/lib/routes/pixiv/novel-api/series/sfw.ts index d9e3d45ca..0b4b0cf3f 100644 --- a/lib/routes/pixiv/novel-api/series/sfw.ts +++ b/lib/routes/pixiv/novel-api/series/sfw.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { getSFWNovelContent } from '../content/sfw'; + +import got from '@/utils/got'; + import pixivUtils from '../../utils'; -import { SeriesContentResponse, SeriesFeed } from './types'; +import { getSFWNovelContent } from '../content/sfw'; +import type { SeriesContentResponse, SeriesFeed } from './types'; const baseUrl = 'https://www.pixiv.net'; diff --git a/lib/routes/pixiv/novel-api/user-novels/nsfw.ts b/lib/routes/pixiv/novel-api/user-novels/nsfw.ts index b55f188e0..db9a896de 100644 --- a/lib/routes/pixiv/novel-api/user-novels/nsfw.ts +++ b/lib/routes/pixiv/novel-api/user-novels/nsfw.ts @@ -1,16 +1,18 @@ -import got from '../../pixiv-got'; -import { maskHeader } from '../../constants'; import queryString from 'query-string'; + import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; + +import { maskHeader } from '../../constants'; +import got from '../../pixiv-got'; +import { getToken } from '../../token'; import pixivUtils from '../../utils'; import { getNSFWNovelContent } from '../content/nsfw'; -import { parseDate } from '@/utils/parse-date'; import { convertPixivProtocolExtended } from '../content/utils'; -import type { NSFWNovelsResponse, NovelList } from './types'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; -import cache from '@/utils/cache'; -import { getToken } from '../../token'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { NovelList, NSFWNovelsResponse } from './types'; function getNovels(user_id: string, token: string): Promise { return got('https://app-api.pixiv.net/v1/user/novels', { diff --git a/lib/routes/pixiv/novel-api/user-novels/sfw.ts b/lib/routes/pixiv/novel-api/user-novels/sfw.ts index ce7fbed89..61b3b8bd0 100644 --- a/lib/routes/pixiv/novel-api/user-novels/sfw.ts +++ b/lib/routes/pixiv/novel-api/user-novels/sfw.ts @@ -1,8 +1,9 @@ import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import pixivUtils from '../../utils'; import { getSFWNovelContent } from '../content/sfw'; -import type { SFWNovelsResponse, NovelList } from './types'; +import type { NovelList, SFWNovelsResponse } from './types'; const baseUrl = 'https://www.pixiv.net'; diff --git a/lib/routes/pixiv/novel-series.ts b/lib/routes/pixiv/novel-series.ts index 6343be281..4f1097a88 100644 --- a/lib/routes/pixiv/novel-series.ts +++ b/lib/routes/pixiv/novel-series.ts @@ -1,9 +1,10 @@ -import { Data, Route } from '@/types'; import { config } from '@/config'; +import type { Data, Route } from '@/types'; +import got from '@/utils/got'; + import { getNSFWSeriesNovels } from './novel-api/series/nsfw'; import { getSFWSeriesNovels } from './novel-api/series/sfw'; -import { SeriesDetail } from './novel-api/series/types'; -import got from '@/utils/got'; +import type { SeriesDetail } from './novel-api/series/types'; const baseUrl = 'https://www.pixiv.net'; diff --git a/lib/routes/pixiv/novels.ts b/lib/routes/pixiv/novels.ts index 1ea94c242..6eff8472a 100644 --- a/lib/routes/pixiv/novels.ts +++ b/lib/routes/pixiv/novels.ts @@ -1,9 +1,11 @@ -import { Data, Route, ViewType } from '@/types'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; + import { getNSFWUserNovels } from './novel-api/user-novels/nsfw'; import { getSFWUserNovels } from './novel-api/user-novels/sfw'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/user/novels/:id/:full_content?', diff --git a/lib/routes/pixiv/pixiv-got.ts b/lib/routes/pixiv/pixiv-got.ts index a935500c8..d1eafa702 100644 --- a/lib/routes/pixiv/pixiv-got.ts +++ b/lib/routes/pixiv/pixiv-got.ts @@ -1,8 +1,10 @@ import tls from 'node:tls'; + import ipRegex from 'ip-regex'; + +import { config } from '@/config'; import got from '@/utils/got'; import logger from '@/utils/logger'; -import { config } from '@/config'; async function dohResolve(name, jsonDohEndpoint) { try { diff --git a/lib/routes/pixiv/ranking.ts b/lib/routes/pixiv/ranking.ts index 7422ba25f..84bc503ae 100644 --- a/lib/routes/pixiv/ranking.ts +++ b/lib/routes/pixiv/ranking.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import { getToken } from './token'; -import getRanking from './api/get-ranking'; import { config } from '@/config'; -import pixivUtils from './utils'; -import { parseDate } from '@/utils/parse-date'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; + +import getRanking from './api/get-ranking'; +import { getToken } from './token'; +import pixivUtils from './utils'; const titles = { day: 'pixiv 日排行', diff --git a/lib/routes/pixiv/search.ts b/lib/routes/pixiv/search.ts index 080040d31..5ee9924c2 100644 --- a/lib/routes/pixiv/search.ts +++ b/lib/routes/pixiv/search.ts @@ -1,12 +1,14 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import { getToken } from './token'; -import searchPopularIllust from './api/search-popular-illust'; -import searchIllust from './api/search-illust'; import { config } from '@/config'; -import pixivUtils from './utils'; -import { parseDate } from '@/utils/parse-date'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; + +import searchIllust from './api/search-illust'; +import searchPopularIllust from './api/search-popular-illust'; +import { getToken } from './token'; +import pixivUtils from './utils'; export const route: Route = { path: '/search/:keyword/:order?/:mode?/:include_ai?', diff --git a/lib/routes/pixiv/token.ts b/lib/routes/pixiv/token.ts index 98356a057..c087a2700 100644 --- a/lib/routes/pixiv/token.ts +++ b/lib/routes/pixiv/token.ts @@ -1,7 +1,8 @@ import { config } from '@/config'; import logger from '@/utils/logger'; -import got from './pixiv-got'; + import { maskHeader } from './constants'; +import got from './pixiv-got'; let token = null; diff --git a/lib/routes/pixiv/user.ts b/lib/routes/pixiv/user.ts index ca074aabe..baf25f566 100644 --- a/lib/routes/pixiv/user.ts +++ b/lib/routes/pixiv/user.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import { getToken } from './token'; -import getIllusts from './api/get-illusts'; import { config } from '@/config'; -import pixivUtils from './utils'; -import { parseDate } from '@/utils/parse-date'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; + +import getIllusts from './api/get-illusts'; +import { getToken } from './token'; +import pixivUtils from './utils'; export const route: Route = { path: '/user/:id', diff --git a/lib/routes/pixivision/index.ts b/lib/routes/pixivision/index.ts index 71df03218..d397b7875 100644 --- a/lib/routes/pixivision/index.ts +++ b/lib/routes/pixivision/index.ts @@ -1,8 +1,11 @@ -import { Route, DataItem, Data, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { processContent } from './utils'; export const route: Route = { diff --git a/lib/routes/pixivision/utils.ts b/lib/routes/pixivision/utils.ts index ac05698fa..ad07b8e1c 100644 --- a/lib/routes/pixivision/utils.ts +++ b/lib/routes/pixivision/utils.ts @@ -1,4 +1,5 @@ -import { CheerioAPI } from 'cheerio'; +import type { CheerioAPI } from 'cheerio'; + import { config } from '@/config'; const multiImagePrompt = { diff --git a/lib/routes/piyao/jrpy.ts b/lib/routes/piyao/jrpy.ts index 3774ca096..a08218d6e 100644 --- a/lib/routes/piyao/jrpy.ts +++ b/lib/routes/piyao/jrpy.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.piyao.org.cn'; diff --git a/lib/routes/pkmer/recent.ts b/lib/routes/pkmer/recent.ts index 2ef02f69d..d5da8b201 100644 --- a/lib/routes/pkmer/recent.ts +++ b/lib/routes/pkmer/recent.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const baseUrl = 'https://pkmer.cn'; export const route: Route = { diff --git a/lib/routes/pku/bbs/hot.ts b/lib/routes/pku/bbs/hot.ts index c1f29e8e8..c621c8fc6 100644 --- a/lib/routes/pku/bbs/hot.ts +++ b/lib/routes/pku/bbs/hot.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { config } from '@/config'; import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/pku/cls/announcement.ts b/lib/routes/pku/cls/announcement.ts index 9523afe06..d01a788f6 100644 --- a/lib/routes/pku/cls/announcement.ts +++ b/lib/routes/pku/cls/announcement.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const homeUrl = 'https://bio.pku.edu.cn/homes/Index/news/21/21.html'; diff --git a/lib/routes/pku/cls/lecture.ts b/lib/routes/pku/cls/lecture.ts index 5f31cd64e..3582926be 100644 --- a/lib/routes/pku/cls/lecture.ts +++ b/lib/routes/pku/cls/lecture.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const homeUrl = 'http://bio.pku.edu.cn/homes/Index/news_jz/7/7.html'; diff --git a/lib/routes/pku/eecs.ts b/lib/routes/pku/eecs.ts index 2d336cd33..3f7de9c43 100644 --- a/lib/routes/pku/eecs.ts +++ b/lib/routes/pku/eecs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { eecsMap } from './utils'; diff --git a/lib/routes/pku/hr.ts b/lib/routes/pku/hr.ts index 3ced800a0..5d271eedc 100644 --- a/lib/routes/pku/hr.ts +++ b/lib/routes/pku/hr.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/pku/nsd.ts b/lib/routes/pku/nsd.ts index 1bc3011a8..a72fe87e1 100644 --- a/lib/routes/pku/nsd.ts +++ b/lib/routes/pku/nsd.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { finishArticleItem } from '@/utils/wechat-mp'; import { parseDate } from '@/utils/parse-date'; +import { finishArticleItem } from '@/utils/wechat-mp'; const baseUrl = 'https://nsd.pku.edu.cn/sylm/gd/'; diff --git a/lib/routes/pku/pkuyjs.ts b/lib/routes/pku/pkuyjs.ts index 9b174f7fb..b89eec740 100644 --- a/lib/routes/pku/pkuyjs.ts +++ b/lib/routes/pku/pkuyjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/pku/rccp/mzyt.ts b/lib/routes/pku/rccp/mzyt.ts index 69af2b0d9..26cd5ccd5 100644 --- a/lib/routes/pku/rccp/mzyt.ts +++ b/lib/routes/pku/rccp/mzyt.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://www.rccp.pku.edu.cn/mzyt/'; export const route: Route = { diff --git a/lib/routes/pku/scc/recruit.ts b/lib/routes/pku/scc/recruit.ts index 9116f9c66..7d16d5cec 100644 --- a/lib/routes/pku/scc/recruit.ts +++ b/lib/routes/pku/scc/recruit.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const arr = { diff --git a/lib/routes/pku/ss/admission.ts b/lib/routes/pku/ss/admission.ts index 267ada8b0..5fb012521 100644 --- a/lib/routes/pku/ss/admission.ts +++ b/lib/routes/pku/ss/admission.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { baseUrl, getSingleRecord, getArticle } from './common'; + +import { baseUrl, getArticle, getSingleRecord } from './common'; const host = `${baseUrl}/admission/admnotice/`; diff --git a/lib/routes/pku/ss/common.ts b/lib/routes/pku/ss/common.ts index 21ec500e8..e7416191e 100644 --- a/lib/routes/pku/ss/common.ts +++ b/lib/routes/pku/ss/common.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://www.ss.pku.edu.cn'; @@ -30,4 +31,4 @@ const getArticle = (item, tryGet) => return item; }); -export { baseUrl, getSingleRecord, getArticle }; +export { baseUrl, getArticle, getSingleRecord }; diff --git a/lib/routes/pku/ss/notice.ts b/lib/routes/pku/ss/notice.ts index 265675369..b00bf22a3 100644 --- a/lib/routes/pku/ss/notice.ts +++ b/lib/routes/pku/ss/notice.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { baseUrl, getSingleRecord, getArticle } from './common'; + +import { baseUrl, getArticle, getSingleRecord } from './common'; const host = `${baseUrl}/newscenter/notice/`; diff --git a/lib/routes/pku/ss/pg-admin.ts b/lib/routes/pku/ss/pg-admin.ts index ef6dbc21f..f16b7ccb8 100644 --- a/lib/routes/pku/ss/pg-admin.ts +++ b/lib/routes/pku/ss/pg-admin.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { baseUrl, getSingleRecord, getArticle } from './common'; + +import { baseUrl, getArticle, getSingleRecord } from './common'; const host = `${baseUrl}/admission/admbrochure/`; diff --git a/lib/routes/playno1/av.ts b/lib/routes/playno1/av.ts index b3c1e3c99..04956e769 100644 --- a/lib/routes/playno1/av.ts +++ b/lib/routes/playno1/av.ts @@ -1,10 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { cookieJar, processArticle } from './utils'; + const baseUrl = 'http://www.playno1.com'; export const route: Route = { diff --git a/lib/routes/playno1/st.ts b/lib/routes/playno1/st.ts index bda62fa98..653540e4f 100644 --- a/lib/routes/playno1/st.ts +++ b/lib/routes/playno1/st.ts @@ -1,10 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { cookieJar, processArticle } from './utils'; + const baseUrl = 'http://stno1.playno1.com'; export const route: Route = { diff --git a/lib/routes/playno1/utils.ts b/lib/routes/playno1/utils.ts index 10cbe66f8..4a4681b5b 100644 --- a/lib/routes/playno1/utils.ts +++ b/lib/routes/playno1/utils.ts @@ -1,6 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { CookieJar, Cookie } from 'tough-cookie'; +import { Cookie, CookieJar } from 'tough-cookie'; + +import got from '@/utils/got'; + const cookieJar = new CookieJar(); const cookie = Cookie.fromJSON({ key: 'playno1', diff --git a/lib/routes/playpcesor/rss.ts b/lib/routes/playpcesor/rss.ts index ce01a3660..9c212b816 100644 --- a/lib/routes/playpcesor/rss.ts +++ b/lib/routes/playpcesor/rss.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/plurk/anonymous.ts b/lib/routes/plurk/anonymous.ts index 453e76867..7ee88d659 100644 --- a/lib/routes/plurk/anonymous.ts +++ b/lib/routes/plurk/anonymous.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { baseUrl, getPlurk } from './utils'; export const route: Route = { diff --git a/lib/routes/plurk/hotlinks.ts b/lib/routes/plurk/hotlinks.ts index 503ef59a6..b655243f0 100644 --- a/lib/routes/plurk/hotlinks.ts +++ b/lib/routes/plurk/hotlinks.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { baseUrl, getPlurk } from './utils'; export const route: Route = { diff --git a/lib/routes/plurk/news.ts b/lib/routes/plurk/news.ts index 29a9a1c1d..45557a02f 100644 --- a/lib/routes/plurk/news.ts +++ b/lib/routes/plurk/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { baseUrl, fetchFriends, getPlurk } from './utils'; export const route: Route = { diff --git a/lib/routes/plurk/search.ts b/lib/routes/plurk/search.ts index 58764cb40..f14fcdc34 100644 --- a/lib/routes/plurk/search.ts +++ b/lib/routes/plurk/search.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import dayjs from 'dayjs'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import dayjs from 'dayjs'; + import { baseUrl, getPlurk } from './utils'; export const route: Route = { diff --git a/lib/routes/plurk/top.ts b/lib/routes/plurk/top.ts index 3c65320f1..b3ad3992d 100644 --- a/lib/routes/plurk/top.ts +++ b/lib/routes/plurk/top.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { baseUrl, getPlurk } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const categoryList = new Set(['topReplurks', 'topFavorites', 'topResponded']); diff --git a/lib/routes/plurk/topic.ts b/lib/routes/plurk/topic.ts index 3c2b2fb60..886646994 100644 --- a/lib/routes/plurk/topic.ts +++ b/lib/routes/plurk/topic.ts @@ -1,7 +1,10 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { baseUrl, fetchFriends, getPlurk } from './utils'; export const route: Route = { diff --git a/lib/routes/plurk/user.ts b/lib/routes/plurk/user.ts index 7fcf353ce..7c629b083 100644 --- a/lib/routes/plurk/user.ts +++ b/lib/routes/plurk/user.ts @@ -1,7 +1,10 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { baseUrl, fetchFriends, getPlurk } from './utils'; export const route: Route = { diff --git a/lib/routes/plurk/utils.ts b/lib/routes/plurk/utils.ts index 730354fa1..a070ac782 100644 --- a/lib/routes/plurk/utils.ts +++ b/lib/routes/plurk/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://www.plurk.com'; diff --git a/lib/routes/pnas/index.ts b/lib/routes/pnas/index.ts index 1e3516371..28a92fffa 100644 --- a/lib/routes/pnas/index.ts +++ b/lib/routes/pnas/index.ts @@ -1,15 +1,16 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import got from '@/utils/got'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { setCookies } from '@/utils/puppeteer-utils'; + +import { load } from 'cheerio'; import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import { setCookies } from '@/utils/puppeteer-utils'; +import { art } from '@/utils/render'; export const route: Route = { path: '/:topicPath{.+}?', diff --git a/lib/routes/podwise/collections.ts b/lib/routes/podwise/collections.ts index 98ee10118..cd2f531a6 100644 --- a/lib/routes/podwise/collections.ts +++ b/lib/routes/podwise/collections.ts @@ -1,5 +1,7 @@ -import { Route, ViewType } from '@/types'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; // 统一使用的请求库 export const route: Route = { diff --git a/lib/routes/podwise/episodes.ts b/lib/routes/podwise/episodes.ts index 5a4ac23a3..915205b67 100644 --- a/lib/routes/podwise/episodes.ts +++ b/lib/routes/podwise/episodes.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; // 统一使用的请求库 -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import dayjs from 'dayjs'; import duration from 'dayjs/plugin/duration.js'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; // 统一使用的请求库 +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + dayjs.extend(duration); export const route: Route = { diff --git a/lib/routes/pornhub/category-url.ts b/lib/routes/pornhub/category-url.ts index 7f190f6f0..ae583e23f 100644 --- a/lib/routes/pornhub/category-url.ts +++ b/lib/routes/pornhub/category-url.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { isValidHost } from '@/utils/valid-host'; -import { headers, parseItems } from './utils'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { isValidHost } from '@/utils/valid-host'; + +import { headers, parseItems } from './utils'; export const route: Route = { path: '/category_url/:url?/:language?', diff --git a/lib/routes/pornhub/category.ts b/lib/routes/pornhub/category.ts index a5d271608..5dca3a323 100644 --- a/lib/routes/pornhub/category.ts +++ b/lib/routes/pornhub/category.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { defaultDomain, renderDescription } from './utils'; -import { config } from '@/config'; export const route: Route = { path: '/category/:caty', diff --git a/lib/routes/pornhub/model.ts b/lib/routes/pornhub/model.ts index 910c90d39..cb53a52c4 100644 --- a/lib/routes/pornhub/model.ts +++ b/lib/routes/pornhub/model.ts @@ -1,9 +1,12 @@ -import { Route, ViewType, Data } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { isValidHost } from '@/utils/valid-host'; -import { headers, parseItems, getRadarDomin } from './utils'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, Route } from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { isValidHost } from '@/utils/valid-host'; + +import { getRadarDomin, headers, parseItems } from './utils'; export const route: Route = { path: '/model/:username/:language?/:sort?', diff --git a/lib/routes/pornhub/pornstar.ts b/lib/routes/pornhub/pornstar.ts index 092619b5b..06489745e 100644 --- a/lib/routes/pornhub/pornstar.ts +++ b/lib/routes/pornhub/pornstar.ts @@ -1,9 +1,12 @@ -import { Route, ViewType, Data } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { isValidHost } from '@/utils/valid-host'; -import { headers, parseItems, getRadarDomin } from './utils'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, Route } from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { isValidHost } from '@/utils/valid-host'; + +import { getRadarDomin, headers, parseItems } from './utils'; export const route: Route = { path: '/pornstar/:username/:language?/:sort?', diff --git a/lib/routes/pornhub/search.ts b/lib/routes/pornhub/search.ts index 56dd63fde..03cb877eb 100644 --- a/lib/routes/pornhub/search.ts +++ b/lib/routes/pornhub/search.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { defaultDomain, renderDescription } from './utils'; export const route: Route = { diff --git a/lib/routes/pornhub/users.ts b/lib/routes/pornhub/users.ts index 7dbfb4a4f..b14991ac5 100644 --- a/lib/routes/pornhub/users.ts +++ b/lib/routes/pornhub/users.ts @@ -1,9 +1,11 @@ -import { Route, Data } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { isValidHost } from '@/utils/valid-host'; -import { headers, parseItems, getRadarDomin } from './utils'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, Route } from '@/types'; +import got from '@/utils/got'; +import { isValidHost } from '@/utils/valid-host'; + +import { getRadarDomin, headers, parseItems } from './utils'; export const route: Route = { path: '/users/:username/:language?', diff --git a/lib/routes/pornhub/utils.ts b/lib/routes/pornhub/utils.ts index 3d1292370..0d65e0ee3 100644 --- a/lib/routes/pornhub/utils.ts +++ b/lib/routes/pornhub/utils.ts @@ -1,8 +1,10 @@ -import { art } from '@/utils/render'; import path from 'node:path'; -import { parseRelativeDate } from '@/utils/parse-date'; + import dayjs from 'dayjs'; +import { parseRelativeDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const defaultDomain = 'https://www.pornhub.com'; const headers = { @@ -38,4 +40,4 @@ const getRadarDomin = (path: string) => [ })), ]; -export { defaultDomain, headers, renderDescription, parseItems, getRadarDomin }; +export { defaultDomain, getRadarDomin, headers, parseItems, renderDescription }; diff --git a/lib/routes/postman/release-notes.ts b/lib/routes/postman/release-notes.ts index 9fa903c26..ef3d53e29 100644 --- a/lib/routes/postman/release-notes.ts +++ b/lib/routes/postman/release-notes.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/priconne-redive/news.ts b/lib/routes/priconne-redive/news.ts index 2da784008..b0a096d7a 100644 --- a/lib/routes/priconne-redive/news.ts +++ b/lib/routes/priconne-redive/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/news/:server?', categories: ['game'], diff --git a/lib/routes/producthunt/today.ts b/lib/routes/producthunt/today.ts index cd1804e6d..75ce3e89d 100644 --- a/lib/routes/producthunt/today.ts +++ b/lib/routes/producthunt/today.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; export const route: Route = { path: '/today', diff --git a/lib/routes/ps/monthly-games.ts b/lib/routes/ps/monthly-games.ts index ead30ee64..3306da329 100644 --- a/lib/routes/ps/monthly-games.ts +++ b/lib/routes/ps/monthly-games.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { art } from '@/utils/render'; export const route: Route = { diff --git a/lib/routes/ps/trophy.ts b/lib/routes/ps/trophy.ts index 3729fda21..f1554247d 100644 --- a/lib/routes/ps/trophy.ts +++ b/lib/routes/ps/trophy.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/trophy/:id', categories: ['game'], diff --git a/lib/routes/psnine/game.ts b/lib/routes/psnine/game.ts index a9960ab2d..8481ce6dc 100644 --- a/lib/routes/psnine/game.ts +++ b/lib/routes/psnine/game.ts @@ -1,8 +1,8 @@ -import type { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + const handler = async () => { const url = 'https://www.psnine.com/psngame'; const response = await ofetch(url); diff --git a/lib/routes/psnine/index.ts b/lib/routes/psnine/index.ts index 095a9b30f..0cff6134c 100644 --- a/lib/routes/psnine/index.ts +++ b/lib/routes/psnine/index.ts @@ -1,7 +1,7 @@ -import type { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseRelativeDate } from '@/utils/parse-date'; const handler = async () => { diff --git a/lib/routes/psnine/node.ts b/lib/routes/psnine/node.ts index 47823c7ef..47e7642d3 100644 --- a/lib/routes/psnine/node.ts +++ b/lib/routes/psnine/node.ts @@ -1,10 +1,10 @@ -import type { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; const handler = async (ctx) => { const { id = 'news', order = 'obdate' } = ctx.req.param(); diff --git a/lib/routes/psnine/shuzhe.ts b/lib/routes/psnine/shuzhe.ts index 312dd8022..2cb7390b8 100644 --- a/lib/routes/psnine/shuzhe.ts +++ b/lib/routes/psnine/shuzhe.ts @@ -1,8 +1,8 @@ -import type { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + const handler = async () => { const url = 'https://www.psnine.com/dd'; const response = await ofetch(url); diff --git a/lib/routes/psnine/trade.ts b/lib/routes/psnine/trade.ts index 9a926c8e1..a7c25d604 100644 --- a/lib/routes/psnine/trade.ts +++ b/lib/routes/psnine/trade.ts @@ -1,7 +1,7 @@ -import type { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseRelativeDate } from '@/utils/parse-date'; const handler = async () => { diff --git a/lib/routes/psyche/topic.ts b/lib/routes/psyche/topic.ts index 5c6034697..cf488fe9f 100644 --- a/lib/routes/psyche/topic.ts +++ b/lib/routes/psyche/topic.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { getData } from './utils'; export const route: Route = { diff --git a/lib/routes/psyche/type.ts b/lib/routes/psyche/type.ts index f4dbaeca4..56c3ac7e9 100644 --- a/lib/routes/psyche/type.ts +++ b/lib/routes/psyche/type.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import { getData } from './utils'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { getData } from './utils'; + export const route: Route = { path: '/type/:type', categories: ['new-media'], diff --git a/lib/routes/psyche/utils.ts b/lib/routes/psyche/utils.ts index 52cba2aa3..8e6cdc205 100644 --- a/lib/routes/psyche/utils.ts +++ b/lib/routes/psyche/utils.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; const getImageById = async (id) => { const response = await ofetch('https://api.aeonmedia.co/graphql', { diff --git a/lib/routes/pts/curations.ts b/lib/routes/pts/curations.ts index 372090843..3bdded723 100644 --- a/lib/routes/pts/curations.ts +++ b/lib/routes/pts/curations.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/curations', diff --git a/lib/routes/pts/index.ts b/lib/routes/pts/index.ts index ddd49bfc3..d8899e01c 100644 --- a/lib/routes/pts/index.ts +++ b/lib/routes/pts/index.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '*', diff --git a/lib/routes/pts/live.ts b/lib/routes/pts/live.ts index 5ecc57d8b..bb7bcd471 100644 --- a/lib/routes/pts/live.ts +++ b/lib/routes/pts/live.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/live/:id', diff --git a/lib/routes/pts/projects.ts b/lib/routes/pts/projects.ts index 9452b8ac0..fc74e190b 100644 --- a/lib/routes/pts/projects.ts +++ b/lib/routes/pts/projects.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/projects', diff --git a/lib/routes/publico/ciencias.ts b/lib/routes/publico/ciencias.ts index 9bd842ff8..9740e3a4c 100644 --- a/lib/routes/publico/ciencias.ts +++ b/lib/routes/publico/ciencias.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/culturas.ts b/lib/routes/publico/culturas.ts index dd344c549..f9dd2b542 100644 --- a/lib/routes/publico/culturas.ts +++ b/lib/routes/publico/culturas.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/economia.ts b/lib/routes/publico/economia.ts index be998d28c..4ed7ffb76 100644 --- a/lib/routes/publico/economia.ts +++ b/lib/routes/publico/economia.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/internacional.ts b/lib/routes/publico/internacional.ts index 7ea2b15c0..69722da62 100644 --- a/lib/routes/publico/internacional.ts +++ b/lib/routes/publico/internacional.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/mujer.ts b/lib/routes/publico/mujer.ts index e5d2438b8..85b25691a 100644 --- a/lib/routes/publico/mujer.ts +++ b/lib/routes/publico/mujer.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/opinion.ts b/lib/routes/publico/opinion.ts index 6cd7595d7..623e7b266 100644 --- a/lib/routes/publico/opinion.ts +++ b/lib/routes/publico/opinion.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/politica.ts b/lib/routes/publico/politica.ts index 75e464d14..975d50819 100644 --- a/lib/routes/publico/politica.ts +++ b/lib/routes/publico/politica.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/public.ts b/lib/routes/publico/public.ts index 6bb15a7dd..a60624da6 100644 --- a/lib/routes/publico/public.ts +++ b/lib/routes/publico/public.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/sociedad.ts b/lib/routes/publico/sociedad.ts index ff02395d8..35e506c2e 100644 --- a/lib/routes/publico/sociedad.ts +++ b/lib/routes/publico/sociedad.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/tremending.ts b/lib/routes/publico/tremending.ts index 7692662a1..55994b38f 100644 --- a/lib/routes/publico/tremending.ts +++ b/lib/routes/publico/tremending.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/pubmed/trending.ts b/lib/routes/pubmed/trending.ts index 5f114f74e..b9db7b59d 100644 --- a/lib/routes/pubmed/trending.ts +++ b/lib/routes/pubmed/trending.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/trending/:filters?', diff --git a/lib/routes/pubscholar/explore.ts b/lib/routes/pubscholar/explore.ts index 66c24df35..cee31ba77 100644 --- a/lib/routes/pubscholar/explore.ts +++ b/lib/routes/pubscholar/explore.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import sanitizeHtml from 'sanitize-html'; + +import type { Route } from '@/types'; +import md5 from '@/utils/md5'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { baseUrl, uuidv4, getArticleLink, getSignedHeaders } from './utils'; -import md5 from '@/utils/md5'; -import { Resource } from './types'; -import sanitizeHtml from 'sanitize-html'; + +import type { Resource } from './types'; +import { baseUrl, getArticleLink, getSignedHeaders, uuidv4 } from './utils'; export const route: Route = { path: '/explore/:category?/:keyword?', diff --git a/lib/routes/pubscholar/utils.ts b/lib/routes/pubscholar/utils.ts index 4fa71fac0..5c894ee07 100644 --- a/lib/routes/pubscholar/utils.ts +++ b/lib/routes/pubscholar/utils.ts @@ -1,4 +1,5 @@ import crypto from 'node:crypto'; + import CryptoJS from 'crypto-js'; const salt = '6m6pingbinwaktg227gngifoocrfbo95'; diff --git a/lib/routes/pumc/mdadmission.ts b/lib/routes/pumc/mdadmission.ts index 405c9df24..da0ce1f2a 100644 --- a/lib/routes/pumc/mdadmission.ts +++ b/lib/routes/pumc/mdadmission.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/putty/changes.ts b/lib/routes/putty/changes.ts index d108a855f..0037c89c5 100644 --- a/lib/routes/putty/changes.ts +++ b/lib/routes/putty/changes.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/pwc/sustainability.ts b/lib/routes/pwc/sustainability.ts index 91c45fd85..653fbab53 100644 --- a/lib/routes/pwc/sustainability.ts +++ b/lib/routes/pwc/sustainability.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; interface PlayerOptions { link: string; diff --git a/lib/routes/python/release.ts b/lib/routes/python/release.ts index bd77fdc17..25c2e6378 100644 --- a/lib/routes/python/release.ts +++ b/lib/routes/python/release.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/qbitai/category.ts b/lib/routes/qbitai/category.ts index 990e7475b..da4f31e30 100644 --- a/lib/routes/qbitai/category.ts +++ b/lib/routes/qbitai/category.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import parser from '@/utils/rss-parser'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/qbitai/tag.ts b/lib/routes/qbitai/tag.ts index edea512d1..7abf96a14 100644 --- a/lib/routes/qbitai/tag.ts +++ b/lib/routes/qbitai/tag.ts @@ -1,7 +1,6 @@ -import { Route } from '@/types'; -import parser from '@/utils/rss-parser'; - +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; export const route: Route = { path: '/tag/:tag', diff --git a/lib/routes/qbittorrent/news.ts b/lib/routes/qbittorrent/news.ts index 0659ccfc7..85f0e909c 100644 --- a/lib/routes/qbittorrent/news.ts +++ b/lib/routes/qbittorrent/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; export const route: Route = { path: '/news', diff --git a/lib/routes/qdu/houqin.ts b/lib/routes/qdu/houqin.ts index ed60c0d4c..2303edb7d 100644 --- a/lib/routes/qdu/houqin.ts +++ b/lib/routes/qdu/houqin.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const base = 'https://houqin.qdu.edu.cn/'; diff --git a/lib/routes/qdu/jwc.ts b/lib/routes/qdu/jwc.ts index 58d4c5fff..b79f98abd 100644 --- a/lib/routes/qdu/jwc.ts +++ b/lib/routes/qdu/jwc.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const base = 'https://jwc.qdu.edu.cn/'; diff --git a/lib/routes/qianp/news.ts b/lib/routes/qianp/news.ts index 1136b70c1..203beea20 100644 --- a/lib/routes/qianp/news.ts +++ b/lib/routes/qianp/news.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { getTokenAndSecret } from './utils'; export const route: Route = { diff --git a/lib/routes/qianzhan/column.ts b/lib/routes/qianzhan/column.ts index e6acc15c0..718bcef7f 100644 --- a/lib/routes/qianzhan/column.ts +++ b/lib/routes/qianzhan/column.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/qianzhan/rank.ts b/lib/routes/qianzhan/rank.ts index d3099afc0..6e63d24ef 100644 --- a/lib/routes/qianzhan/rank.ts +++ b/lib/routes/qianzhan/rank.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/qiche365/namespace.ts b/lib/routes/qiche365/namespace.ts index 33eee78e3..4712a06f0 100644 --- a/lib/routes/qiche365/namespace.ts +++ b/lib/routes/qiche365/namespace.ts @@ -1,4 +1,5 @@ import type { Namespace } from '@/types'; + export const namespace: Namespace = { name: '汽车召回网', url: 'qiche365.org.cn', diff --git a/lib/routes/qiche365/recall.ts b/lib/routes/qiche365/recall.ts index 882a93019..4d18836b8 100644 --- a/lib/routes/qiche365/recall.ts +++ b/lib/routes/qiche365/recall.ts @@ -1,6 +1,7 @@ -import { Route, Data, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/qidian/author.ts b/lib/routes/qidian/author.ts index ec9a1a6f1..f7cb6d697 100644 --- a/lib/routes/qidian/author.ts +++ b/lib/routes/qidian/author.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/qidian/chapter.ts b/lib/routes/qidian/chapter.ts index 2272e826e..a72f315d1 100644 --- a/lib/routes/qidian/chapter.ts +++ b/lib/routes/qidian/chapter.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/qidian/forum.ts b/lib/routes/qidian/forum.ts index 5c40a21a3..3d8096954 100644 --- a/lib/routes/qidian/forum.ts +++ b/lib/routes/qidian/forum.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/qidian/free-next.ts b/lib/routes/qidian/free-next.ts index b19d71d71..0f5bd46ef 100644 --- a/lib/routes/qidian/free-next.ts +++ b/lib/routes/qidian/free-next.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/free-next/:type?', categories: ['reading'], diff --git a/lib/routes/qidian/free.ts b/lib/routes/qidian/free.ts index a864f61c0..ede85968c 100644 --- a/lib/routes/qidian/free.ts +++ b/lib/routes/qidian/free.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/qingting/channel.ts b/lib/routes/qingting/channel.ts index 8833715da..6a9e47dfd 100644 --- a/lib/routes/qingting/channel.ts +++ b/lib/routes/qingting/channel.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/channel/:id', diff --git a/lib/routes/qingting/podcast.ts b/lib/routes/qingting/podcast.ts index 1d418f400..5bc02fddb 100644 --- a/lib/routes/qingting/podcast.ts +++ b/lib/routes/qingting/podcast.ts @@ -1,10 +1,11 @@ +import crypto from 'node:crypto'; + +import { config } from '@/config'; import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; -import crypto from 'node:crypto'; import ofetch from '@/utils/ofetch'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; +import timezone from '@/utils/timezone'; const qingtingId = config.qingting.id ?? ''; diff --git a/lib/routes/qipamaijia/index.ts b/lib/routes/qipamaijia/index.ts index e2ea456c4..3b188907d 100644 --- a/lib/routes/qipamaijia/index.ts +++ b/lib/routes/qipamaijia/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const rootUrl = 'https://www.qipamaijia.com'; export const route: Route = { diff --git a/lib/routes/qiyoujiage/price.ts b/lib/routes/qiyoujiage/price.ts index 795cf519e..10cdc51e3 100644 --- a/lib/routes/qiyoujiage/price.ts +++ b/lib/routes/qiyoujiage/price.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import md5 from '@/utils/md5'; export const route: Route = { diff --git a/lib/routes/qlu/notice.ts b/lib/routes/qlu/notice.ts index 3db95edba..760955792 100644 --- a/lib/routes/qlu/notice.ts +++ b/lib/routes/qlu/notice.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const host = 'https://www.qlu.edu.cn'; diff --git a/lib/routes/qm120/news.ts b/lib/routes/qm120/news.ts index 5be2a794d..5fbd5e891 100644 --- a/lib/routes/qm120/news.ts +++ b/lib/routes/qm120/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/news/:category?', diff --git a/lib/routes/qoo-app/apps/card.ts b/lib/routes/qoo-app/apps/card.ts index 98f5eda7e..a2bc275be 100644 --- a/lib/routes/qoo-app/apps/card.ts +++ b/lib/routes/qoo-app/apps/card.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { appsUrl } from '../utils'; export const route: Route = { diff --git a/lib/routes/qoo-app/apps/comment.ts b/lib/routes/qoo-app/apps/comment.ts index d8e13ba92..e8db39377 100644 --- a/lib/routes/qoo-app/apps/comment.ts +++ b/lib/routes/qoo-app/apps/comment.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import { appsUrl } from '../utils'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + +import { appsUrl } from '../utils'; + export const route: Route = { path: '/apps/:lang?/comment/:id', categories: ['anime'], diff --git a/lib/routes/qoo-app/apps/note.ts b/lib/routes/qoo-app/apps/note.ts index f18933b84..8a9aca13e 100644 --- a/lib/routes/qoo-app/apps/note.ts +++ b/lib/routes/qoo-app/apps/note.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { appsUrl } from '../utils'; export const route: Route = { diff --git a/lib/routes/qoo-app/apps/post.ts b/lib/routes/qoo-app/apps/post.ts index 0cf396882..0a85ef54a 100644 --- a/lib/routes/qoo-app/apps/post.ts +++ b/lib/routes/qoo-app/apps/post.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { appsUrl, newsUrl, fixImg } from '../utils'; + +import { appsUrl, fixImg, newsUrl } from '../utils'; export const route: Route = { path: '/apps/:lang?/post/:id', diff --git a/lib/routes/qoo-app/news.ts b/lib/routes/qoo-app/news.ts index 81b4e9c03..06cf23e89 100644 --- a/lib/routes/qoo-app/news.ts +++ b/lib/routes/qoo-app/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { newsUrl, siteIcon, fixImg } from './utils'; +import { fixImg, newsUrl, siteIcon } from './utils'; export const route: Route = { path: '/news/:lang?', diff --git a/lib/routes/qoo-app/notes/note.ts b/lib/routes/qoo-app/notes/note.ts index 273e5fadc..d86332157 100644 --- a/lib/routes/qoo-app/notes/note.ts +++ b/lib/routes/qoo-app/notes/note.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { ssoUrl, notesUrl } from '../utils'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { notesUrl, ssoUrl } from '../utils'; + export const route: Route = { path: '/notes/:lang?/note/:id', categories: ['anime'], diff --git a/lib/routes/qoo-app/notes/topic.ts b/lib/routes/qoo-app/notes/topic.ts index b1d69f421..178011db1 100644 --- a/lib/routes/qoo-app/notes/topic.ts +++ b/lib/routes/qoo-app/notes/topic.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { notesUrl, extractNotes } from '../utils'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { extractNotes, notesUrl } from '../utils'; export const route: Route = { path: '/notes/:lang?/topic/:topic', diff --git a/lib/routes/qoo-app/notes/user.ts b/lib/routes/qoo-app/notes/user.ts index 9b9f6398a..29def526d 100644 --- a/lib/routes/qoo-app/notes/user.ts +++ b/lib/routes/qoo-app/notes/user.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { notesUrl, extractNotes } from '../utils'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { extractNotes, notesUrl } from '../utils'; export const route: Route = { path: '/notes/:lang?/user/:uid', diff --git a/lib/routes/qoo-app/user/app-comment.ts b/lib/routes/qoo-app/user/app-comment.ts index 83ecdfece..9f050ea44 100644 --- a/lib/routes/qoo-app/user/app-comment.ts +++ b/lib/routes/qoo-app/user/app-comment.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import { userUrl, appsUrl } from '../utils'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + +import { appsUrl, userUrl } from '../utils'; + export const route: Route = { path: '/user/:lang?/appComment/:uid', categories: ['anime'], diff --git a/lib/routes/qoo-app/utils.ts b/lib/routes/qoo-app/utils.ts index 6746ad348..612ac0c6e 100644 --- a/lib/routes/qoo-app/utils.ts +++ b/lib/routes/qoo-app/utils.ts @@ -45,4 +45,4 @@ const extractNotes = ($) => { }); }; -export { appsUrl, newsUrl, notesUrl, ssoUrl, userUrl, siteIcon, fixImg, extractNotes }; +export { appsUrl, extractNotes, fixImg, newsUrl, notesUrl, siteIcon, ssoUrl, userUrl }; diff --git a/lib/routes/qq/ac/comic.ts b/lib/routes/qq/ac/comic.ts index 5b308f452..ceaccc0c3 100644 --- a/lib/routes/qq/ac/comic.ts +++ b/lib/routes/qq/ac/comic.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, mobileRootUrl } from './utils'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { mobileRootUrl, rootUrl } from './utils'; export const route: Route = { path: '/ac/comic/:id?', diff --git a/lib/routes/qq/ac/rank.ts b/lib/routes/qq/ac/rank.ts index 4e21a3fdd..553c512e2 100644 --- a/lib/routes/qq/ac/rank.ts +++ b/lib/routes/qq/ac/rank.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, ProcessItems } from './utils'; +import type { Route } from '@/types'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/ac/rank/:type?/:time?', diff --git a/lib/routes/qq/ac/utils.ts b/lib/routes/qq/ac/utils.ts index 62205ac25..6499a677f 100644 --- a/lib/routes/qq/ac/utils.ts +++ b/lib/routes/qq/ac/utils.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://ac.qq.com'; const mobileRootUrl = 'https://m.ac.qq.com'; @@ -66,4 +68,4 @@ const ProcessItems = async (ctx, currentUrl, time, title) => { }; }; -export { rootUrl, mobileRootUrl, ProcessItems }; +export { mobileRootUrl, ProcessItems, rootUrl }; diff --git a/lib/routes/qq/cfhd/index.ts b/lib/routes/qq/cfhd/index.ts index 826ec9a95..088d405f9 100644 --- a/lib/routes/qq/cfhd/index.ts +++ b/lib/routes/qq/cfhd/index.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = '60847' } = ctx.req.param(); diff --git a/lib/routes/qq/fact/index.ts b/lib/routes/qq/fact/index.ts index 67c45825e..3c79365e3 100644 --- a/lib/routes/qq/fact/index.ts +++ b/lib/routes/qq/fact/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; +import CryptoJS from 'crypto-js'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import CryptoJS from 'crypto-js'; import { art } from '@/utils/render'; -import path from 'node:path'; const getRequestToken = () => { const e = 'sgn51n6r6q97o6g3'; diff --git a/lib/routes/qq/kg/cache.ts b/lib/routes/qq/kg/cache.ts index 18cb4ac7e..59dce3eb0 100644 --- a/lib/routes/qq/kg/cache.ts +++ b/lib/routes/qq/kg/cache.ts @@ -1,6 +1,7 @@ +import { JSDOM } from 'jsdom'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { JSDOM } from 'jsdom'; export default { getPlayInfo: async (ctx, shareId, ksong_mid = '') => { diff --git a/lib/routes/qq/kg/reply.ts b/lib/routes/qq/kg/reply.ts index 901de7909..70dd6ea39 100644 --- a/lib/routes/qq/kg/reply.ts +++ b/lib/routes/qq/kg/reply.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import cache from './cache'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; +import cache from './cache'; + export const route: Route = { path: '/kg/reply/:playId', categories: ['social-media'], diff --git a/lib/routes/qq/kg/user.ts b/lib/routes/qq/kg/user.ts index 97cadacbe..e42812c21 100644 --- a/lib/routes/qq/kg/user.ts +++ b/lib/routes/qq/kg/user.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { JSDOM } from 'jsdom'; -import cache from './cache'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import cache from './cache'; + export const route: Route = { path: '/kg/:userId', categories: ['social-media'], diff --git a/lib/routes/qq/lol/news.ts b/lib/routes/qq/lol/news.ts index 18ed97dea..20b2141f2 100644 --- a/lib/routes/qq/lol/news.ts +++ b/lib/routes/qq/lol/news.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import cache from '@/utils/cache'; +import { type CheerioAPI, load } from 'cheerio'; +import { type Context } from 'hono'; import iconv from 'iconv-lite'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, load } from 'cheerio'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 23 } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/qq/pd/guild.ts b/lib/routes/qq/pd/guild.ts index 91c21736a..9bbfddcf7 100644 --- a/lib/routes/qq/pd/guild.ts +++ b/lib/routes/qq/pd/guild.ts @@ -1,11 +1,12 @@ -import { Data, DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; import type { Context } from 'hono'; -import { Feed } from './types'; -import { parseFeed } from './utils'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import type { Feed } from './types'; +import { parseFeed } from './utils'; const baseUrl = 'https://pd.qq.com/g/'; const baseApiUrl = 'https://pd.qq.com/qunng/guild/gotrpc/noauth/trpc.qchannel.commreader.ComReader/'; diff --git a/lib/routes/qq/pd/utils.ts b/lib/routes/qq/pd/utils.ts index 7e469d552..988b1b5c0 100644 --- a/lib/routes/qq/pd/utils.ts +++ b/lib/routes/qq/pd/utils.ts @@ -1,6 +1,6 @@ // Description: QQ PD utils -import { Feed, FeedImage, FeedPattern, FeedFontProps, FeedPatternData } from './types'; +import type { Feed, FeedFontProps, FeedImage, FeedPattern, FeedPatternData } from './types'; const patternTypeMap = { 1: 'text', diff --git a/lib/routes/qq/weread/category.ts b/lib/routes/qq/weread/category.ts index 410f728ca..d46e54cb2 100644 --- a/lib/routes/qq/weread/category.ts +++ b/lib/routes/qq/weread/category.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/qq88/index.ts b/lib/routes/qq88/index.ts index ef9e1141a..d446c9bd2 100644 --- a/lib/routes/qq88/index.ts +++ b/lib/routes/qq88/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/qqorw/index.ts b/lib/routes/qqorw/index.ts index b485e7ff0..592024cdb 100644 --- a/lib/routes/qqorw/index.ts +++ b/lib/routes/qqorw/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/qstheory/index.ts b/lib/routes/qstheory/index.ts index 9af215f31..a0a767519 100644 --- a/lib/routes/qstheory/index.ts +++ b/lib/routes/qstheory/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + import { baseUrl as rootUrl, getItem } from './utils'; const config = { diff --git a/lib/routes/qstheory/magazine.ts b/lib/routes/qstheory/magazine.ts index 4096ddd49..532f90092 100644 --- a/lib/routes/qstheory/magazine.ts +++ b/lib/routes/qstheory/magazine.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, getItem } from './utils'; export const route: Route = { diff --git a/lib/routes/qstheory/utils.ts b/lib/routes/qstheory/utils.ts index 08878d9c3..eda6b3c06 100644 --- a/lib/routes/qstheory/utils.ts +++ b/lib/routes/qstheory/utils.ts @@ -1,5 +1,6 @@ -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const baseUrl = 'http://www.qstheory.cn'; diff --git a/lib/routes/questmobile/report.ts b/lib/routes/questmobile/report.ts index 273d8a209..b34deddae 100644 --- a/lib/routes/questmobile/report.ts +++ b/lib/routes/questmobile/report.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; /** * Parses a tree array and returns an array of objects containing the key-value pairs. diff --git a/lib/routes/questn/community.ts b/lib/routes/questn/community.ts index f6094e8eb..f8266042d 100644 --- a/lib/routes/questn/community.ts +++ b/lib/routes/questn/community.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/community/:communityUrl', diff --git a/lib/routes/questn/events.ts b/lib/routes/questn/events.ts index 74ad6298b..3366b0ba2 100644 --- a/lib/routes/questn/events.ts +++ b/lib/routes/questn/events.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { parseFilterStr } from './util'; diff --git a/lib/routes/quicker/qa.ts b/lib/routes/quicker/qa.ts index 4f1b418d1..955fab1b6 100644 --- a/lib/routes/quicker/qa.ts +++ b/lib/routes/quicker/qa.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/qa/:category?/:state?', diff --git a/lib/routes/quicker/share.ts b/lib/routes/quicker/share.ts index f8a73ddef..db06b3ace 100644 --- a/lib/routes/quicker/share.ts +++ b/lib/routes/quicker/share.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/share/:category?', diff --git a/lib/routes/quicker/user.ts b/lib/routes/quicker/user.ts index 25a6a526f..d9814894a 100644 --- a/lib/routes/quicker/user.ts +++ b/lib/routes/quicker/user.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/user/:category/:id', diff --git a/lib/routes/quicker/versions.ts b/lib/routes/quicker/versions.ts index f99d8fd9c..9cf62a0e3 100644 --- a/lib/routes/quicker/versions.ts +++ b/lib/routes/quicker/versions.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/qust/jw.ts b/lib/routes/qust/jw.ts index 12042667a..250752fee 100644 --- a/lib/routes/qust/jw.ts +++ b/lib/routes/qust/jw.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const baseUrl = 'https://jw.qust.edu.cn/'; export const route: Route = { diff --git a/lib/routes/qweather/3days.ts b/lib/routes/qweather/3days.ts index f85a80ca3..a25df7e64 100644 --- a/lib/routes/qweather/3days.ts +++ b/lib/routes/qweather/3days.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + import { render3DaysDescription, type WeatherForecastItem } from './util'; + const author = 'QWeather'; export const route: Route = { diff --git a/lib/routes/qweather/now.ts b/lib/routes/qweather/now.ts index a891f2ffe..7409015a8 100644 --- a/lib/routes/qweather/now.ts +++ b/lib/routes/qweather/now.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; -import { renderNowDescription, type NowItem } from './util'; + +import { type NowItem, renderNowDescription } from './util'; export const route: Route = { path: '/now/:location', diff --git a/lib/routes/qweather/util.tsx b/lib/routes/qweather/util.tsx index 273d46f18..c7cb124ae 100644 --- a/lib/routes/qweather/util.tsx +++ b/lib/routes/qweather/util.tsx @@ -86,4 +86,4 @@ const Now = ({ item }: { item: NowItem }) => (

); -export { render3DaysDescription, renderNowDescription, type WeatherForecastItem, type NowItem }; +export { type NowItem, render3DaysDescription, renderNowDescription, type WeatherForecastItem }; diff --git a/lib/routes/qwenlm/blog.ts b/lib/routes/qwenlm/blog.ts index 5c7016823..befc24a9f 100644 --- a/lib/routes/qwenlm/blog.ts +++ b/lib/routes/qwenlm/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/qztc/home/index.ts b/lib/routes/qztc/home/index.ts index 872255795..953230869 100644 --- a/lib/routes/qztc/home/index.ts +++ b/lib/routes/qztc/home/index.ts @@ -1,8 +1,9 @@ -import { Data, Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const rootUrl = 'https://www.qztc.edu.cn/'; diff --git a/lib/routes/qztc/jwc/index.ts b/lib/routes/qztc/jwc/index.ts index e536f3053..f384009cb 100644 --- a/lib/routes/qztc/jwc/index.ts +++ b/lib/routes/qztc/jwc/index.ts @@ -1,8 +1,9 @@ -import { Data, Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const rootUrl = 'https://www.qztc.edu.cn/jwc/'; diff --git a/lib/routes/qztc/sjxy/index.ts b/lib/routes/qztc/sjxy/index.ts index 0cea3be85..a7f63b29b 100644 --- a/lib/routes/qztc/sjxy/index.ts +++ b/lib/routes/qztc/sjxy/index.ts @@ -1,8 +1,9 @@ -import { Data, Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const rootUrl = 'https://www.qztc.edu.cn/sjxy/'; diff --git a/lib/routes/radio-canada/latest.ts b/lib/routes/radio-canada/latest.ts index 90f786204..f7b0776e0 100644 --- a/lib/routes/radio-canada/latest.ts +++ b/lib/routes/radio-canada/latest.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/latest/:language?', diff --git a/lib/routes/radio/album.ts b/lib/routes/radio/album.ts index 69ac22eec..daf54a41f 100644 --- a/lib/routes/radio/album.ts +++ b/lib/routes/radio/album.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import timezone from '@/utils/timezone'; const audio_types = { diff --git a/lib/routes/radio/index.ts b/lib/routes/radio/index.ts index a0be7ef16..f09525aa7 100644 --- a/lib/routes/radio/index.ts +++ b/lib/routes/radio/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:id', diff --git a/lib/routes/radio/zhibo.ts b/lib/routes/radio/zhibo.ts index 85c17eae8..e53bdd0a6 100644 --- a/lib/routes/radio/zhibo.ts +++ b/lib/routes/radio/zhibo.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import CryptoJS from 'crypto-js'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import CryptoJS from 'crypto-js'; const audio_types = { m3u8: 'x-mpegURL', diff --git a/lib/routes/railway/index.ts b/lib/routes/railway/index.ts index ed8843190..4c2e89ff6 100644 --- a/lib/routes/railway/index.ts +++ b/lib/routes/railway/index.ts @@ -1,10 +1,10 @@ -import { Route, DataItem } from '@/types'; - -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; +import type { Context } from 'hono'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { Context } from 'hono'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/blog', diff --git a/lib/routes/rarehistoricalphotos/index.ts b/lib/routes/rarehistoricalphotos/index.ts index 52e875e0d..f569de4c9 100644 --- a/lib/routes/rarehistoricalphotos/index.ts +++ b/lib/routes/rarehistoricalphotos/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/raspberrypi/magazine.ts b/lib/routes/raspberrypi/magazine.ts index 746a166ed..eb5d612ca 100644 --- a/lib/routes/raspberrypi/magazine.ts +++ b/lib/routes/raspberrypi/magazine.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '12', 10); diff --git a/lib/routes/rattibha/user.ts b/lib/routes/rattibha/user.ts index 77aea5ce7..52be2f03c 100644 --- a/lib/routes/rattibha/user.ts +++ b/lib/routes/rattibha/user.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { getCurrentPath } from '@/utils/helpers'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const __dirname = getCurrentPath(import.meta.url); diff --git a/lib/routes/rawkuma/manga.ts b/lib/routes/rawkuma/manga.ts index a403591c5..7daae2cd6 100644 --- a/lib/routes/rawkuma/manga.ts +++ b/lib/routes/rawkuma/manga.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/manga/:id', diff --git a/lib/routes/raycast/changelog.ts b/lib/routes/raycast/changelog.ts index 35e72f539..7e3f8cdba 100644 --- a/lib/routes/raycast/changelog.ts +++ b/lib/routes/raycast/changelog.ts @@ -1,7 +1,8 @@ -import type { Route, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; const handler: Route['handler'] = async () => { diff --git a/lib/routes/react/blog.ts b/lib/routes/react/blog.ts index a1d3f2f01..38e79c704 100644 --- a/lib/routes/react/blog.ts +++ b/lib/routes/react/blog.ts @@ -1,8 +1,9 @@ -import type { DataItem, Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const handler: Route['handler'] = async () => { const data = await ofetch('https://react.dev/blog'); diff --git a/lib/routes/reactiflux/transcripts.ts b/lib/routes/reactiflux/transcripts.ts index 881b7a886..5f2abf7a1 100644 --- a/lib/routes/reactiflux/transcripts.ts +++ b/lib/routes/reactiflux/transcripts.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/reactnewsletter/reactnewsletter.ts b/lib/routes/reactnewsletter/reactnewsletter.ts index d763664de..e8d908771 100644 --- a/lib/routes/reactnewsletter/reactnewsletter.ts +++ b/lib/routes/reactnewsletter/reactnewsletter.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -const currentURL = 'https://reactnewsletter.com/issues'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +const currentURL = 'https://reactnewsletter.com/issues'; + export const route: Route = { path: '/', radar: [ diff --git a/lib/routes/readhub/daily.ts b/lib/routes/readhub/daily.ts index 71572b8cb..cff69db28 100644 --- a/lib/routes/readhub/daily.ts +++ b/lib/routes/readhub/daily.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, apiRootUrl, processItems } from './util'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { apiRootUrl, processItems, rootUrl } from './util'; export const route: Route = { path: '/daily', diff --git a/lib/routes/readhub/index.ts b/lib/routes/readhub/index.ts index 7e535f15b..a405411bc 100644 --- a/lib/routes/readhub/index.ts +++ b/lib/routes/readhub/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; -import { rootUrl, apiTopicUrl, art, processItems } from './util'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import { apiTopicUrl, art, processItems, rootUrl } from './util'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/readhub/util.ts b/lib/routes/readhub/util.ts index a97f45548..08e6c9f62 100644 --- a/lib/routes/readhub/util.ts +++ b/lib/routes/readhub/util.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import dayjs from 'dayjs'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import dayjs from 'dayjs'; const domain = 'readhub.cn'; const rootUrl = `https://${domain}`; @@ -59,6 +61,6 @@ const processItems = async (items, tryGet) => ) ); -export { rootUrl, apiRootUrl, apiTopicUrl, processItems }; +export { apiRootUrl, apiTopicUrl, processItems, rootUrl }; export { art } from '@/utils/render'; diff --git a/lib/routes/readwise/list.ts b/lib/routes/readwise/list.ts index f996a7e08..a480ced39 100644 --- a/lib/routes/readwise/list.ts +++ b/lib/routes/readwise/list.ts @@ -1,7 +1,7 @@ -import ConfigNotFoundError from '@/errors/types/config-not-found'; -import ofetch from '@/utils/ofetch'; -import { Route } from '@/types'; import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/rebase/geekdaily.ts b/lib/routes/rebase/geekdaily.ts index 7ac9e4a7e..37a6ffae8 100644 --- a/lib/routes/rebase/geekdaily.ts +++ b/lib/routes/rebase/geekdaily.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/remnote/changelog.ts b/lib/routes/remnote/changelog.ts index 511cedcc4..b6e78a79e 100644 --- a/lib/routes/remnote/changelog.ts +++ b/lib/routes/remnote/changelog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const FQDN = 'feedback.remnote.com'; const apiGateway = 'https://gateway.hellonext.co'; diff --git a/lib/routes/researchgate/publications.ts b/lib/routes/researchgate/publications.ts index d00f42ead..b455c395f 100644 --- a/lib/routes/researchgate/publications.ts +++ b/lib/routes/researchgate/publications.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/routes/resetera/thread.ts b/lib/routes/resetera/thread.ts index bc980b322..fc3441141 100644 --- a/lib/routes/resetera/thread.ts +++ b/lib/routes/resetera/thread.ts @@ -1,7 +1,8 @@ // lib/routes/resetera/thread.ts +import { load } from 'cheerio'; + import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; const BASE = 'https://www.resetera.com'; diff --git a/lib/routes/resonac/products.ts b/lib/routes/resonac/products.ts index 68d0a11dd..67c3ce556 100644 --- a/lib/routes/resonac/products.ts +++ b/lib/routes/resonac/products.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; // import { parseDate } from '@/utils/parse-date'; // import timezone from '@/utils/timezone'; diff --git a/lib/routes/reuters/common.ts b/lib/routes/reuters/common.ts index 12064725d..97e7493fc 100644 --- a/lib/routes/reuters/common.ts +++ b/lib/routes/reuters/common.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category/:topic?', diff --git a/lib/routes/reuters/investigates.ts b/lib/routes/reuters/investigates.ts index b75960567..82be8df6a 100644 --- a/lib/routes/reuters/investigates.ts +++ b/lib/routes/reuters/investigates.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/rfa/index.ts b/lib/routes/rfa/index.ts index 4afa1ebba..b437a8a75 100644 --- a/lib/routes/rfa/index.ts +++ b/lib/routes/rfa/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/rfi/news.ts b/lib/routes/rfi/news.ts index cd5977a55..d1fe744cc 100644 --- a/lib/routes/rfi/news.ts +++ b/lib/routes/rfi/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/right/forum.ts b/lib/routes/right/forum.ts index e0152337a..0cf8a887b 100644 --- a/lib/routes/right/forum.ts +++ b/lib/routes/right/forum.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/forum/:id?', diff --git a/lib/routes/robots.txt.ts b/lib/routes/robots.txt.ts index 3185d1bdb..20b9d1bf6 100644 --- a/lib/routes/robots.txt.ts +++ b/lib/routes/robots.txt.ts @@ -1,4 +1,5 @@ import type { Handler } from 'hono'; + import { config } from '@/config'; const handler: Handler = (ctx) => { diff --git a/lib/routes/rockthejvm/articles.ts b/lib/routes/rockthejvm/articles.ts index ffe2d97f4..6e7ac6b8b 100644 --- a/lib/routes/rockthejvm/articles.ts +++ b/lib/routes/rockthejvm/articles.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/rodong/news.ts b/lib/routes/rodong/news.ts index 07258ceef..1335f9e0d 100644 --- a/lib/routes/rodong/news.ts +++ b/lib/routes/rodong/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'http://www.rodong.rep.kp'; diff --git a/lib/routes/routledge/book-series.ts b/lib/routes/routledge/book-series.ts index 78bb418e6..248e85d2c 100644 --- a/lib/routes/routledge/book-series.ts +++ b/lib/routes/routledge/book-series.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:bookName/book-series/:bookId', diff --git a/lib/routes/rsc/journal.ts b/lib/routes/rsc/journal.ts index 7b1e924d0..47ae3828d 100644 --- a/lib/routes/rsc/journal.ts +++ b/lib/routes/rsc/journal.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/journal/:id/:category?', diff --git a/lib/routes/rss3/index.ts b/lib/routes/rss3/index.ts index bd96959f4..62235918a 100644 --- a/lib/routes/rss3/index.ts +++ b/lib/routes/rss3/index.ts @@ -1,8 +1,8 @@ -import { Route, type DataItem } from '@/types'; +import { renderItemActionToHTML } from '@rss3/sdk'; +import type { type DataItem, Route } from '@/types'; import { camelcaseKeys } from '@/utils/camelcase-keys'; import ofetch from '@/utils/ofetch'; -import { renderItemActionToHTML } from '@rss3/sdk'; export const route: Route = { path: '/:account/:network?/:tag?', diff --git a/lib/routes/rss3/interfaces/metadata.ts b/lib/routes/rss3/interfaces/metadata.ts index 52b40a8c3..0bfcea375 100644 --- a/lib/routes/rss3/interfaces/metadata.ts +++ b/lib/routes/rss3/interfaces/metadata.ts @@ -1,4 +1,4 @@ -import { +import type { CollectibleApproval, CollectibleBurn, CollectibleMint, @@ -20,9 +20,9 @@ import { SocialRevise, SocialReward, SocialShare, + StakerProfitSnapshot, StakeStaking, StakeTransaction, - StakerProfitSnapshot, TransactionApproval, TransactionBridge, TransactionBurn, @@ -30,6 +30,7 @@ import { TransactionMint, TransactionTransfer, } from '@rss3/sdk'; + export type RSS3DataModels = { CollectibleApproval: CollectibleApproval; CollectibleBurn: CollectibleBurn; diff --git a/lib/routes/rsshub/routes.ts b/lib/routes/rsshub/routes.ts index 421b28010..274f0b585 100644 --- a/lib/routes/rsshub/routes.ts +++ b/lib/routes/rsshub/routes.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/routes/:lang?', categories: ['program-update'], diff --git a/lib/routes/rsshub/transform/html.ts b/lib/routes/rsshub/transform/html.ts index af1d6471b..d712cf1bf 100644 --- a/lib/routes/rsshub/transform/html.ts +++ b/lib/routes/rsshub/transform/html.ts @@ -1,10 +1,11 @@ -import { DataItem, Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import sanitizeHtml from 'sanitize-html'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; -import sanitizeHtml from 'sanitize-html'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; export const route: Route = { path: '/transform/html/:url/:routeParams', diff --git a/lib/routes/rsshub/transform/json.ts b/lib/routes/rsshub/transform/json.ts index 09d1af601..9d0823d91 100644 --- a/lib/routes/rsshub/transform/json.ts +++ b/lib/routes/rsshub/transform/json.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; function jsonGet(obj, attr) { if (typeof attr !== 'string') { diff --git a/lib/routes/rsshub/transform/sitemap.ts b/lib/routes/rsshub/transform/sitemap.ts index f013e943a..94f63ee65 100644 --- a/lib/routes/rsshub/transform/sitemap.ts +++ b/lib/routes/rsshub/transform/sitemap.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/transform/sitemap/:url/:routeParams?', diff --git a/lib/routes/ruancan/category.ts b/lib/routes/ruancan/category.ts index ea61a6744..a1111e395 100644 --- a/lib/routes/ruancan/category.ts +++ b/lib/routes/ruancan/category.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import fetchFeed from './utils'; export const route: Route = { diff --git a/lib/routes/ruancan/index.ts b/lib/routes/ruancan/index.ts index de304f9b3..5e6a66ad2 100644 --- a/lib/routes/ruancan/index.ts +++ b/lib/routes/ruancan/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import fetchFeed from './utils'; export const route: Route = { diff --git a/lib/routes/ruancan/search.ts b/lib/routes/ruancan/search.ts index 55a8fae37..ad067e54f 100644 --- a/lib/routes/ruancan/search.ts +++ b/lib/routes/ruancan/search.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import fetchFeed from './utils'; export const route: Route = { diff --git a/lib/routes/ruancan/user.ts b/lib/routes/ruancan/user.ts index 431e7bc48..df2dd2c8f 100644 --- a/lib/routes/ruancan/user.ts +++ b/lib/routes/ruancan/user.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import fetchFeed from './utils'; export const route: Route = { diff --git a/lib/routes/ruancan/utils.ts b/lib/routes/ruancan/utils.ts index 75eaeb133..9b4365a7b 100644 --- a/lib/routes/ruancan/utils.ts +++ b/lib/routes/ruancan/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const fetchFeed = async (ctx, currentUrl) => { diff --git a/lib/routes/ruankao/news.ts b/lib/routes/ruankao/news.ts index 1d0cff612..679c775ec 100644 --- a/lib/routes/ruankao/news.ts +++ b/lib/routes/ruankao/news.ts @@ -1,8 +1,10 @@ +import { load } from 'cheerio'; + import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; + const BASE_URL = 'https://www.ruankao.org.cn/index/work.html'; const removeFontPresetting = (html: string = ''): string => { diff --git a/lib/routes/ruc/ai.ts b/lib/routes/ruc/ai.ts index 1a8f639ee..e99326439 100644 --- a/lib/routes/ruc/ai.ts +++ b/lib/routes/ruc/ai.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; export const route: Route = { path: '/ai/:category?', diff --git a/lib/routes/ruc/hr.ts b/lib/routes/ruc/hr.ts index 7c81ca193..612f35707 100644 --- a/lib/routes/ruc/hr.ts +++ b/lib/routes/ruc/hr.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/runtrail/posts.ts b/lib/routes/runtrail/posts.ts index 5e2be6f31..1323bab71 100644 --- a/lib/routes/runtrail/posts.ts +++ b/lib/routes/runtrail/posts.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/rustcc/jobs.ts b/lib/routes/rustcc/jobs.ts index bcb291289..02d50ef6d 100644 --- a/lib/routes/rustcc/jobs.ts +++ b/lib/routes/rustcc/jobs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/rustcc/news.ts b/lib/routes/rustcc/news.ts index cccac9c06..66a9f5892 100644 --- a/lib/routes/rustcc/news.ts +++ b/lib/routes/rustcc/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sakurazaka46/blog.ts b/lib/routes/sakurazaka46/blog.ts index 2bc756d95..eea3c63d5 100644 --- a/lib/routes/sakurazaka46/blog.ts +++ b/lib/routes/sakurazaka46/blog.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/blog/:id?/:page?', diff --git a/lib/routes/sakurazaka46/news.ts b/lib/routes/sakurazaka46/news.ts index 58fb34729..c9866129e 100644 --- a/lib/routes/sakurazaka46/news.ts +++ b/lib/routes/sakurazaka46/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/samd/news.ts b/lib/routes/samd/news.ts index 097c42de4..3efe7aaa6 100644 --- a/lib/routes/samd/news.ts +++ b/lib/routes/samd/news.ts @@ -1,9 +1,10 @@ -import { Route, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; const dict = { '434': '行业资讯', '436': '协会动态', '438': '重要通知', '440': '政策法规' }; diff --git a/lib/routes/samrdprc/index.ts b/lib/routes/samrdprc/index.ts index be5a0968f..692101a04 100644 --- a/lib/routes/samrdprc/index.ts +++ b/lib/routes/samrdprc/index.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { id = 'xwdt/gzdt' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '17', 10); diff --git a/lib/routes/samrdprc/news.ts b/lib/routes/samrdprc/news.ts index 629f32dd6..8dc5efaf5 100644 --- a/lib/routes/samrdprc/news.ts +++ b/lib/routes/samrdprc/news.ts @@ -1,8 +1,9 @@ -import { Route, DataItem } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/news/:type1/:type2', diff --git a/lib/routes/samsung/research/blog.ts b/lib/routes/samsung/research/blog.ts index 750d82bd3..159e9118c 100644 --- a/lib/routes/samsung/research/blog.ts +++ b/lib/routes/samsung/research/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sankei/news.ts b/lib/routes/sankei/news.ts index cbd723e6f..192f38974 100644 --- a/lib/routes/sankei/news.ts +++ b/lib/routes/sankei/news.ts @@ -1,10 +1,10 @@ -import { Route, Data, DataItem } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { Context } from 'hono'; export const route: Route = { path: '/news/:category', diff --git a/lib/routes/sankei/topics.ts b/lib/routes/sankei/topics.ts index 852031847..6c8d1557f 100644 --- a/lib/routes/sankei/topics.ts +++ b/lib/routes/sankei/topics.ts @@ -1,10 +1,10 @@ -import { Route, Data, DataItem } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { Context } from 'hono'; export const route: Route = { path: ['/topics/:topic'], diff --git a/lib/routes/sara/index.ts b/lib/routes/sara/index.ts index 27520482a..0f66e8953 100644 --- a/lib/routes/sara/index.ts +++ b/lib/routes/sara/index.ts @@ -1,6 +1,7 @@ -import { Route, DataItem } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; const typeMap = { diff --git a/lib/routes/saraba1st/digest.ts b/lib/routes/saraba1st/digest.ts index 94493e467..48c849afa 100644 --- a/lib/routes/saraba1st/digest.ts +++ b/lib/routes/saraba1st/digest.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/digest/:tid', diff --git a/lib/routes/saraba1st/thread.ts b/lib/routes/saraba1st/thread.ts index 3c7b3d24c..80390852e 100644 --- a/lib/routes/saraba1st/thread.ts +++ b/lib/routes/saraba1st/thread.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import queryString from 'query-string'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sass/gs/index.ts b/lib/routes/sass/gs/index.ts index 6400849ad..c3ea0e9eb 100644 --- a/lib/routes/sass/gs/index.ts +++ b/lib/routes/sass/gs/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://gs.sass.org.cn'; diff --git a/lib/routes/scau/yjs.ts b/lib/routes/scau/yjs.ts index 36e164b58..6454a5e8b 100644 --- a/lib/routes/scau/yjs.ts +++ b/lib/routes/scau/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/scau/yjsy.ts b/lib/routes/scau/yjsy.ts index 0cdcb77a2..00872744e 100644 --- a/lib/routes/scau/yjsy.ts +++ b/lib/routes/scau/yjsy.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/science/blogs.ts b/lib/routes/science/blogs.ts index 1ddd29ec8..7e42daf67 100644 --- a/lib/routes/science/blogs.ts +++ b/lib/routes/science/blogs.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { baseUrl } from './utils'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import { baseUrl } from './utils'; + export const route: Route = { path: '/blogs/:name?', categories: ['journal'], diff --git a/lib/routes/science/cover.ts b/lib/routes/science/cover.ts index bc5c8b5bb..f8970f06c 100644 --- a/lib/routes/science/cover.ts +++ b/lib/routes/science/cover.ts @@ -1,5 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; // journals form AAAS publishing group // // science: Science @@ -8,12 +11,10 @@ import { Route } from '@/types'; // scirobotics: Science Robotics // signaling: Science Signaling // stm: Science Translational Medicine - import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { baseUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/science/current.ts b/lib/routes/science/current.ts index 759421fc4..17d65e692 100644 --- a/lib/routes/science/current.ts +++ b/lib/routes/science/current.ts @@ -1,5 +1,3 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; // journals form AAAS publishing group // // science: Science @@ -8,12 +6,15 @@ import cache from '@/utils/cache'; // scirobotics: Science Robotics // signaling: Science Signaling // stm: Science Translational Medicine - import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; -import { baseUrl, fetchDesc, getItem } from './utils'; import puppeteer from '@/utils/puppeteer'; +import { baseUrl, fetchDesc, getItem } from './utils'; + export const route: Route = { path: '/current/:journal?', categories: ['journal'], diff --git a/lib/routes/science/early.ts b/lib/routes/science/early.ts index c3d006061..5cc20e2e8 100644 --- a/lib/routes/science/early.ts +++ b/lib/routes/science/early.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/routes/science/utils.ts b/lib/routes/science/utils.ts index a49e54526..e616d1fb9 100644 --- a/lib/routes/science/utils.ts +++ b/lib/routes/science/utils.ts @@ -1,7 +1,9 @@ -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const baseUrl = 'https://www.science.org'; diff --git a/lib/routes/sciencedirect/call-for-paper.ts b/lib/routes/sciencedirect/call-for-paper.ts index 290a9eb17..c3954a869 100644 --- a/lib/routes/sciencedirect/call-for-paper.ts +++ b/lib/routes/sciencedirect/call-for-paper.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/call-for-paper/:subject', categories: ['journal'], diff --git a/lib/routes/sciencedirect/cf-email.ts b/lib/routes/sciencedirect/cf-email.ts index 39f7cc651..21af4821b 100644 --- a/lib/routes/sciencedirect/cf-email.ts +++ b/lib/routes/sciencedirect/cf-email.ts @@ -29,7 +29,6 @@ export { * @returns decoded email address */ decodeCFEmail, - /** * Returns CloudFlare protected email address. * @param {String} email - email in plaintext diff --git a/lib/routes/sciencedirect/current-issue.ts b/lib/routes/sciencedirect/current-issue.ts index 6657e61cb..0349c31e8 100644 --- a/lib/routes/sciencedirect/current-issue.ts +++ b/lib/routes/sciencedirect/current-issue.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import sanitizeHtml from 'sanitize-html'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import sanitizeHtml from 'sanitize-html'; -import { config } from '@/config'; export const route: Route = { path: '/journal/:id/current', diff --git a/lib/routes/sciencedirect/journal.ts b/lib/routes/sciencedirect/journal.ts index cc5364049..dcac29bdb 100644 --- a/lib/routes/sciencedirect/journal.ts +++ b/lib/routes/sciencedirect/journal.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { decodeCFEmail } from './cf-email'; export const route: Route = { diff --git a/lib/routes/sciencenet/blog.ts b/lib/routes/sciencenet/blog.ts index af867f18a..f2550276a 100644 --- a/lib/routes/sciencenet/blog.ts +++ b/lib/routes/sciencenet/blog.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/blog/:type?/:time?/:sort?', diff --git a/lib/routes/sciencenet/user.ts b/lib/routes/sciencenet/user.ts index 5e65a1c38..5a64c3c88 100644 --- a/lib/routes/sciencenet/user.ts +++ b/lib/routes/sciencenet/user.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/user/:id', diff --git a/lib/routes/scientificamerican/podcast.ts b/lib/routes/scientificamerican/podcast.ts index 423fe8da9..caebf9bd2 100644 --- a/lib/routes/scientificamerican/podcast.ts +++ b/lib/routes/scientificamerican/podcast.ts @@ -3,12 +3,11 @@ import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - -import { art } from '@/utils/render'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/scitechvista/index.ts b/lib/routes/scitechvista/index.ts index 1709b45f4..72cdf98ff 100644 --- a/lib/routes/scitechvista/index.ts +++ b/lib/routes/scitechvista/index.ts @@ -1,12 +1,14 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import { type Data, type DataItem, type Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; import { namespace } from './namespace'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; -import { art } from '@/utils/render'; const baseUrl = `https://${namespace.url}`; diff --git a/lib/routes/scmp/coronavirus.ts b/lib/routes/scmp/coronavirus.ts index 193267e80..6e7e15903 100644 --- a/lib/routes/scmp/coronavirus.ts +++ b/lib/routes/scmp/coronavirus.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + export const route: Route = { path: '/coronavirus', categories: ['other'], diff --git a/lib/routes/scmp/index.ts b/lib/routes/scmp/index.ts index b3eb8dae4..a1e86888e 100644 --- a/lib/routes/scmp/index.ts +++ b/lib/routes/scmp/index.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/scmp/topic.ts b/lib/routes/scmp/topic.ts index 97e53528c..5b008dc92 100644 --- a/lib/routes/scmp/topic.ts +++ b/lib/routes/scmp/topic.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/scmp/utils.ts b/lib/routes/scmp/utils.ts index ddfa87762..648c6c0ea 100644 --- a/lib/routes/scmp/utils.ts +++ b/lib/routes/scmp/utils.ts @@ -1,6 +1,7 @@ import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const renderHTML = (node) => { if (!node) { diff --git a/lib/routes/scnu/cs/match.ts b/lib/routes/scnu/cs/match.ts index 17ef9bd8e..4d56f42a3 100644 --- a/lib/routes/scnu/cs/match.ts +++ b/lib/routes/scnu/cs/match.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/scnu/jw.ts b/lib/routes/scnu/jw.ts index 8bfe1bd14..591a5a9b0 100644 --- a/lib/routes/scnu/jw.ts +++ b/lib/routes/scnu/jw.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/scnu/library.ts b/lib/routes/scnu/library.ts index f64b3f932..9972b43ea 100644 --- a/lib/routes/scnu/library.ts +++ b/lib/routes/scnu/library.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/scnu/physics-school-announcements-and-news.ts b/lib/routes/scnu/physics-school-announcements-and-news.ts index 47e0f7ffa..aa82dcef0 100644 --- a/lib/routes/scnu/physics-school-announcements-and-news.ts +++ b/lib/routes/scnu/physics-school-announcements-and-news.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const getAritlces = async (category, url, cache) => { const { data } = await got(url); diff --git a/lib/routes/scnu/ss.ts b/lib/routes/scnu/ss.ts index 7f2ec38a8..0ed04b7e7 100644 --- a/lib/routes/scnu/ss.ts +++ b/lib/routes/scnu/ss.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/scnu/yjs.ts b/lib/routes/scnu/yjs.ts index ff2b571ea..6f5aaeabf 100644 --- a/lib/routes/scnu/yjs.ts +++ b/lib/routes/scnu/yjs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/yjs', categories: ['university'], diff --git a/lib/routes/scoop/apps.ts b/lib/routes/scoop/apps.ts index 829698f4c..a41ef2005 100644 --- a/lib/routes/scoop/apps.ts +++ b/lib/routes/scoop/apps.ts @@ -1,12 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const orderbys = (desc: string) => { const base = { diff --git a/lib/routes/scpta/news.ts b/lib/routes/scpta/news.ts index f0c32dd2d..90003dab1 100644 --- a/lib/routes/scpta/news.ts +++ b/lib/routes/scpta/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/news/:category', diff --git a/lib/routes/sctv/programme.ts b/lib/routes/sctv/programme.ts index e156f8923..3d62e9771 100644 --- a/lib/routes/sctv/programme.ts +++ b/lib/routes/sctv/programme.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/programme/:id?/:limit?/:isFull?', diff --git a/lib/routes/scu/jwc/tzgg.ts b/lib/routes/scu/jwc/tzgg.ts index dcc7383e3..07fffc87f 100644 --- a/lib/routes/scu/jwc/tzgg.ts +++ b/lib/routes/scu/jwc/tzgg.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 const baseUrl = 'https://jwc.scu.edu.cn/tzgg.htm'; const baseIndexUrl = 'https://jwc.scu.edu.cn/'; diff --git a/lib/routes/scu/scupi/_utils.ts b/lib/routes/scu/scupi/_utils.ts index 295220cfc..7ea8074db 100644 --- a/lib/routes/scu/scupi/_utils.ts +++ b/lib/routes/scu/scupi/_utils.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export async function getNotifList() { try { diff --git a/lib/routes/scu/scupi/notice.ts b/lib/routes/scu/scupi/notice.ts index 845722300..73c7b55ca 100644 --- a/lib/routes/scu/scupi/notice.ts +++ b/lib/routes/scu/scupi/notice.ts @@ -1,9 +1,10 @@ // Warning: The author still knows nothing about javascript! -import { getNotifList, getArticle } from './_utils'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import { getArticle, getNotifList } from './_utils'; + export const route: Route = { path: '/scupi', categories: ['university'], diff --git a/lib/routes/scut/gzic/media.ts b/lib/routes/scut/gzic/media.ts index 6d94de2a8..4dc01169d 100644 --- a/lib/routes/scut/gzic/media.ts +++ b/lib/routes/scut/gzic/media.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/gzic/media', diff --git a/lib/routes/scut/gzic/news.ts b/lib/routes/scut/gzic/news.ts index d295d929b..c512910de 100644 --- a/lib/routes/scut/gzic/news.ts +++ b/lib/routes/scut/gzic/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/gzic/news', diff --git a/lib/routes/scut/gzic/notice.ts b/lib/routes/scut/gzic/notice.ts index ce55a124f..9c9281ad3 100644 --- a/lib/routes/scut/gzic/notice.ts +++ b/lib/routes/scut/gzic/notice.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const categoryMap = { xsyg: { title: '学术预告', tag: '30284' }, diff --git a/lib/routes/scut/jwc/news.ts b/lib/routes/scut/jwc/news.ts index f286e805c..8c86719d8 100644 --- a/lib/routes/scut/jwc/news.ts +++ b/lib/routes/scut/jwc/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import querystring from 'node:querystring'; +import * as url from 'node:url'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import * as url from 'node:url'; -import querystring from 'node:querystring'; const baseUrl = 'http://jw.scut.edu.cn'; const refererUrl = baseUrl + '/dist/'; diff --git a/lib/routes/scut/jwc/notice.ts b/lib/routes/scut/jwc/notice.ts index bbd6794ea..fd807371a 100644 --- a/lib/routes/scut/jwc/notice.ts +++ b/lib/routes/scut/jwc/notice.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import querystring from 'node:querystring'; +import * as url from 'node:url'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import * as url from 'node:url'; -import querystring from 'node:querystring'; const baseUrl = 'http://jw.scut.edu.cn'; const refererUrl = baseUrl + '/dist/'; diff --git a/lib/routes/scut/jwc/school.ts b/lib/routes/scut/jwc/school.ts index ad41dc2fb..0b0879f21 100644 --- a/lib/routes/scut/jwc/school.ts +++ b/lib/routes/scut/jwc/school.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import querystring from 'node:querystring'; +import * as url from 'node:url'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import * as url from 'node:url'; -import querystring from 'node:querystring'; const baseUrl = 'http://jw.scut.edu.cn'; const refererUrl = baseUrl + '/dist/'; diff --git a/lib/routes/scut/scet/notice.ts b/lib/routes/scut/scet/notice.ts index ddbacbaca..3e324c412 100644 --- a/lib/routes/scut/scet/notice.ts +++ b/lib/routes/scut/scet/notice.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/scet/notice', categories: ['university'], diff --git a/lib/routes/scut/seie/news-ccenter.ts b/lib/routes/scut/seie/news-ccenter.ts index c42d405a5..888378683 100644 --- a/lib/routes/scut/seie/news-ccenter.ts +++ b/lib/routes/scut/seie/news-ccenter.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/scut/smae/notice.ts b/lib/routes/scut/smae/notice.ts index 206ca57ce..5daac4609 100644 --- a/lib/routes/scut/smae/notice.ts +++ b/lib/routes/scut/smae/notice.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 导入必要的模组 import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const categoryMap = { diff --git a/lib/routes/scut/yjs.ts b/lib/routes/scut/yjs.ts index 4e95cfd10..743072cb2 100644 --- a/lib/routes/scut/yjs.ts +++ b/lib/routes/scut/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/scvtc/xygg.ts b/lib/routes/scvtc/xygg.ts index b2aabc852..5a2101b84 100644 --- a/lib/routes/scvtc/xygg.ts +++ b/lib/routes/scvtc/xygg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sdo/ff14risingstones/api.ts b/lib/routes/sdo/ff14risingstones/api.ts index e91e4bad0..be8da2448 100644 --- a/lib/routes/sdo/ff14risingstones/api.ts +++ b/lib/routes/sdo/ff14risingstones/api.ts @@ -1,4 +1,5 @@ import cache from '@/utils/cache'; + import { API_URL } from './constant'; import type { DutiesPartyDetail, FreeCompanyPartyDetail, NoviceNetworkParty, PostDetail, Resently, UserDynamic, UserInfo, UserPost } from './types'; import { requestAPI } from './utils'; diff --git a/lib/routes/sdo/ff14risingstones/posts.ts b/lib/routes/sdo/ff14risingstones/posts.ts index dd142d535..cf35b36f8 100644 --- a/lib/routes/sdo/ff14risingstones/posts.ts +++ b/lib/routes/sdo/ff14risingstones/posts.ts @@ -1,8 +1,10 @@ -import type { Route } from '@/types'; -import { INDEX_URL, LOGO_URL, POST_PART, POST_TYPE, REQUIRE_CONFIG } from './constant'; import type { Context } from 'hono'; -import { checkConfig, generatePostFeeds } from './utils'; + +import type { Route } from '@/types'; + import { getPosts } from './api'; +import { INDEX_URL, LOGO_URL, POST_PART, POST_TYPE, REQUIRE_CONFIG } from './constant'; +import { checkConfig, generatePostFeeds } from './utils'; export const route: Route = { path: '/ff14risingstones/posts/:pid?/:type?', diff --git a/lib/routes/sdo/ff14risingstones/strats.ts b/lib/routes/sdo/ff14risingstones/strats.ts index 6b75187fd..218a2540e 100644 --- a/lib/routes/sdo/ff14risingstones/strats.ts +++ b/lib/routes/sdo/ff14risingstones/strats.ts @@ -1,8 +1,10 @@ -import type { Route } from '@/types'; -import { INDEX_URL, LOGO_URL, POST_TYPE, REQUIRE_CONFIG, STRAT_PART } from './constant'; import type { Context } from 'hono'; -import { checkConfig, generatePostFeeds } from './utils'; + +import type { Route } from '@/types'; + import { getPosts } from './api'; +import { INDEX_URL, LOGO_URL, POST_TYPE, REQUIRE_CONFIG, STRAT_PART } from './constant'; +import { checkConfig, generatePostFeeds } from './utils'; export const route: Route = { path: '/ff14risingstones/strats/:pid?/:type?', diff --git a/lib/routes/sdo/ff14risingstones/timeline.ts b/lib/routes/sdo/ff14risingstones/timeline.ts index f8bfa1e9d..b964e4c70 100644 --- a/lib/routes/sdo/ff14risingstones/timeline.ts +++ b/lib/routes/sdo/ff14risingstones/timeline.ts @@ -1,8 +1,10 @@ -import type { Data, Route } from '@/types'; -import { INDEX_URL, LOGO_URL, REQUIRE_CONFIG } from './constant'; import type { Context } from 'hono'; -import { checkConfig, generateDynamicFeeds } from './utils'; + +import type { Data, Route } from '@/types'; + import { getFollowDynamicList } from './api'; +import { INDEX_URL, LOGO_URL, REQUIRE_CONFIG } from './constant'; +import { checkConfig, generateDynamicFeeds } from './utils'; export const route: Route = { path: '/ff14risingstones/timeline', diff --git a/lib/routes/sdo/ff14risingstones/types/dynamic.ts b/lib/routes/sdo/ff14risingstones/types/dynamic.ts index 6d6532d2d..1cdb2f8ab 100644 --- a/lib/routes/sdo/ff14risingstones/types/dynamic.ts +++ b/lib/routes/sdo/ff14risingstones/types/dynamic.ts @@ -1,6 +1,6 @@ import type { DynamicSource } from '../constant'; import type { DateTimeFormat, UserPost } from './other'; -import type { DutiesParty, NoviceNetworkParty, FreeCompanyParty, OtherParty, RolePlayParty } from './party'; +import type { DutiesParty, FreeCompanyParty, NoviceNetworkParty, OtherParty, RolePlayParty } from './party'; interface BaseUserDynamic { character_name: string; diff --git a/lib/routes/sdo/ff14risingstones/user-dynamics.ts b/lib/routes/sdo/ff14risingstones/user-dynamics.ts index 200170aa7..1886fdca7 100644 --- a/lib/routes/sdo/ff14risingstones/user-dynamics.ts +++ b/lib/routes/sdo/ff14risingstones/user-dynamics.ts @@ -1,8 +1,10 @@ -import type { Data, Route } from '@/types'; -import { INDEX_URL, REQUIRE_CONFIG } from './constant'; import type { Context } from 'hono'; -import { checkConfig, generateDynamicFeeds } from './utils'; + +import type { Data, Route } from '@/types'; + import { getUserDynamic, getUserInfo } from './api'; +import { INDEX_URL, REQUIRE_CONFIG } from './constant'; +import { checkConfig, generateDynamicFeeds } from './utils'; export const route: Route = { path: '/ff14risingstones/user-dynamics/:uid', diff --git a/lib/routes/sdo/ff14risingstones/user-posts.ts b/lib/routes/sdo/ff14risingstones/user-posts.ts index d06e2cff5..0937449f7 100644 --- a/lib/routes/sdo/ff14risingstones/user-posts.ts +++ b/lib/routes/sdo/ff14risingstones/user-posts.ts @@ -1,8 +1,10 @@ -import type { Data, Route } from '@/types'; -import { INDEX_URL, REQUIRE_CONFIG } from './constant'; import type { Context } from 'hono'; -import { checkConfig, generatePostFeeds } from './utils'; + +import type { Data, Route } from '@/types'; + import { getUserInfo, getUserPosts } from './api'; +import { INDEX_URL, REQUIRE_CONFIG } from './constant'; +import { checkConfig, generatePostFeeds } from './utils'; export const route: Route = { path: '/ff14risingstones/user-posts/:uid', diff --git a/lib/routes/sdo/ff14risingstones/user-resently.ts b/lib/routes/sdo/ff14risingstones/user-resently.ts index 6040e6093..df453df2e 100644 --- a/lib/routes/sdo/ff14risingstones/user-resently.ts +++ b/lib/routes/sdo/ff14risingstones/user-resently.ts @@ -1,11 +1,13 @@ -import type { Data, Route } from '@/types'; -import { INDEX_URL, REQUIRE_CONFIG } from './constant'; import type { Context } from 'hono'; -import { checkConfig } from './utils'; -import { getResently, getUserInfo } from './api'; + +import type { Data, Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { getResently, getUserInfo } from './api'; +import { INDEX_URL, REQUIRE_CONFIG } from './constant'; +import { checkConfig } from './utils'; + export const route: Route = { path: '/ff14risingstones/user-resently/:uid', categories: ['bbs'], diff --git a/lib/routes/sdo/ff14risingstones/user-strats.ts b/lib/routes/sdo/ff14risingstones/user-strats.ts index 480c31965..2386e7699 100644 --- a/lib/routes/sdo/ff14risingstones/user-strats.ts +++ b/lib/routes/sdo/ff14risingstones/user-strats.ts @@ -1,8 +1,10 @@ -import type { Data, Route } from '@/types'; -import { INDEX_URL, REQUIRE_CONFIG } from './constant'; import type { Context } from 'hono'; -import { checkConfig, generatePostFeeds } from './utils'; + +import type { Data, Route } from '@/types'; + import { getUserInfo, getUserPosts } from './api'; +import { INDEX_URL, REQUIRE_CONFIG } from './constant'; +import { checkConfig, generatePostFeeds } from './utils'; export const route: Route = { path: '/ff14risingstones/user-strats/:uid', diff --git a/lib/routes/sdo/ff14risingstones/utils.ts b/lib/routes/sdo/ff14risingstones/utils.ts index 93c64eb4e..dc8b3b160 100644 --- a/lib/routes/sdo/ff14risingstones/utils.ts +++ b/lib/routes/sdo/ff14risingstones/utils.ts @@ -1,14 +1,16 @@ +import path from 'node:path'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { DataItem } from '@/types'; import ofetch from '@/utils/ofetch'; -import type { BaseResponse, DutiesPartyDetail, FreeCompanyPartyDetail, NoviceNetworkParty, PostDetail, UserDynamic, UserPost } from './types'; -import { DataItem } from '@/types'; -import { DynamicSource, INDEX_URL, JOB, NoviceNetworkIdentity, PLAY_STYLE } from './constant'; -import { getDutiesRecruitDetail, getFreeCompanyRecruitDetail, getNoviceNetworkRecruitDetail, getPostsDetail } from './api'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; + +import { getDutiesRecruitDetail, getFreeCompanyRecruitDetail, getNoviceNetworkRecruitDetail, getPostsDetail } from './api'; +import { DynamicSource, INDEX_URL, JOB, NoviceNetworkIdentity, PLAY_STYLE } from './constant'; +import type { BaseResponse, DutiesPartyDetail, FreeCompanyPartyDetail, NoviceNetworkParty, PostDetail, UserDynamic, UserPost } from './types'; export function checkConfig() { if (!config.sdo.ff14risingstones || !config.sdo.ua) { diff --git a/lib/routes/sdu/cmse.ts b/lib/routes/sdu/cmse.ts index 8affc159a..b6c0a8297 100644 --- a/lib/routes/sdu/cmse.ts +++ b/lib/routes/sdu/cmse.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'http://www.cmse.sdu.edu.cn/'; diff --git a/lib/routes/sdu/cs/index.ts b/lib/routes/sdu/cs/index.ts index 63760d348..a7f1c4444 100644 --- a/lib/routes/sdu/cs/index.ts +++ b/lib/routes/sdu/cs/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; diff --git a/lib/routes/sdu/cs/yjsgz.ts b/lib/routes/sdu/cs/yjsgz.ts index 3ebffc9ef..08da928e3 100644 --- a/lib/routes/sdu/cs/yjsgz.ts +++ b/lib/routes/sdu/cs/yjsgz.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; diff --git a/lib/routes/sdu/epe.ts b/lib/routes/sdu/epe.ts index 7b5e5af8d..613b01eb4 100644 --- a/lib/routes/sdu/epe.ts +++ b/lib/routes/sdu/epe.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sdu/extractor/index.ts b/lib/routes/sdu/extractor/index.ts index 8e58211f5..55edee95b 100644 --- a/lib/routes/sdu/extractor/index.ts +++ b/lib/routes/sdu/extractor/index.ts @@ -1,7 +1,7 @@ -import news from './wh/news'; -import view from './view'; import sdrj from './sdrj'; +import view from './view'; import jwc from './wh/jwc'; +import news from './wh/news'; const index = (link) => { if (link.startsWith('https://xinwen.wh.sdu.edu.cn/')) { diff --git a/lib/routes/sdu/extractor/sdrj.ts b/lib/routes/sdu/extractor/sdrj.ts index 3cacd0eb6..397f92c3b 100644 --- a/lib/routes/sdu/extractor/sdrj.ts +++ b/lib/routes/sdu/extractor/sdrj.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sdu/extractor/view.ts b/lib/routes/sdu/extractor/view.ts index bcf0118bd..9f62f3d26 100644 --- a/lib/routes/sdu/extractor/view.ts +++ b/lib/routes/sdu/extractor/view.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sdu/extractor/wh/jwc.ts b/lib/routes/sdu/extractor/wh/jwc.ts index 27a322685..22755b8a7 100644 --- a/lib/routes/sdu/extractor/wh/jwc.ts +++ b/lib/routes/sdu/extractor/wh/jwc.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sdu/extractor/wh/news.ts b/lib/routes/sdu/extractor/wh/news.ts index 4fcda6228..88d430fae 100644 --- a/lib/routes/sdu/extractor/wh/news.ts +++ b/lib/routes/sdu/extractor/wh/news.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sdu/gjsw.ts b/lib/routes/sdu/gjsw.ts index 27d2ef4f6..2fea3b9e3 100644 --- a/lib/routes/sdu/gjsw.ts +++ b/lib/routes/sdu/gjsw.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; diff --git a/lib/routes/sdu/mech.ts b/lib/routes/sdu/mech.ts index 7a9e48ff5..c5cf3a5b8 100644 --- a/lib/routes/sdu/mech.ts +++ b/lib/routes/sdu/mech.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sdu/qd/xszxqd.ts b/lib/routes/sdu/qd/xszxqd.ts index 8c75a0ea2..abee5ca4a 100644 --- a/lib/routes/sdu/qd/xszxqd.ts +++ b/lib/routes/sdu/qd/xszxqd.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; diff --git a/lib/routes/sdu/qd/xyb.ts b/lib/routes/sdu/qd/xyb.ts index 905ebac4b..e09a1a4d2 100644 --- a/lib/routes/sdu/qd/xyb.ts +++ b/lib/routes/sdu/qd/xyb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; diff --git a/lib/routes/sdu/sc.ts b/lib/routes/sdu/sc.ts index 43732ed64..0d38f43e9 100644 --- a/lib/routes/sdu/sc.ts +++ b/lib/routes/sdu/sc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://www.sc.sdu.edu.cn/'; diff --git a/lib/routes/sdu/wh/jwc.ts b/lib/routes/sdu/wh/jwc.ts index e33de99df..126470fd6 100644 --- a/lib/routes/sdu/wh/jwc.ts +++ b/lib/routes/sdu/wh/jwc.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import data from '../data'; -import extractor from '../extractor'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import data from '../data'; +import extractor from '../extractor'; + export const route: Route = { path: '/wh/jwc/:column?', categories: ['university'], diff --git a/lib/routes/sdu/wh/news.ts b/lib/routes/sdu/wh/news.ts index 42b8d7dae..b3f4e42bf 100644 --- a/lib/routes/sdu/wh/news.ts +++ b/lib/routes/sdu/wh/news.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; +import { parseDate } from '@/utils/parse-date'; + import data from '../data'; import extractor from '../extractor'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/wh/news/:column?', diff --git a/lib/routes/sdu/ygb.ts b/lib/routes/sdu/ygb.ts index 56e99782e..f81d91c38 100644 --- a/lib/routes/sdu/ygb.ts +++ b/lib/routes/sdu/ygb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; diff --git a/lib/routes/sdust/yjsy/zhaosheng.ts b/lib/routes/sdust/yjsy/zhaosheng.ts index c033d6ca7..59c2cb081 100644 --- a/lib/routes/sdust/yjsy/zhaosheng.ts +++ b/lib/routes/sdust/yjsy/zhaosheng.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sdzk/index.ts b/lib/routes/sdzk/index.ts index c75848145..a67563983 100644 --- a/lib/routes/sdzk/index.ts +++ b/lib/routes/sdzk/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sec-in/index.ts b/lib/routes/sec-in/index.ts index ad5c680d6..fc0d3078b 100644 --- a/lib/routes/sec-in/index.ts +++ b/lib/routes/sec-in/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sec-wiki/weekly.ts b/lib/routes/sec-wiki/weekly.ts index 4a50ce3fb..763d99db6 100644 --- a/lib/routes/sec-wiki/weekly.ts +++ b/lib/routes/sec-wiki/weekly.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; // import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/secretsanfrancisco/rss.ts b/lib/routes/secretsanfrancisco/rss.ts index 47957b97c..d50f56fc5 100644 --- a/lib/routes/secretsanfrancisco/rss.ts +++ b/lib/routes/secretsanfrancisco/rss.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/secrss/author.ts b/lib/routes/secrss/author.ts index 9fefa7d73..d08c5db4b 100644 --- a/lib/routes/secrss/author.ts +++ b/lib/routes/secrss/author.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/author/:author', diff --git a/lib/routes/secrss/category.ts b/lib/routes/secrss/category.ts index d4d46da67..75b4c7e89 100644 --- a/lib/routes/secrss/category.ts +++ b/lib/routes/secrss/category.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; export const route: Route = { path: '/category/:category?', diff --git a/lib/routes/seekingalpha/index.ts b/lib/routes/seekingalpha/index.ts index b76e288e2..e99b83d21 100644 --- a/lib/routes/seekingalpha/index.ts +++ b/lib/routes/seekingalpha/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { art } from '@/utils/render'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; +import { art } from '@/utils/render'; const baseUrl = 'https://seekingalpha.com'; diff --git a/lib/routes/sega/maimaidx.ts b/lib/routes/sega/maimaidx.ts index 63984ffc9..57c40c3a9 100644 --- a/lib/routes/sega/maimaidx.ts +++ b/lib/routes/sega/maimaidx.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import * as cheerio from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/maimaidx/news', diff --git a/lib/routes/sega/pjsekai.ts b/lib/routes/sega/pjsekai.ts index 03f6db774..3e164b46c 100644 --- a/lib/routes/sega/pjsekai.ts +++ b/lib/routes/sega/pjsekai.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import * as cheerio from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import timezone from '@/utils/timezone'; + export const route: Route = { path: '/pjsekai/news', categories: ['game'], diff --git a/lib/routes/segmentfault/blogs.ts b/lib/routes/segmentfault/blogs.ts index c81fcf4eb..6d7515248 100644 --- a/lib/routes/segmentfault/blogs.ts +++ b/lib/routes/segmentfault/blogs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { host, acw_sc__v2, parseList, parseItems } from './utils'; + +import { acw_sc__v2, host, parseItems, parseList } from './utils'; export const route: Route = { path: '/blogs/:tag', diff --git a/lib/routes/segmentfault/channel.ts b/lib/routes/segmentfault/channel.ts index ab764a7e1..3b60de381 100644 --- a/lib/routes/segmentfault/channel.ts +++ b/lib/routes/segmentfault/channel.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { host, acw_sc__v2, parseList, parseItems } from './utils'; + +import { acw_sc__v2, host, parseItems, parseList } from './utils'; export const route: Route = { path: '/channel/:name', diff --git a/lib/routes/segmentfault/user.ts b/lib/routes/segmentfault/user.ts index 2beca2b64..8e16d0c7c 100644 --- a/lib/routes/segmentfault/user.ts +++ b/lib/routes/segmentfault/user.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { host, acw_sc__v2, parseList, parseItems } from './utils'; + +import { acw_sc__v2, host, parseItems, parseList } from './utils'; export const route: Route = { path: '/user/:name', diff --git a/lib/routes/segmentfault/utils.ts b/lib/routes/segmentfault/utils.ts index 1a0489a50..b7294c02a 100644 --- a/lib/routes/segmentfault/utils.ts +++ b/lib/routes/segmentfault/utils.ts @@ -1,7 +1,9 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + import { getAcwScV2ByArg1 } from '../5eplay/utils'; const host = 'https://segmentfault.com'; @@ -54,4 +56,4 @@ const parseItems = (cookie, item, tryGet) => return item; }); -export { host, acw_sc__v2, parseList, parseItems }; +export { acw_sc__v2, host, parseItems, parseList }; diff --git a/lib/routes/sehuatang/index.ts b/lib/routes/sehuatang/index.ts index 5b8ea3f3e..8d04bc792 100644 --- a/lib/routes/sehuatang/index.ts +++ b/lib/routes/sehuatang/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { config } from '@/config'; const host = 'https://www.sehuatang.net/'; diff --git a/lib/routes/sehuatang/user.ts b/lib/routes/sehuatang/user.ts index 96114e039..c7df077bf 100644 --- a/lib/routes/sehuatang/user.ts +++ b/lib/routes/sehuatang/user.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 导入必要的模组 import got from '@/utils/got'; // 自订的 got -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; const baseUrl = 'https://sehuatang.org/'; diff --git a/lib/routes/sensortower/blog.ts b/lib/routes/sensortower/blog.ts index 91778f280..3029779f6 100644 --- a/lib/routes/sensortower/blog.ts +++ b/lib/routes/sensortower/blog.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/blog/:language?', diff --git a/lib/routes/setn/index.ts b/lib/routes/setn/index.ts index 4b390a036..952012c7d 100644 --- a/lib/routes/setn/index.ts +++ b/lib/routes/setn/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const defaultRootUrl = 'https://www.setn.com'; diff --git a/lib/routes/seu/cse/index.ts b/lib/routes/seu/cse/index.ts index 27925e2c6..5482b0e5b 100644 --- a/lib/routes/seu/cse/index.ts +++ b/lib/routes/seu/cse/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/seu/cyber/index.ts b/lib/routes/seu/cyber/index.ts index 43274f9c5..3aa782e4b 100644 --- a/lib/routes/seu/cyber/index.ts +++ b/lib/routes/seu/cyber/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/seu/radio/academic.ts b/lib/routes/seu/radio/academic.ts index aa3569d6c..26413c0af 100644 --- a/lib/routes/seu/radio/academic.ts +++ b/lib/routes/seu/radio/academic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/seu/yjs.ts b/lib/routes/seu/yjs.ts index 792d26419..7f28b23ad 100644 --- a/lib/routes/seu/yjs.ts +++ b/lib/routes/seu/yjs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; const url = 'https://seugs.seu.edu.cn/26671/list.htm'; diff --git a/lib/routes/seu/yzb/index.ts b/lib/routes/seu/yzb/index.ts index 57aed72cb..d4a05e508 100644 --- a/lib/routes/seu/yzb/index.ts +++ b/lib/routes/seu/yzb/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sfacg/novel-chapter.ts b/lib/routes/sfacg/novel-chapter.ts index 965f0c16c..103c76de5 100644 --- a/lib/routes/sfacg/novel-chapter.ts +++ b/lib/routes/sfacg/novel-chapter.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/shcstheatre/programs.ts b/lib/routes/shcstheatre/programs.ts index 90ddc2257..6d5d6d966 100644 --- a/lib/routes/shcstheatre/programs.ts +++ b/lib/routes/shcstheatre/programs.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { art } from '@/utils/render'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import path from 'node:path'; export const route: Route = { path: '/programs', diff --git a/lib/routes/shiep/index.ts b/lib/routes/shiep/index.ts index 83af844bf..3c95bf790 100644 --- a/lib/routes/shiep/index.ts +++ b/lib/routes/shiep/index.ts @@ -1,15 +1,17 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import dayjs from 'dayjs'; -import path from 'node:path'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; + import { config } from './config'; import { radar } from './radar'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/:type/:id?', diff --git a/lib/routes/shisu/en.ts b/lib/routes/shisu/en.ts index 6d89518cc..62438ea48 100644 --- a/lib/routes/shisu/en.ts +++ b/lib/routes/shisu/en.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const url = 'http://en.shisu.edu.cn'; diff --git a/lib/routes/shisu/news.ts b/lib/routes/shisu/news.ts index 79b983b9c..b7f2c6b6c 100644 --- a/lib/routes/shisu/news.ts +++ b/lib/routes/shisu/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const url = 'https://news.shisu.edu.cn'; diff --git a/lib/routes/shmeea/index.ts b/lib/routes/shmeea/index.ts index 900820b1f..2291935e9 100644 --- a/lib/routes/shmeea/index.ts +++ b/lib/routes/shmeea/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/shmeea/self-study.ts b/lib/routes/shmeea/self-study.ts index b5434032b..1e1dc8d85 100644 --- a/lib/routes/shmeea/self-study.ts +++ b/lib/routes/shmeea/self-study.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/shmtu/jwc.ts b/lib/routes/shmtu/jwc.ts index 9b51d6dd6..e588409ee 100644 --- a/lib/routes/shmtu/jwc.ts +++ b/lib/routes/shmtu/jwc.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const host = 'https://jwc.shmtu.edu.cn'; async function loadContent(link) { diff --git a/lib/routes/shmtu/portal.ts b/lib/routes/shmtu/portal.ts index 76f223637..d520a7a13 100644 --- a/lib/routes/shmtu/portal.ts +++ b/lib/routes/shmtu/portal.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const bootstrapHost = 'https://weixin.shmtu.edu.cn/dynamic/shmtuHttps'; const host = 'https://portal.shmtu.edu.cn/api'; diff --git a/lib/routes/shmtu/www.ts b/lib/routes/shmtu/www.ts index 5c86c2a4d..b7480eff6 100644 --- a/lib/routes/shmtu/www.ts +++ b/lib/routes/shmtu/www.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const host = 'https://www.shmtu.edu.cn'; async function loadContent(link) { diff --git a/lib/routes/shoac/recent-show.ts b/lib/routes/shoac/recent-show.ts index a6b43f4b1..61d7308c1 100644 --- a/lib/routes/shoac/recent-show.ts +++ b/lib/routes/shoac/recent-show.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import path from 'node:path'; -import { art } from '@/utils/render'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/recent-show', diff --git a/lib/routes/shopback/store.ts b/lib/routes/shopback/store.ts index af21e4db6..738fd111b 100644 --- a/lib/routes/shopback/store.ts +++ b/lib/routes/shopback/store.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/:store', categories: ['shopping'], diff --git a/lib/routes/shopify/apps/[handle].reviews.ts b/lib/routes/shopify/apps/[handle].reviews.ts index 91e4ed861..e124416eb 100644 --- a/lib/routes/shopify/apps/[handle].reviews.ts +++ b/lib/routes/shopify/apps/[handle].reviews.ts @@ -1,8 +1,10 @@ -import { Data, DataItem, Route } from '@/types'; -import { Context } from 'hono'; -import { baseURL } from './const'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; +import got from '@/utils/got'; + +import { baseURL } from './const'; export const route: Route = { path: '/apps/:handle/reviews/:page?', diff --git a/lib/routes/shopify/apps/search.ts b/lib/routes/shopify/apps/search.ts index 9da81cc6d..f08968a64 100644 --- a/lib/routes/shopify/apps/search.ts +++ b/lib/routes/shopify/apps/search.ts @@ -1,7 +1,9 @@ -import { Data, DataItem, Route } from '@/types'; -import type { Context } from 'hono'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; +import got from '@/utils/got'; + import { baseURL } from './const'; export const route: Route = { diff --git a/lib/routes/shoppingdesign/posts.ts b/lib/routes/shoppingdesign/posts.ts index 0e8c4beac..4a4595a61 100644 --- a/lib/routes/shoppingdesign/posts.ts +++ b/lib/routes/shoppingdesign/posts.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import pMap from 'p-map'; export const route: Route = { path: '/posts', diff --git a/lib/routes/showstart/artist.ts b/lib/routes/showstart/artist.ts index 564253e7a..1a18e443a 100644 --- a/lib/routes/showstart/artist.ts +++ b/lib/routes/showstart/artist.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import { TITLE, HOST } from './const'; -import { fetchPerformerInfo } from './service'; import type { Context } from 'hono'; +import type { Data, Route } from '@/types'; + +import { HOST, TITLE } from './const'; +import { fetchPerformerInfo } from './service'; + export const route: Route = { path: '/artist/:id', categories: ['shopping'], diff --git a/lib/routes/showstart/brand.ts b/lib/routes/showstart/brand.ts index ffb7c70c1..5dfafc70a 100644 --- a/lib/routes/showstart/brand.ts +++ b/lib/routes/showstart/brand.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import { TITLE, HOST } from './const'; -import { fetchBrandInfo } from './service'; import type { Context } from 'hono'; +import type { Data, Route } from '@/types'; + +import { HOST, TITLE } from './const'; +import { fetchBrandInfo } from './service'; + export const route: Route = { path: '/brand/:id', categories: ['shopping'], diff --git a/lib/routes/showstart/event.ts b/lib/routes/showstart/event.ts index 5b822baa9..57f8237b7 100644 --- a/lib/routes/showstart/event.ts +++ b/lib/routes/showstart/event.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import { TITLE, HOST } from './const'; -import { fetchActivityList, fetchDictionary } from './service'; import type { Context } from 'hono'; +import type { Data, Route } from '@/types'; + +import { HOST, TITLE } from './const'; +import { fetchActivityList, fetchDictionary } from './service'; + export const route: Route = { path: '/event/:cityCode/:showStyle?', categories: ['shopping'], diff --git a/lib/routes/showstart/search.ts b/lib/routes/showstart/search.ts index 0794ac08f..356824898 100644 --- a/lib/routes/showstart/search.ts +++ b/lib/routes/showstart/search.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import { TITLE, HOST } from './const'; -import { fetchActivityList, fetchPerformerList, fetchSiteList, fetchBrandList, fetchCityList, fetchStyleList } from './service'; import type { Context } from 'hono'; +import type { Data, Route } from '@/types'; + +import { HOST, TITLE } from './const'; +import { fetchActivityList, fetchBrandList, fetchCityList, fetchPerformerList, fetchSiteList, fetchStyleList } from './service'; + export const route: Route = { path: '/search/:type/:keyword?', categories: ['shopping'], diff --git a/lib/routes/showstart/service.ts b/lib/routes/showstart/service.ts index 0ba5b8cbc..519233a80 100644 --- a/lib/routes/showstart/service.ts +++ b/lib/routes/showstart/service.ts @@ -183,4 +183,4 @@ async function fetchDictionary(cityCode: string, showStyle: string) { }; } -export { fetchActivityList, fetchCityList, fetchStyleList, fetchPerformerList, fetchPerformerInfo, fetchSiteList, fetchSiteInfo, fetchBrandList, fetchBrandInfo, fetchDictionary }; +export { fetchActivityList, fetchBrandInfo, fetchBrandList, fetchCityList, fetchDictionary, fetchPerformerInfo, fetchPerformerList, fetchSiteInfo, fetchSiteList, fetchStyleList }; diff --git a/lib/routes/showstart/site.ts b/lib/routes/showstart/site.ts index 46da8ca95..2c4c625c9 100644 --- a/lib/routes/showstart/site.ts +++ b/lib/routes/showstart/site.ts @@ -1,7 +1,9 @@ -import { Data, Route } from '@/types'; -import { TITLE, HOST } from './const'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; + +import { HOST, TITLE } from './const'; import { fetchActivityList, fetchSiteInfo } from './service'; -import { Context } from 'hono'; export const route: Route = { path: '/site/:siteId', diff --git a/lib/routes/showstart/utils.ts b/lib/routes/showstart/utils.ts index 5cf63d4c9..2b3e7d9b6 100644 --- a/lib/routes/showstart/utils.ts +++ b/lib/routes/showstart/utils.ts @@ -84,4 +84,4 @@ function uniqBy(items: any[], key: string) { }); } -export { post, getAccessToken, uuid, sortBy, uniqBy }; +export { getAccessToken, post, sortBy, uniqBy, uuid }; diff --git a/lib/routes/shu/global.ts b/lib/routes/shu/global.ts index f1e255a18..54ea2844c 100644 --- a/lib/routes/shu/global.ts +++ b/lib/routes/shu/global.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // cheerio@1.0.0 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; // cheerio@1.0.0 import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/shu/gs.ts b/lib/routes/shu/gs.ts index 9b693ae89..a6ff6bac5 100644 --- a/lib/routes/shu/gs.ts +++ b/lib/routes/shu/gs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // cheerio@1.0.0 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; // cheerio@1.0.0 import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/shu/index.ts b/lib/routes/shu/index.ts index abdf79a0b..a18462c1d 100644 --- a/lib/routes/shu/index.ts +++ b/lib/routes/shu/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // cheerio@1.0.0 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; // cheerio@1.0.0 import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/shu/jwb.ts b/lib/routes/shu/jwb.ts index 61d908777..83cb7b1b4 100644 --- a/lib/routes/shu/jwb.ts +++ b/lib/routes/shu/jwb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://jwb.shu.edu.cn/'; diff --git a/lib/routes/shu/society.ts b/lib/routes/shu/society.ts index 6da04f776..3e32376bd 100644 --- a/lib/routes/shu/society.ts +++ b/lib/routes/shu/society.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/shu/xxgk.ts b/lib/routes/shu/xxgk.ts index e2ab63dec..6484e584d 100644 --- a/lib/routes/shu/xxgk.ts +++ b/lib/routes/shu/xxgk.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/shu/xykd.ts b/lib/routes/shu/xykd.ts index 15a3cef59..69c6bc8e3 100644 --- a/lib/routes/shu/xykd.ts +++ b/lib/routes/shu/xykd.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // cheerio@1.0.0 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; // cheerio@1.0.0 import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/shuiguopai/index.ts b/lib/routes/shuiguopai/index.ts index 73949f23d..c4f00defe 100644 --- a/lib/routes/shuiguopai/index.ts +++ b/lib/routes/shuiguopai/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/', diff --git a/lib/routes/sicau/dky.ts b/lib/routes/sicau/dky.ts index d98801a34..e0f9b2350 100644 --- a/lib/routes/sicau/dky.ts +++ b/lib/routes/sicau/dky.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sicau/jiaowu.ts b/lib/routes/sicau/jiaowu.ts index b320f189e..6f9e7c6e3 100644 --- a/lib/routes/sicau/jiaowu.ts +++ b/lib/routes/sicau/jiaowu.ts @@ -1,10 +1,11 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import { Language } from '@/routes/kurogames/wutheringwaves/constants'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { Language } from '@/routes/kurogames/wutheringwaves/constants'; const $get = async (url: string, encoding = 'gb2312') => new TextDecoder(encoding).decode(await ofetch(url, { responseType: 'arrayBuffer' })); const $trim = (str: string) => { diff --git a/lib/routes/sicau/jk.ts b/lib/routes/sicau/jk.ts index 21262bb12..44bf78476 100644 --- a/lib/routes/sicau/jk.ts +++ b/lib/routes/sicau/jk.ts @@ -1,6 +1,6 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sicau/yan.ts b/lib/routes/sicau/yan.ts index 1838df071..9cf9dbab0 100644 --- a/lib/routes/sicau/yan.ts +++ b/lib/routes/sicau/yan.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sicau/zsjy.ts b/lib/routes/sicau/zsjy.ts index 7c0762625..197be16cd 100644 --- a/lib/routes/sicau/zsjy.ts +++ b/lib/routes/sicau/zsjy.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sigsac/ccs.ts b/lib/routes/sigsac/ccs.ts index 064765273..3074edd24 100644 --- a/lib/routes/sigsac/ccs.ts +++ b/lib/routes/sigsac/ccs.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -const url = 'https://www.sigsac.org/'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + +const url = 'https://www.sigsac.org/'; // https://www.sigsac.org/ccs/CCS2022/program/accepted-papers.html export const route: Route = { diff --git a/lib/routes/simpleinfo/index.ts b/lib/routes/simpleinfo/index.ts index 1fd3ad1f1..8130f2c78 100644 --- a/lib/routes/simpleinfo/index.ts +++ b/lib/routes/simpleinfo/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; -import { art } from '@/utils/render'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/sina/chuangshiji.ts b/lib/routes/sina/chuangshiji.ts index 74e8a4723..50355859d 100644 --- a/lib/routes/sina/chuangshiji.ts +++ b/lib/routes/sina/chuangshiji.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { getRollNewsList, parseRollNewsList, parseArticle } from './utils'; + +import { getRollNewsList, parseArticle, parseRollNewsList } from './utils'; export const route: Route = { path: '/csj', diff --git a/lib/routes/sina/discovery.ts b/lib/routes/sina/discovery.ts index aa63a2a98..39af3bbd9 100644 --- a/lib/routes/sina/discovery.ts +++ b/lib/routes/sina/discovery.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { getRollNewsList, parseRollNewsList, parseArticle } from './utils'; + +import { getRollNewsList, parseArticle, parseRollNewsList } from './utils'; const link = 'https://tech.sina.com.cn/discovery/'; const map = new Map([ diff --git a/lib/routes/sina/finance/china.ts b/lib/routes/sina/finance/china.ts index 6b88d0433..b4568ff9f 100644 --- a/lib/routes/sina/finance/china.ts +++ b/lib/routes/sina/finance/china.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { getRollNewsList, parseRollNewsList, parseArticle } from '../utils'; + +import { getRollNewsList, parseArticle, parseRollNewsList } from '../utils'; export const route: Route = { path: '/finance/china/:lid?', diff --git a/lib/routes/sina/finance/stock/usstock.ts b/lib/routes/sina/finance/stock/usstock.ts index 251b107ad..9b036fd10 100644 --- a/lib/routes/sina/finance/stock/usstock.ts +++ b/lib/routes/sina/finance/stock/usstock.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { parseArticle } from '../../utils'; export const route: Route = { diff --git a/lib/routes/sina/rollnews.ts b/lib/routes/sina/rollnews.ts index e6af3fa09..b23e14c4f 100644 --- a/lib/routes/sina/rollnews.ts +++ b/lib/routes/sina/rollnews.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { getRollNewsList, parseRollNewsList, parseArticle } from './utils'; + +import { getRollNewsList, parseArticle, parseRollNewsList } from './utils'; export const route: Route = { path: '/rollnews/:lid?', diff --git a/lib/routes/sina/sports.ts b/lib/routes/sina/sports.ts index d8915d400..20d739b5e 100644 --- a/lib/routes/sina/sports.ts +++ b/lib/routes/sina/sports.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/sina/utils.ts b/lib/routes/sina/utils.ts index 2251c8f00..977510e5f 100644 --- a/lib/routes/sina/utils.ts +++ b/lib/routes/sina/utils.ts @@ -1,10 +1,12 @@ -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + const getRollNewsList = (pageid, lid, limit) => got('https://feed.mix.sina.com.cn/api/roll/get', { headers: { @@ -97,4 +99,4 @@ const parseArticle = (item, tryGet) => return item; }); -export { getRollNewsList, parseRollNewsList, parseArticle }; +export { getRollNewsList, parseArticle, parseRollNewsList }; diff --git a/lib/routes/sinchew/index.ts b/lib/routes/sinchew/index.ts index 8e8e61114..200c7b77a 100644 --- a/lib/routes/sinchew/index.ts +++ b/lib/routes/sinchew/index.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '*', diff --git a/lib/routes/sis001/author.ts b/lib/routes/sis001/author.ts index 5f3e629ba..8f2b33568 100644 --- a/lib/routes/sis001/author.ts +++ b/lib/routes/sis001/author.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { config } from '@/config'; import { load } from 'cheerio'; import type { Context } from 'hono'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + import { getCookie, getThread } from './common'; export const route: Route = { diff --git a/lib/routes/sis001/common.ts b/lib/routes/sis001/common.ts index 92ee06aea..1dbcb7291 100644 --- a/lib/routes/sis001/common.ts +++ b/lib/routes/sis001/common.ts @@ -1,11 +1,12 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import CryptoJS from 'crypto-js'; + +import { config } from '@/config'; +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { DataItem } from '@/types'; -import CryptoJS from 'crypto-js'; -import cache from '@/utils/cache'; -import { config } from '@/config'; function getCookie(url: string): Promise { return cache.tryGet( diff --git a/lib/routes/sis001/forum.ts b/lib/routes/sis001/forum.ts index 1c1ac5bd8..8b8d165a7 100644 --- a/lib/routes/sis001/forum.ts +++ b/lib/routes/sis001/forum.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { config } from '@/config'; import { load } from 'cheerio'; import type { Context } from 'hono'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + import { getCookie, getThread } from './common'; export const route: Route = { diff --git a/lib/routes/sjtu/gs.ts b/lib/routes/sjtu/gs.ts index 8d3d9fdb4..401d24926 100644 --- a/lib/routes/sjtu/gs.ts +++ b/lib/routes/sjtu/gs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; import { fetchArticle } from '@/utils/wechat-mp'; diff --git a/lib/routes/sjtu/jwc.ts b/lib/routes/sjtu/jwc.ts index 2f1c9d33b..c9278d364 100644 --- a/lib/routes/sjtu/jwc.ts +++ b/lib/routes/sjtu/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const urlRoot = 'https://jwc.sjtu.edu.cn'; diff --git a/lib/routes/sjtu/seiee/icisee.ts b/lib/routes/sjtu/seiee/icisee.ts index 0535a932e..a6a1b0512 100644 --- a/lib/routes/sjtu/seiee/icisee.ts +++ b/lib/routes/sjtu/seiee/icisee.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import ofetch from '@/utils/ofetch'; import { finishArticleItem } from '@/utils/wechat-mp'; export const route: Route = { diff --git a/lib/routes/sjtu/seiee/index.ts b/lib/routes/sjtu/seiee/index.ts index d7ec9548d..89fec8c7a 100644 --- a/lib/routes/sjtu/seiee/index.ts +++ b/lib/routes/sjtu/seiee/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/seiee/:path/:catID?/:searchCatCode?', diff --git a/lib/routes/sjtu/seiee/utils.ts b/lib/routes/sjtu/seiee/utils.ts index 9cd5394be..3ca5e5db0 100644 --- a/lib/routes/sjtu/seiee/utils.ts +++ b/lib/routes/sjtu/seiee/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://bjwb.seiee.sjtu.edu.cn'; diff --git a/lib/routes/sjtu/tongqu/activity.ts b/lib/routes/sjtu/tongqu/activity.ts index e5f0490bf..3290b1eef 100644 --- a/lib/routes/sjtu/tongqu/activity.ts +++ b/lib/routes/sjtu/tongqu/activity.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const urlRoot = 'https://tongqu.sjtu.edu.cn'; diff --git a/lib/routes/sjtu/yzb/zkxx.ts b/lib/routes/sjtu/yzb/zkxx.ts index ab2ce285e..f4d673fcf 100644 --- a/lib/routes/sjtu/yzb/zkxx.ts +++ b/lib/routes/sjtu/yzb/zkxx.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { fetchArticle } from '@/utils/wechat-mp'; -import ofetch from '@/utils/ofetch'; const baseTitle = '上海交通大学研究生招生网招考信息'; const baseUrl = 'https://yzb.sjtu.edu.cn/index/zkxx/'; diff --git a/lib/routes/skeb/following-creators.ts b/lib/routes/skeb/following-creators.ts index 5ad246c15..9b89e967b 100644 --- a/lib/routes/skeb/following-creators.ts +++ b/lib/routes/skeb/following-creators.ts @@ -1,6 +1,7 @@ -import { Data, DataItem, Route } from '@/types'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, DataItem, Route } from '@/types'; + import { getFollowingsItems } from './utils'; export const route: Route = { diff --git a/lib/routes/skeb/following-works.ts b/lib/routes/skeb/following-works.ts index dcc8c3216..1f9682a57 100644 --- a/lib/routes/skeb/following-works.ts +++ b/lib/routes/skeb/following-works.ts @@ -1,6 +1,7 @@ -import { Data, DataItem, Route } from '@/types'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, DataItem, Route } from '@/types'; + import { getFollowingsItems } from './utils'; export const route: Route = { diff --git a/lib/routes/skeb/friend-works.ts b/lib/routes/skeb/friend-works.ts index cb6c0124b..4f4bb1175 100644 --- a/lib/routes/skeb/friend-works.ts +++ b/lib/routes/skeb/friend-works.ts @@ -1,6 +1,7 @@ -import { Data, DataItem, Route } from '@/types'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, DataItem, Route } from '@/types'; + import { getFollowingsItems } from './utils'; export const route: Route = { diff --git a/lib/routes/skeb/index.ts b/lib/routes/skeb/index.ts index ee9614741..596a8ed44 100644 --- a/lib/routes/skeb/index.ts +++ b/lib/routes/skeb/index.ts @@ -1,8 +1,9 @@ -import { Route, Data, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; -import { baseUrl, processWork, processCreator } from './utils'; import { config } from '@/config'; +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, processCreator, processWork } from './utils'; const categoryMap = { // Works categories diff --git a/lib/routes/skeb/search.ts b/lib/routes/skeb/search.ts index 3a4978a01..4df1dae4e 100644 --- a/lib/routes/skeb/search.ts +++ b/lib/routes/skeb/search.ts @@ -1,8 +1,9 @@ -import { Data, DataItem, Route } from '@/types'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { processWork, baseUrl } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import { baseUrl, processWork } from './utils'; export const route: Route = { path: '/search/:keyword', diff --git a/lib/routes/skeb/utils.ts b/lib/routes/skeb/utils.ts index 41d822ca4..3d03bc9e3 100644 --- a/lib/routes/skeb/utils.ts +++ b/lib/routes/skeb/utils.ts @@ -1,9 +1,10 @@ +import path from 'node:path'; + import { config } from '@/config'; -import { DataItem } from '@/types'; +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import path from 'node:path'; export const baseUrl = 'https://skeb.jp'; diff --git a/lib/routes/skeb/works.ts b/lib/routes/skeb/works.ts index d92e714ac..017702de6 100644 --- a/lib/routes/skeb/works.ts +++ b/lib/routes/skeb/works.ts @@ -1,10 +1,11 @@ -import { Data, DataItem, Route } from '@/types'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; -import { baseUrl, processWork } from './utils'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, processWork } from './utils'; export const route: Route = { path: '/works/:username', diff --git a/lib/routes/skebetter/illust.ts b/lib/routes/skebetter/illust.ts index 9abcb4689..ea8c5ac7c 100644 --- a/lib/routes/skebetter/illust.ts +++ b/lib/routes/skebetter/illust.ts @@ -1,7 +1,8 @@ -import { Data, DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; -import { processItems, fetchData } from './utils'; import { config } from '@/config'; +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; + +import { fetchData, processItems } from './utils'; export const route: Route = { path: '/illust/:type', diff --git a/lib/routes/skebetter/index.ts b/lib/routes/skebetter/index.ts index 2740ded52..563eb2769 100644 --- a/lib/routes/skebetter/index.ts +++ b/lib/routes/skebetter/index.ts @@ -1,7 +1,8 @@ -import { Data, DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; -import { processItems, fetchData } from './utils'; import { config } from '@/config'; +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; + +import { fetchData, processItems } from './utils'; export const route: Route = { path: '/:type', diff --git a/lib/routes/skebetter/manga.ts b/lib/routes/skebetter/manga.ts index a728a3597..5965ae4d4 100644 --- a/lib/routes/skebetter/manga.ts +++ b/lib/routes/skebetter/manga.ts @@ -1,7 +1,8 @@ -import { Data, DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; -import { processItems, fetchData } from './utils'; import { config } from '@/config'; +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; + +import { fetchData, processItems } from './utils'; export const route: Route = { path: '/manga/:order', diff --git a/lib/routes/skebetter/utils.ts b/lib/routes/skebetter/utils.ts index 271fe5539..40de43522 100644 --- a/lib/routes/skebetter/utils.ts +++ b/lib/routes/skebetter/utils.ts @@ -1,4 +1,4 @@ -import { DataItem } from '@/types'; +import type { DataItem } from '@/types'; import ofetch from '@/utils/ofetch'; export interface MediaUrl { diff --git a/lib/routes/sketis/isabelle-dev/blog/index.ts b/lib/routes/sketis/isabelle-dev/blog/index.ts index f2c39ec19..24001b9ae 100644 --- a/lib/routes/sketis/isabelle-dev/blog/index.ts +++ b/lib/routes/sketis/isabelle-dev/blog/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; const source = [ diff --git a/lib/routes/skysports/news.ts b/lib/routes/skysports/news.ts index 5c297fbff..93b105c4f 100644 --- a/lib/routes/skysports/news.ts +++ b/lib/routes/skysports/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/slowmist/slowmist.ts b/lib/routes/slowmist/slowmist.ts index ce34b02db..905fd6ced 100644 --- a/lib/routes/slowmist/slowmist.ts +++ b/lib/routes/slowmist/slowmist.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -const baseUrl = 'https://www.slowmist.com'; import { finishArticleItem } from '@/utils/wechat-mp'; +const baseUrl = 'https://www.slowmist.com'; + export const route: Route = { path: '/:type?', categories: ['new-media'], diff --git a/lib/routes/smartlink/index.ts b/lib/routes/smartlink/index.ts index 235fc805b..7d8e05104 100644 --- a/lib/routes/smartlink/index.ts +++ b/lib/routes/smartlink/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { toTitleCase } from '@/utils/common-utils'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/smashingmagazine/category.ts b/lib/routes/smashingmagazine/category.ts index ebf06eb14..bbe17e485 100644 --- a/lib/routes/smashingmagazine/category.ts +++ b/lib/routes/smashingmagazine/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/smzdm/article.ts b/lib/routes/smzdm/article.ts index f87cbb81d..8a19c4aff 100644 --- a/lib/routes/smzdm/article.ts +++ b/lib/routes/smzdm/article.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { config } from '@/config'; + import { getHeaders } from './utils'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/article/:uid', diff --git a/lib/routes/smzdm/baoliao.ts b/lib/routes/smzdm/baoliao.ts index a3314e5d2..bc89f17c2 100644 --- a/lib/routes/smzdm/baoliao.ts +++ b/lib/routes/smzdm/baoliao.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { config } from '@/config'; + import { getHeaders } from './utils'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/baoliao/:uid', diff --git a/lib/routes/smzdm/haowen-fenlei.ts b/lib/routes/smzdm/haowen-fenlei.ts index 35ece724b..281675dbf 100644 --- a/lib/routes/smzdm/haowen-fenlei.ts +++ b/lib/routes/smzdm/haowen-fenlei.ts @@ -1,12 +1,15 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; +import timezone from '@/utils/timezone'; + import { getHeaders } from './utils'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; + export const route: Route = { path: '/haowen/fenlei/:name/:sort?', categories: ['shopping'], diff --git a/lib/routes/smzdm/haowen.ts b/lib/routes/smzdm/haowen.ts index 11e5aa5dd..2b616a0e8 100644 --- a/lib/routes/smzdm/haowen.ts +++ b/lib/routes/smzdm/haowen.ts @@ -1,12 +1,14 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getHeaders } from './utils'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; -import { config } from '@/config'; export const route: Route = { path: '/haowen/:day?', diff --git a/lib/routes/smzdm/keyword.ts b/lib/routes/smzdm/keyword.ts index 30c146cc6..1c30b1bf5 100644 --- a/lib/routes/smzdm/keyword.ts +++ b/lib/routes/smzdm/keyword.ts @@ -1,11 +1,14 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getHeaders } from './utils'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; -import { config } from '@/config'; export const route: Route = { path: '/keyword/:keyword', diff --git a/lib/routes/smzdm/product.ts b/lib/routes/smzdm/product.ts index d8673e4f9..ccd06dd57 100644 --- a/lib/routes/smzdm/product.ts +++ b/lib/routes/smzdm/product.ts @@ -1,10 +1,12 @@ -import { Route, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import { getHeaders } from './utils'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; + import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { getHeaders } from './utils'; export const route: Route = { path: '/product/:id', diff --git a/lib/routes/smzdm/ranking.ts b/lib/routes/smzdm/ranking.ts index 4a7956a8c..0736b5da1 100644 --- a/lib/routes/smzdm/ranking.ts +++ b/lib/routes/smzdm/ranking.ts @@ -1,9 +1,11 @@ import { config } from '@/config'; -import { Route, ViewType } from '@/types'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import timezone from '@/utils/timezone'; + import { getHeaders } from './utils'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; const getTrueHour = (rank_type, rank_id, hour) => { const rank_two_hour = ['11', '17', '28', '29']; diff --git a/lib/routes/snowpeak/us-new-arrivals.ts b/lib/routes/snowpeak/us-new-arrivals.ts index 091a39e04..782636929 100644 --- a/lib/routes/snowpeak/us-new-arrivals.ts +++ b/lib/routes/snowpeak/us-new-arrivals.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; + const host = 'https://www.snowpeak.com'; export const route: Route = { path: '/us/new-arrivals', diff --git a/lib/routes/sobooks/date.ts b/lib/routes/sobooks/date.ts index 1a559a831..aa958e205 100644 --- a/lib/routes/sobooks/date.ts +++ b/lib/routes/sobooks/date.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/sobooks/index.ts b/lib/routes/sobooks/index.ts index 3d53bbdfa..0c90598e2 100644 --- a/lib/routes/sobooks/index.ts +++ b/lib/routes/sobooks/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/sobooks/tag.ts b/lib/routes/sobooks/tag.ts index 9fe0ddb31..3fe68508f 100644 --- a/lib/routes/sobooks/tag.ts +++ b/lib/routes/sobooks/tag.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/sobooks/utils.ts b/lib/routes/sobooks/utils.ts index 743797814..902a264d9 100644 --- a/lib/routes/sobooks/utils.ts +++ b/lib/routes/sobooks/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const utils = async (ctx, currentUrl) => { diff --git a/lib/routes/sogou/doodles.ts b/lib/routes/sogou/doodles.ts index 1ee23c790..2f868213b 100644 --- a/lib/routes/sogou/doodles.ts +++ b/lib/routes/sogou/doodles.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/sogou/search.ts b/lib/routes/sogou/search.ts index 6b2918069..9ed582c81 100644 --- a/lib/routes/sogou/search.ts +++ b/lib/routes/sogou/search.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; -import path from 'node:path'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; +import { art } from '@/utils/render'; const renderDescription = (description, images) => art(path.join(__dirname, './templates/description.art'), { description, images }); diff --git a/lib/routes/sohu/mobile.ts b/lib/routes/sohu/mobile.ts index b3db164be..5fc65c032 100644 --- a/lib/routes/sohu/mobile.ts +++ b/lib/routes/sohu/mobile.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sohu/mp.ts b/lib/routes/sohu/mp.ts index ac2b3d917..f01cdc54a 100644 --- a/lib/routes/sohu/mp.ts +++ b/lib/routes/sohu/mp.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import * as cheerio from 'cheerio'; +import CryptoJS from 'crypto-js'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; import { art } from '@/utils/render'; -import CryptoJS from 'crypto-js'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/mp/:xpt', diff --git a/lib/routes/solidot/_article.ts b/lib/routes/solidot/_article.ts index 270651f3e..341db83b3 100644 --- a/lib/routes/solidot/_article.ts +++ b/lib/routes/solidot/_article.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; // get web content import { load } from 'cheerio'; // html parser + +import got from '@/utils/got'; // get web content import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/solidot/main.ts b/lib/routes/solidot/main.ts index b919e0adb..a6de6560b 100644 --- a/lib/routes/solidot/main.ts +++ b/lib/routes/solidot/main.ts @@ -1,15 +1,16 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; // html parser + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; // Warning: The author still knows nothing about javascript! - // params: // type: subject type - import got from '@/utils/got'; // get web content -import { load } from 'cheerio'; // html parser -import get_article from './_article'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import get_article from './_article'; export const route: Route = { path: '/:type?', diff --git a/lib/routes/sony/downloads.ts b/lib/routes/sony/downloads.ts index 2bfb5b365..da6ff3f24 100644 --- a/lib/routes/sony/downloads.ts +++ b/lib/routes/sony/downloads.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + const host = 'https://www.sony.com'; export const route: Route = { path: '/downloads/:productType/:productId', diff --git a/lib/routes/sorrycc/index.ts b/lib/routes/sorrycc/index.ts index 6d96a4db9..5008fb02f 100644 --- a/lib/routes/sorrycc/index.ts +++ b/lib/routes/sorrycc/index.ts @@ -1,12 +1,14 @@ -import { type DataItem, ViewType, type Data, type Route } from '@/types'; -import type { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import type { Post } from './types'; +import type { Context } from 'hono'; + import { config } from '@/config'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import type { Post } from './types'; + const WORDPRESS_HASH = 'f05fca638390aed897fbe3c2fff03000'; export const route: Route = { diff --git a/lib/routes/sotwe/user.ts b/lib/routes/sotwe/user.ts index a51219f40..c53b13964 100644 --- a/lib/routes/sotwe/user.ts +++ b/lib/routes/sotwe/user.ts @@ -1,11 +1,12 @@ -import { Route, ViewType } from '@/types'; - -import { parseDate } from '@/utils/parse-date'; import sanitizeHtml from 'sanitize-html'; -import puppeteer from '@/utils/puppeteer'; -import logger from '@/utils/logger'; -import cache from '@/utils/cache'; + import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; +import puppeteer from '@/utils/puppeteer'; export const route: Route = { path: '/user/:id', diff --git a/lib/routes/soundofhope/channel.ts b/lib/routes/soundofhope/channel.ts index d2cc00e3c..34d869b33 100644 --- a/lib/routes/soundofhope/channel.ts +++ b/lib/routes/soundofhope/channel.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/soundon/podcast.ts b/lib/routes/soundon/podcast.ts index d8163dfc2..abadabb27 100644 --- a/lib/routes/soundon/podcast.ts +++ b/lib/routes/soundon/podcast.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { Podcast, PodcastInfo } from './types'; + +import type { Podcast, PodcastInfo } from './types'; const handler = async (ctx) => { const { id } = ctx.req.param(); diff --git a/lib/routes/sourceforge/index.ts b/lib/routes/sourceforge/index.ts index b3f181d43..1ede6067a 100644 --- a/lib/routes/sourceforge/index.ts +++ b/lib/routes/sourceforge/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/southcn/nfapp/column.ts b/lib/routes/southcn/nfapp/column.ts index 385a3ba63..17743309c 100644 --- a/lib/routes/southcn/nfapp/column.ts +++ b/lib/routes/southcn/nfapp/column.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; + import { parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/southcn/nfapp/reporter.ts b/lib/routes/southcn/nfapp/reporter.ts index 2d69ed61d..b6934b94b 100644 --- a/lib/routes/southcn/nfapp/reporter.ts +++ b/lib/routes/southcn/nfapp/reporter.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + import { parseArticle } from './utils'; -import path from 'node:path'; export const route: Route = { path: '/nfapp/reporter/:reporter', diff --git a/lib/routes/southcn/nfapp/utils.ts b/lib/routes/southcn/nfapp/utils.ts index 9a3d28d3e..3adfb3684 100644 --- a/lib/routes/southcn/nfapp/utils.ts +++ b/lib/routes/southcn/nfapp/utils.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + const parseArticle = (item, tryGet) => tryGet(item.link, async () => { const detailResponse = await got({ diff --git a/lib/routes/spankbang/new-videos.ts b/lib/routes/spankbang/new-videos.ts index d1497041b..57ff9b146 100644 --- a/lib/routes/spankbang/new-videos.ts +++ b/lib/routes/spankbang/new-videos.ts @@ -1,12 +1,13 @@ -import { Data, Route } from '@/types'; - -import puppeteer from '@/utils/puppeteer'; -import * as cheerio from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import * as cheerio from 'cheerio'; + import { config } from '@/config'; -import logger from '@/utils/logger'; +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; +import logger from '@/utils/logger'; +import puppeteer from '@/utils/puppeteer'; +import { art } from '@/utils/render'; const render = (data) => art(path.join(__dirname, 'templates/video.art'), data); diff --git a/lib/routes/spglobal/ratings.ts b/lib/routes/spglobal/ratings.ts index c8c172d1c..c550c6781 100644 --- a/lib/routes/spglobal/ratings.ts +++ b/lib/routes/spglobal/ratings.ts @@ -1,6 +1,7 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/ratings/:language?', diff --git a/lib/routes/spotify/artist.ts b/lib/routes/spotify/artist.ts index d7a55f82f..aa95320dc 100644 --- a/lib/routes/spotify/artist.ts +++ b/lib/routes/spotify/artist.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import utils from './utils'; export const route: Route = { path: '/artist/:id', diff --git a/lib/routes/spotify/artists-top.ts b/lib/routes/spotify/artists-top.ts index eff236705..e0d19559b 100644 --- a/lib/routes/spotify/artists-top.ts +++ b/lib/routes/spotify/artists-top.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import utils from './utils'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import utils from './utils'; + export const route: Route = { path: '/top/artists', categories: ['multimedia'], diff --git a/lib/routes/spotify/playlist.ts b/lib/routes/spotify/playlist.ts index fcd12bb6f..8364ab02d 100644 --- a/lib/routes/spotify/playlist.ts +++ b/lib/routes/spotify/playlist.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import utils from './utils'; export const route: Route = { path: '/playlist/:id', diff --git a/lib/routes/spotify/saved.ts b/lib/routes/spotify/saved.ts index 5ff59dae6..ef434e73d 100644 --- a/lib/routes/spotify/saved.ts +++ b/lib/routes/spotify/saved.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import utils from './utils'; export const route: Route = { path: '/saved/:limit?', diff --git a/lib/routes/spotify/show.ts b/lib/routes/spotify/show.ts index b478cff81..77942cba4 100644 --- a/lib/routes/spotify/show.ts +++ b/lib/routes/spotify/show.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import utils from './utils'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + export const route: Route = { path: '/show/:id', categories: ['multimedia'], diff --git a/lib/routes/spotify/tracks-top.ts b/lib/routes/spotify/tracks-top.ts index c9b732bba..3cf106712 100644 --- a/lib/routes/spotify/tracks-top.ts +++ b/lib/routes/spotify/tracks-top.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import utils from './utils'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import utils from './utils'; + export const route: Route = { path: '/top/tracks', categories: ['multimedia'], diff --git a/lib/routes/springer/journal.ts b/lib/routes/springer/journal.ts index d3d0fe66d..552269f94 100644 --- a/lib/routes/springer/journal.ts +++ b/lib/routes/springer/journal.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import path from 'node:path'; import { art } from '@/utils/render'; -import { CookieJar } from 'tough-cookie'; const cookieJar = new CookieJar(); export const route: Route = { diff --git a/lib/routes/sputniknews/index.ts b/lib/routes/sputniknews/index.ts index af31a4996..d69ce7114 100644 --- a/lib/routes/sputniknews/index.ts +++ b/lib/routes/sputniknews/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const languages = { diff --git a/lib/routes/sqmc/www.ts b/lib/routes/sqmc/www.ts index 4181edb38..1f3eb5af1 100644 --- a/lib/routes/sqmc/www.ts +++ b/lib/routes/sqmc/www.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/www/:category?', diff --git a/lib/routes/sse/convert.ts b/lib/routes/sse/convert.ts index 622d55ece..2311bffd8 100644 --- a/lib/routes/sse/convert.ts +++ b/lib/routes/sse/convert.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sse/disclosure.ts b/lib/routes/sse/disclosure.ts index 5d4dce1fc..960953fd2 100644 --- a/lib/routes/sse/disclosure.ts +++ b/lib/routes/sse/disclosure.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sse/inquire.ts b/lib/routes/sse/inquire.ts index fbc2cc9f9..2e404426e 100644 --- a/lib/routes/sse/inquire.ts +++ b/lib/routes/sse/inquire.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/inquire', diff --git a/lib/routes/sse/renewal.ts b/lib/routes/sse/renewal.ts index 12155e554..053a54c5d 100644 --- a/lib/routes/sse/renewal.ts +++ b/lib/routes/sse/renewal.ts @@ -1,12 +1,15 @@ -import { Route } from '@/types'; +import 'dayjs/locale/zh-cn.js'; +import path from 'node:path'; + +import dayjs from 'dayjs'; +import localizedFormat from 'dayjs/plugin/localizedFormat.js'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import dayjs from 'dayjs'; -import localizedFormat from 'dayjs/plugin/localizedFormat.js'; -import 'dayjs/locale/zh-cn.js'; + dayjs.extend(localizedFormat); const currStatusName = ['全部', '已受理', '已询问', '通过', '未通过', '提交注册', '补充审核', '注册结果', '中止', '终止']; diff --git a/lib/routes/sse/sselawsrules.ts b/lib/routes/sse/sselawsrules.ts index a33e3989e..b40b7f7b7 100644 --- a/lib/routes/sse/sselawsrules.ts +++ b/lib/routes/sse/sselawsrules.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'latest' } = ctx.req.param(); diff --git a/lib/routes/ssm/news.ts b/lib/routes/ssm/news.ts index d2f9bd839..8a5160c98 100644 --- a/lib/routes/ssm/news.ts +++ b/lib/routes/ssm/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const rootUrl = `https://www.ssm.gov.mo`; diff --git a/lib/routes/sspai/activity.ts b/lib/routes/sspai/activity.ts index bb1855d5a..d837c4a61 100644 --- a/lib/routes/sspai/activity.ts +++ b/lib/routes/sspai/activity.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/author.ts b/lib/routes/sspai/author.ts index 48f13bcf4..c942240ab 100644 --- a/lib/routes/sspai/author.ts +++ b/lib/routes/sspai/author.ts @@ -1,5 +1,5 @@ import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/bookmarks.ts b/lib/routes/sspai/bookmarks.ts index 5fba4ec04..9d648a060 100644 --- a/lib/routes/sspai/bookmarks.ts +++ b/lib/routes/sspai/bookmarks.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/column.ts b/lib/routes/sspai/column.ts index e16eaea84..aa56608a9 100644 --- a/lib/routes/sspai/column.ts +++ b/lib/routes/sspai/column.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/index.ts b/lib/routes/sspai/index.ts index 44359a3ae..fc9d9a395 100644 --- a/lib/routes/sspai/index.ts +++ b/lib/routes/sspai/index.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/matrix.ts b/lib/routes/sspai/matrix.ts index a222d27aa..c107fbb1d 100644 --- a/lib/routes/sspai/matrix.ts +++ b/lib/routes/sspai/matrix.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/prime-community.ts b/lib/routes/sspai/prime-community.ts index 86c332aeb..407443bde 100644 --- a/lib/routes/sspai/prime-community.ts +++ b/lib/routes/sspai/prime-community.ts @@ -1,5 +1,5 @@ import { config } from '@/config'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/sspai/series-update.ts b/lib/routes/sspai/series-update.ts index 52d03b8cc..62f8638a2 100644 --- a/lib/routes/sspai/series-update.ts +++ b/lib/routes/sspai/series-update.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/series.ts b/lib/routes/sspai/series.ts index 98703357f..ddc4d00f7 100644 --- a/lib/routes/sspai/series.ts +++ b/lib/routes/sspai/series.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; export const route: Route = { path: '/series', diff --git a/lib/routes/sspai/shortcuts-gallery.ts b/lib/routes/sspai/shortcuts-gallery.ts index 751fde0de..88a05ae6a 100644 --- a/lib/routes/sspai/shortcuts-gallery.ts +++ b/lib/routes/sspai/shortcuts-gallery.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/tag.ts b/lib/routes/sspai/tag.ts index 2734268a7..2b48a3414 100644 --- a/lib/routes/sspai/tag.ts +++ b/lib/routes/sspai/tag.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/topic.ts b/lib/routes/sspai/topic.ts index 5a53383a7..2530d6af8 100644 --- a/lib/routes/sspai/topic.ts +++ b/lib/routes/sspai/topic.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/topics.ts b/lib/routes/sspai/topics.ts index 90d7ecfd7..a7744c6e4 100644 --- a/lib/routes/sspai/topics.ts +++ b/lib/routes/sspai/topics.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspu/jwc.ts b/lib/routes/sspu/jwc.ts index 908915611..dfcfaa323 100644 --- a/lib/routes/sspu/jwc.ts +++ b/lib/routes/sspu/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sspu/pe.ts b/lib/routes/sspu/pe.ts index 1987ba322..21edfd56d 100644 --- a/lib/routes/sspu/pe.ts +++ b/lib/routes/sspu/pe.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/stanford/blog.ts b/lib/routes/stanford/blog.ts index 0d56f9baa..cc7769803 100644 --- a/lib/routes/stanford/blog.ts +++ b/lib/routes/stanford/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/startuplatte/index.ts b/lib/routes/startuplatte/index.ts index 6dfcd0a79..24e5a4194 100644 --- a/lib/routes/startuplatte/index.ts +++ b/lib/routes/startuplatte/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/stbu/jsjxy.ts b/lib/routes/stbu/jsjxy.ts index 669432e62..d386d393d 100644 --- a/lib/routes/stbu/jsjxy.ts +++ b/lib/routes/stbu/jsjxy.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/stbu/xyxw.ts b/lib/routes/stbu/xyxw.ts index a93e25bed..4a85d24af 100644 --- a/lib/routes/stbu/xyxw.ts +++ b/lib/routes/stbu/xyxw.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/stcn/index.ts b/lib/routes/stcn/index.ts index e625a7a68..3343c3ddc 100644 --- a/lib/routes/stcn/index.ts +++ b/lib/routes/stcn/index.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { id = 'yw' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/stcn/kx.ts b/lib/routes/stcn/kx.ts index 2697e4a63..f8adaa502 100644 --- a/lib/routes/stcn/kx.ts +++ b/lib/routes/stcn/kx.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type CheerioAPI, load } from 'cheerio'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, load } from 'cheerio'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/stcn/rank.ts b/lib/routes/stcn/rank.ts index 1ba8105e0..ef531fbeb 100644 --- a/lib/routes/stcn/rank.ts +++ b/lib/routes/stcn/rank.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type CheerioAPI, load } from 'cheerio'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, load } from 'cheerio'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { id = 'yw' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/stdaily/digitalpaper.ts b/lib/routes/stdaily/digitalpaper.ts index 4c33df794..67493d2b3 100644 --- a/lib/routes/stdaily/digitalpaper.ts +++ b/lib/routes/stdaily/digitalpaper.ts @@ -1,13 +1,16 @@ -import type { Data, DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import type { ArticleDetailResponse, ArticleListResponse, DateListResponse, SectionListResponse } from './types'; -import { art } from '@/utils/render'; import path from 'node:path'; -import timezone from '@/utils/timezone'; -import dayjs from 'dayjs'; + import { load } from 'cheerio'; +import dayjs from 'dayjs'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + +import type { ArticleDetailResponse, ArticleListResponse, DateListResponse, SectionListResponse } from './types'; const SITE_ID = '811c18b08cf04e79be3b67d6902ee1a7'; const CODE = 'KJRB'; diff --git a/lib/routes/steam/appcommunityfeed.ts b/lib/routes/steam/appcommunityfeed.ts index 44faf44ed..185f3ec06 100644 --- a/lib/routes/steam/appcommunityfeed.ts +++ b/lib/routes/steam/appcommunityfeed.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import path from 'node:path'; const workshopFileTypes = { 0: 'Community', diff --git a/lib/routes/steam/curator.ts b/lib/routes/steam/curator.ts index ef109ff3f..633cffbcf 100644 --- a/lib/routes/steam/curator.ts +++ b/lib/routes/steam/curator.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; export const route: Route = { diff --git a/lib/routes/steam/news.ts b/lib/routes/steam/news.ts index 9c94e2e1c..81a4c3942 100644 --- a/lib/routes/steam/news.ts +++ b/lib/routes/steam/news.ts @@ -1,13 +1,13 @@ -import { Route, Data, DataItem } from '@/types'; -import type { BBobCoreTagNodeTree, PresetFactory, NodeContent } from '@bbob/types'; - -import got from '@/utils/got'; import bbobHTML from '@bbob/html'; -import presetHTML5 from '@bbob/preset-html5'; import { getUniqAttr } from '@bbob/plugin-helper'; -import { parseDate } from '@/utils/parse-date'; +import presetHTML5 from '@bbob/preset-html5'; +import type { BBobCoreTagNodeTree, NodeContent, PresetFactory } from '@bbob/types'; import type { Context } from 'hono'; +import type { Data, DataItem, Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/news/:appid/:language?', name: 'News', diff --git a/lib/routes/steam/search.ts b/lib/routes/steam/search.ts index 4bc046e0d..19ea613ba 100644 --- a/lib/routes/steam/search.ts +++ b/lib/routes/steam/search.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import type { Route } from '@/types'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/search/:params', diff --git a/lib/routes/steam/sharefile-changelog.ts b/lib/routes/steam/sharefile-changelog.ts index 8a0fe49ea..ecedec433 100644 --- a/lib/routes/steam/sharefile-changelog.ts +++ b/lib/routes/steam/sharefile-changelog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/steam/workshop-search.ts b/lib/routes/steam/workshop-search.ts index a4bf9ce8b..083fa47f7 100644 --- a/lib/routes/steam/workshop-search.ts +++ b/lib/routes/steam/workshop-search.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/workshopsearch/:appid?/:routeParams?', categories: ['game'], diff --git a/lib/routes/stheadline/std/realtime.ts b/lib/routes/stheadline/std/realtime.ts index e4d072812..d11558bca 100644 --- a/lib/routes/stheadline/std/realtime.ts +++ b/lib/routes/stheadline/std/realtime.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://www.stheadline.com'; diff --git a/lib/routes/stockedge/daily-news.ts b/lib/routes/stockedge/daily-news.ts index a5eb8c547..2f91b1c30 100644 --- a/lib/routes/stockedge/daily-news.ts +++ b/lib/routes/stockedge/daily-news.ts @@ -1,5 +1,7 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; + import { getData, getList } from './utils'; export const route: Route = { diff --git a/lib/routes/stockedge/utils.ts b/lib/routes/stockedge/utils.ts index 33bd2b42f..812f3af28 100644 --- a/lib/routes/stockedge/utils.ts +++ b/lib/routes/stockedge/utils.ts @@ -1,4 +1,4 @@ -import { DataItem } from '@/types'; +import type { DataItem } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/storm/channel.ts b/lib/routes/storm/channel.ts index b668efb91..1eda985a8 100644 --- a/lib/routes/storm/channel.ts +++ b/lib/routes/storm/channel.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/storm/index.ts b/lib/routes/storm/index.ts index 4705f7cb2..306667b21 100644 --- a/lib/routes/storm/index.ts +++ b/lib/routes/storm/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/storyfm/episodes.ts b/lib/routes/storyfm/episodes.ts index d5615e4c0..dc0dd02ae 100644 --- a/lib/routes/storyfm/episodes.ts +++ b/lib/routes/storyfm/episodes.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/episodes', diff --git a/lib/routes/storyfm/index.ts b/lib/routes/storyfm/index.ts index 1512a7874..134ff21b2 100644 --- a/lib/routes/storyfm/index.ts +++ b/lib/routes/storyfm/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/index', categories: ['multimedia'], diff --git a/lib/routes/straitstimes/index.ts b/lib/routes/straitstimes/index.ts index a72c26440..d48f200e4 100644 --- a/lib/routes/straitstimes/index.ts +++ b/lib/routes/straitstimes/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; import { art } from '@/utils/render'; export const route: Route = { diff --git a/lib/routes/stratechery/index.ts b/lib/routes/stratechery/index.ts index d4625b9d4..613192c95 100644 --- a/lib/routes/stratechery/index.ts +++ b/lib/routes/stratechery/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; export const route: Route = { diff --git a/lib/routes/stream-capital/search.ts b/lib/routes/stream-capital/search.ts index c1adec947..f88af1553 100644 --- a/lib/routes/stream-capital/search.ts +++ b/lib/routes/stream-capital/search.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { encrypt, decrypt } from './utils'; -import { EncryptedResponse, WebBlog } from './types'; -import cache from '@/utils/cache'; + +import type { EncryptedResponse, WebBlog } from './types'; +import { decrypt, encrypt } from './utils'; export const route: Route = { path: '/search', diff --git a/lib/routes/studygolang/go.ts b/lib/routes/studygolang/go.ts index 1a699e119..332ecb249 100644 --- a/lib/routes/studygolang/go.ts +++ b/lib/routes/studygolang/go.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { FetchGoItems } from './utils'; export const route: Route = { diff --git a/lib/routes/studygolang/jobs.ts b/lib/routes/studygolang/jobs.ts index 0effa9448..39133b02a 100644 --- a/lib/routes/studygolang/jobs.ts +++ b/lib/routes/studygolang/jobs.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { FetchGoItems } from './utils'; export const route: Route = { diff --git a/lib/routes/studygolang/utils.ts b/lib/routes/studygolang/utils.ts index 60dd6bdb6..7fec467bb 100644 --- a/lib/routes/studygolang/utils.ts +++ b/lib/routes/studygolang/utils.ts @@ -1,9 +1,11 @@ +import { load } from 'cheerio'; +import MarkdownIt from 'markdown-it'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; +import timezone from '@/utils/timezone'; + const md = MarkdownIt({ html: true, linkify: true, diff --git a/lib/routes/studygolang/weekly.ts b/lib/routes/studygolang/weekly.ts index 836085650..4cfcb48ea 100644 --- a/lib/routes/studygolang/weekly.ts +++ b/lib/routes/studygolang/weekly.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { FetchGoItems } from './utils'; export const route: Route = { diff --git a/lib/routes/subhd/index.ts b/lib/routes/subhd/index.ts index 7033df399..926c2855b 100644 --- a/lib/routes/subhd/index.ts +++ b/lib/routes/subhd/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const config = { sub: { diff --git a/lib/routes/substack/subscribe.ts b/lib/routes/substack/subscribe.ts index a04b6150d..9cc946654 100644 --- a/lib/routes/substack/subscribe.ts +++ b/lib/routes/substack/subscribe.ts @@ -1,9 +1,10 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; -import parser from '@/utils/rss-parser'; -import { parseDate } from '@/utils/parse-date'; -import { isValidHost } from '@/utils/valid-host'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; +import { isValidHost } from '@/utils/valid-host'; export const route: Route = { path: '/subscribe/:user', diff --git a/lib/routes/supchina/index.ts b/lib/routes/supchina/index.ts index e6092d5a3..a2965c097 100644 --- a/lib/routes/supchina/index.ts +++ b/lib/routes/supchina/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/supchina/podcasts.ts b/lib/routes/supchina/podcasts.ts index ae35b509c..106d0c842 100644 --- a/lib/routes/supchina/podcasts.ts +++ b/lib/routes/supchina/podcasts.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/surfshark/blog.ts b/lib/routes/surfshark/blog.ts index ab48265f1..92a2cf418 100644 --- a/lib/routes/surfshark/blog.ts +++ b/lib/routes/surfshark/blog.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category } = ctx.req.param(); diff --git a/lib/routes/sustainabilitymag/articles.ts b/lib/routes/sustainabilitymag/articles.ts index a4a27ae77..69637e88f 100644 --- a/lib/routes/sustainabilitymag/articles.ts +++ b/lib/routes/sustainabilitymag/articles.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import oftech from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/articles', diff --git a/lib/routes/sustech/bidding.ts b/lib/routes/sustech/bidding.ts index 1ec548dfa..da4f8874a 100644 --- a/lib/routes/sustech/bidding.ts +++ b/lib/routes/sustech/bidding.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sustech/newshub-zh.ts b/lib/routes/sustech/newshub-zh.ts index 8744a8b99..0bcaa05d3 100644 --- a/lib/routes/sustech/newshub-zh.ts +++ b/lib/routes/sustech/newshub-zh.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sustech/yjs.ts b/lib/routes/sustech/yjs.ts index e88e325f0..5fc9090a3 100644 --- a/lib/routes/sustech/yjs.ts +++ b/lib/routes/sustech/yjs.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/swissinfo/index.ts b/lib/routes/swissinfo/index.ts index aa2bc3a1a..2de079e86 100644 --- a/lib/routes/swissinfo/index.ts +++ b/lib/routes/swissinfo/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/swjtu/gsee/yjs.ts b/lib/routes/swjtu/gsee/yjs.ts index 4c747778c..290891fc7 100644 --- a/lib/routes/swjtu/gsee/yjs.ts +++ b/lib/routes/swjtu/gsee/yjs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://gsee.swjtu.edu.cn'; diff --git a/lib/routes/swjtu/jtys/yjs.ts b/lib/routes/swjtu/jtys/yjs.ts index 9ee5cbb4a..9093865df 100644 --- a/lib/routes/swjtu/jtys/yjs.ts +++ b/lib/routes/swjtu/jtys/yjs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://ctt.swjtu.edu.cn'; diff --git a/lib/routes/swjtu/jwc.ts b/lib/routes/swjtu/jwc.ts index 0bce77dac..0dd6a7237 100644 --- a/lib/routes/swjtu/jwc.ts +++ b/lib/routes/swjtu/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootURL = 'http://jwc.swjtu.edu.cn'; diff --git a/lib/routes/swjtu/jyzpxx.ts b/lib/routes/swjtu/jyzpxx.ts index 1c3b3d130..2c91d8740 100644 --- a/lib/routes/swjtu/jyzpxx.ts +++ b/lib/routes/swjtu/jyzpxx.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import utils from './utils'; import got from '@/utils/got'; +import utils from './utils'; + const rootURL = 'https://jiuye.swjtu.edu.cn/career'; export const route: Route = { diff --git a/lib/routes/swjtu/scai.ts b/lib/routes/swjtu/scai.ts index 35fc42cf8..92dc47346 100644 --- a/lib/routes/swjtu/scai.ts +++ b/lib/routes/swjtu/scai.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://scai.swjtu.edu.cn'; diff --git a/lib/routes/swjtu/sports.ts b/lib/routes/swjtu/sports.ts index 3ab502ac1..edaaa63d5 100644 --- a/lib/routes/swjtu/sports.ts +++ b/lib/routes/swjtu/sports.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://sports.swjtu.edu.cn'; const pageURL = `${rootURL}/xwzx.htm`; diff --git a/lib/routes/swjtu/utils.ts b/lib/routes/swjtu/utils.ts index 779f4a7d5..e4725cf97 100644 --- a/lib/routes/swjtu/utils.ts +++ b/lib/routes/swjtu/utils.ts @@ -1,8 +1,9 @@ -import got from '@/utils/got'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const renderDetail = (jobs) => art(path.join(__dirname, 'templates/job_detail.art'), { jobs }); const renderDesc = (intro) => art(path.join(__dirname, 'templates/job_desc.art'), { diff --git a/lib/routes/swjtu/xg.ts b/lib/routes/swjtu/xg.ts index 2556b8a52..648d28251 100644 --- a/lib/routes/swjtu/xg.ts +++ b/lib/routes/swjtu/xg.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const rootURL = 'http://xg.swjtu.edu.cn'; const listURL = { diff --git a/lib/routes/swpu/bgw.ts b/lib/routes/swpu/bgw.ts index 48800ee6c..852426039 100644 --- a/lib/routes/swpu/bgw.ts +++ b/lib/routes/swpu/bgw.ts @@ -1,11 +1,13 @@ -import { DataItem, Route, Data } from '@/types'; -import cache from '@/utils/cache'; -import { joinUrl } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { joinUrl } from './utils'; + export const route: Route = { path: '/bgw/:code', categories: ['university'], diff --git a/lib/routes/swpu/cjxy.ts b/lib/routes/swpu/cjxy.ts index 0b65c0599..83f4ccf88 100644 --- a/lib/routes/swpu/cjxy.ts +++ b/lib/routes/swpu/cjxy.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/swpu/dean.ts b/lib/routes/swpu/dean.ts index f2c2f4bae..cf3403eb1 100644 --- a/lib/routes/swpu/dean.ts +++ b/lib/routes/swpu/dean.ts @@ -1,11 +1,13 @@ -import { DataItem, Route, Data } from '@/types'; -import cache from '@/utils/cache'; -import { joinUrl } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { joinUrl } from './utils'; + export const route: Route = { path: '/dean/:code', categories: ['university'], diff --git a/lib/routes/swpu/dxy.ts b/lib/routes/swpu/dxy.ts index 535d6cffb..b5258d907 100644 --- a/lib/routes/swpu/dxy.ts +++ b/lib/routes/swpu/dxy.ts @@ -1,11 +1,13 @@ -import { DataItem, Route, Data } from '@/types'; -import cache from '@/utils/cache'; -import { joinUrl } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { joinUrl } from './utils'; + export const route: Route = { path: '/dxy/:code', categories: ['university'], diff --git a/lib/routes/swpu/is.ts b/lib/routes/swpu/is.ts index c4baf5733..4924d2c34 100644 --- a/lib/routes/swpu/is.ts +++ b/lib/routes/swpu/is.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/swpu/scs.ts b/lib/routes/swpu/scs.ts index 0a39d6e72..f1999ef09 100644 --- a/lib/routes/swpu/scs.ts +++ b/lib/routes/swpu/scs.ts @@ -1,11 +1,13 @@ -import { DataItem, Route, Data } from '@/types'; -import cache from '@/utils/cache'; -import { joinUrl } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { joinUrl } from './utils'; + export const route: Route = { path: '/scs/:code', categories: ['university'], diff --git a/lib/routes/sycl/feeds.ts b/lib/routes/sycl/feeds.ts index 6da6f50b4..488cbac2a 100644 --- a/lib/routes/sycl/feeds.ts +++ b/lib/routes/sycl/feeds.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/syosetu/dev.ts b/lib/routes/syosetu/dev.ts index 4456e13e9..61ea23780 100644 --- a/lib/routes/syosetu/dev.ts +++ b/lib/routes/syosetu/dev.ts @@ -1,7 +1,8 @@ -import { Data, Route } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/dev', diff --git a/lib/routes/syosetu/index.ts b/lib/routes/syosetu/index.ts index efa36951c..1a2116f02 100644 --- a/lib/routes/syosetu/index.ts +++ b/lib/routes/syosetu/index.ts @@ -1,8 +1,10 @@ -import { Route, Data, DataItem } from '@/types'; -import { fetchNovelInfo, fetchChapterContent } from './utils'; -import { Context } from 'hono'; +import type { Context } from 'hono'; import { NovelType } from 'narou'; +import type { Data, DataItem, Route } from '@/types'; + +import { fetchChapterContent, fetchNovelInfo } from './utils'; + export const route: Route = { path: '/:ncode', categories: ['reading'], diff --git a/lib/routes/syosetu/ranking-isekai.ts b/lib/routes/syosetu/ranking-isekai.ts index 76059e427..99c3ef9e2 100644 --- a/lib/routes/syosetu/ranking-isekai.ts +++ b/lib/routes/syosetu/ranking-isekai.ts @@ -1,10 +1,14 @@ -import { Data, DataItem } from '@/types'; -import { NarouNovelFetch, SearchBuilder, SearchParams, BigGenre } from 'narou'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { SearchParams } from 'narou'; +import { BigGenre, NarouNovelFetch, SearchBuilder } from 'narou'; +import type { Join } from 'narou/util/type'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Join } from 'narou/util/type'; -import { RankingPeriod, NovelType, periodToJapanese, novelTypeToJapanese, periodToOrder, periodToPointField, IsekaiCategory, isekaiCategoryToJapanese } from './types/ranking'; +import type { Data, DataItem } from '@/types'; +import { art } from '@/utils/render'; + +import { IsekaiCategory, isekaiCategoryToJapanese, NovelType, novelTypeToJapanese, periodToJapanese, periodToOrder, periodToPointField, RankingPeriod } from './types/ranking'; export function parseIsekaiRankingType(type: string): { period: RankingPeriod; category: IsekaiCategory; novelType: NovelType } { const [periodStr, categoryStr, novelTypeStr = NovelType.TOTAL] = type.split('_'); diff --git a/lib/routes/syosetu/ranking-r18.ts b/lib/routes/syosetu/ranking-r18.ts index cc09f0be3..7b09e4894 100644 --- a/lib/routes/syosetu/ranking-r18.ts +++ b/lib/routes/syosetu/ranking-r18.ts @@ -1,10 +1,14 @@ -import { Route, Data, DataItem } from '@/types'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { Context } from 'hono'; -import { SearchBuilderR18, SearchParams, NarouNovelFetch } from 'narou'; + +import type { Context } from 'hono'; +import type { SearchParams } from 'narou'; +import { NarouNovelFetch, SearchBuilderR18 } from 'narou'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { RankingPeriod, periodToJapanese, novelTypeToJapanese, periodToOrder, NovelType, SyosetuSub, syosetuSubToJapanese, syosetuSubToNocgenre } from './types/ranking-r18'; +import type { Data, DataItem, Route } from '@/types'; +import { art } from '@/utils/render'; + +import { NovelType, novelTypeToJapanese, periodToJapanese, periodToOrder, RankingPeriod, SyosetuSub, syosetuSubToJapanese, syosetuSubToNocgenre } from './types/ranking-r18'; /** * Implementation of "Syosetu" R18 Rankings diff --git a/lib/routes/syosetu/ranking.ts b/lib/routes/syosetu/ranking.ts index 7683a5074..165eb1d62 100644 --- a/lib/routes/syosetu/ranking.ts +++ b/lib/routes/syosetu/ranking.ts @@ -1,11 +1,15 @@ -import { Route, Data, DataItem } from '@/types'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { Context } from 'hono'; -import { Genre, SearchBuilder, SearchParams, NarouNovelFetch, GenreNotation } from 'narou'; + +import type { Context } from 'hono'; +import type { SearchParams } from 'narou'; +import { Genre, GenreNotation, NarouNovelFetch, SearchBuilder } from 'narou'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, DataItem, Route } from '@/types'; +import { art } from '@/utils/render'; + import { handleIsekaiRanking } from './ranking-isekai'; -import { RankingPeriod, periodToJapanese, novelTypeToJapanese, periodToOrder, RankingType, NovelType, isekaiCategoryToJapanese, IsekaiCategory } from './types/ranking'; +import { IsekaiCategory, isekaiCategoryToJapanese, NovelType, novelTypeToJapanese, periodToJapanese, periodToOrder, RankingPeriod, RankingType } from './types/ranking'; const getParameters = () => { // Generate ranking type options diff --git a/lib/routes/syosetu/search.ts b/lib/routes/syosetu/search.ts index 09403b957..7c61a91be 100644 --- a/lib/routes/syosetu/search.ts +++ b/lib/routes/syosetu/search.ts @@ -1,12 +1,17 @@ -import { Route, Data } from '@/types'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { Context } from 'hono'; -import { Genre, GenreNotation, NarouNovelFetch, NovelTypeParam, Order, R18Site, SearchBuilder, SearchBuilderR18, SearchParams } from 'narou'; + +import type { Context } from 'hono'; +import type { Genre, NovelTypeParam, Order, SearchParams } from 'narou'; +import { GenreNotation, NarouNovelFetch, R18Site, SearchBuilder, SearchBuilderR18 } from 'narou'; +import type { Join } from 'narou/util/type'; import queryString from 'query-string'; -import { Join } from 'narou/util/type'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { SyosetuSub, NarouSearchParams, syosetuSubToJapanese } from './types/search'; +import type { Data, Route } from '@/types'; +import { art } from '@/utils/render'; + +import type { NarouSearchParams} from './types/search'; +import { SyosetuSub, syosetuSubToJapanese } from './types/search'; export const route: Route = { path: '/search/:sub/:query', diff --git a/lib/routes/syosetu/utils.ts b/lib/routes/syosetu/utils.ts index 9970c6dc3..c927f49c5 100644 --- a/lib/routes/syosetu/utils.ts +++ b/lib/routes/syosetu/utils.ts @@ -1,10 +1,12 @@ -import { DataItem } from '@/types'; +import { load } from 'cheerio'; +import type { NarouSearchResult} from 'narou'; +import { NarouNovelFetch, SearchBuilder, SearchBuilderR18 } from 'narou'; + +import { config } from '@/config'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { config } from '@/config'; -import { NarouNovelFetch, NarouSearchResult, SearchBuilder, SearchBuilderR18 } from 'narou'; export async function fetchNovelInfo(ncode: string): Promise<{ baseUrl: string; novel: NarouSearchResult }> { const api = new NarouNovelFetch(); diff --git a/lib/routes/sysu/cse.ts b/lib/routes/sysu/cse.ts index e40575e89..8512d45cd 100644 --- a/lib/routes/sysu/cse.ts +++ b/lib/routes/sysu/cse.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/cse', categories: ['university'], diff --git a/lib/routes/sysu/ygafz.ts b/lib/routes/sysu/ygafz.ts index 017b52c96..6e6c214ef 100644 --- a/lib/routes/sysu/ygafz.ts +++ b/lib/routes/sysu/ygafz.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/szftedu/dongtai.ts b/lib/routes/szftedu/dongtai.ts index c2acc657f..320f4766c 100644 --- a/lib/routes/szftedu/dongtai.ts +++ b/lib/routes/szftedu/dongtai.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/szftedu/gonggao.ts b/lib/routes/szftedu/gonggao.ts index 359451db1..d0f58191f 100644 --- a/lib/routes/szftedu/gonggao.ts +++ b/lib/routes/szftedu/gonggao.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/szse/disclosure/listed-notice.ts b/lib/routes/szse/disclosure/listed-notice.ts index e96f3e34d..b7fa0b929 100644 --- a/lib/routes/szse/disclosure/listed-notice.ts +++ b/lib/routes/szse/disclosure/listed-notice.ts @@ -1,10 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type CheerioAPI, load } from 'cheerio'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, load } from 'cheerio'; -import { type Context } from 'hono'; function isValidDate(dateString: string): boolean { // 正则表达式检查格式:YYYY-MM-DD diff --git a/lib/routes/szse/inquire.ts b/lib/routes/szse/inquire.ts index 70d19387c..780be1e20 100644 --- a/lib/routes/szse/inquire.ts +++ b/lib/routes/szse/inquire.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/inquire/:category?/:select?/:keyword?', diff --git a/lib/routes/szse/notice.ts b/lib/routes/szse/notice.ts index 2c4a7df90..585b9f286 100644 --- a/lib/routes/szse/notice.ts +++ b/lib/routes/szse/notice.ts @@ -1,8 +1,11 @@ -import { Route } from '@/types'; +import * as url from 'node:url'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import * as url from 'node:url'; + const host = 'http://www.szse.cn/'; export const route: Route = { path: '/notice', diff --git a/lib/routes/szse/projectdynamic.ts b/lib/routes/szse/projectdynamic.ts index 3660a9c2b..1eb3cf641 100644 --- a/lib/routes/szse/projectdynamic.ts +++ b/lib/routes/szse/projectdynamic.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/projectdynamic/:type?/:stage?/:status?', diff --git a/lib/routes/szse/rule.ts b/lib/routes/szse/rule.ts index cbb7f9674..b7b6805c4 100644 --- a/lib/routes/szse/rule.ts +++ b/lib/routes/szse/rule.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/szu/yz/index.ts b/lib/routes/szu/yz/index.ts index 37a921b24..815d6e56d 100644 --- a/lib/routes/szu/yz/index.ts +++ b/lib/routes/szu/yz/index.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; const map = new Map([ diff --git a/lib/routes/szu/yz/utils.ts b/lib/routes/szu/yz/utils.ts index e23096bcd..a479966b3 100644 --- a/lib/routes/szu/yz/utils.ts +++ b/lib/routes/szu/yz/utils.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/t66y/index.ts b/lib/routes/t66y/index.ts index 751293d60..27e95f040 100644 --- a/lib/routes/t66y/index.ts +++ b/lib/routes/t66y/index.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; import * as cheerio from 'cheerio'; -import got from '@/utils/got'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, parseContent } from './utils'; export const route: Route = { diff --git a/lib/routes/t66y/post.ts b/lib/routes/t66y/post.ts index a4ace5a57..301c6327d 100644 --- a/lib/routes/t66y/post.ts +++ b/lib/routes/t66y/post.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; import * as cheerio from 'cheerio'; -import got from '@/utils/got'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, parseContent } from './utils'; function parseItems(tid: string, $: cheerio.CheerioAPI) { diff --git a/lib/routes/tableau/viz-of-the-day.ts b/lib/routes/tableau/viz-of-the-day.ts index 43d913cba..fc7976fb2 100644 --- a/lib/routes/tableau/viz-of-the-day.ts +++ b/lib/routes/tableau/viz-of-the-day.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; // import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/tailwindcss/blog.ts b/lib/routes/tailwindcss/blog.ts index afcb8b411..a2a484cce 100644 --- a/lib/routes/tailwindcss/blog.ts +++ b/lib/routes/tailwindcss/blog.ts @@ -1,5 +1,7 @@ -import { Route } from '@/types'; -import { Context } from 'hono'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; + import { fetchFeed } from './utils'; export const handler = (ctx: Context) => { diff --git a/lib/routes/tailwindcss/utils.ts b/lib/routes/tailwindcss/utils.ts index b0e1ec0df..65d1dd75d 100644 --- a/lib/routes/tailwindcss/utils.ts +++ b/lib/routes/tailwindcss/utils.ts @@ -1,9 +1,11 @@ -import ofetch from '@/utils/ofetch'; -import { Data, DataItem } from '@/types'; -import { BASE_URL } from './constants'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; +import type { Data, DataItem } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { BASE_URL } from './constants'; + /** Fetch the content of a given article. */ export const fetchArticleContent = async (url: string): Promise => { const data = await ofetch(url, { responseType: 'text' }); diff --git a/lib/routes/taiwanmobile/rate-plans.ts b/lib/routes/taiwanmobile/rate-plans.ts index 2eda102ce..cf3ff9668 100644 --- a/lib/routes/taiwanmobile/rate-plans.ts +++ b/lib/routes/taiwanmobile/rate-plans.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/rate-plans', diff --git a/lib/routes/taiwannews/hot.ts b/lib/routes/taiwannews/hot.ts index 018089cfb..812303326 100644 --- a/lib/routes/taiwannews/hot.ts +++ b/lib/routes/taiwannews/hot.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/tangshufang/index.ts b/lib/routes/tangshufang/index.ts index 913777196..d5b39509f 100644 --- a/lib/routes/tangshufang/index.ts +++ b/lib/routes/tangshufang/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/taobao/mysql.ts b/lib/routes/taobao/mysql.ts index d4291cdb4..64902957e 100644 --- a/lib/routes/taobao/mysql.ts +++ b/lib/routes/taobao/mysql.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/taobao/zhongchou.ts b/lib/routes/taobao/zhongchou.ts index 9670e8ba8..394acd209 100644 --- a/lib/routes/taobao/zhongchou.ts +++ b/lib/routes/taobao/zhongchou.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/zhongchou/:type?', diff --git a/lib/routes/taoguba/blog.ts b/lib/routes/taoguba/blog.ts index 6b15d56a5..b0c1ad5ff 100644 --- a/lib/routes/taoguba/blog.ts +++ b/lib/routes/taoguba/blog.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, renderPostDetail } from './util'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { renderPostDetail, rootUrl } from './util'; export const route: Route = { path: '/blog/:id', diff --git a/lib/routes/taoguba/index.ts b/lib/routes/taoguba/index.ts index b062740e0..4e8282f4a 100644 --- a/lib/routes/taoguba/index.ts +++ b/lib/routes/taoguba/index.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, renderPostDetail } from './util'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { renderPostDetail, rootUrl } from './util'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/taoguba/util.ts b/lib/routes/taoguba/util.ts index 8d2400ef9..11aa5fcd5 100644 --- a/lib/routes/taoguba/util.ts +++ b/lib/routes/taoguba/util.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.tgb.cn'; @@ -45,4 +46,4 @@ const renderPostDetail = async (item) => return item; }); -export { rootUrl, renderPostDetail }; +export { renderPostDetail, rootUrl }; diff --git a/lib/routes/taptap/changelog-cn.ts b/lib/routes/taptap/changelog-cn.ts index 52c9574b0..f121c5fe4 100644 --- a/lib/routes/taptap/changelog-cn.ts +++ b/lib/routes/taptap/changelog-cn.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common/changelog'; export const route: Route = { diff --git a/lib/routes/taptap/changelog-intl.ts b/lib/routes/taptap/changelog-intl.ts index 11163c181..c7acf14ce 100644 --- a/lib/routes/taptap/changelog-intl.ts +++ b/lib/routes/taptap/changelog-intl.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common/changelog'; export const route: Route = { diff --git a/lib/routes/taptap/common/changelog.ts b/lib/routes/taptap/common/changelog.ts index fd320e3a0..6fcb41bd7 100644 --- a/lib/routes/taptap/common/changelog.ts +++ b/lib/routes/taptap/common/changelog.ts @@ -1,6 +1,7 @@ import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { getRootUrl, appDetail, X_UA } from '../utils'; + +import { appDetail, getRootUrl, X_UA } from '../utils'; export async function handler(ctx) { const requestPath = ctx.req.path.replace('/taptap', ''); diff --git a/lib/routes/taptap/common/review.ts b/lib/routes/taptap/common/review.ts index 80bb0602e..47b02c4a4 100644 --- a/lib/routes/taptap/common/review.ts +++ b/lib/routes/taptap/common/review.ts @@ -1,6 +1,7 @@ import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { getRootUrl, appDetail, X_UA } from '../utils'; + +import { appDetail, getRootUrl, X_UA } from '../utils'; /* const sortMap = { diff --git a/lib/routes/taptap/review-cn.ts b/lib/routes/taptap/review-cn.ts index dc38b771a..788484a4d 100644 --- a/lib/routes/taptap/review-cn.ts +++ b/lib/routes/taptap/review-cn.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common/review'; export const route: Route = { diff --git a/lib/routes/taptap/review-intl.ts b/lib/routes/taptap/review-intl.ts index 88936dec4..264fdb8dc 100644 --- a/lib/routes/taptap/review-intl.ts +++ b/lib/routes/taptap/review-intl.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common/review'; export const route: Route = { diff --git a/lib/routes/taptap/topic.ts b/lib/routes/taptap/topic.ts index 43ed43537..2954d4377 100644 --- a/lib/routes/taptap/topic.ts +++ b/lib/routes/taptap/topic.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { getRootUrl, X_UA, appDetail, imagePost, topicPost, videoPost } from './utils'; + +import { appDetail, getRootUrl, imagePost, topicPost, videoPost, X_UA } from './utils'; const typeMap = { feed: { diff --git a/lib/routes/taptap/utils.ts b/lib/routes/taptap/utils.ts index c020ea560..0dd451990 100644 --- a/lib/routes/taptap/utils.ts +++ b/lib/routes/taptap/utils.ts @@ -1,9 +1,12 @@ -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import path from 'node:path'; -import { art } from '@/utils/render'; + +import { load } from 'cheerio'; + import cache from '@/utils/cache'; -import { Detail } from './types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + +import type { Detail } from './types'; const X_UA = (lang = 'zh_CN') => `X-UA=${encodeURIComponent(`V=1&PN=WebApp&VN=0.1.0&LANG=${lang}&PLT=PC`)}`; @@ -44,4 +47,4 @@ const videoPost = (video) => previewUrl: video.thumbnail.original_url || video.thumbnail.url, }); -export { getRootUrl, X_UA, appDetail, imagePost, topicPost, videoPost }; +export { appDetail, getRootUrl, imagePost, topicPost, videoPost, X_UA }; diff --git a/lib/routes/tass/news.ts b/lib/routes/tass/news.ts index c9f472ead..8463e762e 100644 --- a/lib/routes/tass/news.ts +++ b/lib/routes/tass/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/techcrunch/category.ts b/lib/routes/techcrunch/category.ts index ddb52ddb6..b7552293e 100644 --- a/lib/routes/techcrunch/category.ts +++ b/lib/routes/techcrunch/category.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const host = 'https://techcrunch.com'; export const route: Route = { diff --git a/lib/routes/techcrunch/news.ts b/lib/routes/techcrunch/news.ts index a093641cd..25548dba1 100644 --- a/lib/routes/techcrunch/news.ts +++ b/lib/routes/techcrunch/news.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const host = 'https://techcrunch.com'; export const route: Route = { diff --git a/lib/routes/techflowpost/express.ts b/lib/routes/techflowpost/express.ts index 4cc21e73a..8ebac2a72 100644 --- a/lib/routes/techflowpost/express.ts +++ b/lib/routes/techflowpost/express.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; import dayjs from 'dayjs'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + export const route: Route = { path: '/express', categories: ['finance'], diff --git a/lib/routes/techflowpost/index.ts b/lib/routes/techflowpost/index.ts index cb06b9774..362232def 100644 --- a/lib/routes/techflowpost/index.ts +++ b/lib/routes/techflowpost/index.ts @@ -1,7 +1,8 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/', diff --git a/lib/routes/techpowerup/index.ts b/lib/routes/techpowerup/index.ts index b6f4f0590..b7f24bf13 100644 --- a/lib/routes/techpowerup/index.ts +++ b/lib/routes/techpowerup/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { baseUrl, headers, fixImages, parseReviews } from './utils'; + +import { baseUrl, fixImages, headers, parseReviews } from './utils'; export const route: Route = { path: '/', diff --git a/lib/routes/techpowerup/review.ts b/lib/routes/techpowerup/review.ts index b3f2abdee..870523559 100644 --- a/lib/routes/techpowerup/review.ts +++ b/lib/routes/techpowerup/review.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { baseUrl, headers, fixImages, parseReviews } from './utils'; + +import { baseUrl, fixImages, headers, parseReviews } from './utils'; export const route: Route = { path: '/review/:keyword?', diff --git a/lib/routes/techpowerup/utils.ts b/lib/routes/techpowerup/utils.ts index 81c0cb9f9..249f44b72 100644 --- a/lib/routes/techpowerup/utils.ts +++ b/lib/routes/techpowerup/utils.ts @@ -1,7 +1,8 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import md5 from '@/utils/md5'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://www.techpowerup.com'; @@ -73,4 +74,4 @@ const parseReviews = async ($, item) => { item.description = content.html(); }; -export { baseUrl, headers, fixImages, hdImage, parseReviews, removeFigureStyle, removeResponsiveStyle }; +export { baseUrl, fixImages, hdImage, headers, parseReviews, removeFigureStyle, removeResponsiveStyle }; diff --git a/lib/routes/techsir/index.ts b/lib/routes/techsir/index.ts index a2ceb44ac..a479a9f8d 100644 --- a/lib/routes/techsir/index.ts +++ b/lib/routes/techsir/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/', diff --git a/lib/routes/telecompaper/news.ts b/lib/routes/telecompaper/news.ts index b6c9147c5..9cc179043 100644 --- a/lib/routes/telecompaper/news.ts +++ b/lib/routes/telecompaper/news.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import FormData from 'form-data'; import tough from 'tough-cookie'; -import FormData from 'form-data'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; export const route: Route = { path: '/news/:caty/:year?/:country?/:type?', diff --git a/lib/routes/telecompaper/search.ts b/lib/routes/telecompaper/search.ts index 33cfb9286..4a7ba310d 100644 --- a/lib/routes/telecompaper/search.ts +++ b/lib/routes/telecompaper/search.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/search/:keyword?/:company?/:sort?/:period?', diff --git a/lib/routes/telegram/blog.ts b/lib/routes/telegram/blog.ts index 1155554b2..cb2bd12dd 100644 --- a/lib/routes/telegram/blog.ts +++ b/lib/routes/telegram/blog.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import * as cheerio from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/telegram/channel-media.ts b/lib/routes/telegram/channel-media.ts index c1118aa18..a5c639aca 100644 --- a/lib/routes/telegram/channel-media.ts +++ b/lib/routes/telegram/channel-media.ts @@ -1,14 +1,17 @@ -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; -import { Context } from 'hono'; +import type { Context } from 'hono'; import { stream } from 'hono/streaming'; -import { Api, TelegramClient } from 'telegram'; -import { IterDownloadFunction } from 'telegram/client/downloads.js'; -import { getAppropriatedPartSize } from 'telegram/Utils.js'; -import { config } from '@/config'; -import cacheModule from '@/utils/cache/index'; -import { getClient, getDocument, getFilename, unwrapMedia } from './tglib/client'; +import type { TelegramClient } from 'telegram'; +import { Api } from 'telegram'; +import type { IterDownloadFunction } from 'telegram/client/downloads.js'; import { returnBigInt as bigInt } from 'telegram/Helpers.js'; +import { getAppropriatedPartSize } from 'telegram/Utils.js'; + +import { config } from '@/config'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cacheModule from '@/utils/cache/index'; + +import { getClient, getDocument, getFilename, unwrapMedia } from './tglib/client'; /** * https://core.telegram.org/api/files#stripped-thumbnails diff --git a/lib/routes/telegram/channel.ts b/lib/routes/telegram/channel.ts index d3d27f59d..0c47cd076 100644 --- a/lib/routes/telegram/channel.ts +++ b/lib/routes/telegram/channel.ts @@ -1,13 +1,17 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import { config } from '@/config'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; import querystring from 'node:querystring'; + +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { fallback, queryToBoolean } from '@/utils/readable-social'; +import { art } from '@/utils/render'; + import tglibchannel from './tglib/channel'; /* message types */ diff --git a/lib/routes/telegram/stickerpack.ts b/lib/routes/telegram/stickerpack.ts index 96021960c..5a5d5b7b9 100644 --- a/lib/routes/telegram/stickerpack.ts +++ b/lib/routes/telegram/stickerpack.ts @@ -1,8 +1,9 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/stickerpack/:name', diff --git a/lib/routes/telegram/stories.ts b/lib/routes/telegram/stories.ts index fbeb9cb49..14468315a 100644 --- a/lib/routes/telegram/stories.ts +++ b/lib/routes/telegram/stories.ts @@ -1,11 +1,13 @@ /* eslint-disable no-await-in-loop */ +import type { Context } from 'hono'; +import { Api } from 'telegram'; + import NotFoundError from '@/errors/types/not-found'; import { configureMiddlewares, handleMedia } from '@/routes/telegram/channel-media'; -import { Data, DataItem, Route } from '@/types'; -import { Context } from 'hono'; -import { Api } from 'telegram'; -import { getClient, getStory, unwrapMedia } from './tglib/client'; +import type { Data, DataItem, Route } from '@/types'; + import { getGeoLink, getMediaLink } from './tglib/channel'; +import { getClient, getStory, unwrapMedia } from './tglib/client'; export const route: Route = { path: '/stories/:username/:story?', diff --git a/lib/routes/telegram/tglib/channel.ts b/lib/routes/telegram/tglib/channel.ts index ca604c6c8..6863cd07f 100644 --- a/lib/routes/telegram/tglib/channel.ts +++ b/lib/routes/telegram/tglib/channel.ts @@ -1,12 +1,14 @@ /* eslint-disable no-await-in-loop */ -import { DataItem } from '@/types'; -import { Context } from 'hono'; +import type { Context } from 'hono'; import { Api } from 'telegram'; import { HTMLParser } from 'telegram/extensions/html.js'; -import { getClient, getDocument, getFilename, unwrapMedia } from './client'; -import { getDisplayName } from 'telegram/Utils.js'; -import cache from '@/utils/cache'; import { returnBigInt } from 'telegram/Helpers.js'; +import { getDisplayName } from 'telegram/Utils.js'; + +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; + +import { getClient, getDocument, getFilename, unwrapMedia } from './client'; export function getGeoLink(geo: Api.GeoPoint) { return `Geo LatLon: ${geo.lat}, ${geo.long}`; diff --git a/lib/routes/telegram/tglib/client.ts b/lib/routes/telegram/tglib/client.ts index 82241a3b8..21a3268a0 100644 --- a/lib/routes/telegram/tglib/client.ts +++ b/lib/routes/telegram/tglib/client.ts @@ -1,5 +1,5 @@ import { Api, TelegramClient } from 'telegram'; -import { UserAuthParams } from 'telegram/client/auth'; +import type { UserAuthParams } from 'telegram/client/auth'; import { StringSession } from 'telegram/sessions/index.js'; import { config } from '@/config'; diff --git a/lib/routes/tencent/cloud/developer/column.ts b/lib/routes/tencent/cloud/developer/column.ts index 8cf0cbd20..182f8c04d 100644 --- a/lib/routes/tencent/cloud/developer/column.ts +++ b/lib/routes/tencent/cloud/developer/column.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; const PAGE = 1; const PAGE_SIZE = 20; diff --git a/lib/routes/tencent/news/author.ts b/lib/routes/tencent/news/author.ts index 0b36e938e..371167303 100644 --- a/lib/routes/tencent/news/author.ts +++ b/lib/routes/tencent/news/author.ts @@ -1,12 +1,13 @@ -import { Route, Data } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/news/author/:mid', diff --git a/lib/routes/tencent/news/coronavirus/data.ts b/lib/routes/tencent/news/coronavirus/data.ts index 4564d795a..fac85b08b 100644 --- a/lib/routes/tencent/news/coronavirus/data.ts +++ b/lib/routes/tencent/news/coronavirus/data.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import { getData } from './utils'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import { getData } from './utils'; export const route: Route = { path: '/news/coronavirus/data/:province?/:city?', diff --git a/lib/routes/tencent/news/coronavirus/total.ts b/lib/routes/tencent/news/coronavirus/total.ts index 8e5b4e47f..cef1c3396 100644 --- a/lib/routes/tencent/news/coronavirus/total.ts +++ b/lib/routes/tencent/news/coronavirus/total.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import { getData } from './utils'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import { getData } from './utils'; export const route: Route = { path: '/news/coronavirus/total', diff --git a/lib/routes/tencent/pvp/newsindex.ts b/lib/routes/tencent/pvp/newsindex.ts index 37870b2fb..c23d03ad0 100644 --- a/lib/routes/tencent/pvp/newsindex.ts +++ b/lib/routes/tencent/pvp/newsindex.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const map = new Map([ ['rm', { name: '热门', channelid: 1760 }], ['xw', { name: '新闻', channelid: 1761 }], diff --git a/lib/routes/tencent/qq/sdk/changelog.ts b/lib/routes/tencent/qq/sdk/changelog.ts index 6f58b7c8c..6ff1a0ca2 100644 --- a/lib/routes/tencent/qq/sdk/changelog.ts +++ b/lib/routes/tencent/qq/sdk/changelog.ts @@ -1,8 +1,9 @@ -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/qq/sdk/changelog/:platform', categories: ['program-update'], diff --git a/lib/routes/tesla/cx.ts b/lib/routes/tesla/cx.ts index 9ab6bdd7d..734b0532f 100644 --- a/lib/routes/tesla/cx.ts +++ b/lib/routes/tesla/cx.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/cx/:category?/:city?', diff --git a/lib/routes/tesla/price/get-price.ts b/lib/routes/tesla/price/get-price.ts index 1b5ab8b58..0517efd3a 100644 --- a/lib/routes/tesla/price/get-price.ts +++ b/lib/routes/tesla/price/get-price.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + async function getTeslaPrice(link) { const response = await got(link); diff --git a/lib/routes/tesla/price/index.ts b/lib/routes/tesla/price/index.ts index 090598e99..4ab92c38b 100644 --- a/lib/routes/tesla/price/index.ts +++ b/lib/routes/tesla/price/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getTeslaPrice } from './get-price'; export const route: Route = { diff --git a/lib/routes/test/api-index.ts b/lib/routes/test/api-index.ts index ee0b89479..0d3ac4b4b 100644 --- a/lib/routes/test/api-index.ts +++ b/lib/routes/test/api-index.ts @@ -1,4 +1,4 @@ -import { APIRoute } from '@/types'; +import type { APIRoute } from '@/types'; export const apiRoute: APIRoute = { path: '/', diff --git a/lib/routes/test/index.ts b/lib/routes/test/index.ts index e3637b6f7..7555c6148 100644 --- a/lib/routes/test/index.ts +++ b/lib/routes/test/index.ts @@ -1,12 +1,12 @@ -import { Route, DataItem } from '@/types'; import { config } from '@/config'; -import got from '@/utils/got'; -import wait from '@/utils/wait'; -import cache from '@/utils/cache'; -import { fetchArticle } from '@/utils/wechat-mp'; +import CaptchaError from '@/errors/types/captcha'; import ConfigNotFoundError from '@/errors/types/config-not-found'; import InvalidParameterError from '@/errors/types/invalid-parameter'; -import CaptchaError from '@/errors/types/captcha'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import wait from '@/utils/wait'; +import { fetchArticle } from '@/utils/wechat-mp'; let cacheIndex = 0; diff --git a/lib/routes/tfc-taiwan/category.ts b/lib/routes/tfc-taiwan/category.ts index a82c10c6a..c59d0fd95 100644 --- a/lib/routes/tfc-taiwan/category.ts +++ b/lib/routes/tfc-taiwan/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { baseUrl, parsePost, parseItem } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, parseItem, parsePost } from './utils'; const handler = async (ctx) => { const { category } = ctx.req.param(); diff --git a/lib/routes/tfc-taiwan/index.ts b/lib/routes/tfc-taiwan/index.ts index b1516149f..c7874c002 100644 --- a/lib/routes/tfc-taiwan/index.ts +++ b/lib/routes/tfc-taiwan/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { baseUrl, parsePost, parseItem } from './utils'; + +import { baseUrl, parseItem, parsePost } from './utils'; const handler = async (ctx) => { const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : undefined; diff --git a/lib/routes/tfc-taiwan/utils.ts b/lib/routes/tfc-taiwan/utils.ts index afdb791ef..3d25e0215 100644 --- a/lib/routes/tfc-taiwan/utils.ts +++ b/lib/routes/tfc-taiwan/utils.ts @@ -1,6 +1,6 @@ +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; export const baseUrl = 'https://tfc-taiwan.org.tw'; diff --git a/lib/routes/tgbus/list.ts b/lib/routes/tgbus/list.ts index 4b2680649..572fe6658 100644 --- a/lib/routes/tgbus/list.ts +++ b/lib/routes/tgbus/list.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { parseArticle } from './utils'; type Category = 'news' | 'review' | 'video' | 'special' | 'hardware'; diff --git a/lib/routes/tgbus/utils.ts b/lib/routes/tgbus/utils.ts index 6715c8c0e..3dbd608c9 100644 --- a/lib/routes/tgbus/utils.ts +++ b/lib/routes/tgbus/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/the/index.ts b/lib/routes/the/index.ts index ed130546f..c736feb9b 100644 --- a/lib/routes/the/index.ts +++ b/lib/routes/the/index.ts @@ -1,14 +1,15 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { apiSlug, bakeFilterSearchParams, bakeFiltersWithPair, bakeUrl, fetchData, getFilterParamsForUrl, parseFilterStr } from './util'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; +import { apiSlug, bakeFilterSearchParams, bakeFiltersWithPair, bakeUrl, fetchData, getFilterParamsForUrl, parseFilterStr } from './util'; + export const handler = async (ctx) => { const { filter } = ctx.req.param(); const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 40; diff --git a/lib/routes/the/util.ts b/lib/routes/the/util.ts index fbbdc853f..1e7960cdb 100644 --- a/lib/routes/the/util.ts +++ b/lib/routes/the/util.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + const apiSlug = 'wp-json/wp/v2'; interface Filter { diff --git a/lib/routes/theatlantic/news.ts b/lib/routes/theatlantic/news.ts index 6cc2bd345..fc86811c4 100644 --- a/lib/routes/theatlantic/news.ts +++ b/lib/routes/theatlantic/news.ts @@ -1,7 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { getArticleDetails } from './utils'; + export const route: Route = { path: '/:category', categories: ['traditional-media'], diff --git a/lib/routes/theatlantic/utils.ts b/lib/routes/theatlantic/utils.ts index edca05dfc..60adbb36e 100644 --- a/lib/routes/theatlantic/utils.ts +++ b/lib/routes/theatlantic/utils.ts @@ -1,10 +1,12 @@ -import cache from '@/utils/cache'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import cache from '@/utils/cache'; +import { PRESETS } from '@/utils/header-generator'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { PRESETS } from '@/utils/header-generator'; const getArticleDetails = async (items) => { const list = await Promise.all( diff --git a/lib/routes/theblock/index.ts b/lib/routes/theblock/index.ts index e34b53c83..fb435a167 100644 --- a/lib/routes/theblock/index.ts +++ b/lib/routes/theblock/index.ts @@ -1,9 +1,10 @@ -import { Route, Data } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; +import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import logger from '@/utils/logger'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/theblockbeats/index.ts b/lib/routes/theblockbeats/index.ts index b01c78997..dfd5dddc6 100644 --- a/lib/routes/theblockbeats/index.ts +++ b/lib/routes/theblockbeats/index.ts @@ -1,9 +1,12 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; import { art } from '@/utils/render'; const domain = 'theblockbeats.info'; diff --git a/lib/routes/thecover/channel.ts b/lib/routes/thecover/channel.ts index f26a287e8..9d3dfe39d 100644 --- a/lib/routes/thecover/channel.ts +++ b/lib/routes/thecover/channel.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const rootUrl = 'https://www.thecover.cn'; const nodes = { diff --git a/lib/routes/thegadgetflow/rss.ts b/lib/routes/thegadgetflow/rss.ts index d91afb9b3..8ec091501 100644 --- a/lib/routes/thegadgetflow/rss.ts +++ b/lib/routes/thegadgetflow/rss.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/thegradient/index.ts b/lib/routes/thegradient/index.ts index f255f7ad5..9eece5aaf 100644 --- a/lib/routes/thegradient/index.ts +++ b/lib/routes/thegradient/index.ts @@ -1,8 +1,9 @@ -import { Route, DataItem } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/posts', diff --git a/lib/routes/thehindu/topic.ts b/lib/routes/thehindu/topic.ts index 54f8c4f50..a615b2952 100644 --- a/lib/routes/thehindu/topic.ts +++ b/lib/routes/thehindu/topic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/theinitium/app.ts b/lib/routes/theinitium/app.ts index 2b3cc4c77..b2783a2e0 100644 --- a/lib/routes/theinitium/app.ts +++ b/lib/routes/theinitium/app.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { load, type CheerioAPI } from 'cheerio'; -import type { Element } from 'domhandler'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; const appUrl = 'https://app.theinitium.com/'; const userAgent = 'PugpigBolt v4.1.8 (iPhone, iOS 18.2.1) on phone (model iPhone15,2)'; diff --git a/lib/routes/theinitium/author.ts b/lib/routes/theinitium/author.ts index a1d5dbc60..253848047 100644 --- a/lib/routes/theinitium/author.ts +++ b/lib/routes/theinitium/author.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processFeed } from './utils'; const handler = (ctx) => processFeed('author', ctx); diff --git a/lib/routes/theinitium/channel.ts b/lib/routes/theinitium/channel.ts index b00f3b1fd..da63ae056 100644 --- a/lib/routes/theinitium/channel.ts +++ b/lib/routes/theinitium/channel.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processFeed } from './utils'; const handler = (ctx) => processFeed('channel', ctx); diff --git a/lib/routes/theinitium/follow.ts b/lib/routes/theinitium/follow.ts index 6c4d1d4d2..50f9ceb7c 100644 --- a/lib/routes/theinitium/follow.ts +++ b/lib/routes/theinitium/follow.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processFeed } from './utils'; const handler = (ctx) => processFeed('follow', ctx); diff --git a/lib/routes/theinitium/tags.ts b/lib/routes/theinitium/tags.ts index fd0beb1a2..fb209acda 100644 --- a/lib/routes/theinitium/tags.ts +++ b/lib/routes/theinitium/tags.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processFeed } from './utils'; const handler = (ctx) => processFeed('tags', ctx); diff --git a/lib/routes/theinitium/utils.ts b/lib/routes/theinitium/utils.ts index 5ede1da12..902ff5aed 100644 --- a/lib/routes/theinitium/utils.ts +++ b/lib/routes/theinitium/utils.ts @@ -1,11 +1,12 @@ -import { Context } from 'hono'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; +import { FetchError } from 'ofetch'; + +import { config } from '@/config'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { FetchError } from 'ofetch'; const TOKEN = 'Basic YW5vbnltb3VzOkdpQ2VMRWp4bnFCY1ZwbnA2Y0xzVXZKaWV2dlJRY0FYTHY='; diff --git a/lib/routes/themoviedb/collection.ts b/lib/routes/themoviedb/collection.ts index b1f529860..cb1c0b651 100644 --- a/lib/routes/themoviedb/collection.ts +++ b/lib/routes/themoviedb/collection.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import apiKey from './api-key'; import { handleMovieItem } from './utils'; diff --git a/lib/routes/themoviedb/episodes.ts b/lib/routes/themoviedb/episodes.ts index d2ff3a3b1..152c2bb0b 100644 --- a/lib/routes/themoviedb/episodes.ts +++ b/lib/routes/themoviedb/episodes.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import apiKey from './api-key'; import { handleDescription } from './utils'; diff --git a/lib/routes/themoviedb/seasons.ts b/lib/routes/themoviedb/seasons.ts index a74f885e9..02d621740 100644 --- a/lib/routes/themoviedb/seasons.ts +++ b/lib/routes/themoviedb/seasons.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import apiKey from './api-key'; import { handleDescription } from './utils'; diff --git a/lib/routes/themoviedb/sheet.ts b/lib/routes/themoviedb/sheet.ts index 9f30be13b..0392cf20b 100644 --- a/lib/routes/themoviedb/sheet.ts +++ b/lib/routes/themoviedb/sheet.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import apiKey from './api-key'; import { MEDIA_TYPE_TO_ITEM_HANDLE } from './utils'; diff --git a/lib/routes/themoviedb/trending.ts b/lib/routes/themoviedb/trending.ts index f43754aa8..0804486ed 100644 --- a/lib/routes/themoviedb/trending.ts +++ b/lib/routes/themoviedb/trending.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import apiKey from './api-key'; import { MEDIA_TYPE_TO_ITEM_HANDLE } from './utils'; diff --git a/lib/routes/themoviedb/utils.ts b/lib/routes/themoviedb/utils.ts index 9d618202c..3594cacee 100644 --- a/lib/routes/themoviedb/utils.ts +++ b/lib/routes/themoviedb/utils.ts @@ -1,6 +1,7 @@ import path from 'node:path'; -import { art } from '@/utils/render'; + import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const handleDescription = (item) => { const poster_path = item.poster_path ?? item.still_path; diff --git a/lib/routes/thenewslens/index.ts b/lib/routes/thenewslens/index.ts index da8779e37..00546d502 100644 --- a/lib/routes/thenewslens/index.ts +++ b/lib/routes/thenewslens/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '*', diff --git a/lib/routes/thepaper/839studio/category.ts b/lib/routes/thepaper/839studio/category.ts index 1244e1590..d14b46f8e 100644 --- a/lib/routes/thepaper/839studio/category.ts +++ b/lib/routes/thepaper/839studio/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/839studio/:id', radar: [ diff --git a/lib/routes/thepaper/839studio/studio.ts b/lib/routes/thepaper/839studio/studio.ts index ea5639992..81c86ecdd 100644 --- a/lib/routes/thepaper/839studio/studio.ts +++ b/lib/routes/thepaper/839studio/studio.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/839studio', name: '澎湃美数课作品集', diff --git a/lib/routes/thepaper/channel.ts b/lib/routes/thepaper/channel.ts index 872d41d2c..48c605347 100644 --- a/lib/routes/thepaper/channel.ts +++ b/lib/routes/thepaper/channel.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import utils from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; +import utils from './utils'; + export const route: Route = { path: '/channel/:id', categories: ['new-media'], diff --git a/lib/routes/thepaper/factpaper.ts b/lib/routes/thepaper/factpaper.ts index dd136624c..701e359b3 100644 --- a/lib/routes/thepaper/factpaper.ts +++ b/lib/routes/thepaper/factpaper.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/factpaper/:status?', diff --git a/lib/routes/thepaper/featured.ts b/lib/routes/thepaper/featured.ts index 1f4127e49..9de15d90e 100644 --- a/lib/routes/thepaper/featured.ts +++ b/lib/routes/thepaper/featured.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import utils from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; +import utils from './utils'; + export const route: Route = { path: '/featured', categories: ['new-media'], diff --git a/lib/routes/thepaper/list.ts b/lib/routes/thepaper/list.ts index a9bf0e678..df01b7fb1 100644 --- a/lib/routes/thepaper/list.ts +++ b/lib/routes/thepaper/list.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import utils from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; +import utils from './utils'; + export const route: Route = { path: '/list/:id', categories: ['new-media'], diff --git a/lib/routes/thepaper/sidebar.ts b/lib/routes/thepaper/sidebar.ts index 9170ca1d5..3b3bdedc5 100644 --- a/lib/routes/thepaper/sidebar.ts +++ b/lib/routes/thepaper/sidebar.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import utils from './utils'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import utils from './utils'; + const sections = { hotNews: '澎湃热榜', financialInformationNews: '澎湃财讯', diff --git a/lib/routes/thepaper/user.ts b/lib/routes/thepaper/user.ts index d072f0024..ed019dd67 100644 --- a/lib/routes/thepaper/user.ts +++ b/lib/routes/thepaper/user.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; import * as cheerio from 'cheerio'; -import ofetch from '@/utils/ofetch'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/thepaper/utils.ts b/lib/routes/thepaper/utils.ts index b9c8fe23a..c36f33c2a 100644 --- a/lib/routes/thepaper/utils.ts +++ b/lib/routes/thepaper/utils.ts @@ -1,10 +1,12 @@ -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import { parseDate, parseRelativeDate } from '@/utils/parse-date'; -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const defaultRssItem = (item) => ({ title: item.name, link: item.link, diff --git a/lib/routes/thepetcity/index.ts b/lib/routes/thepetcity/index.ts index b8ecdb590..3b63cc473 100644 --- a/lib/routes/thepetcity/index.ts +++ b/lib/routes/thepetcity/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + import { termsMap } from './terms-map'; const baseUrl = 'https://thepetcity.co'; diff --git a/lib/routes/theverge/index.ts b/lib/routes/theverge/index.ts index ef197adc0..6ba303006 100644 --- a/lib/routes/theverge/index.ts +++ b/lib/routes/theverge/index.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; -import path from 'node:path'; import { art } from '@/utils/render'; +import parser from '@/utils/rss-parser'; const excludeTypes = new Set(['NewsletterBlockType', 'RelatedPostsBlockType', 'ProductsTableBlockType', 'TableOfContentsBlockType']); diff --git a/lib/routes/thewirehindi/category.ts b/lib/routes/thewirehindi/category.ts index 5a629b5f8..8adf75714 100644 --- a/lib/routes/thewirehindi/category.ts +++ b/lib/routes/thewirehindi/category.ts @@ -1,5 +1,6 @@ -import { Data, Route } from '@/types'; +import type { Data, Route } from '@/types'; import got from '@/utils/got'; + import { mapPostToItem } from './utils'; const categories = [ diff --git a/lib/routes/thewirehindi/index.ts b/lib/routes/thewirehindi/index.ts index 8d63f5330..4b4499b1b 100644 --- a/lib/routes/thewirehindi/index.ts +++ b/lib/routes/thewirehindi/index.ts @@ -1,5 +1,6 @@ -import { Data, Route } from '@/types'; +import type { Data, Route } from '@/types'; import got from '@/utils/got'; + import { mapPostToItem } from './utils'; export const route: Route = { diff --git a/lib/routes/thewirehindi/utils.ts b/lib/routes/thewirehindi/utils.ts index 0f2200baa..730ded2bc 100644 --- a/lib/routes/thewirehindi/utils.ts +++ b/lib/routes/thewirehindi/utils.ts @@ -1,7 +1,8 @@ -import { DataItem } from '@/types'; +import path from 'node:path'; + +import type { DataItem } from '@/types'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export function mapPostToItem(post): DataItem { const featuredMedia = post._embedded?.['wp:featuredmedia']?.find((v) => v.id === post.featured_media); diff --git a/lib/routes/thoughtco/index.ts b/lib/routes/thoughtco/index.ts index 9d6e98341..f3bbe0458 100644 --- a/lib/routes/thoughtco/index.ts +++ b/lib/routes/thoughtco/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/thoughtworks/index.ts b/lib/routes/thoughtworks/index.ts index daa652eec..1df1b2d76 100644 --- a/lib/routes/thoughtworks/index.ts +++ b/lib/routes/thoughtworks/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/threads/index.ts b/lib/routes/threads/index.ts index 9dc62ec18..6c40d644f 100644 --- a/lib/routes/threads/index.ts +++ b/lib/routes/threads/index.ts @@ -1,9 +1,12 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import { threadUrl, profileUrl, extractTokens, getUserId, buildContent } from './utils'; import { JSDOM } from 'jsdom'; import { JSONPath } from 'jsonpath-plus'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import { buildContent, extractTokens, getUserId, profileUrl, threadUrl } from './utils'; export const route: Route = { path: '/:user/:routeParams?', diff --git a/lib/routes/threads/utils.ts b/lib/routes/threads/utils.ts index 1b35c346a..d26a88751 100644 --- a/lib/routes/threads/utils.ts +++ b/lib/routes/threads/utils.ts @@ -1,11 +1,12 @@ import { load } from 'cheerio'; import dayjs from 'dayjs'; -import cache from '@/utils/cache'; -import NotFoundError from '@/errors/types/not-found'; -import ofetch from '@/utils/ofetch'; import { JSDOM } from 'jsdom'; import { JSONPath } from 'jsonpath-plus'; +import NotFoundError from '@/errors/types/not-found'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + const profileUrl = (user: string) => `https://www.threads.com/@${user}`; const threadUrl = (code: string) => `https://www.threads.com/t/${code}`; @@ -167,4 +168,4 @@ const buildContent = (item, options) => { return { title, description }; }; -export { profileUrl, threadUrl, extractTokens, getUserId, buildContent }; +export { buildContent, extractTokens, getUserId, profileUrl, threadUrl }; diff --git a/lib/routes/thwiki/index.ts b/lib/routes/thwiki/index.ts index 92399fb12..7f0f6e072 100644 --- a/lib/routes/thwiki/index.ts +++ b/lib/routes/thwiki/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import dayjs from 'dayjs'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/calendar/:before?/:after?', categories: ['anime'], diff --git a/lib/routes/thzt/index.ts b/lib/routes/thzt/index.ts index aac9768ce..8102e6ef7 100644 --- a/lib/routes/thzt/index.ts +++ b/lib/routes/thzt/index.ts @@ -1,8 +1,8 @@ -import { Route, DataItem } from '@/types'; +import { load } from 'cheerio'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/tidb/blog.ts b/lib/routes/tidb/blog.ts index 5470783cf..ebd22505e 100644 --- a/lib/routes/tidb/blog.ts +++ b/lib/routes/tidb/blog.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type CheerioAPI, load } from 'cheerio'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, load } from 'cheerio'; -import { type Context } from 'hono'; - const escapeHtml = (text: string): string => text?.replaceAll('&', '&')?.replaceAll('<', '<')?.replaceAll('>', '>')?.replaceAll("'", '"')?.replaceAll("'", ''') ?? text; const parseTextChildren = (children: any[]): string => children.map((child: any) => escapeHtml(child.text)).join(''); diff --git a/lib/routes/tiddlywiki/releases.ts b/lib/routes/tiddlywiki/releases.ts index cbc9174a6..622a309ab 100644 --- a/lib/routes/tiddlywiki/releases.ts +++ b/lib/routes/tiddlywiki/releases.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/tiktok/user.ts b/lib/routes/tiktok/user.ts index 9c2927ed2..e7d405ad6 100644 --- a/lib/routes/tiktok/user.ts +++ b/lib/routes/tiktok/user.ts @@ -1,12 +1,12 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { config } from '@/config'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { queryToBoolean } from '@/utils/readable-social'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import { queryToBoolean } from '@/utils/readable-social'; +import { art } from '@/utils/render'; const baseUrl = 'https://www.tiktok.com'; diff --git a/lib/routes/timednews/news.ts b/lib/routes/timednews/news.ts index fe6f242ea..c3b66a589 100644 --- a/lib/routes/timednews/news.ts +++ b/lib/routes/timednews/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const BASE = 'https://www.timednews.com/topic'; diff --git a/lib/routes/tingshuitz/changsha.ts b/lib/routes/tingshuitz/changsha.ts index 1cf041f65..4513a04eb 100644 --- a/lib/routes/tingshuitz/changsha.ts +++ b/lib/routes/tingshuitz/changsha.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'http://www.supplywater.com'; export const route: Route = { diff --git a/lib/routes/tingshuitz/dalian.ts b/lib/routes/tingshuitz/dalian.ts index 1d1811890..274314ac0 100644 --- a/lib/routes/tingshuitz/dalian.ts +++ b/lib/routes/tingshuitz/dalian.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/tingshuitz/dongguan.ts b/lib/routes/tingshuitz/dongguan.ts index ef0e4a53b..362bcb318 100644 --- a/lib/routes/tingshuitz/dongguan.ts +++ b/lib/routes/tingshuitz/dongguan.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/tingshuitz/guangzhou.ts b/lib/routes/tingshuitz/guangzhou.ts index 0142497f4..c76d1601b 100644 --- a/lib/routes/tingshuitz/guangzhou.ts +++ b/lib/routes/tingshuitz/guangzhou.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/tingshuitz/hangzhou.ts b/lib/routes/tingshuitz/hangzhou.ts index 234307b48..9baade89b 100644 --- a/lib/routes/tingshuitz/hangzhou.ts +++ b/lib/routes/tingshuitz/hangzhou.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/hangzhou', categories: ['forecast'], diff --git a/lib/routes/tingshuitz/nanjing.ts b/lib/routes/tingshuitz/nanjing.ts index e17dd88d7..e2d2aa899 100644 --- a/lib/routes/tingshuitz/nanjing.ts +++ b/lib/routes/tingshuitz/nanjing.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const HOME_PAGE = 'http://www.jlwater.com/'; export const route: Route = { diff --git a/lib/routes/tingshuitz/shenzhen.ts b/lib/routes/tingshuitz/shenzhen.ts index 8f3f5e1ae..6bc5792b8 100644 --- a/lib/routes/tingshuitz/shenzhen.ts +++ b/lib/routes/tingshuitz/shenzhen.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/shenzhen', diff --git a/lib/routes/tingshuitz/wuhan.ts b/lib/routes/tingshuitz/wuhan.ts index f2a03e8f5..415452b97 100644 --- a/lib/routes/tingshuitz/wuhan.ts +++ b/lib/routes/tingshuitz/wuhan.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://www.whwater.com'; export const route: Route = { diff --git a/lib/routes/tingshuitz/xian.ts b/lib/routes/tingshuitz/xian.ts index 560b08f1a..855cf7755 100644 --- a/lib/routes/tingshuitz/xian.ts +++ b/lib/routes/tingshuitz/xian.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/xian', categories: ['forecast'], diff --git a/lib/routes/tingshuitz/xiaoshan.ts b/lib/routes/tingshuitz/xiaoshan.ts index 444de1cdd..5ec44886f 100644 --- a/lib/routes/tingshuitz/xiaoshan.ts +++ b/lib/routes/tingshuitz/xiaoshan.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/xiaoshan', categories: ['forecast'], diff --git a/lib/routes/tingshuitz/yangjiang.ts b/lib/routes/tingshuitz/yangjiang.ts index dab09a273..b4570f7f8 100644 --- a/lib/routes/tingshuitz/yangjiang.ts +++ b/lib/routes/tingshuitz/yangjiang.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/tingtingfm/program.ts b/lib/routes/tingtingfm/program.ts index e73eb33a3..a6c6afe12 100644 --- a/lib/routes/tingtingfm/program.ts +++ b/lib/routes/tingtingfm/program.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; -import { art } from '@/utils/render'; -import path from 'node:path'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + import { getClientVal, sign } from './utils'; export const route: Route = { diff --git a/lib/routes/tisi/index.ts b/lib/routes/tisi/index.ts index 5c6427aa4..537e63a5e 100644 --- a/lib/routes/tisi/index.ts +++ b/lib/routes/tisi/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.tisi.org'; diff --git a/lib/routes/tju/cic/index.ts b/lib/routes/tju/cic/index.ts index bf08e241b..6ce3a999b 100644 --- a/lib/routes/tju/cic/index.ts +++ b/lib/routes/tju/cic/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/tju/news/index.ts b/lib/routes/tju/news/index.ts index b2f8a98a4..e5d0b116f 100644 --- a/lib/routes/tju/news/index.ts +++ b/lib/routes/tju/news/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/tju/oaa/index.ts b/lib/routes/tju/oaa/index.ts index 923c62dde..b65e2872a 100644 --- a/lib/routes/tju/oaa/index.ts +++ b/lib/routes/tju/oaa/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { finishArticleItem } from '@/utils/wechat-mp'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { finishArticleItem } from '@/utils/wechat-mp'; const oaa_base_url = 'http://oaa.tju.edu.cn/'; const repo_url = 'https://github.com/DIYgod/RSSHub/issues'; diff --git a/lib/routes/tju/yzb/index.ts b/lib/routes/tju/yzb/index.ts index 1fc5b7748..8f7f6147d 100644 --- a/lib/routes/tju/yzb/index.ts +++ b/lib/routes/tju/yzb/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/tkww/index.ts b/lib/routes/tkww/index.ts index 4a00ab114..61e0b81de 100644 --- a/lib/routes/tkww/index.ts +++ b/lib/routes/tkww/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { config } from '@/config'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; export const route: Route = { path: '/:column{.+}?', diff --git a/lib/routes/tmtpost/column.ts b/lib/routes/tmtpost/column.ts index a611f8bee..43e7a3c3d 100644 --- a/lib/routes/tmtpost/column.ts +++ b/lib/routes/tmtpost/column.ts @@ -1,8 +1,8 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; -import { baseUrl, apiBaseUrl, processItems } from './util'; +import { type Data, type Route, ViewType } from '@/types'; + +import { apiBaseUrl, baseUrl, processItems } from './util'; export const handler = async (ctx: Context): Promise => { const { id } = ctx.req.param(); diff --git a/lib/routes/tmtpost/new.ts b/lib/routes/tmtpost/new.ts index aa29f2212..623194914 100644 --- a/lib/routes/tmtpost/new.ts +++ b/lib/routes/tmtpost/new.ts @@ -1,8 +1,8 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; -import { baseUrl, apiBaseUrl, processItems } from './util'; +import { type Data, type Route, ViewType } from '@/types'; + +import { apiBaseUrl, baseUrl, processItems } from './util'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/tmtpost/nictation.ts b/lib/routes/tmtpost/nictation.ts index 0b8f4204f..50d773310 100644 --- a/lib/routes/tmtpost/nictation.ts +++ b/lib/routes/tmtpost/nictation.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/tmtpost/util.ts b/lib/routes/tmtpost/util.ts index 70a3d446c..87c21da81 100644 --- a/lib/routes/tmtpost/util.ts +++ b/lib/routes/tmtpost/util.ts @@ -1,12 +1,12 @@ -import { type Data, type DataItem } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type CheerioAPI, load } from 'cheerio'; + +import { type Data, type DataItem } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, load } from 'cheerio'; -import path from 'node:path'; +import { art } from '@/utils/render'; const baseUrl: string = 'https://www.tmtpost.com'; const apiBaseUrl: string = 'https://api.tmtpost.com'; @@ -201,4 +201,4 @@ const processItems = async (limit: number, query: Record, apiUrl: s }; }; -export { baseUrl, apiBaseUrl, processItems }; +export { apiBaseUrl, baseUrl, processItems }; diff --git a/lib/routes/tokeninsight/blog.ts b/lib/routes/tokeninsight/blog.ts index 9adc43c7a..35b38fcea 100644 --- a/lib/routes/tokeninsight/blog.ts +++ b/lib/routes/tokeninsight/blog.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseURL = 'https://www.tokeninsight.com/'; const title = 'TokenInsight'; const link = 'https://www.tokeninsight.com/'; diff --git a/lib/routes/tokeninsight/bulletin.ts b/lib/routes/tokeninsight/bulletin.ts index fc50d30e3..fe39c6dcf 100644 --- a/lib/routes/tokeninsight/bulletin.ts +++ b/lib/routes/tokeninsight/bulletin.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseURL = 'https://www.tokeninsight.com/'; const title = 'TokenInsight'; const link = 'https://www.tokeninsight.com/'; diff --git a/lib/routes/tokeninsight/report.ts b/lib/routes/tokeninsight/report.ts index 68eee16f9..7e26add65 100644 --- a/lib/routes/tokeninsight/report.ts +++ b/lib/routes/tokeninsight/report.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseURL = 'https://www.tokeninsight.com/'; const title = 'TokenInsight'; const link = 'https://www.tokeninsight.com/'; diff --git a/lib/routes/tongji/bks.ts b/lib/routes/tongji/bks.ts index 01266aa1e..9bef2e53e 100644 --- a/lib/routes/tongji/bks.ts +++ b/lib/routes/tongji/bks.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/tongji/gs.ts b/lib/routes/tongji/gs.ts index 4d1917344..1c7712eed 100644 --- a/lib/routes/tongji/gs.ts +++ b/lib/routes/tongji/gs.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/gs', diff --git a/lib/routes/tongji/sem/_utils.ts b/lib/routes/tongji/sem/_utils.ts index 090d1fce9..b735acac7 100644 --- a/lib/routes/tongji/sem/_utils.ts +++ b/lib/routes/tongji/sem/_utils.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export async function getNotifByPage(url): Promise<{ title: string; link: string; pubDate: Date }[]> { const pageUrl: string = url; diff --git a/lib/routes/tongji/sem/notice.ts b/lib/routes/tongji/sem/notice.ts index 790e67ce1..f5e398d3a 100644 --- a/lib/routes/tongji/sem/notice.ts +++ b/lib/routes/tongji/sem/notice.ts @@ -1,8 +1,9 @@ // Warning: The author still knows nothing about javascript! -import { Route } from '@/types'; -import { getNotifByPage, getArticle } from './_utils'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import { getArticle, getNotifByPage } from './_utils'; + export const route: Route = { path: '/sem/:type?', categories: ['university'], diff --git a/lib/routes/tongji/sse/_article.ts b/lib/routes/tongji/sse/_article.ts index 4f8891760..d976a79f6 100644 --- a/lib/routes/tongji/sse/_article.ts +++ b/lib/routes/tongji/sse/_article.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; // get web content import { load } from 'cheerio'; // html parser +import got from '@/utils/got'; // get web content + export default async function getArticle(item) { const response = await got({ method: 'get', diff --git a/lib/routes/tongji/sse/notice.ts b/lib/routes/tongji/sse/notice.ts index 87beaf7b7..1babd3315 100644 --- a/lib/routes/tongji/sse/notice.ts +++ b/lib/routes/tongji/sse/notice.ts @@ -1,15 +1,15 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // html parser + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // Warning: The author still knows nothing about javascript! - // params: // type: notification type - import got from '@/utils/got'; // get web content -import { load } from 'cheerio'; // html parser -import getArticle from './_article'; import { parseDate } from '@/utils/parse-date'; +import getArticle from './_article'; + export const route: Route = { path: '/sse/:type?', categories: ['university'], diff --git a/lib/routes/tongji/yjs.ts b/lib/routes/tongji/yjs.ts index afdfb0a01..b18739530 100644 --- a/lib/routes/tongji/yjs.ts +++ b/lib/routes/tongji/yjs.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/yjs', diff --git a/lib/routes/tongli/news.ts b/lib/routes/tongli/news.ts index da9072b13..df3a59a4a 100644 --- a/lib/routes/tongli/news.ts +++ b/lib/routes/tongli/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import * as cheerio from 'cheerio'; export const route: Route = { path: '/news/:type', diff --git a/lib/routes/toodaylab/index.ts b/lib/routes/toodaylab/index.ts index 09f770350..6bf80982b 100644 --- a/lib/routes/toodaylab/index.ts +++ b/lib/routes/toodaylab/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:params{.+}?', diff --git a/lib/routes/tophub/index.ts b/lib/routes/tophub/index.ts index a753fa47e..c25b0d359 100644 --- a/lib/routes/tophub/index.ts +++ b/lib/routes/tophub/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/:id', diff --git a/lib/routes/tophub/list.ts b/lib/routes/tophub/list.ts index 9ce023004..14dd039fe 100644 --- a/lib/routes/tophub/list.ts +++ b/lib/routes/tophub/list.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { config } from '@/config'; import path from 'node:path'; -import { art } from '@/utils/render'; + +import { load } from 'cheerio'; import xxhash from 'xxhash-wasm'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/list/:id', categories: ['new-media'], diff --git a/lib/routes/topys/index.ts b/lib/routes/topys/index.ts index 1428fb3d9..a956f3903 100644 --- a/lib/routes/topys/index.ts +++ b/lib/routes/topys/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/toranoana/news.ts b/lib/routes/toranoana/news.ts index 404c1f513..9c60d77f0 100644 --- a/lib/routes/toranoana/news.ts +++ b/lib/routes/toranoana/news.ts @@ -1,7 +1,8 @@ -import { Route, Data, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/news/:category?', diff --git a/lib/routes/toutiao/user.ts b/lib/routes/toutiao/user.ts index fbddd91b5..c72224bd6 100644 --- a/lib/routes/toutiao/user.ts +++ b/lib/routes/toutiao/user.ts @@ -1,15 +1,17 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import { config } from '@/config'; +import RejectError from '@/errors/types/reject'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import { generateHeaders, PRESETS } from '@/utils/header-generator'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { PRESETS, generateHeaders } from '@/utils/header-generator'; -import { generate_a_bogus } from './a-bogus'; -import { Feed } from './types'; -import RejectError from '@/errors/types/reject'; -import { config } from '@/config'; -import path from 'node:path'; import { art } from '@/utils/render'; +import { generate_a_bogus } from './a-bogus'; +import type { Feed } from './types'; + export const route: Route = { path: '/user/token/:token', categories: ['new-media'], diff --git a/lib/routes/towardsdatascience/latest.ts b/lib/routes/towardsdatascience/latest.ts index 38ddf2f79..22eb9712c 100644 --- a/lib/routes/towardsdatascience/latest.ts +++ b/lib/routes/towardsdatascience/latest.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/latest', diff --git a/lib/routes/tradingview/blog.ts b/lib/routes/tradingview/blog.ts index 8ffca34d1..02d3b62c9 100644 --- a/lib/routes/tradingview/blog.ts +++ b/lib/routes/tradingview/blog.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import pMap from 'p-map'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/blog/:category{.+}?', diff --git a/lib/routes/tradingview/desktop.ts b/lib/routes/tradingview/desktop.ts index 09375cc71..6873678fb 100644 --- a/lib/routes/tradingview/desktop.ts +++ b/lib/routes/tradingview/desktop.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/desktop', diff --git a/lib/routes/tradingview/pine.ts b/lib/routes/tradingview/pine.ts index cc2167dab..d78848fa5 100644 --- a/lib/routes/tradingview/pine.ts +++ b/lib/routes/tradingview/pine.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/transcriptforest/index.ts b/lib/routes/transcriptforest/index.ts index 3bf8f75d5..7fcea4d0e 100644 --- a/lib/routes/transcriptforest/index.ts +++ b/lib/routes/transcriptforest/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const bakeTimestamp = (seconds) => { const hours = Math.floor(seconds / 3600); diff --git a/lib/routes/transformer-circuits/index.ts b/lib/routes/transformer-circuits/index.ts index f5a40235f..1586228b9 100644 --- a/lib/routes/transformer-circuits/index.ts +++ b/lib/routes/transformer-circuits/index.ts @@ -1,11 +1,13 @@ -import { Route, DataItem } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import logger from '@/utils/logger'; // Define the main route path export const route: Route = { diff --git a/lib/routes/trendforce/new.ts b/lib/routes/trendforce/new.ts index 7a9591d34..101013f1c 100644 --- a/lib/routes/trendforce/new.ts +++ b/lib/routes/trendforce/new.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '10', 10); diff --git a/lib/routes/trendingpapers/papers.ts b/lib/routes/trendingpapers/papers.ts index db5b76e20..33d3a11cc 100644 --- a/lib/routes/trendingpapers/papers.ts +++ b/lib/routes/trendingpapers/papers.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/tribalfootball/latest.ts b/lib/routes/tribalfootball/latest.ts index 11acd4cb5..149f87e89 100644 --- a/lib/routes/tribalfootball/latest.ts +++ b/lib/routes/tribalfootball/latest.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const rssUrl = 'https://www.tribalfootball.com/rss/mediafed/general/rss.xml'; diff --git a/lib/routes/trow/portal.ts b/lib/routes/trow/portal.ts index 8f086ae82..c814477d3 100644 --- a/lib/routes/trow/portal.ts +++ b/lib/routes/trow/portal.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/tsdm39/bd.ts b/lib/routes/tsdm39/bd.ts index 2f65bda68..399a1db38 100644 --- a/lib/routes/tsdm39/bd.ts +++ b/lib/routes/tsdm39/bd.ts @@ -1,9 +1,10 @@ -import type { DataItem, Route } from '@/types'; -import { config } from '@/config'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; // type id => display name type Mapping = Record; diff --git a/lib/routes/tsinghua/lib/tzgg.ts b/lib/routes/tsinghua/lib/tzgg.ts index 73ff5975f..b78f63a78 100644 --- a/lib/routes/tsinghua/lib/tzgg.ts +++ b/lib/routes/tsinghua/lib/tzgg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/lib/tzgg/:category', diff --git a/lib/routes/tsinghua/lib/zydt.ts b/lib/routes/tsinghua/lib/zydt.ts index 6083c27f2..37274420c 100644 --- a/lib/routes/tsinghua/lib/zydt.ts +++ b/lib/routes/tsinghua/lib/zydt.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/tsinghua/news.ts b/lib/routes/tsinghua/news.ts index 4158a6f81..1f23a0f32 100644 --- a/lib/routes/tsinghua/news.ts +++ b/lib/routes/tsinghua/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ttv/index.ts b/lib/routes/ttv/index.ts index b670f0104..cab774a2a 100644 --- a/lib/routes/ttv/index.ts +++ b/lib/routes/ttv/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/tumblr/posts.ts b/lib/routes/tumblr/posts.ts index 622df014c..908fafa68 100644 --- a/lib/routes/tumblr/posts.ts +++ b/lib/routes/tumblr/posts.ts @@ -1,11 +1,13 @@ -import { Data, Route } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import type { Context } from 'hono'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, Route } from '@/types'; +import got from '@/utils/got'; import { fallback, queryToInteger } from '@/utils/readable-social'; +import utils from './utils'; + export const route: Route = { path: '/posts/:blog', categories: ['blog'], diff --git a/lib/routes/tumblr/utils.ts b/lib/routes/tumblr/utils.ts index 97f584c65..8ac2eb26c 100644 --- a/lib/routes/tumblr/utils.ts +++ b/lib/routes/tumblr/utils.ts @@ -1,9 +1,9 @@ -import { parseDate } from '@/utils/parse-date'; -import { DataItem } from '@/types'; import { config } from '@/config'; +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; -import logger from '@/utils/logger'; import got from '@/utils/got'; +import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; const getAccessToken: () => Promise = async () => { let accessToken: string | null = await cache.get('tumblr:accessToken', false); diff --git a/lib/routes/tvb/news.ts b/lib/routes/tvb/news.ts index df834931f..f610bea1d 100644 --- a/lib/routes/tvb/news.ts +++ b/lib/routes/tvb/news.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const titles = { focus: { diff --git a/lib/routes/tver/series.ts b/lib/routes/tver/series.ts index bc3f8e7f5..18e821d56 100644 --- a/lib/routes/tver/series.ts +++ b/lib/routes/tver/series.ts @@ -1,8 +1,9 @@ -import { Route, Data, DataItem } from '@/types'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { Context } from 'hono'; export const route: Route = { path: '/series/:id', diff --git a/lib/routes/tvtropes/featured.ts b/lib/routes/tvtropes/featured.ts index c1b4cb9de..9e9677f5b 100644 --- a/lib/routes/tvtropes/featured.ts +++ b/lib/routes/tvtropes/featured.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const categories = { today: 'left', newest: 'right', diff --git a/lib/routes/twitch/live.ts b/lib/routes/twitch/live.ts index d6f0c2933..f7445b920 100644 --- a/lib/routes/twitch/live.ts +++ b/lib/routes/twitch/live.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/twitch/schedule.ts b/lib/routes/twitch/schedule.ts index 1f5af2c5e..daad1d2f0 100644 --- a/lib/routes/twitch/schedule.ts +++ b/lib/routes/twitch/schedule.ts @@ -1,5 +1,5 @@ import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; // https://github.com/streamlink/streamlink/blob/master/src/streamlink/plugins/twitch.py#L286 diff --git a/lib/routes/twitch/video.ts b/lib/routes/twitch/video.ts index c9df3e7b8..f3324dbc4 100644 --- a/lib/routes/twitch/video.ts +++ b/lib/routes/twitch/video.ts @@ -1,5 +1,6 @@ import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/twitter/api/index.ts b/lib/routes/twitter/api/index.ts index 9f17ad751..59536b138 100644 --- a/lib/routes/twitter/api/index.ts +++ b/lib/routes/twitter/api/index.ts @@ -1,7 +1,8 @@ +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; + import mobileApi from './mobile-api/api'; import webApi from './web-api/api'; -import { config } from '@/config'; const enableThirdPartyApi = config.twitter.thirdPartyApi; const enableMobileApi = config.twitter.username && config.twitter.password; diff --git a/lib/routes/twitter/api/mobile-api/api.ts b/lib/routes/twitter/api/mobile-api/api.ts index 35d64c103..4f3e12ce5 100644 --- a/lib/routes/twitter/api/mobile-api/api.ts +++ b/lib/routes/twitter/api/mobile-api/api.ts @@ -1,14 +1,16 @@ -import { baseUrl, gqlMap, gqlFeatures, consumerKey, consumerSecret } from './constants'; -import { config } from '@/config'; -import logger from '@/utils/logger'; -import OAuth from 'oauth-1.0a'; import CryptoJS from 'crypto-js'; +import OAuth from 'oauth-1.0a'; import queryString from 'query-string'; -import { getToken } from './token'; -import cache from '@/utils/cache'; + +import { config } from '@/config'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import cache from '@/utils/cache'; +import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; +import { baseUrl, consumerKey, consumerSecret, gqlFeatures, gqlMap } from './constants'; +import { getToken } from './token'; + const twitterGot = async (url, params) => { const token = await getToken(); diff --git a/lib/routes/twitter/api/mobile-api/constants.ts b/lib/routes/twitter/api/mobile-api/constants.ts index cd9b92bbb..01af42494 100644 --- a/lib/routes/twitter/api/mobile-api/constants.ts +++ b/lib/routes/twitter/api/mobile-api/constants.ts @@ -83,4 +83,4 @@ const bearerToken = 'Bearer AAAAAAAAAAAAAAAAAAAAAFXzAwAAAAAAMHCxpeSDG1gLNLghVe8d const guestActivateUrl = baseUrl + '/1.1/guest/activate.json'; -export { baseUrl, consumerKey, consumerSecret, gqlMap, gqlFeatures, timelineParams, bearerToken, guestActivateUrl }; +export { baseUrl, bearerToken, consumerKey, consumerSecret, gqlFeatures, gqlMap, guestActivateUrl, timelineParams }; diff --git a/lib/routes/twitter/api/mobile-api/login.ts b/lib/routes/twitter/api/mobile-api/login.ts index f266877ec..5544ea210 100644 --- a/lib/routes/twitter/api/mobile-api/login.ts +++ b/lib/routes/twitter/api/mobile-api/login.ts @@ -1,14 +1,17 @@ // https://github.com/BANKA2017/twitter-monitor/blob/node/apps/open_account/scripts/login.mjs -import { bearerToken, guestActivateUrl } from './constants'; -import got from '@/utils/got'; -import ofetch from '@/utils/ofetch'; import crypto from 'node:crypto'; -import { v5 as uuidv5 } from 'uuid'; + import { authenticator } from 'otplib'; -import logger from '@/utils/logger'; -import cache from '@/utils/cache'; import { RateLimiterMemory, RateLimiterQueue, RateLimiterRedis } from 'rate-limiter-flexible'; +import { v5 as uuidv5 } from 'uuid'; + +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; + +import { bearerToken, guestActivateUrl } from './constants'; const ENDPOINT = 'https://api.x.com/1.1/onboarding/task.json'; diff --git a/lib/routes/twitter/api/mobile-api/token.ts b/lib/routes/twitter/api/mobile-api/token.ts index 51d6eba44..93a6069ce 100644 --- a/lib/routes/twitter/api/mobile-api/token.ts +++ b/lib/routes/twitter/api/mobile-api/token.ts @@ -1,7 +1,8 @@ import { config } from '@/config'; -import login from './login'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import login from './login'; + let tokenIndex = 0; async function getToken() { diff --git a/lib/routes/twitter/api/web-api/api.ts b/lib/routes/twitter/api/web-api/api.ts index 44fc3144e..cd3686d85 100644 --- a/lib/routes/twitter/api/web-api/api.ts +++ b/lib/routes/twitter/api/web-api/api.ts @@ -1,10 +1,11 @@ -import { baseUrl, gqlMap, gqlFeatures } from './constants'; import { config } from '@/config'; -import cache from '@/utils/cache'; -import { twitterGot, paginationTweets, gatherLegacyFromData } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { baseUrl, gqlFeatures, gqlMap } from './constants'; +import { gatherLegacyFromData, paginationTweets, twitterGot } from './utils'; + const getUserData = (id) => cache.tryGet(`twitter-userdata-${id}`, () => { const params = { diff --git a/lib/routes/twitter/api/web-api/constants.ts b/lib/routes/twitter/api/web-api/constants.ts index aecefd1ab..1b9856ecb 100644 --- a/lib/routes/twitter/api/web-api/constants.ts +++ b/lib/routes/twitter/api/web-api/constants.ts @@ -114,4 +114,4 @@ const timelineParams = { const bearerToken = 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA'; -export { baseUrl, gqlMap, gqlFeatures, timelineParams, bearerToken, thirdPartySupportedAPI }; +export { baseUrl, bearerToken, gqlFeatures, gqlMap, thirdPartySupportedAPI, timelineParams }; diff --git a/lib/routes/twitter/api/web-api/login.ts b/lib/routes/twitter/api/web-api/login.ts index bb7474d73..85f71a023 100644 --- a/lib/routes/twitter/api/web-api/login.ts +++ b/lib/routes/twitter/api/web-api/login.ts @@ -1,10 +1,11 @@ import { authenticator } from 'otplib'; -import logger from '@/utils/logger'; -import cache from '@/utils/cache'; -import { RateLimiterMemory, RateLimiterRedis, RateLimiterQueue } from 'rate-limiter-flexible'; -import puppeteer from '@/utils/puppeteer'; +import { RateLimiterMemory, RateLimiterQueue, RateLimiterRedis } from 'rate-limiter-flexible'; import { CookieJar } from 'tough-cookie'; +import cache from '@/utils/cache'; +import logger from '@/utils/logger'; +import puppeteer from '@/utils/puppeteer'; + const loginLimiter = cache.clients.redisClient ? new RateLimiterRedis({ points: 1, diff --git a/lib/routes/twitter/api/web-api/utils.ts b/lib/routes/twitter/api/web-api/utils.ts index 91315e095..7d99d00b5 100644 --- a/lib/routes/twitter/api/web-api/utils.ts +++ b/lib/routes/twitter/api/web-api/utils.ts @@ -1,14 +1,16 @@ -import ConfigNotFoundError from '@/errors/types/config-not-found'; -import { baseUrl, gqlFeatures, bearerToken, gqlMap, thirdPartySupportedAPI } from './constants'; -import { config } from '@/config'; +import { cookie as HttpCookieAgentCookie, CookieAgent } from 'http-cookie-agent/undici'; import queryString from 'query-string'; import { Cookie, CookieJar } from 'tough-cookie'; -import { CookieAgent, cookie as HttpCookieAgentCookie } from 'http-cookie-agent/undici'; -import { ProxyAgent, Client } from 'undici'; +import { Client, ProxyAgent } from 'undici'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; import cache from '@/utils/cache'; import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; import proxy from '@/utils/proxy'; + +import { baseUrl, bearerToken, gqlFeatures, gqlMap, thirdPartySupportedAPI } from './constants'; import login from './login'; let authTokenIndex = 0; diff --git a/lib/routes/twitter/home-latest.ts b/lib/routes/twitter/home-latest.ts index 6c1a7b51b..df4088944 100644 --- a/lib/routes/twitter/home-latest.ts +++ b/lib/routes/twitter/home-latest.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import utils from './utils'; +import type { Route } from '@/types'; + import api from './api'; +import utils from './utils'; export const route: Route = { path: '/home_latest/:routeParams?', diff --git a/lib/routes/twitter/home.ts b/lib/routes/twitter/home.ts index 1516c6829..64a8d103c 100644 --- a/lib/routes/twitter/home.ts +++ b/lib/routes/twitter/home.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import utils from './utils'; +import type { Route } from '@/types'; + import api from './api'; +import utils from './utils'; export const route: Route = { path: '/home/:routeParams?', diff --git a/lib/routes/twitter/keyword.ts b/lib/routes/twitter/keyword.ts index bfa99cc97..7ffdf8fd7 100644 --- a/lib/routes/twitter/keyword.ts +++ b/lib/routes/twitter/keyword.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import api from './api'; import utils from './utils'; diff --git a/lib/routes/twitter/likes.ts b/lib/routes/twitter/likes.ts index 76f3ebe98..d2dde8672 100644 --- a/lib/routes/twitter/likes.ts +++ b/lib/routes/twitter/likes.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import utils from './utils'; +import type { Route } from '@/types'; + import api from './api'; +import utils from './utils'; export const route: Route = { path: '/likes/:id/:routeParams?', diff --git a/lib/routes/twitter/list.ts b/lib/routes/twitter/list.ts index a97e20e8f..9d71f9636 100644 --- a/lib/routes/twitter/list.ts +++ b/lib/routes/twitter/list.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import api from './api'; import utils from './utils'; diff --git a/lib/routes/twitter/media.ts b/lib/routes/twitter/media.ts index 342fe4c73..a3faef1f9 100644 --- a/lib/routes/twitter/media.ts +++ b/lib/routes/twitter/media.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import logger from '@/utils/logger'; + import api from './api'; import utils from './utils'; -import logger from '@/utils/logger'; export const route: Route = { path: '/media/:id/:routeParams?', diff --git a/lib/routes/twitter/trends.ts b/lib/routes/twitter/trends.ts index 5bfb1d56e..8b0e63c0c 100644 --- a/lib/routes/twitter/trends.ts +++ b/lib/routes/twitter/trends.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import utils from './utils'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; + +import utils from './utils'; export const route: Route = { path: '/trends/:woeid?', diff --git a/lib/routes/twitter/tweet.ts b/lib/routes/twitter/tweet.ts index 9b809e4e7..02470cf5f 100644 --- a/lib/routes/twitter/tweet.ts +++ b/lib/routes/twitter/tweet.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; + import api from './api'; import utils from './utils'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; -import { config } from '@/config'; export const route: Route = { path: '/tweet/:id/status/:status/:original?', diff --git a/lib/routes/twitter/user.ts b/lib/routes/twitter/user.ts index a8bb96e54..db1fae8b4 100644 --- a/lib/routes/twitter/user.ts +++ b/lib/routes/twitter/user.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import utils from './utils'; -import api from './api'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import logger from '@/utils/logger'; +import api from './api'; +import utils from './utils'; + export const route: Route = { path: '/user/:id/:routeParams?', categories: ['social-media'], diff --git a/lib/routes/twitter/utils.ts b/lib/routes/twitter/utils.ts index 766c7da68..7eb9c5481 100644 --- a/lib/routes/twitter/utils.ts +++ b/lib/routes/twitter/utils.ts @@ -1,8 +1,10 @@ import URL from 'node:url'; -import { config } from '@/config'; + import { TwitterApi } from 'twitter-api-v2'; -import { fallback, queryToBoolean, queryToInteger } from '@/utils/readable-social'; + +import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; +import { fallback, queryToBoolean, queryToInteger } from '@/utils/readable-social'; const getQueryParams = (url) => URL.parse(url, true).query; const getOriginalImg = (url) => { diff --git a/lib/routes/twreporter/category.ts b/lib/routes/twreporter/category.ts index cf5f6bc59..acce9370e 100644 --- a/lib/routes/twreporter/category.ts +++ b/lib/routes/twreporter/category.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/twreporter/fetch-article.ts b/lib/routes/twreporter/fetch-article.ts index a81876372..fa1d40c51 100644 --- a/lib/routes/twreporter/fetch-article.ts +++ b/lib/routes/twreporter/fetch-article.ts @@ -1,7 +1,8 @@ +import path from 'node:path'; + import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export default async function fetch(slug: string) { const url = `https://go-api.twreporter.org/v2/posts/${slug}?full=true`; diff --git a/lib/routes/twreporter/newest.ts b/lib/routes/twreporter/newest.ts index 017ed0605..eb65efd6e 100644 --- a/lib/routes/twreporter/newest.ts +++ b/lib/routes/twreporter/newest.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/txks/news.ts b/lib/routes/txks/news.ts index f267d4a77..dae83a9cc 100644 --- a/lib/routes/txks/news.ts +++ b/lib/routes/txks/news.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; const BASE_URL = 'https://www.txks.org.cn/index/work.html'; diff --git a/lib/routes/txrjy/fornumtopic.ts b/lib/routes/txrjy/fornumtopic.ts index 5c2b44bf8..110329840 100644 --- a/lib/routes/txrjy/fornumtopic.ts +++ b/lib/routes/txrjy/fornumtopic.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.txrjy.com'; diff --git a/lib/routes/tynu/tynu.ts b/lib/routes/tynu/tynu.ts index bf53ba059..99373ee6b 100644 --- a/lib/routes/tynu/tynu.ts +++ b/lib/routes/tynu/tynu.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'http://www.tynu.edu.cn'; export const route: Route = { diff --git a/lib/routes/typora/changelog-dev.ts b/lib/routes/typora/changelog-dev.ts index fd59818f3..6859758d5 100644 --- a/lib/routes/typora/changelog-dev.ts +++ b/lib/routes/typora/changelog-dev.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/changelog/dev', categories: ['program-update'], diff --git a/lib/routes/typora/changelog.ts b/lib/routes/typora/changelog.ts index 35aefca17..c6f7c23df 100644 --- a/lib/routes/typora/changelog.ts +++ b/lib/routes/typora/changelog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/typst/universe.ts b/lib/routes/typst/universe.ts index e8ca12409..2ba9ae26b 100644 --- a/lib/routes/typst/universe.ts +++ b/lib/routes/typst/universe.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import vm from 'node:vm'; + import { load } from 'cheerio'; import markdownit from 'markdown-it'; -import vm from 'node:vm'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; interface Package { name: string; diff --git a/lib/routes/u3c3/index.ts b/lib/routes/u3c3/index.ts index 17cf67594..01fea524c 100644 --- a/lib/routes/u3c3/index.ts +++ b/lib/routes/u3c3/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: ['/search/:keyword/:preview?', '/:type?/:preview?'], diff --git a/lib/routes/u9a9/index.ts b/lib/routes/u9a9/index.ts index a430fd109..dbf2ea70b 100644 --- a/lib/routes/u9a9/index.ts +++ b/lib/routes/u9a9/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/uber/blog.ts b/lib/routes/uber/blog.ts index 985e51d11..aea54a2c9 100644 --- a/lib/routes/uber/blog.ts +++ b/lib/routes/uber/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://www.uber.com'; diff --git a/lib/routes/ucas/ai.ts b/lib/routes/ucas/ai.ts index 778faf40b..8f0911539 100644 --- a/lib/routes/ucas/ai.ts +++ b/lib/routes/ucas/ai.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ucas/index.ts b/lib/routes/ucas/index.ts index 52a648030..bf8c78e05 100644 --- a/lib/routes/ucas/index.ts +++ b/lib/routes/ucas/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://zhaopin.ucas.ac.cn'; diff --git a/lib/routes/uchicago/current.ts b/lib/routes/uchicago/current.ts index 3d7516d38..5651e1984 100644 --- a/lib/routes/uchicago/current.ts +++ b/lib/routes/uchicago/current.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { getCookies, setCookies } from '@/utils/puppeteer-utils'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import { getCookies, setCookies } from '@/utils/puppeteer-utils'; export const route: Route = { path: '/journals/current/:journal', diff --git a/lib/routes/udn/breaking-news.ts b/lib/routes/udn/breaking-news.ts index bf6925998..a8a2cb104 100644 --- a/lib/routes/udn/breaking-news.ts +++ b/lib/routes/udn/breaking-news.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/news/breakingnews/:id', diff --git a/lib/routes/udn/global/index.ts b/lib/routes/udn/global/index.ts index 1fa74ba0a..0c4a4a884 100644 --- a/lib/routes/udn/global/index.ts +++ b/lib/routes/udn/global/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/global/:category?', diff --git a/lib/routes/udn/global/tag.ts b/lib/routes/udn/global/tag.ts index 7a3fc9b08..b1d86c80a 100644 --- a/lib/routes/udn/global/tag.ts +++ b/lib/routes/udn/global/tag.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/uestc/auto.ts b/lib/routes/uestc/auto.ts index 0ad59b338..5db79cbbb 100644 --- a/lib/routes/uestc/auto.ts +++ b/lib/routes/uestc/auto.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/routes/uestc/bbs.ts b/lib/routes/uestc/bbs.ts index da8f590f7..4020e608d 100644 --- a/lib/routes/uestc/bbs.ts +++ b/lib/routes/uestc/bbs.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { parseDate } from '@/utils/parse-date'; // 解析日期的工具函数 import timezone from '@/utils/timezone'; -import { config } from '@/config'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/bbs/:types?', diff --git a/lib/routes/uestc/cqe.ts b/lib/routes/uestc/cqe.ts index 3af115ae9..650fae4e5 100644 --- a/lib/routes/uestc/cqe.ts +++ b/lib/routes/uestc/cqe.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const baseUrl = 'https://cqe.uestc.edu.cn/'; diff --git a/lib/routes/uestc/gr.ts b/lib/routes/uestc/gr.ts index 8ebe51475..3d901d0f1 100644 --- a/lib/routes/uestc/gr.ts +++ b/lib/routes/uestc/gr.ts @@ -1,11 +1,12 @@ -import { Data, DataItem, Route } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import type { Context } from 'hono'; const baseUrl = 'https://gr.uestc.edu.cn/'; const detailUrl = 'https://gr.uestc.edu.cn/'; diff --git a/lib/routes/uestc/jwc.ts b/lib/routes/uestc/jwc.ts index 301a1e257..00433e05e 100644 --- a/lib/routes/uestc/jwc.ts +++ b/lib/routes/uestc/jwc.ts @@ -1,11 +1,12 @@ -import { Data, DataItem, Route } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import type { Context } from 'hono'; const baseUrl = 'https://www.jwc.uestc.edu.cn/'; const detailUrl = 'https://www.jwc.uestc.edu.cn/info/'; diff --git a/lib/routes/uestc/news.ts b/lib/routes/uestc/news.ts index c02a64c84..60335e930 100644 --- a/lib/routes/uestc/news.ts +++ b/lib/routes/uestc/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const dateRegex = /(20\d{2}).(\d{2})-(\d{2})/; diff --git a/lib/routes/uestc/scse.ts b/lib/routes/uestc/scse.ts index 06f9fc92c..71689707d 100644 --- a/lib/routes/uestc/scse.ts +++ b/lib/routes/uestc/scse.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import dayjs from 'dayjs'; + +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; const baseIndexUrl = 'https://www.scse.uestc.edu.cn/index.htm'; diff --git a/lib/routes/uestc/sice.ts b/lib/routes/uestc/sice.ts index 91d08f0ff..7a401f135 100644 --- a/lib/routes/uestc/sice.ts +++ b/lib/routes/uestc/sice.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import dayjs from 'dayjs'; + +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; const baseIndexUrl = 'https://www.sice.uestc.edu.cn/index.htm'; diff --git a/lib/routes/uestc/sise.ts b/lib/routes/uestc/sise.ts index 080a9428a..eede6d877 100644 --- a/lib/routes/uestc/sise.ts +++ b/lib/routes/uestc/sise.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import dayjs from 'dayjs'; -import puppeteer from '@/utils/puppeteer'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import puppeteer from '@/utils/puppeteer'; const baseUrl = 'https://sise.uestc.edu.cn/'; diff --git a/lib/routes/uibe/hr.ts b/lib/routes/uibe/hr.ts index 69ed2a5da..be06f587a 100644 --- a/lib/routes/uibe/hr.ts +++ b/lib/routes/uibe/hr.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ulapia/index.ts b/lib/routes/ulapia/index.ts index 84c08f80d..32f4a4cd8 100644 --- a/lib/routes/ulapia/index.ts +++ b/lib/routes/ulapia/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'http://www.ulapia.com'; diff --git a/lib/routes/ulapia/research.ts b/lib/routes/ulapia/research.ts index 70f8e0f75..a78e27e77 100644 --- a/lib/routes/ulapia/research.ts +++ b/lib/routes/ulapia/research.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'http://www.ulapia.com'; diff --git a/lib/routes/unipd/ilbolive/news.ts b/lib/routes/unipd/ilbolive/news.ts index 32fd5ed33..dfbc1ad10 100644 --- a/lib/routes/unipd/ilbolive/news.ts +++ b/lib/routes/unipd/ilbolive/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/uniqlo/new.ts b/lib/routes/uniqlo/new.ts index 7909d4ff9..90f3e0504 100644 --- a/lib/routes/uniqlo/new.ts +++ b/lib/routes/uniqlo/new.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/unraid/community-apps.ts b/lib/routes/unraid/community-apps.ts index 6cb0eb42c..004a62e88 100644 --- a/lib/routes/unraid/community-apps.ts +++ b/lib/routes/unraid/community-apps.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/unusualwhales/news.ts b/lib/routes/unusualwhales/news.ts index ca7921227..9ed0755bf 100644 --- a/lib/routes/unusualwhales/news.ts +++ b/lib/routes/unusualwhales/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/upc/jsj.ts b/lib/routes/upc/jsj.ts index 4092d3732..1dc8d9461 100644 --- a/lib/routes/upc/jsj.ts +++ b/lib/routes/upc/jsj.ts @@ -1,13 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 计算机科学与技术学院:http://computer.upc.edu.cn/ // - 学院新闻:http://computer.upc.edu.cn/6277/list.htm // - 学术关注:http://computer.upc.edu.cn/6278/list.htm // - 学工动态:http://computer.upc.edu.cn/6279/list.htm // - 通知公告:http://computer.upc.edu.cn/6280/list.htm - import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/upc/jwc.ts b/lib/routes/upc/jwc.ts index 10ed178d1..a2b21ccae 100644 --- a/lib/routes/upc/jwc.ts +++ b/lib/routes/upc/jwc.ts @@ -1,9 +1,10 @@ // 导入必要的模组 -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const handler = async (ctx) => { diff --git a/lib/routes/upc/main.ts b/lib/routes/upc/main.ts index b308fee8d..ea41372a8 100644 --- a/lib/routes/upc/main.ts +++ b/lib/routes/upc/main.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 学校官网:http://www.upc.edu.cn/ import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/upc/yjs.ts b/lib/routes/upc/yjs.ts index 585f4b6d4..a59b1ed8b 100644 --- a/lib/routes/upc/yjs.ts +++ b/lib/routes/upc/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ups/track.ts b/lib/routes/ups/track.ts index d04352d6f..f1069ca75 100644 --- a/lib/routes/ups/track.ts +++ b/lib/routes/ups/track.ts @@ -1,5 +1,6 @@ -import { Route, DataItem } from '@/types'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/routes/uptimerobot/rss.ts b/lib/routes/uptimerobot/rss.ts index 550aabd85..ad7d4ff1a 100644 --- a/lib/routes/uptimerobot/rss.ts +++ b/lib/routes/uptimerobot/rss.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; - -import Parser from 'rss-parser'; -import { art } from '@/utils/render'; import path from 'node:path'; + import dayjs from 'dayjs'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; +import Parser from 'rss-parser'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; +import { art } from '@/utils/render'; const titleRegex = /(.+)\s+is\s+([A-Z]+)\s+\((.+)\)/; diff --git a/lib/routes/uraaka-joshi/uraaka-joshi-user.ts b/lib/routes/uraaka-joshi/uraaka-joshi-user.ts index 78d34cc77..51933cbd9 100644 --- a/lib/routes/uraaka-joshi/uraaka-joshi-user.ts +++ b/lib/routes/uraaka-joshi/uraaka-joshi-user.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; export const route: Route = { diff --git a/lib/routes/uraaka-joshi/uraaka-joshi.ts b/lib/routes/uraaka-joshi/uraaka-joshi.ts index 0fa0e1016..e10b6ab8a 100644 --- a/lib/routes/uraaka-joshi/uraaka-joshi.ts +++ b/lib/routes/uraaka-joshi/uraaka-joshi.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/routes/urbandictionary/random.ts b/lib/routes/urbandictionary/random.ts index 0a2fc1360..405ba1d69 100644 --- a/lib/routes/urbandictionary/random.ts +++ b/lib/routes/urbandictionary/random.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/random', diff --git a/lib/routes/usenix/loginonline.ts b/lib/routes/usenix/loginonline.ts index 661455a82..2c8848941 100644 --- a/lib/routes/usenix/loginonline.ts +++ b/lib/routes/usenix/loginonline.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/usenix/usenix.ts b/lib/routes/usenix/usenix.ts index dec57b60f..8eff3387f 100644 --- a/lib/routes/usenix/usenix.ts +++ b/lib/routes/usenix/usenix.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -const url = 'https://www.usenix.org'; import { parseDate } from '@/utils/parse-date'; +const url = 'https://www.usenix.org'; + const seasons = ['spring', 'summer', 'fall', 'winter']; export const route: Route = { diff --git a/lib/routes/usepanda/index.ts b/lib/routes/usepanda/index.ts index 3ef3a4a13..fc36878de 100644 --- a/lib/routes/usepanda/index.ts +++ b/lib/routes/usepanda/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ustb/tj/news.ts b/lib/routes/ustb/tj/news.ts index 96cb77453..bc0a86e77 100644 --- a/lib/routes/ustb/tj/news.ts +++ b/lib/routes/ustb/tj/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ustb/yjsy/news.ts b/lib/routes/ustb/yjsy/news.ts index 44c9b2414..93496d5f9 100644 --- a/lib/routes/ustb/yjsy/news.ts +++ b/lib/routes/ustb/yjsy/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; // import logger from '@/utils/logger'; diff --git a/lib/routes/ustb/yzxc/tzgg.ts b/lib/routes/ustb/yzxc/tzgg.ts index 7af45c210..0b824fa5d 100644 --- a/lib/routes/ustb/yzxc/tzgg.ts +++ b/lib/routes/ustb/yzxc/tzgg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://yzxc.ustb.edu.cn'; diff --git a/lib/routes/ustc/eeis.ts b/lib/routes/ustc/eeis.ts index e155d0a6f..f0f29b98d 100644 --- a/lib/routes/ustc/eeis.ts +++ b/lib/routes/ustc/eeis.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['tzgg', { title: '中国科学技术大学电子工程与信息科学系 - 通知公告', id: '2702' }], diff --git a/lib/routes/ustc/gs.ts b/lib/routes/ustc/gs.ts index 8dbd4e08c..4db48abd3 100644 --- a/lib/routes/ustc/gs.ts +++ b/lib/routes/ustc/gs.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['tzgg', { title: '中国科学技术大学研究生院 - 通知公告', id: '9' }], diff --git a/lib/routes/ustc/index.ts b/lib/routes/ustc/index.ts index dda89d45a..f17cff09a 100644 --- a/lib/routes/ustc/index.ts +++ b/lib/routes/ustc/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ustc/job.ts b/lib/routes/ustc/job.ts index 0e0b0d546..8c5a7fc42 100644 --- a/lib/routes/ustc/job.ts +++ b/lib/routes/ustc/job.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ustc/jwc.ts b/lib/routes/ustc/jwc.ts index 135cdeced..168c6adb9 100644 --- a/lib/routes/ustc/jwc.ts +++ b/lib/routes/ustc/jwc.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const noticeUrl = 'https://www.teach.ustc.edu.cn/category/notice'; const noticeType = { teaching: '教学', info: '信息', exam: '考试', exchange: '交流' }; diff --git a/lib/routes/ustc/math.ts b/lib/routes/ustc/math.ts index 212b6e6e4..4b216dd9f 100644 --- a/lib/routes/ustc/math.ts +++ b/lib/routes/ustc/math.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['xyxw', { title: '中国科学技术大学数学科学学院 - 学院新闻', id: 'xyxw' }], diff --git a/lib/routes/ustc/scms.ts b/lib/routes/ustc/scms.ts index 5ae9e447d..0195aad6c 100644 --- a/lib/routes/ustc/scms.ts +++ b/lib/routes/ustc/scms.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; // import InvalidParameterError from '@/errors/types/invalid-parameter'; diff --git a/lib/routes/ustc/sist.ts b/lib/routes/ustc/sist.ts index 44d0ba3dc..bd9a0e4a5 100644 --- a/lib/routes/ustc/sist.ts +++ b/lib/routes/ustc/sist.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['tzgg', { title: '中国科学技术大学信息科学技术学院 - 通知公告', id: '5142' }], diff --git a/lib/routes/usts/jwch.ts b/lib/routes/usts/jwch.ts index 6146bf309..efa3c7985 100644 --- a/lib/routes/usts/jwch.ts +++ b/lib/routes/usts/jwch.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/utgd/category.ts b/lib/routes/utgd/category.ts index cefd42925..d12a0f325 100644 --- a/lib/routes/utgd/category.ts +++ b/lib/routes/utgd/category.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { rootUrl, apiRootUrl, parseResult, parseArticle } from './utils'; + +import { apiRootUrl, parseArticle, parseResult, rootUrl } from './utils'; export const route: Route = { path: '/category/:category?', diff --git a/lib/routes/utgd/timeline.ts b/lib/routes/utgd/timeline.ts index 1b23fcec6..422de4337 100644 --- a/lib/routes/utgd/timeline.ts +++ b/lib/routes/utgd/timeline.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { rootUrl, apiRootUrl, parseResult, parseArticle } from './utils'; + +import { apiRootUrl, parseArticle, parseResult, rootUrl } from './utils'; export const route: Route = { path: '/timeline', diff --git a/lib/routes/utgd/topic.ts b/lib/routes/utgd/topic.ts index 03819e957..50e43b342 100644 --- a/lib/routes/utgd/topic.ts +++ b/lib/routes/utgd/topic.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { rootUrl, apiRootUrl, parseResult, parseArticle } from './utils'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { apiRootUrl, parseArticle, parseResult, rootUrl } from './utils'; export const route: Route = { path: '/topic/:topic?', diff --git a/lib/routes/utgd/utils.ts b/lib/routes/utgd/utils.ts index 36a10ea8c..85223d93a 100644 --- a/lib/routes/utgd/utils.ts +++ b/lib/routes/utgd/utils.ts @@ -1,10 +1,13 @@ +import path from 'node:path'; + +import MarkdownIt from 'markdown-it'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import MarkdownIt from 'markdown-it'; +import timezone from '@/utils/timezone'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/uw/gix/news.ts b/lib/routes/uw/gix/news.ts index c8125125a..bc2476403 100644 --- a/lib/routes/uw/gix/news.ts +++ b/lib/routes/uw/gix/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; const gixBaseURL = 'https://gixnetwork.org'; diff --git a/lib/routes/v1tx/index.ts b/lib/routes/v1tx/index.ts index a82e16b67..4da2bb2f6 100644 --- a/lib/routes/v1tx/index.ts +++ b/lib/routes/v1tx/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/v2ex/post.ts b/lib/routes/v2ex/post.ts index f346c94cb..756536940 100644 --- a/lib/routes/v2ex/post.ts +++ b/lib/routes/v2ex/post.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/v2ex/tab.ts b/lib/routes/v2ex/tab.ts index e5186a227..95d395ad4 100644 --- a/lib/routes/v2ex/tab.ts +++ b/lib/routes/v2ex/tab.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/tab/:tabid', diff --git a/lib/routes/v2ex/topics.ts b/lib/routes/v2ex/topics.ts index 8589a8580..03e6502f4 100644 --- a/lib/routes/v2ex/topics.ts +++ b/lib/routes/v2ex/topics.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/v2ex/xna.ts b/lib/routes/v2ex/xna.ts index 6dcf2eff8..b05ac1227 100644 --- a/lib/routes/v2ex/xna.ts +++ b/lib/routes/v2ex/xna.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/xna', categories: ['bbs', 'blog'], diff --git a/lib/routes/v2rayshare/index.ts b/lib/routes/v2rayshare/index.ts index 86d8f3dd0..5a8f753ff 100644 --- a/lib/routes/v2rayshare/index.ts +++ b/lib/routes/v2rayshare/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; // 自订的 got import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/vcb-s/category.ts b/lib/routes/vcb-s/category.ts index e2cb4a955..83d90138f 100644 --- a/lib/routes/vcb-s/category.ts +++ b/lib/routes/vcb-s/category.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://vcb-s.com'; const cateAPIUrl = `${rootUrl}/wp-json/wp/v2/categories`; diff --git a/lib/routes/vcb-s/index.ts b/lib/routes/vcb-s/index.ts index 3d638bee8..363da5150 100644 --- a/lib/routes/vcb-s/index.ts +++ b/lib/routes/vcb-s/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://vcb-s.com'; const postsAPIUrl = `${rootUrl}/wp-json/wp/v2/posts`; diff --git a/lib/routes/verfghbw/press.ts b/lib/routes/verfghbw/press.ts index 68a003ec0..3e68e5f02 100644 --- a/lib/routes/verfghbw/press.ts +++ b/lib/routes/verfghbw/press.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/vertikal/latest.ts b/lib/routes/vertikal/latest.ts index d7e765147..3374723f6 100644 --- a/lib/routes/vertikal/latest.ts +++ b/lib/routes/vertikal/latest.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/latest', diff --git a/lib/routes/vice/topic.ts b/lib/routes/vice/topic.ts index 9658fdfbd..43110228f 100644 --- a/lib/routes/vice/topic.ts +++ b/lib/routes/vice/topic.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const render = (data) => art(path.join(__dirname, 'templates/article.art'), data); diff --git a/lib/routes/vimeo/category.ts b/lib/routes/vimeo/category.ts index 9470a1465..87af674a3 100644 --- a/lib/routes/vimeo/category.ts +++ b/lib/routes/vimeo/category.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/category/:category/:staffpicks?', diff --git a/lib/routes/vimeo/channel.ts b/lib/routes/vimeo/channel.ts index 26a987b36..606632a27 100644 --- a/lib/routes/vimeo/channel.ts +++ b/lib/routes/vimeo/channel.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/channel/:channel', diff --git a/lib/routes/vimeo/usr-videos.ts b/lib/routes/vimeo/usr-videos.ts index 0dd57a512..bb8ff211d 100644 --- a/lib/routes/vimeo/usr-videos.ts +++ b/lib/routes/vimeo/usr-videos.ts @@ -1,9 +1,10 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/user/:username/:cat?', diff --git a/lib/routes/visionias/daily-news-summary.ts b/lib/routes/visionias/daily-news-summary.ts index 7944dc348..c4b1eed8a 100644 --- a/lib/routes/visionias/daily-news-summary.ts +++ b/lib/routes/visionias/daily-news-summary.ts @@ -1,9 +1,10 @@ -import { Data, Route, DataItem } from '@/types'; -import { baseUrl } from './utils'; - -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Data, DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl } from './utils'; + export const route: Route = { path: '/dailySummary', example: '/visionias/dailySummary', diff --git a/lib/routes/visionias/monthly-magazine.ts b/lib/routes/visionias/monthly-magazine.ts index 46af15191..e8bbef7ae 100644 --- a/lib/routes/visionias/monthly-magazine.ts +++ b/lib/routes/visionias/monthly-magazine.ts @@ -1,9 +1,10 @@ -import { Data, Route } from '@/types'; -import { baseUrl, extractNews } from './utils'; - -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, extractNews } from './utils'; + export const route: Route = { path: '/monthlyMagazine', example: '/visionias/monthlyMagazine', diff --git a/lib/routes/visionias/news-today.ts b/lib/routes/visionias/news-today.ts index 88892879c..5c8d67bee 100644 --- a/lib/routes/visionias/news-today.ts +++ b/lib/routes/visionias/news-today.ts @@ -1,10 +1,11 @@ -import { Data, Route } from '@/types'; -import { baseUrl, extractNews } from './utils'; -import dayjs from 'dayjs'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import dayjs from 'dayjs'; +import type { Data, Route } from '@/types'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, extractNews } from './utils'; export const route: Route = { path: '/newsToday/:filter?', diff --git a/lib/routes/visionias/utils.ts b/lib/routes/visionias/utils.ts index 2ce3cfa9c..411e489c2 100644 --- a/lib/routes/visionias/utils.ts +++ b/lib/routes/visionias/utils.ts @@ -1,10 +1,12 @@ -import { DataItem } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; export const baseUrl = 'https://visionias.in'; diff --git a/lib/routes/visionias/weekly-focus.ts b/lib/routes/visionias/weekly-focus.ts index fd1c0c2a8..bcf73b69f 100644 --- a/lib/routes/visionias/weekly-focus.ts +++ b/lib/routes/visionias/weekly-focus.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import { baseUrl, extractNews } from './utils'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, extractNews } from './utils'; + export const route: Route = { path: '/weeklyFocus', example: '/visionias/weeklyFocus', diff --git a/lib/routes/visualstudio/code-blog.ts b/lib/routes/visualstudio/code-blog.ts index 75954badb..e5c5b02a9 100644 --- a/lib/routes/visualstudio/code-blog.ts +++ b/lib/routes/visualstudio/code-blog.ts @@ -1,8 +1,10 @@ -import { Route, DataItem, Data, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; export const route: Route = { path: '/code/blog', diff --git a/lib/routes/visualstudio/namespace.ts b/lib/routes/visualstudio/namespace.ts index 240c31c5d..5a7669762 100644 --- a/lib/routes/visualstudio/namespace.ts +++ b/lib/routes/visualstudio/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'Visual Studio', diff --git a/lib/routes/vocus/publication.ts b/lib/routes/vocus/publication.ts index e144d1003..4723f1e9d 100644 --- a/lib/routes/vocus/publication.ts +++ b/lib/routes/vocus/publication.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { processList, ProcessFeed, baseUrl, apiUrl } from './utils'; + +import { apiUrl, baseUrl, ProcessFeed, processList } from './utils'; export const route: Route = { path: '/publication/:id', diff --git a/lib/routes/vocus/user.ts b/lib/routes/vocus/user.ts index 95263d1d2..517652483 100644 --- a/lib/routes/vocus/user.ts +++ b/lib/routes/vocus/user.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { processList, ProcessFeed, baseUrl, apiUrl } from './utils'; + +import { apiUrl, baseUrl, ProcessFeed, processList } from './utils'; export const route: Route = { path: '/user/:id', diff --git a/lib/routes/vocus/utils.ts b/lib/routes/vocus/utils.ts index 85060d834..4792655b6 100644 --- a/lib/routes/vocus/utils.ts +++ b/lib/routes/vocus/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://vocus.cc'; @@ -43,4 +44,4 @@ const ProcessFeed = (list, tryGet) => ) ); -export { processList, ProcessFeed, baseUrl, apiUrl }; +export { apiUrl, baseUrl, ProcessFeed, processList }; diff --git a/lib/routes/vom/featured.ts b/lib/routes/vom/featured.ts index eab557c80..d561778f3 100644 --- a/lib/routes/vom/featured.ts +++ b/lib/routes/vom/featured.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'http://www.vom.mn'; export const route: Route = { diff --git a/lib/routes/voronoiapp/author.ts b/lib/routes/voronoiapp/author.ts index 9731aa638..e1214e5cb 100644 --- a/lib/routes/voronoiapp/author.ts +++ b/lib/routes/voronoiapp/author.ts @@ -1,7 +1,8 @@ import type { Data, Route } from '@/types'; -import { CommonDataProperties, CommonRouteProperties, getPostItems } from './common'; -import ofetch from '@/utils/ofetch'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { CommonDataProperties, CommonRouteProperties, getPostItems } from './common'; export const route: Route = { ...CommonRouteProperties, diff --git a/lib/routes/voronoiapp/common.ts b/lib/routes/voronoiapp/common.ts index 9b14bc9b0..8182ec026 100644 --- a/lib/routes/voronoiapp/common.ts +++ b/lib/routes/voronoiapp/common.ts @@ -1,6 +1,7 @@ -import { ViewType, type Data, type DataItem, type Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + import type { Post } from './types'; export async function getPostItems(params: { diff --git a/lib/routes/voronoiapp/editors-pick.ts b/lib/routes/voronoiapp/editors-pick.ts index 1907f290f..ac523a643 100644 --- a/lib/routes/voronoiapp/editors-pick.ts +++ b/lib/routes/voronoiapp/editors-pick.ts @@ -1,5 +1,6 @@ import type { Data, Route } from '@/types'; -import { getPostItems, CategoryParam, CommonRouteProperties, CommonDataProperties } from './common'; + +import { CategoryParam, CommonDataProperties, CommonRouteProperties, getPostItems } from './common'; export const route: Route = { ...CommonRouteProperties, diff --git a/lib/routes/voronoiapp/home.ts b/lib/routes/voronoiapp/home.ts index 3558e1e22..c4fbffca0 100644 --- a/lib/routes/voronoiapp/home.ts +++ b/lib/routes/voronoiapp/home.ts @@ -1,5 +1,6 @@ import type { Data, Route } from '@/types'; -import { getPostItems, CategoryParam, CommonRouteProperties, CommonDataProperties } from './common'; + +import { CategoryParam, CommonDataProperties, CommonRouteProperties, getPostItems } from './common'; export const route: Route = { ...CommonRouteProperties, diff --git a/lib/routes/voronoiapp/latest.ts b/lib/routes/voronoiapp/latest.ts index 2ef90fc0d..eecb2ee27 100644 --- a/lib/routes/voronoiapp/latest.ts +++ b/lib/routes/voronoiapp/latest.ts @@ -1,5 +1,6 @@ import type { Data, Route } from '@/types'; -import { getPostItems, CategoryParam, CommonRouteProperties, CommonDataProperties } from './common'; + +import { CategoryParam, CommonDataProperties, CommonRouteProperties, getPostItems } from './common'; export const route: Route = { ...CommonRouteProperties, diff --git a/lib/routes/voronoiapp/popular.ts b/lib/routes/voronoiapp/popular.ts index ab99de9f2..1433a3c0f 100644 --- a/lib/routes/voronoiapp/popular.ts +++ b/lib/routes/voronoiapp/popular.ts @@ -1,4 +1,5 @@ import type { Data, Route } from '@/types'; + import { CategoryParam, CommonDataProperties, CommonRouteProperties, getPostItems, TabMap, TabParam, TimeRangeParam } from './common'; export const route: Route = { diff --git a/lib/routes/voronoiapp/search.ts b/lib/routes/voronoiapp/search.ts index d04a99515..74ce0ec8f 100644 --- a/lib/routes/voronoiapp/search.ts +++ b/lib/routes/voronoiapp/search.ts @@ -1,4 +1,5 @@ import type { Data, Route } from '@/types'; + import { CommonDataProperties, CommonRouteProperties, getPostItems } from './common'; export const route: Route = { diff --git a/lib/routes/wabei/index.ts b/lib/routes/wabei/index.ts index e4bc1869f..e24f50059 100644 --- a/lib/routes/wabei/index.ts +++ b/lib/routes/wabei/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/wainao/topics.ts b/lib/routes/wainao/topics.ts index ec49b8056..d1447aa31 100644 --- a/lib/routes/wainao/topics.ts +++ b/lib/routes/wainao/topics.ts @@ -1,12 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { id = 'hotspot' } = ctx.req.param(); diff --git a/lib/routes/wainao/wainao-reads.ts b/lib/routes/wainao/wainao-reads.ts index ef918c81c..f2592117d 100644 --- a/lib/routes/wainao/wainao-reads.ts +++ b/lib/routes/wainao/wainao-reads.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/wallhaven/index.ts b/lib/routes/wallhaven/index.ts index 1d6538844..f2601fbd3 100644 --- a/lib/routes/wallhaven/index.ts +++ b/lib/routes/wallhaven/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://wallhaven.cc'; diff --git a/lib/routes/wallpaperhub/index.ts b/lib/routes/wallpaperhub/index.ts index 67b7c733c..a7cc669b2 100644 --- a/lib/routes/wallpaperhub/index.ts +++ b/lib/routes/wallpaperhub/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/', diff --git a/lib/routes/wallstreetcn/calendar.ts b/lib/routes/wallstreetcn/calendar.ts index 5eae0a3cb..f61dfe383 100644 --- a/lib/routes/wallstreetcn/calendar.ts +++ b/lib/routes/wallstreetcn/calendar.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/wallstreetcn/hot.ts b/lib/routes/wallstreetcn/hot.ts index 5bdaeb9e2..2f92248c9 100644 --- a/lib/routes/wallstreetcn/hot.ts +++ b/lib/routes/wallstreetcn/hot.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/wallstreetcn/live.ts b/lib/routes/wallstreetcn/live.ts index dcf90ec96..3ccdc4a47 100644 --- a/lib/routes/wallstreetcn/live.ts +++ b/lib/routes/wallstreetcn/live.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const titles = { global: '要闻', diff --git a/lib/routes/wallstreetcn/news.ts b/lib/routes/wallstreetcn/news.ts index 7f7893e31..7a98df824 100644 --- a/lib/routes/wallstreetcn/news.ts +++ b/lib/routes/wallstreetcn/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/wanqu/news.ts b/lib/routes/wanqu/news.ts index 59053cb91..39e3d1832 100644 --- a/lib/routes/wanqu/news.ts +++ b/lib/routes/wanqu/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/warhammer-community/namespace.ts b/lib/routes/warhammer-community/namespace.ts index 10af66470..812319109 100644 --- a/lib/routes/warhammer-community/namespace.ts +++ b/lib/routes/warhammer-community/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'Warhammer Community', diff --git a/lib/routes/warhammer-community/news.ts b/lib/routes/warhammer-community/news.ts index 362dc4fe1..50ba1df20 100644 --- a/lib/routes/warhammer-community/news.ts +++ b/lib/routes/warhammer-community/news.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/news', diff --git a/lib/routes/warp/blog.ts b/lib/routes/warp/blog.ts index 528c422e6..116b69efa 100644 --- a/lib/routes/warp/blog.ts +++ b/lib/routes/warp/blog.ts @@ -1,8 +1,10 @@ -import { Route, DataItem, Data, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; export const route: Route = { path: '/blog', diff --git a/lib/routes/warp/namespace.ts b/lib/routes/warp/namespace.ts index 4fcdf64da..ed1e6bed2 100644 --- a/lib/routes/warp/namespace.ts +++ b/lib/routes/warp/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'Warp', diff --git a/lib/routes/warthunder/news.ts b/lib/routes/warthunder/news.ts index 25f266a36..e92685166 100644 --- a/lib/routes/warthunder/news.ts +++ b/lib/routes/warthunder/news.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import path from 'node:path'; -import { art } from '@/utils/render'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; + const renderDescription = (desc) => art(path.join(__dirname, 'templates/description.art'), desc); export const route: Route = { diff --git a/lib/routes/washingtonpost/app.ts b/lib/routes/washingtonpost/app.ts index 80fef6ec3..dc443a9aa 100644 --- a/lib/routes/washingtonpost/app.ts +++ b/lib/routes/washingtonpost/app.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import dayjs from 'dayjs'; +import advancedFormat from 'dayjs/plugin/advancedFormat.js'; +import timezone from 'dayjs/plugin/timezone.js'; +import utc from 'dayjs/plugin/utc.js'; +import { FetchError } from 'ofetch'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { FetchError } from 'ofetch'; -import dayjs from 'dayjs'; -import utc from 'dayjs/plugin/utc.js'; -import timezone from 'dayjs/plugin/timezone.js'; -import advancedFormat from 'dayjs/plugin/advancedFormat.js'; export const route: Route = { path: '/app/:category{.+}?', diff --git a/lib/routes/wbv-gpa/index.ts b/lib/routes/wbv-gpa/index.ts index 49cf9d509..d2164c0f2 100644 --- a/lib/routes/wbv-gpa/index.ts +++ b/lib/routes/wbv-gpa/index.ts @@ -1,6 +1,7 @@ import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + import type { Data, DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; const FEED_LANGUAGE = 'de' as const; const FEED_LOGO = 'https://www.wbv-gpa.at/app/uploads/2024/01/cropped-WBV-Favicon-192x192.png'; diff --git a/lib/routes/wchscu/recruit.ts b/lib/routes/wchscu/recruit.ts index da7dc6b65..b01dcc274 100644 --- a/lib/routes/wchscu/recruit.ts +++ b/lib/routes/wchscu/recruit.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const handler = async () => { const rootUrl = 'https:///www.wchscu.cn'; diff --git a/lib/routes/wdc/download.ts b/lib/routes/wdc/download.ts index fd03de6f4..f2c66f82e 100644 --- a/lib/routes/wdc/download.ts +++ b/lib/routes/wdc/download.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/wdfxw/bookfree.ts b/lib/routes/wdfxw/bookfree.ts index 5700dde5c..e9a689e1d 100644 --- a/lib/routes/wdfxw/bookfree.ts +++ b/lib/routes/wdfxw/bookfree.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { id } = ctx.req.param(); diff --git a/lib/routes/web/articles.ts b/lib/routes/web/articles.ts index 9a1dde2f2..0814fd519 100644 --- a/lib/routes/web/articles.ts +++ b/lib/routes/web/articles.ts @@ -1,4 +1,5 @@ import type { Data, Route } from '@/types'; + import { fetchItems } from './utils'; export const route: Route = { diff --git a/lib/routes/web/blog.ts b/lib/routes/web/blog.ts index d76f417d4..8effd64f4 100644 --- a/lib/routes/web/blog.ts +++ b/lib/routes/web/blog.ts @@ -1,4 +1,5 @@ import type { Data, Route } from '@/types'; + import { fetchItems } from './utils'; export const route: Route = { diff --git a/lib/routes/web/series.ts b/lib/routes/web/series.ts index 3536b41a1..f6fa1f3ef 100644 --- a/lib/routes/web/series.ts +++ b/lib/routes/web/series.ts @@ -1,4 +1,5 @@ import type { Data, Route } from '@/types'; + import { fetchItems, hyphen2Pascal } from './utils'; export const route: Route = { diff --git a/lib/routes/web/utils.ts b/lib/routes/web/utils.ts index b7eb24dfa..3bbdd911e 100644 --- a/lib/routes/web/utils.ts +++ b/lib/routes/web/utils.ts @@ -1,7 +1,8 @@ +import { load } from 'cheerio'; + import type { DataItem } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; type ArticleData = [ string, diff --git a/lib/routes/web3caff/index.ts b/lib/routes/web3caff/index.ts index bbac60380..90f8e9422 100644 --- a/lib/routes/web3caff/index.ts +++ b/lib/routes/web3caff/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/webcatalog/changelog.ts b/lib/routes/webcatalog/changelog.ts index c5b978811..599ba756a 100644 --- a/lib/routes/webcatalog/changelog.ts +++ b/lib/routes/webcatalog/changelog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/changelog', diff --git a/lib/routes/wechat/announce.ts b/lib/routes/wechat/announce.ts index 1880079aa..37b124dae 100644 --- a/lib/routes/wechat/announce.ts +++ b/lib/routes/wechat/announce.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/wechat/ce.ts b/lib/routes/wechat/ce.ts index 21f94788a..3c5418b5a 100644 --- a/lib/routes/wechat/ce.ts +++ b/lib/routes/wechat/ce.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { fixArticleContent } from '@/utils/wechat-mp'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; +import { fixArticleContent } from '@/utils/wechat-mp'; // any UA containing "RSS" can pass the check // mark the UA as a desktop UA with "(X11; Linux x86_64)" diff --git a/lib/routes/wechat/data258.ts b/lib/routes/wechat/data258.ts index fa13cc0a9..f8a1918c2 100644 --- a/lib/routes/wechat/data258.ts +++ b/lib/routes/wechat/data258.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import RequestInProgressError from '@/errors/types/request-in-progress'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { finishArticleItem } from '@/utils/wechat-mp'; import wait from '@/utils/wait'; -import RequestInProgressError from '@/errors/types/request-in-progress'; +import { finishArticleItem } from '@/utils/wechat-mp'; const parsePage = ($item, hyperlinkSelector, timeSelector) => { const hyperlink = $item.find(hyperlinkSelector); diff --git a/lib/routes/wechat/ershcimi.ts b/lib/routes/wechat/ershcimi.ts index cbf89218c..d9d080961 100644 --- a/lib/routes/wechat/ershcimi.ts +++ b/lib/routes/wechat/ershcimi.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { finishArticleItem } from '@/utils/wechat-mp'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { finishArticleItem } from '@/utils/wechat-mp'; export const route: Route = { path: '/ershicimi/:id', diff --git a/lib/routes/wechat/mp.ts b/lib/routes/wechat/mp.ts index 373200309..34e190fad 100755 --- a/lib/routes/wechat/mp.ts +++ b/lib/routes/wechat/mp.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import dayjs from 'dayjs'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { finishArticleItem } from '@/utils/wechat-mp'; export const route: Route = { diff --git a/lib/routes/wechat/msgalbum.ts b/lib/routes/wechat/msgalbum.ts index 7ef324824..327057356 100644 --- a/lib/routes/wechat/msgalbum.ts +++ b/lib/routes/wechat/msgalbum.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import dayjs from 'dayjs'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { finishArticleItem } from '@/utils/wechat-mp'; export const route: Route = { diff --git a/lib/routes/wechat/sogou.ts b/lib/routes/wechat/sogou.ts index 3940f6aca..af15123b9 100644 --- a/lib/routes/wechat/sogou.ts +++ b/lib/routes/wechat/sogou.ts @@ -1,9 +1,10 @@ -import { Route, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; -import logger from '@/utils/logger'; const host = 'https://weixin.sogou.com'; const hardcodedCookie = 'SNUID=78725B470A0EF2C3F97AA5EB0BBF95C1; ABTEST=0|1680917938|v1; SUID=8F7B1C682B83A20A000000006430C5B2; PHPSESSID=le2lak0vghad5c98ijd3t51ls4; IPLOC=USUS5'; diff --git a/lib/routes/wechat/tgchannel.ts b/lib/routes/wechat/tgchannel.ts index aad149517..b7aa7399d 100644 --- a/lib/routes/wechat/tgchannel.ts +++ b/lib/routes/wechat/tgchannel.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { finishArticleItem } from '@/utils/wechat-mp'; export const route: Route = { diff --git a/lib/routes/wechat/uread.ts b/lib/routes/wechat/uread.ts index 5e61f62fb..492b79212 100644 --- a/lib/routes/wechat/uread.ts +++ b/lib/routes/wechat/uread.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/uread/:userid', diff --git a/lib/routes/wechat/wechat2rss.ts b/lib/routes/wechat/wechat2rss.ts index af74a81b3..f518268c9 100644 --- a/lib/routes/wechat/wechat2rss.ts +++ b/lib/routes/wechat/wechat2rss.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import parser from '@/utils/rss-parser'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; import { finishArticleItem } from '@/utils/wechat-mp'; export const route: Route = { diff --git a/lib/routes/weekendhk/posts.ts b/lib/routes/weekendhk/posts.ts index d642a4c6c..86ae64b7d 100644 --- a/lib/routes/weekendhk/posts.ts +++ b/lib/routes/weekendhk/posts.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/weibo/friends.ts b/lib/routes/weibo/friends.ts index c14ec94b8..dbc04bf37 100644 --- a/lib/routes/weibo/friends.ts +++ b/lib/routes/weibo/friends.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; -import got from '@/utils/got'; + import { config } from '@/config'; -import weiboUtils from './utils'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; + +import weiboUtils from './utils'; export const route: Route = { path: '/friends/:routeParams?', diff --git a/lib/routes/weibo/group.ts b/lib/routes/weibo/group.ts index 74e79e636..80f657373 100644 --- a/lib/routes/weibo/group.ts +++ b/lib/routes/weibo/group.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; -import got from '@/utils/got'; + import { config } from '@/config'; -import weiboUtils from './utils'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; + +import weiboUtils from './utils'; export const route: Route = { path: '/group/:gid/:gname?/:routeParams?', diff --git a/lib/routes/weibo/keyword.ts b/lib/routes/weibo/keyword.ts index 0084b515b..97358cb4d 100644 --- a/lib/routes/weibo/keyword.ts +++ b/lib/routes/weibo/keyword.ts @@ -1,11 +1,14 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; -import got from '@/utils/got'; -import weiboUtils from './utils'; -import timezone from '@/utils/timezone'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; + import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; +import timezone from '@/utils/timezone'; + +import weiboUtils from './utils'; export const route: Route = { path: '/keyword/:keyword/:routeParams?', diff --git a/lib/routes/weibo/oasis/user.ts b/lib/routes/weibo/oasis/user.ts index e277be386..44f7b110d 100644 --- a/lib/routes/weibo/oasis/user.ts +++ b/lib/routes/weibo/oasis/user.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; + import weiboUtils from '../utils'; export const route: Route = { diff --git a/lib/routes/weibo/search/hot.ts b/lib/routes/weibo/search/hot.ts index f43192db0..dc5912ba8 100644 --- a/lib/routes/weibo/search/hot.ts +++ b/lib/routes/weibo/search/hot.ts @@ -1,11 +1,14 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; import { art } from '@/utils/render'; -import { load } from 'cheerio'; -import path from 'node:path'; + import weiboUtils from '../utils'; // Default hide all picture diff --git a/lib/routes/weibo/super-index.ts b/lib/routes/weibo/super-index.ts index a8f373065..6aaed19b0 100644 --- a/lib/routes/weibo/super-index.ts +++ b/lib/routes/weibo/super-index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import queryString from 'query-string'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import weiboUtils from './utils'; -import queryString from 'query-string'; -import { config } from '@/config'; export const route: Route = { path: '/super_index/:id/:type?/:routeParams?', diff --git a/lib/routes/weibo/timeline.ts b/lib/routes/weibo/timeline.ts index 2bdb2c474..6ab932141 100644 --- a/lib/routes/weibo/timeline.ts +++ b/lib/routes/weibo/timeline.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import weiboUtils from './utils'; import { fallback, queryToBoolean } from '@/utils/readable-social'; +import weiboUtils from './utils'; + export const route: Route = { path: '/timeline/:uid/:feature?/:routeParams?', categories: ['social-media'], diff --git a/lib/routes/weibo/user-bookmarks.ts b/lib/routes/weibo/user-bookmarks.ts index 099e3a710..436907280 100644 --- a/lib/routes/weibo/user-bookmarks.ts +++ b/lib/routes/weibo/user-bookmarks.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; -import got from '@/utils/got'; + import { config } from '@/config'; -import weiboUtils from './utils'; -import timezone from '@/utils/timezone'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { fallback, queryToBoolean } from '@/utils/readable-social'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; +import timezone from '@/utils/timezone'; + +import weiboUtils from './utils'; export const route: Route = { path: '/user_bookmarks/:uid/:routeParams?', diff --git a/lib/routes/weibo/user.ts b/lib/routes/weibo/user.ts index 945c318f0..9daf7a2a0 100644 --- a/lib/routes/weibo/user.ts +++ b/lib/routes/weibo/user.ts @@ -1,12 +1,15 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; -import got from '@/utils/got'; -import weiboUtils from './utils'; + import { config } from '@/config'; -import timezone from '@/utils/timezone'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { fallback, queryToBoolean } from '@/utils/readable-social'; +import timezone from '@/utils/timezone'; + +import weiboUtils from './utils'; export const route: Route = { path: '/user/:uid/:routeParams?', diff --git a/lib/routes/weibo/utils.ts b/lib/routes/weibo/utils.ts index fd3c881ef..3c553ff8c 100644 --- a/lib/routes/weibo/utils.ts +++ b/lib/routes/weibo/utils.ts @@ -1,11 +1,13 @@ -import cache from '@/utils/cache'; +import querystring from 'node:querystring'; + +import { load } from 'cheerio'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import logger from '@/utils/logger'; import { getPuppeteerPage } from '@/utils/puppeteer'; import { getCookies } from '@/utils/puppeteer-utils'; -import logger from '@/utils/logger'; -import querystring from 'node:querystring'; -import got from '@/utils/got'; -import { load } from 'cheerio'; import { fallback, queryToBoolean, queryToInteger } from '@/utils/readable-social'; class RenewWeiboCookiesError extends Error { diff --git a/lib/routes/wellcee/rent.ts b/lib/routes/wellcee/rent.ts index ef84849b5..612f40a49 100644 --- a/lib/routes/wellcee/rent.ts +++ b/lib/routes/wellcee/rent.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; -import type { Context } from 'hono'; -import { District, House } from './types'; +import path from 'node:path'; +import type { Context } from 'hono'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { baseUrl, getCitys, getDistricts } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import type { District, House } from './types'; +import { baseUrl, getCitys, getDistricts } from './utils'; const render = (data) => art(path.join(__dirname, 'templates/house.art'), data); diff --git a/lib/routes/wellcee/support-city.ts b/lib/routes/wellcee/support-city.ts index 2b0b88d9b..f9eb6e1ea 100644 --- a/lib/routes/wellcee/support-city.ts +++ b/lib/routes/wellcee/support-city.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; import type { Context } from 'hono'; +import type { Route } from '@/types'; + import { baseUrl, getCitys, getDistricts } from './utils'; export const route: Route = { diff --git a/lib/routes/wellcee/utils.ts b/lib/routes/wellcee/utils.ts index f10baf402..a3aad5d15 100644 --- a/lib/routes/wellcee/utils.ts +++ b/lib/routes/wellcee/utils.ts @@ -1,8 +1,8 @@ -import { City, District } from './types'; - -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import type { City, District } from './types'; export const baseUrl = 'https://www.wellcee.com'; export const getCitys = () => diff --git a/lib/routes/wenku8/chapter.ts b/lib/routes/wenku8/chapter.ts index a07ea3f1c..7e1046de2 100644 --- a/lib/routes/wenku8/chapter.ts +++ b/lib/routes/wenku8/chapter.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/chapter/:id', categories: ['reading'], diff --git a/lib/routes/wenku8/index.ts b/lib/routes/wenku8/index.ts index 40267d0ad..73109a6f1 100644 --- a/lib/routes/wenku8/index.ts +++ b/lib/routes/wenku8/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; const cateUrlMap = { lastupdate: 'https://www.wenku8.net/modules/article/toplist.php?sort=lastupdate', diff --git a/lib/routes/wenku8/volume.ts b/lib/routes/wenku8/volume.ts index ddb1b9920..723abaa99 100644 --- a/lib/routes/wenku8/volume.ts +++ b/lib/routes/wenku8/volume.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import { decode } from 'iconv-lite'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + export const route: Route = { path: '/volume/:id', categories: ['reading'], diff --git a/lib/routes/wfdf/news.ts b/lib/routes/wfdf/news.ts index 4d3e901e4..c9ea5616f 100644 --- a/lib/routes/wfdf/news.ts +++ b/lib/routes/wfdf/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/wfu/jwc.ts b/lib/routes/wfu/jwc.ts index 38100a5a2..3b56481f9 100644 --- a/lib/routes/wfu/jwc.ts +++ b/lib/routes/wfu/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + // 参考 whu/news 武汉大学页面写成 const baseUrl = 'https://jwc.wfu.edu.cn/3742/list.htm'; diff --git a/lib/routes/wfu/news.ts b/lib/routes/wfu/news.ts index c049730df..c1945c2a7 100644 --- a/lib/routes/wfu/news.ts +++ b/lib/routes/wfu/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/whitehouse/news.ts b/lib/routes/whitehouse/news.ts index 9e347a296..8e6413bd3 100644 --- a/lib/routes/whitehouse/news.ts +++ b/lib/routes/whitehouse/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/who/news-room.ts b/lib/routes/who/news-room.ts index 6763c3c47..24ad2c453 100644 --- a/lib/routes/who/news-room.ts +++ b/lib/routes/who/news-room.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/who/news.ts b/lib/routes/who/news.ts index 05bfc2451..6395ad5e6 100644 --- a/lib/routes/who/news.ts +++ b/lib/routes/who/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/who/speeches.ts b/lib/routes/who/speeches.ts index 6855b2795..60d65e8c7 100644 --- a/lib/routes/who/speeches.ts +++ b/lib/routes/who/speeches.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/whu/cs.ts b/lib/routes/whu/cs.ts index 6cc609273..61e4f2efd 100644 --- a/lib/routes/whu/cs.ts +++ b/lib/routes/whu/cs.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; const baseUrl = 'https://cs.whu.edu.cn'; diff --git a/lib/routes/whu/gs/index.ts b/lib/routes/whu/gs/index.ts index 22eb4575f..2716297e1 100644 --- a/lib/routes/whu/gs/index.ts +++ b/lib/routes/whu/gs/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const gsIndexMap = new Map([ diff --git a/lib/routes/whu/hyxt.ts b/lib/routes/whu/hyxt.ts index f89fc8f0d..f8162d541 100644 --- a/lib/routes/whu/hyxt.ts +++ b/lib/routes/whu/hyxt.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { domain, processMeta, getMeta, processItems } from './util'; +import { domain, getMeta, processItems, processMeta } from './util'; export const route: Route = { path: '/hyxt/:category{.+}?', diff --git a/lib/routes/whu/news.ts b/lib/routes/whu/news.ts index b6fa154c0..dd2c9461c 100644 --- a/lib/routes/whu/news.ts +++ b/lib/routes/whu/news.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { domain, processMeta, getMeta, processItems } from './util'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { domain, getMeta, processItems, processMeta } from './util'; export const route: Route = { path: '/news/:category{.+}?', diff --git a/lib/routes/whu/rsgis.ts b/lib/routes/whu/rsgis.ts index 3eaaff966..0893164d8 100644 --- a/lib/routes/whu/rsgis.ts +++ b/lib/routes/whu/rsgis.ts @@ -1,10 +1,12 @@ -import { Route, DataItem } from '@/types'; +import type { AnyNode, Cheerio} from 'cheerio'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load, Cheerio, AnyNode } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { Context } from 'hono'; -import cache from '@/utils/cache'; interface Post extends DataItem { external: boolean; diff --git a/lib/routes/whu/swrh.ts b/lib/routes/whu/swrh.ts index 7af1dc1db..ab73c20b9 100644 --- a/lib/routes/whu/swrh.ts +++ b/lib/routes/whu/swrh.ts @@ -1,10 +1,11 @@ // 修改自计算机学院route -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; // import { parseDate } from '@/utils/parse-date'; // import timezone from '@/utils/timezone'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { fetchArticle } from '@/utils/wechat-mp'; const baseUrl = 'https://swrh.whu.edu.cn'; diff --git a/lib/routes/whu/util.ts b/lib/routes/whu/util.ts index 4e7a3c910..b7557c840 100644 --- a/lib/routes/whu/util.ts +++ b/lib/routes/whu/util.ts @@ -1,9 +1,11 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const domain = 'whu.edu.cn'; @@ -137,4 +139,4 @@ const processItems = async (items, tryGet, rootUrl) => }) ); -export { domain, processMeta, getMeta, processItems }; +export { domain, getMeta, processItems, processMeta }; diff --git a/lib/routes/wiensued/index.ts b/lib/routes/wiensued/index.ts index eb48e84dc..cd70d318b 100644 --- a/lib/routes/wiensued/index.ts +++ b/lib/routes/wiensued/index.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import ofetch from '@/utils/ofetch'; -import type { Data, DataItem, Route } from '@/types'; const FEED_LANGUAGE = 'de' as const; const FEED_LOGO = 'https://www.wiensued.at/wp-content/uploads/logo_wiensued_ohneclaim.svg'; diff --git a/lib/routes/wikinews/index.ts b/lib/routes/wikinews/index.ts index 454cbce7b..1ccb16ab8 100644 --- a/lib/routes/wikinews/index.ts +++ b/lib/routes/wikinews/index.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -const currentURL = 'https://zh.wikinews.org/wiki/Special:%E6%96%B0%E9%97%BB%E8%AE%A2%E9%98%85'; import { parseDate } from '@/utils/parse-date'; +const currentURL = 'https://zh.wikinews.org/wiki/Special:%E6%96%B0%E9%97%BB%E8%AE%A2%E9%98%85'; + export const route: Route = { path: '/latest', categories: ['new-media'], diff --git a/lib/routes/wikipedia/current-events.ts b/lib/routes/wikipedia/current-events.ts index 7edd73941..427e1e931 100644 --- a/lib/routes/wikipedia/current-events.ts +++ b/lib/routes/wikipedia/current-events.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; /* The different ways to query Wikipedia's Current Events diff --git a/lib/routes/windsurf/blog.ts b/lib/routes/windsurf/blog.ts index c3b2ec77e..b63a15b3f 100644 --- a/lib/routes/windsurf/blog.ts +++ b/lib/routes/windsurf/blog.ts @@ -1,12 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '10', 10); diff --git a/lib/routes/windsurf/changelog.ts b/lib/routes/windsurf/changelog.ts index fce45ddb9..249705fa2 100644 --- a/lib/routes/windsurf/changelog.ts +++ b/lib/routes/windsurf/changelog.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '100', 10); diff --git a/lib/routes/winstall/update.ts b/lib/routes/winstall/update.ts index 2269edea5..49320057b 100644 --- a/lib/routes/winstall/update.ts +++ b/lib/routes/winstall/update.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { config } from '@/config'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:appId', diff --git a/lib/routes/wired/tag.ts b/lib/routes/wired/tag.ts index 8347d7d19..60b4c5c44 100644 --- a/lib/routes/wired/tag.ts +++ b/lib/routes/wired/tag.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import * as cheerio from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; -import { Item } from './types'; import { parseDate } from '@/utils/parse-date'; +import type { Item } from './types'; + export const route: Route = { path: '/tag/:tag', example: '/wired/tag/facebook', diff --git a/lib/routes/wise/pair.ts b/lib/routes/wise/pair.ts index 628a19f63..352b4adc8 100644 --- a/lib/routes/wise/pair.ts +++ b/lib/routes/wise/pair.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import dayjs from 'dayjs'; +import customParseFormat from 'dayjs/plugin/customParseFormat.js'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import dayjs from 'dayjs'; -import customParseFormat from 'dayjs/plugin/customParseFormat.js'; -dayjs.extend(customParseFormat); import { art } from '@/utils/render'; -import path from 'node:path'; + +dayjs.extend(customParseFormat); const renderDesc = (content) => art(path.join(__dirname, 'templates/description.art'), content); export const route: Route = { diff --git a/lib/routes/withgoogle/explorables.ts b/lib/routes/withgoogle/explorables.ts index 4dd548915..cbbf96af8 100644 --- a/lib/routes/withgoogle/explorables.ts +++ b/lib/routes/withgoogle/explorables.ts @@ -1,7 +1,8 @@ -import type { Route, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; export const route: Route = { name: 'PAIR - AI Exploreables', diff --git a/lib/routes/wizfile/index.ts b/lib/routes/wizfile/index.ts index 4ee9cfe14..81e82eef4 100644 --- a/lib/routes/wizfile/index.ts +++ b/lib/routes/wizfile/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://antibody-software.com'; diff --git a/lib/routes/wmc-bj/publish.ts b/lib/routes/wmc-bj/publish.ts index 9bf21090c..ec56268dd 100644 --- a/lib/routes/wmc-bj/publish.ts +++ b/lib/routes/wmc-bj/publish.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/publish/:category{.+}?', diff --git a/lib/routes/wmpvp/index.ts b/lib/routes/wmpvp/index.ts index 52adb0973..ea8b3e959 100644 --- a/lib/routes/wmpvp/index.ts +++ b/lib/routes/wmpvp/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/wnacg/category.ts b/lib/routes/wnacg/category.ts index c1bc7c386..f520ed205 100644 --- a/lib/routes/wnacg/category.ts +++ b/lib/routes/wnacg/category.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/wnacg/common.ts b/lib/routes/wnacg/common.ts index 4923d1f78..600a615ea 100644 --- a/lib/routes/wnacg/common.ts +++ b/lib/routes/wnacg/common.ts @@ -1,10 +1,12 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const categories = { 1: '同人誌 漢化', diff --git a/lib/routes/wnacg/index.ts b/lib/routes/wnacg/index.ts index 215cfd1fc..03ef27980 100644 --- a/lib/routes/wnacg/index.ts +++ b/lib/routes/wnacg/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/wnacg/tag.ts b/lib/routes/wnacg/tag.ts index 27f3e0b62..8db6f41d0 100644 --- a/lib/routes/wnacg/tag.ts +++ b/lib/routes/wnacg/tag.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/wohnnet/index.ts b/lib/routes/wohnnet/index.ts index 35ecf1394..9cbed1877 100644 --- a/lib/routes/wohnnet/index.ts +++ b/lib/routes/wohnnet/index.ts @@ -1,6 +1,7 @@ import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + import type { Data, DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; const FEED_TITLE = 'wohnnet.at' as const; const FEED_LOGO = 'https://www.wohnnet.at/media/images/wohnnet/icon_192_192.png' as const; diff --git a/lib/routes/wordpress/index.ts b/lib/routes/wordpress/index.ts index fe5db3470..812ead699 100644 --- a/lib/routes/wordpress/index.ts +++ b/lib/routes/wordpress/index.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import parser from '@/utils/rss-parser'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; import { apiSlug, bakeFilterSearchParams, bakeFiltersWithPair, bakeUrl, fetchData, getFilterParamsForUrl, parseFilterStr } from './util'; diff --git a/lib/routes/wordpress/util.ts b/lib/routes/wordpress/util.ts index c57cfffa2..3b0f02194 100644 --- a/lib/routes/wordpress/util.ts +++ b/lib/routes/wordpress/util.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + const apiSlug = 'wp-json/wp/v2'; interface Filter { diff --git a/lib/routes/worldjournal/index.ts b/lib/routes/worldjournal/index.ts index f83aa98a6..7051150a9 100644 --- a/lib/routes/worldjournal/index.ts +++ b/lib/routes/worldjournal/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/worldofwarships/devblog.ts b/lib/routes/worldofwarships/devblog.ts index a8e7fd479..523776f98 100644 --- a/lib/routes/worldofwarships/devblog.ts +++ b/lib/routes/worldofwarships/devblog.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; export const route: Route = { path: '/devblog', diff --git a/lib/routes/woshipm/popular.ts b/lib/routes/woshipm/popular.ts index ff1045ffc..d4d279bba 100644 --- a/lib/routes/woshipm/popular.ts +++ b/lib/routes/woshipm/popular.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, parseArticle } from './utils'; const rangeMap = { diff --git a/lib/routes/woshipm/user-article.ts b/lib/routes/woshipm/user-article.ts index d85c757e3..ad894aa9b 100644 --- a/lib/routes/woshipm/user-article.ts +++ b/lib/routes/woshipm/user-article.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/woshipm/utils.ts b/lib/routes/woshipm/utils.ts index c1f1a16b3..c81cd549f 100644 --- a/lib/routes/woshipm/utils.ts +++ b/lib/routes/woshipm/utils.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + const baseUrl = 'https://www.woshipm.com'; const parseArticle = (item, tryGet) => diff --git a/lib/routes/woshipm/wen.ts b/lib/routes/woshipm/wen.ts index a0c3e91cc..7bcc11182 100644 --- a/lib/routes/woshipm/wen.ts +++ b/lib/routes/woshipm/wen.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -const baseUrl = 'https://wen.woshipm.com'; import { parseRelativeDate } from '@/utils/parse-date'; +const baseUrl = 'https://wen.woshipm.com'; + export const route: Route = { path: '/wen', categories: ['new-media'], diff --git a/lib/routes/wsj/news.ts b/lib/routes/wsj/news.ts index e64dc2001..c48d9ee5c 100644 --- a/lib/routes/wsj/news.ts +++ b/lib/routes/wsj/news.ts @@ -1,8 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseArticle } from './utils'; import pMap from 'p-map'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { parseArticle } from './utils'; + const hostMap = { 'en-us': 'https://www.wsj.com', 'zh-cn': 'https://cn.wsj.com/zh-hans', diff --git a/lib/routes/wsj/utils.ts b/lib/routes/wsj/utils.ts index 11391f259..37fdee011 100644 --- a/lib/routes/wsj/utils.ts +++ b/lib/routes/wsj/utils.ts @@ -1,10 +1,12 @@ -import cache from '@/utils/cache'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { PRESETS } from '@/utils/header-generator'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { PRESETS } from '@/utils/header-generator'; const parseArticle = (item) => cache.tryGet(item.link, async () => { diff --git a/lib/routes/wsyu/news.ts b/lib/routes/wsyu/news.ts index 81f8def2e..ba881bcea 100644 --- a/lib/routes/wsyu/news.ts +++ b/lib/routes/wsyu/news.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import * as url from 'node:url'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import * as url from 'node:url'; const baseUrl = 'http://www.wsyu.edu.cn'; diff --git a/lib/routes/wtu/index.ts b/lib/routes/wtu/index.ts index 216fbcb12..ca8da1547 100644 --- a/lib/routes/wtu/index.ts +++ b/lib/routes/wtu/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/wtu/job.ts b/lib/routes/wtu/job.ts index d732edb01..87e2b1ae9 100644 --- a/lib/routes/wtu/job.ts +++ b/lib/routes/wtu/job.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import zlib from 'node:zlib'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import zlib from 'node:zlib'; -import { load } from 'cheerio'; const baseUrl = 'https://wtu.91wllm.com/'; diff --git a/lib/routes/wufazhuce/one.ts b/lib/routes/wufazhuce/one.ts index 72e4407ad..3b78b83db 100644 --- a/lib/routes/wufazhuce/one.ts +++ b/lib/routes/wufazhuce/one.ts @@ -1,5 +1,6 @@ -import { Route, Data, DataItem } from '@/types'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/wyzxwk/article.ts b/lib/routes/wyzxwk/article.ts index 33f0a8de4..c5193c956 100644 --- a/lib/routes/wyzxwk/article.ts +++ b/lib/routes/wyzxwk/article.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/wzu/news.ts b/lib/routes/wzu/news.ts index 2080b1fe1..3df184969 100644 --- a/lib/routes/wzu/news.ts +++ b/lib/routes/wzu/news.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { URL } from 'node:url'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { URL } from 'node:url'; import { parseDate } from '@/utils/parse-date'; /* 新闻列表 diff --git a/lib/routes/x-mol/news.ts b/lib/routes/x-mol/news.ts index 22ec371da..a05e06d32 100644 --- a/lib/routes/x-mol/news.ts +++ b/lib/routes/x-mol/news.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import utils from './utils'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; + +import utils from './utils'; export const route: Route = { path: '/news/:tag?', diff --git a/lib/routes/x-mol/paper.ts b/lib/routes/x-mol/paper.ts index 079283874..e1116179e 100644 --- a/lib/routes/x-mol/paper.ts +++ b/lib/routes/x-mol/paper.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import utils from './utils'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import pMap from 'p-map'; + +import utils from './utils'; export const route: Route = { path: '/paper/:type/:magazine', diff --git a/lib/routes/x6d/index.ts b/lib/routes/x6d/index.ts index b845333dc..7dafb6f3d 100644 --- a/lib/routes/x6d/index.ts +++ b/lib/routes/x6d/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/xaufe/jiaowu.ts b/lib/routes/xaufe/jiaowu.ts index d478b7d88..6922c7a96 100644 --- a/lib/routes/xaufe/jiaowu.ts +++ b/lib/routes/xaufe/jiaowu.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; // Yep http is bad, but I had no choice :( const rootMeta = { diff --git a/lib/routes/xaut/index.ts b/lib/routes/xaut/index.ts index ff6d9d66e..395cd3be3 100644 --- a/lib/routes/xaut/index.ts +++ b/lib/routes/xaut/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/index/:category?', diff --git a/lib/routes/xaut/jwc.ts b/lib/routes/xaut/jwc.ts index 108edf014..0bfc7b838 100644 --- a/lib/routes/xaut/jwc.ts +++ b/lib/routes/xaut/jwc.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/jwc/:category?', diff --git a/lib/routes/xaut/rsc.ts b/lib/routes/xaut/rsc.ts index a6be2a12d..3c1af4ed9 100644 --- a/lib/routes/xaut/rsc.ts +++ b/lib/routes/xaut/rsc.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/rsc/:category?', diff --git a/lib/routes/xbmu/academic.ts b/lib/routes/xbmu/academic.ts index adc99f71b..797852af1 100644 --- a/lib/routes/xbmu/academic.ts +++ b/lib/routes/xbmu/academic.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; const BASE_URL = 'https://www.xbmu.edu.cn/xwzx/xsxx.htm'; diff --git a/lib/routes/xbmu/announcement.ts b/lib/routes/xbmu/announcement.ts index 56d4486c0..5c5ff50e3 100644 --- a/lib/routes/xbmu/announcement.ts +++ b/lib/routes/xbmu/announcement.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; const BASE_URL = 'https://www.xbmu.edu.cn/xwzx/tzgg.htm'; diff --git a/lib/routes/xbookcn/blog.ts b/lib/routes/xbookcn/blog.ts index 125bba5f8..9b6f98c70 100644 --- a/lib/routes/xbookcn/blog.ts +++ b/lib/routes/xbookcn/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/:label?', // 路由路径 diff --git a/lib/routes/xboxfan/news.ts b/lib/routes/xboxfan/news.ts index 65206e7a4..fb4c4d126 100644 --- a/lib/routes/xboxfan/news.ts +++ b/lib/routes/xboxfan/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseRelativeDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import md5 from '@/utils/md5'; +import { parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { path: '/news', diff --git a/lib/routes/xianbao/index.ts b/lib/routes/xianbao/index.ts index 8bba25832..20864188f 100644 --- a/lib/routes/xianbao/index.ts +++ b/lib/routes/xianbao/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/xiaoheihe/add2cart.ts b/lib/routes/xiaoheihe/add2cart.ts index 2bdbfea03..d6c5b5c36 100644 --- a/lib/routes/xiaoheihe/add2cart.ts +++ b/lib/routes/xiaoheihe/add2cart.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/xiaoheihe/discount.ts b/lib/routes/xiaoheihe/discount.ts index 82ff45b02..5e8d05414 100644 --- a/lib/routes/xiaoheihe/discount.ts +++ b/lib/routes/xiaoheihe/discount.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { calculate } from './util'; export const route: Route = { diff --git a/lib/routes/xiaoheihe/news.ts b/lib/routes/xiaoheihe/news.ts index 9c2e50316..cddb0f3bb 100644 --- a/lib/routes/xiaoheihe/news.ts +++ b/lib/routes/xiaoheihe/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { calculate } from './util'; export const route: Route = { diff --git a/lib/routes/xiaoheihe/user.ts b/lib/routes/xiaoheihe/user.ts index 3de230577..d708a51bc 100644 --- a/lib/routes/xiaoheihe/user.ts +++ b/lib/routes/xiaoheihe/user.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { calculate } from './util'; export const route: Route = { diff --git a/lib/routes/xiaohongshu/board.ts b/lib/routes/xiaohongshu/board.ts index 17d7c9c3e..ac7b51e4d 100644 --- a/lib/routes/xiaohongshu/board.ts +++ b/lib/routes/xiaohongshu/board.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getBoard } from './util'; export const route: Route = { diff --git a/lib/routes/xiaohongshu/check-cookie.ts b/lib/routes/xiaohongshu/check-cookie.ts index 86eecffed..61a5f1aa6 100644 --- a/lib/routes/xiaohongshu/check-cookie.ts +++ b/lib/routes/xiaohongshu/check-cookie.ts @@ -1,4 +1,5 @@ -import { APIRoute } from '@/types'; +import type { APIRoute } from '@/types'; + import { checkCookie } from './util'; export const apiRoute: APIRoute = { diff --git a/lib/routes/xiaohongshu/user.ts b/lib/routes/xiaohongshu/user.ts index 3a71e5910..ff772e3ed 100644 --- a/lib/routes/xiaohongshu/user.ts +++ b/lib/routes/xiaohongshu/user.ts @@ -1,10 +1,14 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; -import { getUser, renderNotesFulltext, getUserWithCookie } from './util'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + import { config } from '@/config'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import { fallback, queryToBoolean } from '@/utils/readable-social'; + +import { getUser, getUserWithCookie, renderNotesFulltext } from './util'; + export const route: Route = { path: '/user/:user_id/:category/:routeParams?', name: '用户笔记/收藏', diff --git a/lib/routes/xiaohongshu/util.ts b/lib/routes/xiaohongshu/util.ts index 70a514433..91a1f6210 100644 --- a/lib/routes/xiaohongshu/util.ts +++ b/lib/routes/xiaohongshu/util.ts @@ -1,11 +1,12 @@ +import { load } from 'cheerio'; + import { config } from '@/config'; +import CaptchaError from '@/errors/types/captcha'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import puppeteer, { getPuppeteerPage } from '@/utils/puppeteer'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import CaptchaError from '@/errors/types/captcha'; // Common headers for requests const getHeaders = (cookie?: string) => ({ @@ -282,4 +283,4 @@ async function checkCookie() { return res.code === 0 && !!res.data.user_id; } -export { getUser, getBoard, formatText, formatNote, renderNotesFulltext, getFullNote, getUserWithCookie, checkCookie }; +export { checkCookie, formatNote, formatText, getBoard, getFullNote, getUser, getUserWithCookie, renderNotesFulltext }; diff --git a/lib/routes/xiaomiyoupin/crowdfunding.ts b/lib/routes/xiaomiyoupin/crowdfunding.ts index 5070b9cd9..54178e4fb 100644 --- a/lib/routes/xiaomiyoupin/crowdfunding.ts +++ b/lib/routes/xiaomiyoupin/crowdfunding.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const base_url = 'https://m.xiaomiyoupin.com'; export const route: Route = { diff --git a/lib/routes/xiaomiyoupin/latest.ts b/lib/routes/xiaomiyoupin/latest.ts index 7a6513425..fdfbd45f7 100644 --- a/lib/routes/xiaomiyoupin/latest.ts +++ b/lib/routes/xiaomiyoupin/latest.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { parseModule, parseFloorItem } from './utils'; + +import { parseFloorItem, parseModule } from './utils'; export const route: Route = { path: '/latest', diff --git a/lib/routes/xiaomiyoupin/utils.ts b/lib/routes/xiaomiyoupin/utils.ts index c2bf17fcd..903f45abf 100644 --- a/lib/routes/xiaomiyoupin/utils.ts +++ b/lib/routes/xiaomiyoupin/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; +import { art } from '@/utils/render'; + const parseModule = (floors, module_key) => floors.find((floor) => floor.module_key === module_key); const parseFloorItem = (floor) => @@ -15,4 +16,4 @@ const parseFloorItem = (floor) => }; }); -export { parseModule, parseFloorItem }; +export { parseFloorItem, parseModule }; diff --git a/lib/routes/xiaote/index.ts b/lib/routes/xiaote/index.ts index 34819d1b2..d961b8c18 100644 --- a/lib/routes/xiaote/index.ts +++ b/lib/routes/xiaote/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; // 自订的 got import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/xiaoyuzhou/pickup.ts b/lib/routes/xiaoyuzhou/pickup.ts index 2c0aef6df..44843a063 100644 --- a/lib/routes/xiaoyuzhou/pickup.ts +++ b/lib/routes/xiaoyuzhou/pickup.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; const XIAOYUZHOU_ITEMS = 'xiaoyuzhou_items'; diff --git a/lib/routes/xiaoyuzhou/podcast.ts b/lib/routes/xiaoyuzhou/podcast.ts index a028cd766..04033f10b 100644 --- a/lib/routes/xiaoyuzhou/podcast.ts +++ b/lib/routes/xiaoyuzhou/podcast.ts @@ -1,8 +1,10 @@ -import { DataItem, Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/podcast/:id', diff --git a/lib/routes/xiaozhuanlan/column.ts b/lib/routes/xiaozhuanlan/column.ts index 3d1daa65b..7a6266c5d 100644 --- a/lib/routes/xiaozhuanlan/column.ts +++ b/lib/routes/xiaozhuanlan/column.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ linkify: true, }); diff --git a/lib/routes/xidian/cs.ts b/lib/routes/xidian/cs.ts index 2760f2637..87d71ef12 100644 --- a/lib/routes/xidian/cs.ts +++ b/lib/routes/xidian/cs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://cs.xidian.edu.cn'; diff --git a/lib/routes/xidian/gr.ts b/lib/routes/xidian/gr.ts index 3ece8bee0..09c20a690 100644 --- a/lib/routes/xidian/gr.ts +++ b/lib/routes/xidian/gr.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://gr.xidian.edu.cn'; diff --git a/lib/routes/xidian/jwc.ts b/lib/routes/xidian/jwc.ts index 60b410684..2efaad3e5 100644 --- a/lib/routes/xidian/jwc.ts +++ b/lib/routes/xidian/jwc.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://jwc.xidian.edu.cn'; export const route: Route = { diff --git a/lib/routes/ximalaya/album.ts b/lib/routes/ximalaya/album.ts index 248567fa1..6d9b1902e 100644 --- a/lib/routes/ximalaya/album.ts +++ b/lib/routes/ximalaya/album.ts @@ -1,12 +1,15 @@ -import { Route } from '@/types'; +import sanitizeHtml from 'sanitize-html'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { getRandom16, decryptUrl } from './utils'; -const baseUrl = 'https://www.ximalaya.com'; -import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; -import { Album, RichIntro, TrackInfoResponse } from './types'; -import sanitizeHtml from 'sanitize-html'; + +import type { Album, RichIntro, TrackInfoResponse } from './types'; +import { decryptUrl, getRandom16 } from './utils'; + +const baseUrl = 'https://www.ximalaya.com'; // Find category from: https://help.apple.com/itc/podcasts_connect/?lang=en#/itc9267a2f12 const categoryDict = { diff --git a/lib/routes/ximalaya/utils.ts b/lib/routes/ximalaya/utils.ts index ba03271e6..3abc57de1 100644 --- a/lib/routes/ximalaya/utils.ts +++ b/lib/routes/ximalaya/utils.ts @@ -165,4 +165,4 @@ const decryptUrl = (encryptedUrl) => { } return Buffer.from(decryptedData).toString('utf8'); }; -export { /* getUrl, */ getRandom16, decryptUrl }; +export { /* getUrl, */ decryptUrl, getRandom16 }; diff --git a/lib/routes/xinpianchang/index.ts b/lib/routes/xinpianchang/index.ts index 261d1bdcf..60b7d355f 100644 --- a/lib/routes/xinpianchang/index.ts +++ b/lib/routes/xinpianchang/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, getData, processItems } from './util'; + +import { getData, processItems, rootUrl } from './util'; export const route: Route = { path: ['/discover/:params?', '/:params?'], diff --git a/lib/routes/xinpianchang/rank.ts b/lib/routes/xinpianchang/rank.ts index 58ab8ad7d..622132b4b 100644 --- a/lib/routes/xinpianchang/rank.ts +++ b/lib/routes/xinpianchang/rank.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, getData, processItems } from './util'; +import { getData, processItems, rootUrl } from './util'; export const route: Route = { path: '/rank/:category?', diff --git a/lib/routes/xinpianchang/util.ts b/lib/routes/xinpianchang/util.ts index 79f38814d..894b9d68e 100644 --- a/lib/routes/xinpianchang/util.ts +++ b/lib/routes/xinpianchang/util.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const appKey = '61a2f329348b3bf77'; @@ -102,4 +104,4 @@ const processItems = async (items, tryGet) => { ); }; -export { rootUrl, getData, processItems }; +export { getData, processItems, rootUrl }; diff --git a/lib/routes/xjtu/2yuan/news.ts b/lib/routes/xjtu/2yuan/news.ts index f97e56dd8..9565c0b00 100644 --- a/lib/routes/xjtu/2yuan/news.ts +++ b/lib/routes/xjtu/2yuan/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/2yuan/news/:id?', diff --git a/lib/routes/xjtu/dean.ts b/lib/routes/xjtu/dean.ts index 1a33098f1..922259252 100644 --- a/lib/routes/xjtu/dean.ts +++ b/lib/routes/xjtu/dean.ts @@ -1,7 +1,8 @@ -import { Route, Data, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/xjtu/dyyy/index.ts b/lib/routes/xjtu/dyyy/index.ts index ea21e6215..bcd7451b4 100644 --- a/lib/routes/xjtu/dyyy/index.ts +++ b/lib/routes/xjtu/dyyy/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'http://www.dyyy.xjtu.edu.cn'; diff --git a/lib/routes/xjtu/ee-jzxx.ts b/lib/routes/xjtu/ee-jzxx.ts index b195e4f15..d8c36523c 100644 --- a/lib/routes/xjtu/ee-jzxx.ts +++ b/lib/routes/xjtu/ee-jzxx.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/xjtu/ee.ts b/lib/routes/xjtu/ee.ts index 1f245ef54..92479f904 100644 --- a/lib/routes/xjtu/ee.ts +++ b/lib/routes/xjtu/ee.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/xjtu/gs/tzgg.ts b/lib/routes/xjtu/gs/tzgg.ts index ac898ca70..e076f6593 100644 --- a/lib/routes/xjtu/gs/tzgg.ts +++ b/lib/routes/xjtu/gs/tzgg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/xjtu/international.ts b/lib/routes/xjtu/international.ts index 449cc4b98..b318ac75a 100644 --- a/lib/routes/xjtu/international.ts +++ b/lib/routes/xjtu/international.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/xjtu/job.ts b/lib/routes/xjtu/job.ts index b03b00229..0e64986f8 100644 --- a/lib/routes/xjtu/job.ts +++ b/lib/routes/xjtu/job.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const baseUrl = 'https://job.xjtu.edu.cn'; const arr = { diff --git a/lib/routes/xjtu/std.ts b/lib/routes/xjtu/std.ts index 21a35fef3..74f3bb3a3 100644 --- a/lib/routes/xjtu/std.ts +++ b/lib/routes/xjtu/std.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/std/:category?', diff --git a/lib/routes/xjtu/yz.ts b/lib/routes/xjtu/yz.ts index 2082d2628..8fde0a275 100644 --- a/lib/routes/xjtu/yz.ts +++ b/lib/routes/xjtu/yz.ts @@ -1,9 +1,10 @@ -import type { Data, DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/xjtu/zs.ts b/lib/routes/xjtu/zs.ts index c271d19bc..bf951d166 100644 --- a/lib/routes/xjtu/zs.ts +++ b/lib/routes/xjtu/zs.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'zsxx1/zskx' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/xkb/index.ts b/lib/routes/xkb/index.ts index c5581e9e8..653aebffd 100644 --- a/lib/routes/xkb/index.ts +++ b/lib/routes/xkb/index.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:channel', diff --git a/lib/routes/xmanhua/index.ts b/lib/routes/xmanhua/index.ts index cd0b06383..f44522108 100644 --- a/lib/routes/xmanhua/index.ts +++ b/lib/routes/xmanhua/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/xmnn/epaper.ts b/lib/routes/xmnn/epaper.ts index 47125f0db..3ce7c1dbe 100644 --- a/lib/routes/xmnn/epaper.ts +++ b/lib/routes/xmnn/epaper.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/epaper/:id?', diff --git a/lib/routes/xmnn/news.ts b/lib/routes/xmnn/news.ts index 018a78812..afafd3f95 100644 --- a/lib/routes/xmnn/news.ts +++ b/lib/routes/xmnn/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/news/:category{.+}?', diff --git a/lib/routes/xmu/kydt.ts b/lib/routes/xmu/kydt.ts index ac6c0be51..c7ee2d8fc 100644 --- a/lib/routes/xmu/kydt.ts +++ b/lib/routes/xmu/kydt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/kydt', diff --git a/lib/routes/xmut/jwc/bkjw.ts b/lib/routes/xmut/jwc/bkjw.ts index 4d395e72e..5843d58f0 100644 --- a/lib/routes/xmut/jwc/bkjw.ts +++ b/lib/routes/xmut/jwc/bkjw.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const xmut = 'https://jwc.xmut.edu.cn'; export const route: Route = { diff --git a/lib/routes/xmut/jwc/yjs.ts b/lib/routes/xmut/jwc/yjs.ts index 2dc81d257..d9e210833 100644 --- a/lib/routes/xmut/jwc/yjs.ts +++ b/lib/routes/xmut/jwc/yjs.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const xmut = 'https://yjs.xmut.edu.cn'; export const route: Route = { diff --git a/lib/routes/xsijishe/forum.ts b/lib/routes/xsijishe/forum.ts index 7e328c3c0..afbb08984 100644 --- a/lib/routes/xsijishe/forum.ts +++ b/lib/routes/xsijishe/forum.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; + const baseUrl = 'https://xsijishe.com'; export const route: Route = { diff --git a/lib/routes/xsijishe/rank.ts b/lib/routes/xsijishe/rank.ts index b744df934..f9ee98814 100644 --- a/lib/routes/xsijishe/rank.ts +++ b/lib/routes/xsijishe/rank.ts @@ -1,12 +1,14 @@ +import { load } from 'cheerio'; + +import { config } from '@/config'; import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { config } from '@/config'; -import { puppeteerGet } from './utils'; import puppeteer from '@/utils/puppeteer'; +import { puppeteerGet } from './utils'; + const baseUrl = 'https://xsijishe.com'; export const route: Route = { diff --git a/lib/routes/xueqiu/column.ts b/lib/routes/xueqiu/column.ts index b7bd7c00f..0a40492e2 100644 --- a/lib/routes/xueqiu/column.ts +++ b/lib/routes/xueqiu/column.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { JSDOM } from 'jsdom'; import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const cookieJar = new CookieJar(); const baseUrl = 'https://xueqiu.com'; diff --git a/lib/routes/xueqiu/cookies.ts b/lib/routes/xueqiu/cookies.ts index 4ab574856..5111e63eb 100644 --- a/lib/routes/xueqiu/cookies.ts +++ b/lib/routes/xueqiu/cookies.ts @@ -1,5 +1,5 @@ -import cache from '@/utils/cache'; import { config } from '@/config'; +import cache from '@/utils/cache'; import puppeteer from '@/utils/puppeteer'; import { getCookies } from '@/utils/puppeteer-utils'; diff --git a/lib/routes/xueqiu/favorite.ts b/lib/routes/xueqiu/favorite.ts index cb1e61971..8832d4656 100644 --- a/lib/routes/xueqiu/favorite.ts +++ b/lib/routes/xueqiu/favorite.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import queryString from 'query-string'; -import { parseDate } from '@/utils/parse-date'; + import { parseToken } from '@/routes/xueqiu/cookies'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/favorite/:id', diff --git a/lib/routes/xueqiu/fund.ts b/lib/routes/xueqiu/fund.ts index b38053948..78bf9e247 100644 --- a/lib/routes/xueqiu/fund.ts +++ b/lib/routes/xueqiu/fund.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/xueqiu/hots.ts b/lib/routes/xueqiu/hots.ts index ffaf9d520..77c8fd3bc 100644 --- a/lib/routes/xueqiu/hots.ts +++ b/lib/routes/xueqiu/hots.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import queryString from 'query-string'; -import { parseDate } from '@/utils/parse-date'; import sanitizeHtml from 'sanitize-html'; + import { parseToken } from '@/routes/xueqiu/cookies'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/hots', diff --git a/lib/routes/xueqiu/snb.ts b/lib/routes/xueqiu/snb.ts index 5e3f60f98..141f971b2 100644 --- a/lib/routes/xueqiu/snb.ts +++ b/lib/routes/xueqiu/snb.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { parseDate } from '@/utils/parse-date'; import { PRESETS } from '@/utils/header-generator'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/snb/:id', diff --git a/lib/routes/xueqiu/stock-comments.ts b/lib/routes/xueqiu/stock-comments.ts index b05155f0f..9bcdf1fed 100644 --- a/lib/routes/xueqiu/stock-comments.ts +++ b/lib/routes/xueqiu/stock-comments.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; +import sanitizeHtml from 'sanitize-html'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; -import path from 'node:path'; import { parseDate } from '@/utils/parse-date'; -import sanitizeHtml from 'sanitize-html'; +import { art } from '@/utils/render'; export const route: Route = { path: '/stock_comments/:id', diff --git a/lib/routes/xueqiu/stock-info.ts b/lib/routes/xueqiu/stock-info.ts index cc3ec8032..d87929a46 100644 --- a/lib/routes/xueqiu/stock-info.ts +++ b/lib/routes/xueqiu/stock-info.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import queryString from 'query-string'; -import { parseDate } from '@/utils/parse-date'; import sanitizeHtml from 'sanitize-html'; + import { parseToken } from '@/routes/xueqiu/cookies'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/stock_info/:id/:type?', diff --git a/lib/routes/xueqiu/timeline.ts b/lib/routes/xueqiu/timeline.ts index 37c97b08d..9f3ecae05 100644 --- a/lib/routes/xueqiu/timeline.ts +++ b/lib/routes/xueqiu/timeline.ts @@ -1,9 +1,10 @@ -import { DataItem, Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'https://xueqiu.com'; export const route: Route = { path: '/timeline/:usergroup_id?', diff --git a/lib/routes/xueqiu/today.ts b/lib/routes/xueqiu/today.ts index 2235d017e..4a6b88ecb 100644 --- a/lib/routes/xueqiu/today.ts +++ b/lib/routes/xueqiu/today.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { parseToken } from '@/routes/xueqiu/cookies'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { parseToken } from '@/routes/xueqiu/cookies'; export const route: Route = { path: '/today', diff --git a/lib/routes/xueqiu/user-stock.ts b/lib/routes/xueqiu/user-stock.ts index 97c9c0ca8..44959474a 100644 --- a/lib/routes/xueqiu/user-stock.ts +++ b/lib/routes/xueqiu/user-stock.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/xueqiu/user.ts b/lib/routes/xueqiu/user.ts index 4fa8a58fc..89de8c06a 100644 --- a/lib/routes/xueqiu/user.ts +++ b/lib/routes/xueqiu/user.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import sanitizeHtml from 'sanitize-html'; + +import { parseToken } from '@/routes/xueqiu/cookies'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -import sanitizeHtml from 'sanitize-html'; -import { parseToken } from '@/routes/xueqiu/cookies'; import puppeteer from '@/utils/puppeteer'; const rootUrl = 'https://xueqiu.com'; diff --git a/lib/routes/xunhupay/index.ts b/lib/routes/xunhupay/index.ts index aa1bfbe28..59b965b64 100644 --- a/lib/routes/xunhupay/index.ts +++ b/lib/routes/xunhupay/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; + const baseUrl = 'https://www.xunhupay.com'; export const route: Route = { diff --git a/lib/routes/xwenming/index.ts b/lib/routes/xwenming/index.ts index 06194960f..ac68fbb4b 100644 --- a/lib/routes/xwenming/index.ts +++ b/lib/routes/xwenming/index.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { category } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '50', 10); diff --git a/lib/routes/xys/new.ts b/lib/routes/xys/new.ts index 3927f1772..51816aee3 100644 --- a/lib/routes/xys/new.ts +++ b/lib/routes/xys/new.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import path from 'node:path'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; diff --git a/lib/routes/xyu/library.ts b/lib/routes/xyu/library.ts index 822787dfb..33dd88d5c 100644 --- a/lib/routes/xyu/library.ts +++ b/lib/routes/xyu/library.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/xyu/notices.ts b/lib/routes/xyu/notices.ts index ac198dfee..02b3f0352 100644 --- a/lib/routes/xyu/notices.ts +++ b/lib/routes/xyu/notices.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/xyzrank/index.ts b/lib/routes/xyzrank/index.ts index 2fd81bc4c..117823fbd 100644 --- a/lib/routes/xyzrank/index.ts +++ b/lib/routes/xyzrank/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/yahoo/news/index.ts b/lib/routes/yahoo/news/index.ts index c93b5cd26..58b6a44f6 100644 --- a/lib/routes/yahoo/news/index.ts +++ b/lib/routes/yahoo/news/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import parser from '@/utils/rss-parser'; -import { getArchive, getCategories, parseList, parseItem } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import { getArchive, getCategories, parseItem, parseList } from './utils'; export const route: Route = { path: '/news/:region/:category?', diff --git a/lib/routes/yahoo/news/listid.ts b/lib/routes/yahoo/news/listid.ts index 1eae53424..074d68b44 100644 --- a/lib/routes/yahoo/news/listid.ts +++ b/lib/routes/yahoo/news/listid.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { getList, parseList, parseItem } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { getList, parseItem, parseList } from './utils'; export const route: Route = { path: '/news/list/:region/:listId', diff --git a/lib/routes/yahoo/news/provider-helper.ts b/lib/routes/yahoo/news/provider-helper.ts index 505968c4e..13d4fd3de 100644 --- a/lib/routes/yahoo/news/provider-helper.ts +++ b/lib/routes/yahoo/news/provider-helper.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { getProviderList } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { getProviderList } from './utils'; export const route: Route = { path: '/news/providers/:region/list', diff --git a/lib/routes/yahoo/news/provider.ts b/lib/routes/yahoo/news/provider.ts index 8b737387b..8e4010ddd 100644 --- a/lib/routes/yahoo/news/provider.ts +++ b/lib/routes/yahoo/news/provider.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { getArchive, getProviderList, parseList, parseItem } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { getArchive, getProviderList, parseItem, parseList } from './utils'; export const route: Route = { path: '/news/provider/:region/:providerId', diff --git a/lib/routes/yahoo/news/utils.ts b/lib/routes/yahoo/news/utils.ts index ead8743b6..160c37753 100644 --- a/lib/routes/yahoo/news/utils.ts +++ b/lib/routes/yahoo/news/utils.ts @@ -1,9 +1,11 @@ -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; -import { art } from '@/utils/render'; + +import { load } from 'cheerio'; + import { config } from '@/config'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const getArchive = async (region, limit, tag, providerId?) => { const { data: response } = await got( @@ -137,4 +139,4 @@ const parseItem = (item, tryGet) => return item; }); -export { getArchive, getList, getCategories, getProviderList, getStores, parseList, parseItem }; +export { getArchive, getCategories, getList, getProviderList, getStores, parseItem, parseList }; diff --git a/lib/routes/yamap/articles.ts b/lib/routes/yamap/articles.ts index ec36a4457..95eaf47dc 100644 --- a/lib/routes/yamap/articles.ts +++ b/lib/routes/yamap/articles.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/yamibo/bbs/forum.ts b/lib/routes/yamibo/bbs/forum.ts index 802685b77..dd167ed80 100644 --- a/lib/routes/yamibo/bbs/forum.ts +++ b/lib/routes/yamibo/bbs/forum.ts @@ -1,11 +1,13 @@ -import type { Data, DataItem, Route } from '@/types'; -import type { Context } from 'hono'; -import { config } from '@/config'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { fetchThread, generateDescription, getDate, bbsOrigin } from '../utils'; +import type { Context } from 'hono'; import pMap from 'p-map'; + +import { config } from '@/config'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { bbsOrigin, fetchThread, generateDescription, getDate } from '../utils'; export const route: Route = { name: 'BBS - 板块', diff --git a/lib/routes/yamibo/bbs/thread.ts b/lib/routes/yamibo/bbs/thread.ts index 0b2060ec5..8ec70b2ea 100644 --- a/lib/routes/yamibo/bbs/thread.ts +++ b/lib/routes/yamibo/bbs/thread.ts @@ -1,7 +1,9 @@ -import type { Data, DataItem, Route } from '@/types'; -import type { Context } from 'hono'; import { load } from 'cheerio'; -import { fetchThread, generateDescription, getDate, bbsOrigin } from '../utils'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; + +import { bbsOrigin, fetchThread, generateDescription, getDate } from '../utils'; export const route: Route = { name: 'BBS - 讨论串', diff --git a/lib/routes/yamibo/utils.ts b/lib/routes/yamibo/utils.ts index 147887786..354cda651 100644 --- a/lib/routes/yamibo/utils.ts +++ b/lib/routes/yamibo/utils.ts @@ -1,9 +1,10 @@ +import type { Cheerio, Element } from 'cheerio'; +import { JSDOM } from 'jsdom'; + +import { config } from '@/config'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; -import { JSDOM } from 'jsdom'; -import type { Cheerio, Element } from 'cheerio'; export const bbsOrigin = 'https://bbs.yamibo.com'; diff --git a/lib/routes/yande/post.ts b/lib/routes/yande/post.ts index 8cd089d9d..03da6d909 100644 --- a/lib/routes/yande/post.ts +++ b/lib/routes/yande/post.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import queryString from 'query-string'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/post/popular_recent/:period?', categories: ['picture'], diff --git a/lib/routes/yangtzeu/dongke.ts b/lib/routes/yangtzeu/dongke.ts index ee287cf1e..e5e477ec0 100644 --- a/lib/routes/yangtzeu/dongke.ts +++ b/lib/routes/yangtzeu/dongke.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/dongke/*', diff --git a/lib/routes/ycwb/index.ts b/lib/routes/ycwb/index.ts index 09614c360..35ce53946 100644 --- a/lib/routes/ycwb/index.ts +++ b/lib/routes/ycwb/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:node', diff --git a/lib/routes/yenpress/series.ts b/lib/routes/yenpress/series.ts index c8c26ed6b..91265610c 100644 --- a/lib/routes/yenpress/series.ts +++ b/lib/routes/yenpress/series.ts @@ -1,13 +1,14 @@ -import { DataItem, Route } from '@/types'; +import path from 'node:path'; + +import * as cheerio from 'cheerio'; import type { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; -import * as cheerio from 'cheerio'; -import timezone from '@/utils/timezone'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const render = (data) => art(path.join(__dirname, 'templates/series.art'), data); diff --git a/lib/routes/ygkkk/rss.ts b/lib/routes/ygkkk/rss.ts index dcade796d..51c21fc02 100644 --- a/lib/routes/ygkkk/rss.ts +++ b/lib/routes/ygkkk/rss.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/yicai/author.ts b/lib/routes/yicai/author.ts index eeaa1f38b..f343bde5b 100644 --- a/lib/routes/yicai/author.ts +++ b/lib/routes/yicai/author.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, ProcessItems } from './utils'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/author/:id?', diff --git a/lib/routes/yicai/brief.ts b/lib/routes/yicai/brief.ts index 4f0dbe673..0c6304dd6 100644 --- a/lib/routes/yicai/brief.ts +++ b/lib/routes/yicai/brief.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; import { rootUrl } from './utils'; diff --git a/lib/routes/yicai/carousel.ts b/lib/routes/yicai/carousel.ts index ef8f9b99a..7fda11549 100644 --- a/lib/routes/yicai/carousel.ts +++ b/lib/routes/yicai/carousel.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { rootUrl, fetchFullArticles } from './utils'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { fetchFullArticles, rootUrl } from './utils'; + export const route: Route = { path: '/carousel', categories: ['traditional-media'], diff --git a/lib/routes/yicai/dt.ts b/lib/routes/yicai/dt.ts index de4b4dda5..3f6dc9a49 100644 --- a/lib/routes/yicai/dt.ts +++ b/lib/routes/yicai/dt.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const columns = { article: 2, diff --git a/lib/routes/yicai/feed.ts b/lib/routes/yicai/feed.ts index e2912fc2c..c81f1c8c4 100644 --- a/lib/routes/yicai/feed.ts +++ b/lib/routes/yicai/feed.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, ProcessItems } from './utils'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/feed/:id?', diff --git a/lib/routes/yicai/headline.ts b/lib/routes/yicai/headline.ts index 36a087735..69b83ab14 100644 --- a/lib/routes/yicai/headline.ts +++ b/lib/routes/yicai/headline.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, ProcessItems } from './utils'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/headline', diff --git a/lib/routes/yicai/latest.ts b/lib/routes/yicai/latest.ts index 9b6308469..5f81654b4 100644 --- a/lib/routes/yicai/latest.ts +++ b/lib/routes/yicai/latest.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, ProcessItems } from './utils'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/latest', diff --git a/lib/routes/yicai/news.ts b/lib/routes/yicai/news.ts index 037a507f1..ca7e05faf 100644 --- a/lib/routes/yicai/news.ts +++ b/lib/routes/yicai/news.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, ProcessItems } from './utils'; +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/news/:id?', diff --git a/lib/routes/yicai/utils.ts b/lib/routes/yicai/utils.ts index b74e85e22..8872a3a16 100644 --- a/lib/routes/yicai/utils.ts +++ b/lib/routes/yicai/utils.ts @@ -1,9 +1,11 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.yicai.com'; @@ -59,4 +61,4 @@ function fetchFullArticles(items, tryGet) { }) ); } -export { rootUrl, ProcessItems, fetchFullArticles }; +export { fetchFullArticles, ProcessItems, rootUrl }; diff --git a/lib/routes/yicai/video.ts b/lib/routes/yicai/video.ts index 1fb9749f1..5169a146e 100644 --- a/lib/routes/yicai/video.ts +++ b/lib/routes/yicai/video.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, ProcessItems } from './utils'; +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/video/:id?', diff --git a/lib/routes/yicai/vip.ts b/lib/routes/yicai/vip.ts index ddd954aff..94eecd79c 100644 --- a/lib/routes/yicai/vip.ts +++ b/lib/routes/yicai/vip.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, ProcessItems } from './utils'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/vip/:id?', diff --git a/lib/routes/yilinzazhi/index.ts b/lib/routes/yilinzazhi/index.ts index f69cdd00b..2f2cd37d7 100644 --- a/lib/routes/yilinzazhi/index.ts +++ b/lib/routes/yilinzazhi/index.ts @@ -1,7 +1,9 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/', diff --git a/lib/routes/yilinzazhi/latest.ts b/lib/routes/yilinzazhi/latest.ts index 0c7cb89ba..7af9b7c67 100644 --- a/lib/routes/yilinzazhi/latest.ts +++ b/lib/routes/yilinzazhi/latest.ts @@ -1,9 +1,11 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import dayjs from 'dayjs'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + export const route: Route = { path: '/latest', categories: ['reading'], diff --git a/lib/routes/ymgal/article.ts b/lib/routes/ymgal/article.ts index bdfb207a7..8ed4a24e8 100644 --- a/lib/routes/ymgal/article.ts +++ b/lib/routes/ymgal/article.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const host = 'https://www.ymgal.games'; diff --git a/lib/routes/ymgal/game.ts b/lib/routes/ymgal/game.ts index 1b2c84665..a89b7bb70 100644 --- a/lib/routes/ymgal/game.ts +++ b/lib/routes/ymgal/game.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; const host = 'https://www.ymgal.games'; diff --git a/lib/routes/yna/index.ts b/lib/routes/yna/index.ts index 62d53c59d..48abb3473 100644 --- a/lib/routes/yna/index.ts +++ b/lib/routes/yna/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import parser from '@/utils/rss-parser'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/ynet/list.ts b/lib/routes/ynet/list.ts index 4ee7b162a..6622a47f0 100644 --- a/lib/routes/ynet/list.ts +++ b/lib/routes/ynet/list.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - const defaultCategory = 'news'; const defaultId = '2121t76'; diff --git a/lib/routes/yoasobi-music/info.ts b/lib/routes/yoasobi-music/info.ts index 8e9d6e499..fbc204cdb 100644 --- a/lib/routes/yoasobi-music/info.ts +++ b/lib/routes/yoasobi-music/info.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { parseJSONP } from './jsonp-helper'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import { parseJSONP } from './jsonp-helper'; export const route: Route = { path: '/info/:category?', diff --git a/lib/routes/yoasobi-music/live.ts b/lib/routes/yoasobi-music/live.ts index 184f3a2ac..23f5ba178 100644 --- a/lib/routes/yoasobi-music/live.ts +++ b/lib/routes/yoasobi-music/live.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { parseJSONP } from './jsonp-helper'; -import { art } from '@/utils/render'; import path from 'node:path'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + +import { parseJSONP } from './jsonp-helper'; + export const route: Route = { path: '/live', categories: ['live'], diff --git a/lib/routes/yoasobi-music/media.ts b/lib/routes/yoasobi-music/media.ts index e01eda19a..212012671 100644 --- a/lib/routes/yoasobi-music/media.ts +++ b/lib/routes/yoasobi-music/media.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseJSONP } from './jsonp-helper'; -import { art } from '@/utils/render'; import path from 'node:path'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + +import { parseJSONP } from './jsonp-helper'; + export const route: Route = { path: '/media', categories: ['live'], diff --git a/lib/routes/yomiuri/news.ts b/lib/routes/yomiuri/news.ts index 57d3253b5..22b104083 100644 --- a/lib/routes/yomiuri/news.ts +++ b/lib/routes/yomiuri/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/yomujp/level.ts b/lib/routes/yomujp/level.ts index a64088d5a..32f5b87cc 100644 --- a/lib/routes/yomujp/level.ts +++ b/lib/routes/yomujp/level.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import md5 from '@/utils/md5'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/:level?', diff --git a/lib/routes/youku/channel.ts b/lib/routes/youku/channel.ts index f28032dda..6795b1a68 100644 --- a/lib/routes/youku/channel.ts +++ b/lib/routes/youku/channel.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/channel/:channelId/:embed?', diff --git a/lib/routes/youmemark/index.ts b/lib/routes/youmemark/index.ts index feacaed4b..90236327d 100644 --- a/lib/routes/youmemark/index.ts +++ b/lib/routes/youmemark/index.ts @@ -1,7 +1,8 @@ -import { Route, Data } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/:userid', diff --git a/lib/routes/youtube/api/google.ts b/lib/routes/youtube/api/google.ts index 82f718fae..0dc29a299 100644 --- a/lib/routes/youtube/api/google.ts +++ b/lib/routes/youtube/api/google.ts @@ -1,17 +1,20 @@ -import { google } from 'googleapis'; -const { OAuth2 } = google.auth; -import { config } from '@/config'; -import utils, { getVideoUrl } from '../utils'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; -import NotFoundError from '@/errors/types/not-found'; -import { Data } from '@/types'; import dayjs from 'dayjs'; import duration from 'dayjs/plugin/duration.js'; +import { google } from 'googleapis'; + +import { config } from '@/config'; +import NotFoundError from '@/errors/types/not-found'; +import type { Data } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import utils, { getVideoUrl } from '../utils'; import { getSrtAttachmentBatch } from './subtitles'; +const { OAuth2 } = google.auth; + dayjs.extend(duration); let count = 0; @@ -52,7 +55,7 @@ if (config.youtube && config.youtube.clientId && config.youtube.clientSecret && youtubeOAuth2Client.setCredentials({ refresh_token: config.youtube.refreshToken }); } -export { youtubeOAuth2Client, exec }; +export { exec, youtubeOAuth2Client }; export const getDataByUsername = async ({ username, embed, filterShorts, isJsonFeed }: { username: string; embed: boolean; filterShorts: boolean; isJsonFeed: boolean }): Promise => { let userHandleData; diff --git a/lib/routes/youtube/api/subtitles.ts b/lib/routes/youtube/api/subtitles.ts index 276ef5620..4548f5d04 100644 --- a/lib/routes/youtube/api/subtitles.ts +++ b/lib/routes/youtube/api/subtitles.ts @@ -1,5 +1,6 @@ -import { getSubtitles } from 'youtube-caption-extractor'; import pMap from 'p-map'; +import { getSubtitles } from 'youtube-caption-extractor'; + import cache from '@/utils/cache'; function pad(n: number, width: number = 2) { diff --git a/lib/routes/youtube/api/youtubei.ts b/lib/routes/youtube/api/youtubei.ts index ed2b0d4e9..c5bceb158 100644 --- a/lib/routes/youtube/api/youtubei.ts +++ b/lib/routes/youtube/api/youtubei.ts @@ -1,7 +1,9 @@ -import { Data } from '@/types'; +import { Innertube } from 'youtubei.js'; + +import type { Data } from '@/types'; import cache from '@/utils/cache'; import { parseRelativeDate } from '@/utils/parse-date'; -import { Innertube } from 'youtubei.js'; + import utils, { getVideoUrl } from '../utils'; import { getSrtAttachmentBatch } from './subtitles'; diff --git a/lib/routes/youtube/channel.ts b/lib/routes/youtube/channel.ts index aebc951da..399c49c2b 100644 --- a/lib/routes/youtube/channel.ts +++ b/lib/routes/youtube/channel.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import utils, { callApi } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { getDataByChannelId as getDataByChannelIdYoutubei } from './api/youtubei'; +import type { Route } from '@/types'; + import { getDataByChannelId as getDataByChannelIdGoogle } from './api/google'; +import { getDataByChannelId as getDataByChannelIdYoutubei } from './api/youtubei'; +import utils, { callApi } from './utils'; export const route: Route = { path: '/channel/:id/:routeParams?', diff --git a/lib/routes/youtube/charts.ts b/lib/routes/youtube/charts.ts index aac74d1c1..207041375 100644 --- a/lib/routes/youtube/charts.ts +++ b/lib/routes/youtube/charts.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; + import { renderDescription } from './utils'; -import { config } from '@/config'; export const route: Route = { path: '/charts/:category?/:country?/:embed?', diff --git a/lib/routes/youtube/community.ts b/lib/routes/youtube/community.ts index 817408e58..320a4ac3f 100644 --- a/lib/routes/youtube/community.ts +++ b/lib/routes/youtube/community.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseRelativeDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { isYouTubeChannelId } from './utils'; export const route: Route = { diff --git a/lib/routes/youtube/custom.ts b/lib/routes/youtube/custom.ts index bdcb33e45..0ec7d10a2 100644 --- a/lib/routes/youtube/custom.ts +++ b/lib/routes/youtube/custom.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import utils from './utils'; -import { config } from '@/config'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import utils from './utils'; export const route: Route = { path: '/c/:username/:embed?', diff --git a/lib/routes/youtube/live.ts b/lib/routes/youtube/live.ts index 639a7bb85..7314cd0f8 100644 --- a/lib/routes/youtube/live.ts +++ b/lib/routes/youtube/live.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import utils from './utils'; -import { config } from '@/config'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import utils from './utils'; export const route: Route = { path: '/live/:username/:embed?', diff --git a/lib/routes/youtube/playlist.ts b/lib/routes/youtube/playlist.ts index 057351ddc..3affa6733 100644 --- a/lib/routes/youtube/playlist.ts +++ b/lib/routes/youtube/playlist.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import { callApi } from './utils'; -import { getDataByPlaylistId as getDataByPlaylistIdYoutubei } from './api/youtubei'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { getDataByPlaylistId as getDataByPlaylistIdGoogle } from './api/google'; +import { getDataByPlaylistId as getDataByPlaylistIdYoutubei } from './api/youtubei'; +import { callApi } from './utils'; export const route: Route = { path: '/playlist/:id/:embed?', diff --git a/lib/routes/youtube/subscriptions.ts b/lib/routes/youtube/subscriptions.ts index c6497268e..2a3d85280 100644 --- a/lib/routes/youtube/subscriptions.ts +++ b/lib/routes/youtube/subscriptions.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { config } from '@/config'; -import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; import pMap from 'p-map'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; + +import utils from './utils'; export const route: Route = { path: '/subscriptions/:embed?', diff --git a/lib/routes/youtube/user.ts b/lib/routes/youtube/user.ts index b48934bce..843f337b1 100644 --- a/lib/routes/youtube/user.ts +++ b/lib/routes/youtube/user.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import { getDataByUsername as getDataByUsernameYoutubei } from './api/youtubei'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { getDataByUsername as getDataByUsernameGoogle } from './api/google'; +import { getDataByUsername as getDataByUsernameYoutubei } from './api/youtubei'; import { callApi } from './utils'; export const route: Route = { diff --git a/lib/routes/youtube/utils.ts b/lib/routes/youtube/utils.ts index 114d3574f..844434704 100644 --- a/lib/routes/youtube/utils.ts +++ b/lib/routes/youtube/utils.ts @@ -1,8 +1,11 @@ -import { google } from 'googleapis'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { google } from 'googleapis'; + import { config } from '@/config'; -import { youtubeOAuth2Client, exec } from './api/google'; +import { art } from '@/utils/render'; + +import { exec, youtubeOAuth2Client } from './api/google'; export const getPlaylistItems = (id, part, cache) => cache.tryGet( diff --git a/lib/routes/youzhiyouxing/materials.ts b/lib/routes/youzhiyouxing/materials.ts index 99d179e38..55f141d1c 100644 --- a/lib/routes/youzhiyouxing/materials.ts +++ b/lib/routes/youzhiyouxing/materials.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/yuanliao/index.ts b/lib/routes/yuanliao/index.ts index 6b4a85794..8d8c1858e 100644 --- a/lib/routes/yuanliao/index.ts +++ b/lib/routes/yuanliao/index.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { tag } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/yuque/book.ts b/lib/routes/yuque/book.ts index 408b8e128..44e36a206 100644 --- a/lib/routes/yuque/book.ts +++ b/lib/routes/yuque/book.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { card2Html } from './utils'; -import { CookieJar } from 'tough-cookie'; const APP_DATA_REGEX = /window\.appData = JSON\.parse\(decodeURIComponent\("(.+?)"\)\);/; const baseUrl = 'https://www.yuque.com'; diff --git a/lib/routes/yxdown/news.ts b/lib/routes/yxdown/news.ts index 6b76f75c4..5c1ee855c 100644 --- a/lib/routes/yxdown/news.ts +++ b/lib/routes/yxdown/news.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import { rootUrl, getCookie } from './utils'; +import timezone from '@/utils/timezone'; + +import { getCookie, rootUrl } from './utils'; export const route: Route = { path: '/news/:category?', diff --git a/lib/routes/yxdown/recommend.ts b/lib/routes/yxdown/recommend.ts index b0e49fd38..492eb167c 100644 --- a/lib/routes/yxdown/recommend.ts +++ b/lib/routes/yxdown/recommend.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import { rootUrl, getCookie } from './utils'; +import timezone from '@/utils/timezone'; + +import { getCookie, rootUrl } from './utils'; export const route: Route = { path: '/recommend', diff --git a/lib/routes/yxdown/utils.ts b/lib/routes/yxdown/utils.ts index 989803f1a..d66f354a6 100644 --- a/lib/routes/yxdown/utils.ts +++ b/lib/routes/yxdown/utils.ts @@ -11,4 +11,4 @@ const getCookie = async () => { return cookieStr; }; -export { rootUrl, getCookie }; +export { getCookie, rootUrl }; diff --git a/lib/routes/yxdzqb/index.ts b/lib/routes/yxdzqb/index.ts index c1589c4fb..7b1b4dcd5 100644 --- a/lib/routes/yxdzqb/index.ts +++ b/lib/routes/yxdzqb/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const host = 'https://www.yxdzqb.com'; const map = { diff --git a/lib/routes/yxrb/home.ts b/lib/routes/yxrb/home.ts index c66c05fd2..d947a2530 100644 --- a/lib/routes/yxrb/home.ts +++ b/lib/routes/yxrb/home.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/yyets/article.ts b/lib/routes/yyets/article.ts index e3e7797ee..7e4eba415 100644 --- a/lib/routes/yyets/article.ts +++ b/lib/routes/yyets/article.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/yyets/today.ts b/lib/routes/yyets/today.ts index e756ada7d..711f6e26b 100644 --- a/lib/routes/yyets/today.ts +++ b/lib/routes/yyets/today.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/today', categories: ['multimedia'], diff --git a/lib/routes/yystv/category.ts b/lib/routes/yystv/category.ts index 6f4207b29..7c76349d5 100644 --- a/lib/routes/yystv/category.ts +++ b/lib/routes/yystv/category.ts @@ -1,9 +1,11 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { fetchDataItemCached } from './fetcher'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import { fetchDataItemCached } from './fetcher'; + export const route: Route = { path: '/category/:category', categories: ['game'], diff --git a/lib/routes/yystv/docs.ts b/lib/routes/yystv/docs.ts index eefb2d9fd..836dfe958 100644 --- a/lib/routes/yystv/docs.ts +++ b/lib/routes/yystv/docs.ts @@ -1,7 +1,9 @@ -import type { Route, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseRelativeDate } from '@/utils/parse-date'; + import { fetchDataItemCached } from './fetcher'; export const route: Route = { diff --git a/lib/routes/yystv/fetcher.ts b/lib/routes/yystv/fetcher.ts index 18bb15c01..751089ceb 100644 --- a/lib/routes/yystv/fetcher.ts +++ b/lib/routes/yystv/fetcher.ts @@ -1,4 +1,4 @@ -import { DataItem } from '@/types'; +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/zagg/new-arrivals.ts b/lib/routes/zagg/new-arrivals.ts index 44016de39..9a8f9faa3 100644 --- a/lib/routes/zagg/new-arrivals.ts +++ b/lib/routes/zagg/new-arrivals.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; + const host = 'https://www.zagg.com/en_us'; export const route: Route = { path: '/new-arrivals/:query?', diff --git a/lib/routes/zaimanhua/comic.ts b/lib/routes/zaimanhua/comic.ts index 3a737cee3..ba110d8f7 100644 --- a/lib/routes/zaimanhua/comic.ts +++ b/lib/routes/zaimanhua/comic.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; +import path from 'node:path'; + +import pMap from 'p-map'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import cache from '@/utils/cache'; -import pMap from 'p-map'; export const route: Route = { path: '/comic/:id', diff --git a/lib/routes/zaimanhua/namespace.ts b/lib/routes/zaimanhua/namespace.ts index b932ffe4a..1103025a9 100644 --- a/lib/routes/zaimanhua/namespace.ts +++ b/lib/routes/zaimanhua/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: '再漫画', diff --git a/lib/routes/zaimanhua/update.ts b/lib/routes/zaimanhua/update.ts index 4afb98e82..8d344a7c1 100644 --- a/lib/routes/zaimanhua/update.ts +++ b/lib/routes/zaimanhua/update.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; +import path from 'node:path'; + +import pMap from 'p-map'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import cache from '@/utils/cache'; -import pMap from 'p-map'; export const route: Route = { path: '/update', diff --git a/lib/routes/zaker/channel.ts b/lib/routes/zaker/channel.ts index c3e68682a..7416c493e 100644 --- a/lib/routes/zaker/channel.ts +++ b/lib/routes/zaker/channel.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import * as cheerio from 'cheerio'; -import { baseUrl, fetchItem, getSafeLineCookieWithData, parseList } from './utils'; import pMap from 'p-map'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { baseUrl, fetchItem, getSafeLineCookieWithData, parseList } from './utils'; + export const route: Route = { path: '/channel/:id?', parameters: { diff --git a/lib/routes/zaker/focus.ts b/lib/routes/zaker/focus.ts index 539b838f2..3442eae46 100644 --- a/lib/routes/zaker/focus.ts +++ b/lib/routes/zaker/focus.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import * as cheerio from 'cheerio'; import pMap from 'p-map'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + import { baseUrl, fetchItem, getSafeLineCookieWithData, parseList } from './utils'; export const route: Route = { diff --git a/lib/routes/zaker/utils.ts b/lib/routes/zaker/utils.ts index ff3f6612b..b0528c3f5 100644 --- a/lib/routes/zaker/utils.ts +++ b/lib/routes/zaker/utils.ts @@ -1,11 +1,11 @@ -import { DataItem } from '@/types'; - -import CryptoJS from 'crypto-js'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; -import logger from '@/utils/logger'; import * as cheerio from 'cheerio'; +import CryptoJS from 'crypto-js'; + +import { config } from '@/config'; +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; +import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zaobao/interactive.ts b/lib/routes/zaobao/interactive.ts index 84ef1710f..491c46e49 100644 --- a/lib/routes/zaobao/interactive.ts +++ b/lib/routes/zaobao/interactive.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { logo } from './util'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { logo } from './util'; + export const route: Route = { path: '/interactive-graphics', categories: ['traditional-media'], diff --git a/lib/routes/zaobao/other.ts b/lib/routes/zaobao/other.ts index 44bbe867a..02b0aa05d 100644 --- a/lib/routes/zaobao/other.ts +++ b/lib/routes/zaobao/other.ts @@ -1,5 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { logo, parseList } from './util'; + const baseUrl = 'https://www.zaobao.com'; export const route: Route = { diff --git a/lib/routes/zaobao/realtime.ts b/lib/routes/zaobao/realtime.ts index 3c3799dc5..1ce55e27f 100644 --- a/lib/routes/zaobao/realtime.ts +++ b/lib/routes/zaobao/realtime.ts @@ -1,5 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { logo, parseList } from './util'; + const baseUrl = 'https://www.zaobao.com'; export const route: Route = { diff --git a/lib/routes/zaobao/util.tsx b/lib/routes/zaobao/util.tsx index a7ecb1e08..fb2d7c554 100644 --- a/lib/routes/zaobao/util.tsx +++ b/lib/routes/zaobao/util.tsx @@ -1,12 +1,14 @@ -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import { renderToString } from 'hono/jsx/dom/server'; import { base32 } from 'rfc4648'; -import Zaobao from './zaobao'; + +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import Zaobao from './zaobao'; + const baseUrl = 'https://www.zaobao.com'; export const logo = 'https://www.zaobao.com.sg/favicon.ico'; diff --git a/lib/routes/zaobao/zaobao.tsx b/lib/routes/zaobao/zaobao.tsx index 35575a8db..4189fb1f1 100644 --- a/lib/routes/zaobao/zaobao.tsx +++ b/lib/routes/zaobao/zaobao.tsx @@ -1,4 +1,4 @@ -import { ImageData } from './util'; +import type { ImageData } from './util'; function zaobao({ imageDataArray, articleBody }) { return ( diff --git a/lib/routes/zaobao/znews.ts b/lib/routes/zaobao/znews.ts index c1c51a71f..1c134b4d7 100644 --- a/lib/routes/zaobao/znews.ts +++ b/lib/routes/zaobao/znews.ts @@ -1,5 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { logo, parseList } from './util'; + const baseUrl = 'https://www.zaobao.com'; export const route: Route = { diff --git a/lib/routes/zaozao/article.ts b/lib/routes/zaozao/article.ts index 2d7458354..861b10a0e 100644 --- a/lib/routes/zaozao/article.ts +++ b/lib/routes/zaozao/article.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/article/:type?', diff --git a/lib/routes/zcmu/jwc/index.ts b/lib/routes/zcmu/jwc/index.ts index 77c55a706..8d51235fd 100644 --- a/lib/routes/zcmu/jwc/index.ts +++ b/lib/routes/zcmu/jwc/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const host = 'https://jwc.zcmu.edu.cn/'; diff --git a/lib/routes/zcmu/yxy/index.ts b/lib/routes/zcmu/yxy/index.ts index 037a33f9f..f65c61279 100644 --- a/lib/routes/zcmu/yxy/index.ts +++ b/lib/routes/zcmu/yxy/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const host = 'https://yxy.zcmu.edu.cn/'; diff --git a/lib/routes/zcool/discover.ts b/lib/routes/zcool/discover.ts index 7e176989f..00483572a 100644 --- a/lib/routes/zcool/discover.ts +++ b/lib/routes/zcool/discover.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import locations from './locations'; export const route: Route = { diff --git a/lib/routes/zcool/top.ts b/lib/routes/zcool/top.ts index 5eb6f62fb..2e4443952 100644 --- a/lib/routes/zcool/top.ts +++ b/lib/routes/zcool/top.ts @@ -1,9 +1,13 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { extractArticle, extractWork } from './utils'; + const baseUrl = 'https://www.zcool.com.cn'; export const route: Route = { diff --git a/lib/routes/zcool/user.ts b/lib/routes/zcool/user.ts index e77e2a95f..13c732393 100644 --- a/lib/routes/zcool/user.ts +++ b/lib/routes/zcool/user.ts @@ -1,11 +1,14 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { extractArticle, extractWork } from './utils'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import { extractArticle, extractWork } from './utils'; export const route: Route = { path: '/user/:uid', diff --git a/lib/routes/zcool/utils.ts b/lib/routes/zcool/utils.ts index a4ed7ec1a..24b290b2b 100644 --- a/lib/routes/zcool/utils.ts +++ b/lib/routes/zcool/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; +import { art } from '@/utils/render'; + const extractArticle = (data) => data.props.pageProps.data.summary + data.props.pageProps.data.memo; const extractWork = (data) => diff --git a/lib/routes/zed/blog.ts b/lib/routes/zed/blog.ts index 8f1d3f84b..07db43160 100644 --- a/lib/routes/zed/blog.ts +++ b/lib/routes/zed/blog.ts @@ -1,8 +1,10 @@ -import { Route, DataItem, Data, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; export const route: Route = { path: '/blog', diff --git a/lib/routes/zed/namespace.ts b/lib/routes/zed/namespace.ts index 64cb0f399..1f665e4c4 100644 --- a/lib/routes/zed/namespace.ts +++ b/lib/routes/zed/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'Zed', diff --git a/lib/routes/zhibo8/forum.ts b/lib/routes/zhibo8/forum.ts index 35517ea28..ece977fad 100644 --- a/lib/routes/zhibo8/forum.ts +++ b/lib/routes/zhibo8/forum.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zhibo8/luxiang.ts b/lib/routes/zhibo8/luxiang.ts index 14fd607d3..b1b9eaf94 100644 --- a/lib/routes/zhibo8/luxiang.ts +++ b/lib/routes/zhibo8/luxiang.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zhibo8/more.ts b/lib/routes/zhibo8/more.ts index b16982f0a..3a8f67818 100644 --- a/lib/routes/zhibo8/more.ts +++ b/lib/routes/zhibo8/more.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const categories = { nba: 'NBA', diff --git a/lib/routes/zhibo8/post.ts b/lib/routes/zhibo8/post.ts index 936d8f1ce..ebd310233 100644 --- a/lib/routes/zhibo8/post.ts +++ b/lib/routes/zhibo8/post.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zhihu/activities.ts b/lib/routes/zhihu/activities.ts index a801031da..709fa4983 100644 --- a/lib/routes/zhihu/activities.ts +++ b/lib/routes/zhihu/activities.ts @@ -1,9 +1,12 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; -import { header, processImage, getSignedHeader } from './utils'; -import { parseDate } from '@/utils/parse-date'; import sanitizeHtml from 'sanitize-html'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import { getSignedHeader, header, processImage } from './utils'; + export const route: Route = { path: '/people/activities/:id', categories: ['social-media'], diff --git a/lib/routes/zhihu/all-collections.ts b/lib/routes/zhihu/all-collections.ts index 4020de3ed..adf55d337 100644 --- a/lib/routes/zhihu/all-collections.ts +++ b/lib/routes/zhihu/all-collections.ts @@ -1,9 +1,11 @@ -import { Route, ViewType, Collection, CollectionItem } from '@/types'; -import got from '@/utils/got'; -import { header } from './utils'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { Collection, CollectionItem, Route } from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import { header } from './utils'; export const route: Route = { path: '/people/allCollections/:id', diff --git a/lib/routes/zhihu/answers.ts b/lib/routes/zhihu/answers.ts index b3113e74b..dbf7d68a8 100644 --- a/lib/routes/zhihu/answers.ts +++ b/lib/routes/zhihu/answers.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { header, getSignedHeader } from './utils'; import { parseDate } from '@/utils/parse-date'; +import { getSignedHeader, header } from './utils'; + export const route: Route = { path: '/people/answers/:id', categories: ['social-media'], diff --git a/lib/routes/zhihu/bookstore/newest.ts b/lib/routes/zhihu/bookstore/newest.ts index 0a50d4111..99ec0faa1 100644 --- a/lib/routes/zhihu/bookstore/newest.ts +++ b/lib/routes/zhihu/bookstore/newest.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/zhihu/check-cookie.ts b/lib/routes/zhihu/check-cookie.ts index 20d9f9bad..6d0938d92 100644 --- a/lib/routes/zhihu/check-cookie.ts +++ b/lib/routes/zhihu/check-cookie.ts @@ -1,5 +1,5 @@ import { config } from '@/config'; -import { APIRoute } from '@/types'; +import type { APIRoute } from '@/types'; import ofetch from '@/utils/ofetch'; export const apiRoute: APIRoute = { diff --git a/lib/routes/zhihu/collection.ts b/lib/routes/zhihu/collection.ts index 34ec64321..2b6a45b74 100644 --- a/lib/routes/zhihu/collection.ts +++ b/lib/routes/zhihu/collection.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { header } from './utils'; -import { generateData } from './pin/utils'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; + +import { generateData } from './pin/utils'; +import { header } from './utils'; export const route: Route = { path: '/collection/:id/:getAll?', diff --git a/lib/routes/zhihu/daily-section.ts b/lib/routes/zhihu/daily-section.ts index b148d7163..20b63acab 100644 --- a/lib/routes/zhihu/daily-section.ts +++ b/lib/routes/zhihu/daily-section.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { header } from './utils'; import { parseDate } from '@/utils/parse-date'; +import { header } from './utils'; + // 参考:https://github.com/izzyleung/ZhihuDailyPurify/wiki/%E7%9F%A5%E4%B9%8E%E6%97%A5%E6%8A%A5-API-%E5%88%86%E6%9E%90 // 文章给出了v7版 api的信息,包含全文api diff --git a/lib/routes/zhihu/daily.ts b/lib/routes/zhihu/daily.ts index c5638ce6d..2152c4357 100644 --- a/lib/routes/zhihu/daily.ts +++ b/lib/routes/zhihu/daily.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/zhihu/hot.ts b/lib/routes/zhihu/hot.ts index e2ac65c33..56237e064 100644 --- a/lib/routes/zhihu/hot.ts +++ b/lib/routes/zhihu/hot.ts @@ -1,6 +1,7 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/zhihu/pin/daily.ts b/lib/routes/zhihu/pin/daily.ts index 5a08d021c..12a872159 100644 --- a/lib/routes/zhihu/pin/daily.ts +++ b/lib/routes/zhihu/pin/daily.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { generateData } from './utils'; export const route: Route = { diff --git a/lib/routes/zhihu/pin/hotlist.ts b/lib/routes/zhihu/pin/hotlist.ts index 1955a2e88..24957f8b8 100644 --- a/lib/routes/zhihu/pin/hotlist.ts +++ b/lib/routes/zhihu/pin/hotlist.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { generateData } from './utils'; export const route: Route = { diff --git a/lib/routes/zhihu/pin/people.ts b/lib/routes/zhihu/pin/people.ts index b396c2271..70fb6fe89 100644 --- a/lib/routes/zhihu/pin/people.ts +++ b/lib/routes/zhihu/pin/people.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { generateData } from './utils'; export const route: Route = { diff --git a/lib/routes/zhihu/posts.ts b/lib/routes/zhihu/posts.ts index 46639bb53..9dd022107 100644 --- a/lib/routes/zhihu/posts.ts +++ b/lib/routes/zhihu/posts.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { header, getSignedHeader, processImage } from './utils'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { Articles, Profile } from './types'; + +import type { Articles, Profile } from './types'; +import { getSignedHeader, header, processImage } from './utils'; export const route: Route = { path: '/posts/:usertype/:id', diff --git a/lib/routes/zhihu/question.ts b/lib/routes/zhihu/question.ts index 0dc56dfca..843ff87b9 100644 --- a/lib/routes/zhihu/question.ts +++ b/lib/routes/zhihu/question.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { header, processImage, getSignedHeader } from './utils'; import { parseDate } from '@/utils/parse-date'; +import { getSignedHeader, header, processImage } from './utils'; + export const route: Route = { path: '/question/:questionId/:sortBy?', categories: ['social-media'], diff --git a/lib/routes/zhihu/timeline.ts b/lib/routes/zhihu/timeline.ts index 1c4c6b1cd..0dd545441 100644 --- a/lib/routes/zhihu/timeline.ts +++ b/lib/routes/zhihu/timeline.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; -import { processImage } from './utils'; -import { parseDate } from '@/utils/parse-date'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import { processImage } from './utils'; export const route: Route = { path: '/timeline', diff --git a/lib/routes/zhihu/topic.ts b/lib/routes/zhihu/topic.ts index 29bd7e19d..da7fb1732 100644 --- a/lib/routes/zhihu/topic.ts +++ b/lib/routes/zhihu/topic.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { header, processImage, getSignedHeader } from './utils'; import { parseDate } from '@/utils/parse-date'; +import { getSignedHeader, header, processImage } from './utils'; + export const route: Route = { path: '/topic/:topicId/:isTop?', categories: ['social-media'], diff --git a/lib/routes/zhihu/utils.ts b/lib/routes/zhihu/utils.ts index fcdecf21a..23119ba79 100644 --- a/lib/routes/zhihu/utils.ts +++ b/lib/routes/zhihu/utils.ts @@ -1,9 +1,11 @@ import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import g_encrypt from './execlib/x-zse-96-v3'; -import md5 from '@/utils/md5'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import md5 from '@/utils/md5'; +import ofetch from '@/utils/ofetch'; + +import g_encrypt from './execlib/x-zse-96-v3'; export const header = { 'x-api-version': '3.0.91', diff --git a/lib/routes/zhihu/weekly.ts b/lib/routes/zhihu/weekly.ts index 371304507..66c0c99b1 100644 --- a/lib/routes/zhihu/weekly.ts +++ b/lib/routes/zhihu/weekly.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const host = 'https://www.zhihu.com'; export const route: Route = { diff --git a/lib/routes/zhihu/xhu/activities.ts b/lib/routes/zhihu/xhu/activities.ts index d5c892a36..f50d03a60 100644 --- a/lib/routes/zhihu/xhu/activities.ts +++ b/lib/routes/zhihu/xhu/activities.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import auth from './auth'; -import { processImage } from '../utils'; import { parseDate } from '@/utils/parse-date'; +import { processImage } from '../utils'; +import auth from './auth'; + export const route: Route = { path: '/xhu/people/activities/:hexId', categories: ['social-media'], diff --git a/lib/routes/zhihu/xhu/answers.ts b/lib/routes/zhihu/xhu/answers.ts index 39dc67f99..1b103b1dd 100644 --- a/lib/routes/zhihu/xhu/answers.ts +++ b/lib/routes/zhihu/xhu/answers.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import auth from './auth'; import { parseDate } from '@/utils/parse-date'; +import auth from './auth'; + export const route: Route = { path: '/xhu/people/answers/:hexId', categories: ['social-media'], diff --git a/lib/routes/zhihu/xhu/collection.ts b/lib/routes/zhihu/xhu/collection.ts index b0ac9a705..66495d08e 100644 --- a/lib/routes/zhihu/xhu/collection.ts +++ b/lib/routes/zhihu/xhu/collection.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import auth from './auth'; -import { generateData } from '../pin/utils'; import { parseDate } from '@/utils/parse-date'; +import { generateData } from '../pin/utils'; +import auth from './auth'; + export const route: Route = { path: '/xhu/collection/:id', categories: ['social-media'], diff --git a/lib/routes/zhihu/xhu/posts.ts b/lib/routes/zhihu/xhu/posts.ts index c71ea46de..d62e06163 100644 --- a/lib/routes/zhihu/xhu/posts.ts +++ b/lib/routes/zhihu/xhu/posts.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import auth from './auth'; import { parseDate } from '@/utils/parse-date'; +import auth from './auth'; + export const route: Route = { path: '/xhu/people/posts/:hexId', categories: ['social-media'], diff --git a/lib/routes/zhihu/xhu/question.ts b/lib/routes/zhihu/xhu/question.ts index 7eeaee78e..f4d9a2ce3 100644 --- a/lib/routes/zhihu/xhu/question.ts +++ b/lib/routes/zhihu/xhu/question.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import auth from './auth'; -import { processImage } from '../utils'; import { parseDate } from '@/utils/parse-date'; +import { processImage } from '../utils'; +import auth from './auth'; + export const route: Route = { path: '/xhu/question/:questionId/:sortBy?', categories: ['social-media'], diff --git a/lib/routes/zhihu/xhu/topic.ts b/lib/routes/zhihu/xhu/topic.ts index da6556f14..3fa7a44ee 100644 --- a/lib/routes/zhihu/xhu/topic.ts +++ b/lib/routes/zhihu/xhu/topic.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import auth from './auth'; -import { processImage } from '../utils'; import { parseDate } from '@/utils/parse-date'; +import { processImage } from '../utils'; +import auth from './auth'; + export const route: Route = { path: '/xhu/topic/:topicId', categories: ['social-media'], diff --git a/lib/routes/zhihu/xhu/zhuanlan.ts b/lib/routes/zhihu/xhu/zhuanlan.ts index 91d0bd7bb..b31f35d91 100644 --- a/lib/routes/zhihu/xhu/zhuanlan.ts +++ b/lib/routes/zhihu/xhu/zhuanlan.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import auth from './auth'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import auth from './auth'; + export const route: Route = { path: '/xhu/zhuanlan/:id', categories: ['social-media'], diff --git a/lib/routes/zhihu/zhuanlan.ts b/lib/routes/zhihu/zhuanlan.ts index a7cfbf107..8ae250a83 100644 --- a/lib/routes/zhihu/zhuanlan.ts +++ b/lib/routes/zhihu/zhuanlan.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { getSignedHeader, header } from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { getSignedHeader, header } from './utils'; + export const route: Route = { path: '/zhuanlan/:id', categories: ['social-media'], diff --git a/lib/routes/zhitongcaijing/index.ts b/lib/routes/zhitongcaijing/index.ts index 034736689..0868ef625 100644 --- a/lib/routes/zhitongcaijing/index.ts +++ b/lib/routes/zhitongcaijing/index.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const ids = { recommend: { diff --git a/lib/routes/zhiy/letter.ts b/lib/routes/zhiy/letter.ts index 04d3d31df..69cf92cfc 100644 --- a/lib/routes/zhiy/letter.ts +++ b/lib/routes/zhiy/letter.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, fetchUserDate } from './utils'; export const route: Route = { diff --git a/lib/routes/zhiy/post.ts b/lib/routes/zhiy/post.ts index 25888e59e..284534c37 100644 --- a/lib/routes/zhiy/post.ts +++ b/lib/routes/zhiy/post.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import dayjs from 'dayjs'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { baseUrl, fetchUserDate } from './utils'; import { art } from '@/utils/render'; -import path from 'node:path'; -import dayjs from 'dayjs'; + +import { baseUrl, fetchUserDate } from './utils'; export const route: Route = { path: '/posts/:author', diff --git a/lib/routes/zhizhuan100/report.ts b/lib/routes/zhizhuan100/report.ts index b719e831d..291a72715 100644 --- a/lib/routes/zhizhuan100/report.ts +++ b/lib/routes/zhizhuan100/report.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import { parseRelativeDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseRelativeDate } from '@/utils/parse-date'; + export const route: Route = { path: '/analytic', categories: ['finance'], diff --git a/lib/routes/zhonglun/index.ts b/lib/routes/zhonglun/index.ts index 960c6184b..525b57994 100644 --- a/lib/routes/zhonglun/index.ts +++ b/lib/routes/zhonglun/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { language = 'zh' } = ctx.req.param(); diff --git a/lib/routes/zhubai/index.ts b/lib/routes/zhubai/index.ts index bc8e9b5ee..8ca6ad918 100644 --- a/lib/routes/zhubai/index.ts +++ b/lib/routes/zhubai/index.ts @@ -1,5 +1,5 @@ import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { isValidHost } from '@/utils/valid-host'; diff --git a/lib/routes/zhubai/top20.ts b/lib/routes/zhubai/top20.ts index 8aff6dc2a..ddf03da42 100644 --- a/lib/routes/zhubai/top20.ts +++ b/lib/routes/zhubai/top20.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const parseContent = (content) => art(path.join(__dirname, 'templates/description.art'), { diff --git a/lib/routes/zhujiceping/rss.ts b/lib/routes/zhujiceping/rss.ts index a85f9cd30..405a580b4 100644 --- a/lib/routes/zhujiceping/rss.ts +++ b/lib/routes/zhujiceping/rss.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/zhuwang/index.ts b/lib/routes/zhuwang/index.ts index 40201cd8d..f530a238e 100644 --- a/lib/routes/zhuwang/index.ts +++ b/lib/routes/zhuwang/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/zimuxia/index.ts b/lib/routes/zimuxia/index.ts index 7939ba9f6..e1e3051cb 100644 --- a/lib/routes/zimuxia/index.ts +++ b/lib/routes/zimuxia/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/zimuxia/portfolio.ts b/lib/routes/zimuxia/portfolio.ts index 1040f5ebe..b2c127d8d 100644 --- a/lib/routes/zimuxia/portfolio.ts +++ b/lib/routes/zimuxia/portfolio.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + const allowlinktypes = new Set(['all', 'magnet', 'ed2k', 'baidu', 'subhd', 'quark', '115']); export const route: Route = { diff --git a/lib/routes/zjgtjy/index.ts b/lib/routes/zjgtjy/index.ts index 47826ad0d..6e39c92ab 100644 --- a/lib/routes/zjgtjy/index.ts +++ b/lib/routes/zjgtjy/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/zjol/paper.ts b/lib/routes/zjol/paper.ts index 3462674a2..258c08116 100644 --- a/lib/routes/zjol/paper.ts +++ b/lib/routes/zjol/paper.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/paper/:id?', diff --git a/lib/routes/zju/career/index.ts b/lib/routes/zju/career/index.ts index 85cdab347..305147721 100644 --- a/lib/routes/zju/career/index.ts +++ b/lib/routes/zju/career/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'http://www.career.zju.edu.cn'; diff --git a/lib/routes/zju/cse/index.ts b/lib/routes/zju/cse/index.ts index e5daab4ed..4473eb2ec 100644 --- a/lib/routes/zju/cse/index.ts +++ b/lib/routes/zju/cse/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zju/cst/custom.ts b/lib/routes/zju/cst/custom.ts index 8654adb47..bb5bdcf18 100644 --- a/lib/routes/zju/cst/custom.ts +++ b/lib/routes/zju/cst/custom.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; async function getPage(id) { diff --git a/lib/routes/zju/cst/index.ts b/lib/routes/zju/cst/index.ts index 18a24947d..8845bce07 100644 --- a/lib/routes/zju/cst/index.ts +++ b/lib/routes/zju/cst/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'http://www.cst.zju.edu.cn/'; diff --git a/lib/routes/zju/grs/index.ts b/lib/routes/zju/grs/index.ts index a8e53dc21..a9a94b14e 100644 --- a/lib/routes/zju/grs/index.ts +++ b/lib/routes/zju/grs/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zju/list.ts b/lib/routes/zju/list.ts index 27b304a6a..4e86f28a0 100644 --- a/lib/routes/zju/list.ts +++ b/lib/routes/zju/list.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const host = 'https://www.zju.edu.cn/'; export const route: Route = { path: '/list/:type', diff --git a/lib/routes/zju/physics/index.ts b/lib/routes/zju/physics/index.ts index ff37b594d..f6c3c35ac 100644 --- a/lib/routes/zju/physics/index.ts +++ b/lib/routes/zju/physics/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; // const host = 'http://physics.zju.edu.cn/redir.php?catalog_id='; diff --git a/lib/routes/zju/sis/index.ts b/lib/routes/zju/sis/index.ts index 9d08ec944..c68955fa2 100644 --- a/lib/routes/zju/sis/index.ts +++ b/lib/routes/zju/sis/index.ts @@ -1,7 +1,8 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const base = 'http://www.sis.zju.edu.cn/sischinese/'; diff --git a/lib/routes/zjut/cs/index.ts b/lib/routes/zjut/cs/index.ts index bc55eb701..06c4ec751 100644 --- a/lib/routes/zjut/cs/index.ts +++ b/lib/routes/zjut/cs/index.ts @@ -1,8 +1,9 @@ -import { Data, Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const rootUrl = 'https://cs.zjut.edu.cn/jsp/newsclass.jsp?wcId='; diff --git a/lib/routes/zjut/da/index.ts b/lib/routes/zjut/da/index.ts index 4869dadcb..77e230503 100644 --- a/lib/routes/zjut/da/index.ts +++ b/lib/routes/zjut/da/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'http://www.design.zjut.edu.cn/'; const host = 'http://www.design.zjut.edu.cn/BigClass.jsp?'; diff --git a/lib/routes/zjut/jwc/index.ts b/lib/routes/zjut/jwc/index.ts index 170848480..e214d0f2b 100644 --- a/lib/routes/zjut/jwc/index.ts +++ b/lib/routes/zjut/jwc/index.ts @@ -1,8 +1,9 @@ -import { Data, Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const rootUrl = 'http://www.jwc.zjut.edu.cn/'; diff --git a/lib/routes/zjut/news.ts b/lib/routes/zjut/news.ts index 8529172e8..5571f18e0 100644 --- a/lib/routes/zjut/news.ts +++ b/lib/routes/zjut/news.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/zjut/www/index.ts b/lib/routes/zjut/www/index.ts index 4f4fb3ad1..cd489f22c 100644 --- a/lib/routes/zjut/www/index.ts +++ b/lib/routes/zjut/www/index.ts @@ -1,8 +1,9 @@ -import { Data, Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const rootUrl = 'https://www.zjut.edu.cn/'; diff --git a/lib/routes/zjuvag/blog.ts b/lib/routes/zjuvag/blog.ts index b583bbe4c..3b7884437 100644 --- a/lib/routes/zjuvag/blog.ts +++ b/lib/routes/zjuvag/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; // 导入必要的模组 import got from '@/utils/got'; // 自订的 got -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zodgame/forum.ts b/lib/routes/zodgame/forum.ts index 79a1118cc..cb7d1d3b5 100644 --- a/lib/routes/zodgame/forum.ts +++ b/lib/routes/zodgame/forum.ts @@ -1,12 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; const rootUrl = 'https://zodgame.xyz'; diff --git a/lib/routes/zongheng/detail.ts b/lib/routes/zongheng/detail.ts index aa05b7c33..91bba2bdd 100644 --- a/lib/routes/zongheng/detail.ts +++ b/lib/routes/zongheng/detail.ts @@ -1,6 +1,7 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zotero/versions.ts b/lib/routes/zotero/versions.ts index a291545bc..cba837516 100644 --- a/lib/routes/zotero/versions.ts +++ b/lib/routes/zotero/versions.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/versions', categories: ['program-update'], diff --git a/lib/routes/zrblog/rss.ts b/lib/routes/zrblog/rss.ts index 4a16d77cd..33a621970 100644 --- a/lib/routes/zrblog/rss.ts +++ b/lib/routes/zrblog/rss.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/zsxq/group.ts b/lib/routes/zsxq/group.ts index 6b743266b..358ecedd9 100644 --- a/lib/routes/zsxq/group.ts +++ b/lib/routes/zsxq/group.ts @@ -1,7 +1,9 @@ -import type { Data, Route } from '@/types'; import type { Context } from 'hono'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, Route } from '@/types'; + import type { GroupInfoResponse, TopicsResponse } from './types'; import { customFetch, generateTopicDataItem } from './utils'; diff --git a/lib/routes/zsxq/user.ts b/lib/routes/zsxq/user.ts index c728f19c9..aa4eb0bd1 100644 --- a/lib/routes/zsxq/user.ts +++ b/lib/routes/zsxq/user.ts @@ -1,7 +1,9 @@ -import type { Data, Route } from '@/types'; import type { Context } from 'hono'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, Route } from '@/types'; + import type { TopicsResponse, UserInfoResponse } from './types'; import { customFetch, generateTopicDataItem } from './utils'; diff --git a/lib/routes/zsxq/utils.ts b/lib/routes/zsxq/utils.ts index 31258346e..570e27854 100644 --- a/lib/routes/zsxq/utils.ts +++ b/lib/routes/zsxq/utils.ts @@ -1,8 +1,9 @@ -import got from '@/utils/got'; -import type { TopicImage, Topic, BasicResponse, ResponseData } from './types'; -import { parseDate } from '@/utils/parse-date'; import { config } from '@/config'; import type { DataItem } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import type { BasicResponse, ResponseData, Topic, TopicImage } from './types'; export async function customFetch>(path: string, retryCount = 0): Promise { const apiUrl = 'https://api.zsxq.com/v2'; diff --git a/lib/routes/zuel/notice.ts b/lib/routes/zuel/notice.ts index 4bd5854b5..5722183d6 100644 --- a/lib/routes/zuel/notice.ts +++ b/lib/routes/zuel/notice.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/zuvio/boards.ts b/lib/routes/zuvio/boards.ts index f34611841..3e429593b 100644 --- a/lib/routes/zuvio/boards.ts +++ b/lib/routes/zuvio/boards.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; + import { getBoards, rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/zuvio/student5.ts b/lib/routes/zuvio/student5.ts index 03801d45d..d99219879 100644 --- a/lib/routes/zuvio/student5.ts +++ b/lib/routes/zuvio/student5.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { token, apiUrl, rootUrl, renderDesc, getBoards } from './utils'; + +import { apiUrl, getBoards, renderDesc, rootUrl, token } from './utils'; export const route: Route = { path: '/student5/:board?', diff --git a/lib/routes/zuvio/utils.ts b/lib/routes/zuvio/utils.ts index 2644ae8c5..d5f1159ae 100644 --- a/lib/routes/zuvio/utils.ts +++ b/lib/routes/zuvio/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; + import got from '@/utils/got'; +import { art } from '@/utils/render'; const token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE0OTcyMzI1MjMsInN5c3RlbV9uYW1lIjoiZm9ydW0iLCJ6dXZpb19pZCI6LTk5OSwiZW1haWwiOm51bGwsIm5hbWUiOm51bGwsInVuaXZlcnNpdHlfaWQiOm51bGwsInVuaXZlcnNpdHlfbmFtZSI6bnVsbH0.0KoJiSnyazsJxLCNEnqnuNUdKsJFhBdCn3R2BJpoUtk'; @@ -66,4 +67,4 @@ const getBoards = (tryGet) => })); }); -export { token, apiUrl, rootUrl, renderDesc, renderSections, getBoards }; +export { apiUrl, getBoards, renderDesc, renderSections, rootUrl, token }; diff --git a/lib/routes/zxcs/novel.ts b/lib/routes/zxcs/novel.ts index 481aeb749..6c5d19c65 100644 --- a/lib/routes/zxcs/novel.ts +++ b/lib/routes/zxcs/novel.ts @@ -1,8 +1,9 @@ import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import type { Route, DataItem } from '@/types'; const types = { jinqigengxin: '近期更新', diff --git a/lib/routes/zyshow/index.ts b/lib/routes/zyshow/index.ts index 01748bc5c..f52698381 100644 --- a/lib/routes/zyshow/index.ts +++ b/lib/routes/zyshow/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '*', diff --git a/lib/routes/zyw/hot.ts b/lib/routes/zyw/hot.ts index e7a0da314..b0f78c551 100644 --- a/lib/routes/zyw/hot.ts +++ b/lib/routes/zyw/hot.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/setup.test.ts b/lib/setup.test.ts index b479f4f9a..e8a6a8dc3 100644 --- a/lib/setup.test.ts +++ b/lib/setup.test.ts @@ -1,6 +1,6 @@ -import { afterAll, afterEach } from 'vitest'; -import { setupServer } from 'msw/node'; import { http, HttpResponse } from 'msw'; +import { setupServer } from 'msw/node'; +import { afterAll, afterEach } from 'vitest'; const genWeChatMpPage = (rich_media_content: string, scripts: string[] | string) => { if (!Array.isArray(scripts)) { diff --git a/lib/utils/cache.test.ts b/lib/utils/cache.test.ts index 05b1acd38..204457d25 100644 --- a/lib/utils/cache.test.ts +++ b/lib/utils/cache.test.ts @@ -1,4 +1,5 @@ -import { describe, expect, it, vi, afterEach, afterAll, beforeAll } from 'vitest'; +import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest'; + import wait from '@/utils/wait'; beforeAll(() => { diff --git a/lib/utils/cache/index.ts b/lib/utils/cache/index.ts index a9a70f0fc..4871a20a4 100644 --- a/lib/utils/cache/index.ts +++ b/lib/utils/cache/index.ts @@ -1,9 +1,10 @@ import { config } from '@/config'; -import redis from './redis'; -import memory from './memory'; -import type CacheModule from './base'; import logger from '@/utils/logger'; +import type CacheModule from './base'; +import memory from './memory'; +import redis from './redis'; + const globalCache: { get: (key: string) => Promise | string | null | undefined; set: (key: string, value?: string | Record, maxAge?: number) => any; diff --git a/lib/utils/cache/memory.ts b/lib/utils/cache/memory.ts index 395f35602..93b315eb2 100644 --- a/lib/utils/cache/memory.ts +++ b/lib/utils/cache/memory.ts @@ -1,5 +1,7 @@ import { LRUCache } from 'lru-cache'; + import { config } from '@/config'; + import type CacheModule from './base'; const status = { available: false }; diff --git a/lib/utils/cache/redis.ts b/lib/utils/cache/redis.ts index a3ba5850c..86b256193 100644 --- a/lib/utils/cache/redis.ts +++ b/lib/utils/cache/redis.ts @@ -1,6 +1,8 @@ -import { config } from '@/config'; import Redis from 'ioredis'; + +import { config } from '@/config'; import logger from '@/utils/logger'; + import type CacheModule from './base'; const status = { available: false }; diff --git a/lib/utils/common-config.test.ts b/lib/utils/common-config.test.ts index d739ffeb3..7cac7f5a6 100644 --- a/lib/utils/common-config.test.ts +++ b/lib/utils/common-config.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from 'vitest'; -import configUtils, { transElemText, replaceParams, getProp } from '@/utils/common-config'; + +import configUtils, { getProp, replaceParams, transElemText } from '@/utils/common-config'; describe('index', () => { it('transElemText', () => { diff --git a/lib/utils/common-config.ts b/lib/utils/common-config.ts index d06b2aad8..f8acc81b5 100644 --- a/lib/utils/common-config.ts +++ b/lib/utils/common-config.ts @@ -1,6 +1,7 @@ import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; import iconv from 'iconv-lite'; + +import ofetch from '@/utils/ofetch'; import { parseDate as _parseDate } from '@/utils/parse-date'; import _timezone from '@/utils/timezone'; @@ -76,4 +77,4 @@ async function buildData(data) { } export default buildData; -export { transElemText, replaceParams, getProp }; +export { getProp, replaceParams, transElemText }; diff --git a/lib/utils/common-utils.test.ts b/lib/utils/common-utils.test.ts index a13f9a261..d496b1908 100644 --- a/lib/utils/common-utils.test.ts +++ b/lib/utils/common-utils.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { toTitleCase, collapseWhitespace, convertDateToISO8601, getLocalhostAddress } from '@/utils/common-utils'; + +import { collapseWhitespace, convertDateToISO8601, getLocalhostAddress, toTitleCase } from '@/utils/common-utils'; describe('common-utils', () => { it('toTitleCase', () => { diff --git a/lib/utils/common-utils.ts b/lib/utils/common-utils.ts index a1e44dfeb..5515a0db4 100644 --- a/lib/utils/common-utils.ts +++ b/lib/utils/common-utils.ts @@ -1,7 +1,9 @@ -import { parseDate } from '@/utils/parse-date'; -import title from 'title'; import os from 'node:os'; +import title from 'title'; + +import { parseDate } from '@/utils/parse-date'; + // convert a string into title case const toTitleCase = (str: string) => title(str); @@ -43,4 +45,4 @@ const getLocalhostAddress = () => { return address; }; -export { toTitleCase, collapseWhitespace, convertDateToISO8601, getSubPath, getLocalhostAddress }; +export { collapseWhitespace, convertDateToISO8601, getLocalhostAddress, getSubPath, toTitleCase }; diff --git a/lib/utils/git-hash.ts b/lib/utils/git-hash.ts index e33b350f3..458651ac2 100644 --- a/lib/utils/git-hash.ts +++ b/lib/utils/git-hash.ts @@ -11,4 +11,4 @@ if (!gitHash) { } } -export { gitHash, gitDate }; +export { gitDate, gitHash }; diff --git a/lib/utils/got-deprecated.ts b/lib/utils/got-deprecated.ts index d99ddc3f6..7d8fc55d9 100644 --- a/lib/utils/got-deprecated.ts +++ b/lib/utils/got-deprecated.ts @@ -1,6 +1,8 @@ -import logger from '@/utils/logger'; +import type { CancelableRequest, Got, Options, OptionsInit, Response as GotResponse } from 'got'; +import got from 'got'; + import { config } from '@/config'; -import got, { CancelableRequest, Response as GotResponse, OptionsInit, Options, Got } from 'got'; +import logger from '@/utils/logger'; type Response = GotResponse & { data: T; @@ -76,4 +78,4 @@ const custom: { custom.all = (list) => Promise.all(list); export default custom; -export type { Response, Options } from 'got'; +export type { Options, Response } from 'got'; diff --git a/lib/utils/got.test.ts b/lib/utils/got.test.ts index 233a01430..bc1d404ad 100644 --- a/lib/utils/got.test.ts +++ b/lib/utils/got.test.ts @@ -1,8 +1,9 @@ -import { describe, expect, it, vi } from 'vitest'; import { http, HttpResponse } from 'msw'; -import got from '@/utils/got'; -import { config } from '@/config'; import { Cookie, CookieJar } from 'tough-cookie'; +import { describe, expect, it, vi } from 'vitest'; + +import { config } from '@/config'; +import got from '@/utils/got'; describe('got', () => { it('no ua headers', async () => { diff --git a/lib/utils/got.ts b/lib/utils/got.ts index 372fe125b..deb9d7cbb 100644 --- a/lib/utils/got.ts +++ b/lib/utils/got.ts @@ -1,5 +1,7 @@ import { destr } from 'destr'; + import ofetch from '@/utils/ofetch'; + import { getSearchParamsString } from './helpers'; const getFakeGot = (defaultOptions?: any) => { diff --git a/lib/utils/header-generator.test.ts b/lib/utils/header-generator.test.ts index a18f80536..e149ae380 100644 --- a/lib/utils/header-generator.test.ts +++ b/lib/utils/header-generator.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from 'vitest'; -import ofetch from '@/utils/ofetch'; + import { generateHeaders, PRESETS } from '@/utils/header-generator'; +import ofetch from '@/utils/ofetch'; describe('header-generator', () => { it('should has no ua', async () => { diff --git a/lib/utils/header-generator.ts b/lib/utils/header-generator.ts index 230f94f4f..fd9241be8 100644 --- a/lib/utils/header-generator.ts +++ b/lib/utils/header-generator.ts @@ -1,4 +1,4 @@ -import { HeaderGenerator, PRESETS, type HeaderGeneratorOptions } from 'header-generator'; +import { HeaderGenerator, type HeaderGeneratorOptions, PRESETS } from 'header-generator'; export { PRESETS } from 'header-generator'; diff --git a/lib/utils/helpers.test.ts b/lib/utils/helpers.test.ts index b5029365f..8a8fd4adb 100644 --- a/lib/utils/helpers.test.ts +++ b/lib/utils/helpers.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import { getRouteNameFromPath, getSearchParamsString, parseDuration } from '@/utils/helpers'; describe('helpers', () => { diff --git a/lib/utils/helpers.ts b/lib/utils/helpers.ts index 63c8ca3a0..bf2a8c82e 100644 --- a/lib/utils/helpers.ts +++ b/lib/utils/helpers.ts @@ -1,5 +1,6 @@ -import { fileURLToPath } from 'node:url'; import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + import { stringifyQuery } from 'ufo'; export const getRouteNameFromPath = (path: string) => { diff --git a/lib/utils/logger.ts b/lib/utils/logger.ts index 224319783..bfb7be7ef 100644 --- a/lib/utils/logger.ts +++ b/lib/utils/logger.ts @@ -1,5 +1,7 @@ import path from 'node:path'; + import winston from 'winston'; + import { config } from '@/config'; let transports: (typeof winston.transports.File)[] = []; diff --git a/lib/utils/md5.test.ts b/lib/utils/md5.test.ts index f0c56341e..67eb9df38 100644 --- a/lib/utils/md5.test.ts +++ b/lib/utils/md5.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import md5 from '@/utils/md5'; describe('md5', () => { diff --git a/lib/utils/ofetch.test.ts b/lib/utils/ofetch.test.ts index 7dfa88a83..7b52c2752 100644 --- a/lib/utils/ofetch.test.ts +++ b/lib/utils/ofetch.test.ts @@ -1,7 +1,8 @@ -import { describe, expect, it, vi } from 'vitest'; import { http, HttpResponse } from 'msw'; -import ofetch from '@/utils/ofetch'; +import { describe, expect, it, vi } from 'vitest'; + import { config } from '@/config'; +import ofetch from '@/utils/ofetch'; describe('ofetch', () => { it('headers', async () => { diff --git a/lib/utils/ofetch.ts b/lib/utils/ofetch.ts index ed4279742..fe5db4b7d 100644 --- a/lib/utils/ofetch.ts +++ b/lib/utils/ofetch.ts @@ -1,8 +1,9 @@ +import type { HeaderGeneratorOptions } from 'header-generator'; +import { register } from 'node-network-devtools'; import { createFetch } from 'ofetch'; + import { config } from '@/config'; import logger from '@/utils/logger'; -import { register } from 'node-network-devtools'; -import type { HeaderGeneratorOptions } from 'header-generator'; declare module 'ofetch' { interface FetchOptions { diff --git a/lib/utils/otel/metric.ts b/lib/utils/otel/metric.ts index 97241ed76..970ac2017 100644 --- a/lib/utils/otel/metric.ts +++ b/lib/utils/otel/metric.ts @@ -1,8 +1,9 @@ -import { resourceFromAttributes } from '@opentelemetry/resources'; -import { PrometheusExporter, PrometheusSerializer } from '@opentelemetry/exporter-prometheus'; -import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions'; -import { MeterProvider } from '@opentelemetry/sdk-metrics'; import type { Attributes } from '@opentelemetry/api'; +import { PrometheusExporter, PrometheusSerializer } from '@opentelemetry/exporter-prometheus'; +import { resourceFromAttributes } from '@opentelemetry/resources'; +import { MeterProvider } from '@opentelemetry/sdk-metrics'; +import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions'; + import { config } from '@/config'; interface IMetricAttributes extends Attributes { diff --git a/lib/utils/otel/trace.ts b/lib/utils/otel/trace.ts index 144602b1b..f3113fe08 100644 --- a/lib/utils/otel/trace.ts +++ b/lib/utils/otel/trace.ts @@ -1,8 +1,8 @@ +import { trace } from '@opentelemetry/api'; +import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'; import { resourceFromAttributes } from '@opentelemetry/resources'; import { BasicTracerProvider, BatchSpanProcessor } from '@opentelemetry/sdk-trace-base'; import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions'; -import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'; -import { trace } from '@opentelemetry/api'; const exporter = new OTLPTraceExporter({ // optional OTEL_EXPORTER_OTLP_ENDPOINT=https://localhost:4318 diff --git a/lib/utils/parse-date.test.ts b/lib/utils/parse-date.test.ts index f4a5c2078..f9e8200a3 100644 --- a/lib/utils/parse-date.test.ts +++ b/lib/utils/parse-date.test.ts @@ -1,6 +1,7 @@ -import { describe, expect, it } from 'vitest'; -import { parseRelativeDate } from '@/utils/parse-date'; import MockDate from 'mockdate'; +import { describe, expect, it } from 'vitest'; + +import { parseRelativeDate } from '@/utils/parse-date'; describe('parseRelativeDate', () => { const second = 1000; diff --git a/lib/utils/proxy/index.ts b/lib/utils/proxy/index.ts index 4eb86afd5..53e383529 100644 --- a/lib/utils/proxy/index.ts +++ b/lib/utils/proxy/index.ts @@ -1,15 +1,16 @@ -import { config } from '@/config'; -import { PacProxyAgent } from 'pac-proxy-agent'; import { HttpsProxyAgent } from 'https-proxy-agent'; +import { PacProxyAgent } from 'pac-proxy-agent'; import { SocksProxyAgent } from 'socks-proxy-agent'; import { ProxyAgent } from 'undici'; + +import { config } from '@/config'; import logger from '@/utils/logger'; -const proxyIsPAC = config.pacUri || config.pacScript; - +import createMultiProxy, { type MultiProxyResult, type ProxyState } from './multi-proxy'; import pacProxy from './pac-proxy'; import unifyProxy from './unify-proxy'; -import createMultiProxy, { type MultiProxyResult, type ProxyState } from './multi-proxy'; + +const proxyIsPAC = config.pacUri || config.pacScript; interface ProxyExport { agent: PacProxyAgent | HttpsProxyAgent | SocksProxyAgent | null; diff --git a/lib/utils/proxy/multi-proxy.ts b/lib/utils/proxy/multi-proxy.ts index 38209f316..2406224d8 100644 --- a/lib/utils/proxy/multi-proxy.ts +++ b/lib/utils/proxy/multi-proxy.ts @@ -1,5 +1,6 @@ import { type Config } from '@/config'; import logger from '@/utils/logger'; + import unifyProxy from './unify-proxy'; export interface ProxyState { diff --git a/lib/utils/proxy/pac-proxy.test.ts b/lib/utils/proxy/pac-proxy.test.ts index 519d3b87b..97a9b5241 100644 --- a/lib/utils/proxy/pac-proxy.test.ts +++ b/lib/utils/proxy/pac-proxy.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import pacProxy from '@/utils/proxy/pac-proxy'; const emptyProxyObj = { diff --git a/lib/utils/proxy/unify-proxy.test.ts b/lib/utils/proxy/unify-proxy.test.ts index 608ef7a0c..28b1e92c1 100644 --- a/lib/utils/proxy/unify-proxy.test.ts +++ b/lib/utils/proxy/unify-proxy.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import unifyProxy from '@/utils/proxy/unify-proxy'; const emptyProxyObj = { diff --git a/lib/utils/puppeteer-utils.test.ts b/lib/utils/puppeteer-utils.test.ts index 08ef0ac22..a97424f8b 100644 --- a/lib/utils/puppeteer-utils.test.ts +++ b/lib/utils/puppeteer-utils.test.ts @@ -1,7 +1,8 @@ -import { describe, expect, it, vi, afterEach } from 'vitest'; -import { parseCookieArray, constructCookieArray, setCookies, getCookies } from '@/utils/puppeteer-utils'; -import puppeteer from '@/utils/puppeteer'; import type { Browser } from 'rebrowser-puppeteer'; +import { afterEach, describe, expect, it, vi } from 'vitest'; + +import puppeteer from '@/utils/puppeteer'; +import { constructCookieArray, getCookies, parseCookieArray, setCookies } from '@/utils/puppeteer-utils'; let browser: Browser | null = null; diff --git a/lib/utils/puppeteer-utils.ts b/lib/utils/puppeteer-utils.ts index 20ad49a55..b421a1405 100644 --- a/lib/utils/puppeteer-utils.ts +++ b/lib/utils/puppeteer-utils.ts @@ -55,4 +55,4 @@ const getCookies = async (page, domainFilter?: string) => { return parseCookieArray(cookies, domainFilter); }; -export { parseCookieArray, constructCookieArray, setCookies, getCookies }; +export { constructCookieArray, getCookies, parseCookieArray, setCookies }; diff --git a/lib/utils/puppeteer.test.ts b/lib/utils/puppeteer.test.ts index 79383ffa0..8a7b737b9 100644 --- a/lib/utils/puppeteer.test.ts +++ b/lib/utils/puppeteer.test.ts @@ -1,6 +1,7 @@ -import { describe, expect, it, vi, afterEach } from 'vitest'; -import wait from './wait'; import { type Browser } from 'rebrowser-puppeteer'; +import { afterEach, describe, expect, it, vi } from 'vitest'; + +import wait from './wait'; let browser: Browser | null = null; diff --git a/lib/utils/puppeteer.ts b/lib/utils/puppeteer.ts index 9319a9bd8..60d838234 100644 --- a/lib/utils/puppeteer.ts +++ b/lib/utils/puppeteer.ts @@ -1,8 +1,11 @@ +import { anonymizeProxy } from 'proxy-chain'; +import type { Browser, Page } from 'rebrowser-puppeteer'; +import puppeteer from 'rebrowser-puppeteer'; + import { config } from '@/config'; -import puppeteer, { Browser, Page } from 'rebrowser-puppeteer'; + import logger from './logger'; import proxy from './proxy'; -import { anonymizeProxy } from 'proxy-chain'; /** * @deprecated use getPage instead diff --git a/lib/utils/readable-social.test.ts b/lib/utils/readable-social.test.ts index 16afaaf1b..4efc7b445 100644 --- a/lib/utils/readable-social.test.ts +++ b/lib/utils/readable-social.test.ts @@ -1,5 +1,6 @@ import { describe, expect, test } from 'vitest'; -import { fallback, queryToBoolean, queryToInteger, queryToFloat } from './readable-social'; + +import { fallback, queryToBoolean, queryToFloat, queryToInteger } from './readable-social'; describe('fallback', () => { test('应该返回第一个存在的参数', () => { diff --git a/lib/utils/readable-social.ts b/lib/utils/readable-social.ts index abed12271..973f2462f 100644 --- a/lib/utils/readable-social.ts +++ b/lib/utils/readable-social.ts @@ -53,4 +53,4 @@ const queryToFloat = (s) => { return Number.parseFloat(s); }; -export { fallback, queryToBoolean, queryToInteger, queryToFloat }; +export { fallback, queryToBoolean, queryToFloat, queryToInteger }; diff --git a/lib/utils/render.ts b/lib/utils/render.ts index 2bae59f1d..f306b5805 100644 --- a/lib/utils/render.ts +++ b/lib/utils/render.ts @@ -1,5 +1,5 @@ -export { default as rss3 } from '@/views/rss3'; +export { default as Atom } from '@/views/atom'; export { default as json } from '@/views/json'; export { default as RSS } from '@/views/rss'; -export { default as Atom } from '@/views/atom'; +export { default as rss3 } from '@/views/rss3'; export { default as art } from 'art-template'; diff --git a/lib/utils/request-rewriter.test.ts b/lib/utils/request-rewriter.test.ts index 3e8a2cf0d..ab09b3cd1 100644 --- a/lib/utils/request-rewriter.test.ts +++ b/lib/utils/request-rewriter.test.ts @@ -1,7 +1,9 @@ -import { describe, expect, it, vi } from 'vitest'; -import undici from 'undici'; -import got from 'got'; import http from 'node:http'; + +import got from 'got'; +import undici from 'undici'; +import { describe, expect, it, vi } from 'vitest'; + import { PRESETS } from '@/utils/header-generator'; process.env.PROXY_URI = 'http://rsshub.proxy:2333/'; diff --git a/lib/utils/request-rewriter/fetch.test.ts b/lib/utils/request-rewriter/fetch.test.ts index e8de9773b..f27851bea 100644 --- a/lib/utils/request-rewriter/fetch.test.ts +++ b/lib/utils/request-rewriter/fetch.test.ts @@ -1,6 +1,7 @@ import { getCurrentCell, setCurrentCell } from 'node-network-devtools'; +import { afterEach, beforeEach, describe, expect, test } from 'vitest'; + import { useCustomHeader } from './fetch'; -import { describe, beforeEach, afterEach, test, expect } from 'vitest'; const getInitRequest = () => ({ diff --git a/lib/utils/request-rewriter/fetch.ts b/lib/utils/request-rewriter/fetch.ts index 6abe97a0b..8acfe06e5 100644 --- a/lib/utils/request-rewriter/fetch.ts +++ b/lib/utils/request-rewriter/fetch.ts @@ -1,11 +1,13 @@ -import logger from '@/utils/logger'; -import { config } from '@/config'; -import undici, { Request, RequestInfo, RequestInit } from 'undici'; -import proxy from '@/utils/proxy'; -import { RateLimiterMemory, RateLimiterQueue } from 'rate-limiter-flexible'; -import { useRegisterRequest } from 'node-network-devtools'; -import { generateHeaders, generatedHeaders as HEADER_LIST } from '@/utils/header-generator'; import type { HeaderGeneratorOptions } from 'header-generator'; +import { useRegisterRequest } from 'node-network-devtools'; +import { RateLimiterMemory, RateLimiterQueue } from 'rate-limiter-flexible'; +import type { RequestInfo, RequestInit } from 'undici'; +import undici, { Request } from 'undici'; + +import { config } from '@/config'; +import { generatedHeaders as HEADER_LIST, generateHeaders } from '@/utils/header-generator'; +import logger from '@/utils/logger'; +import proxy from '@/utils/proxy'; const limiter = new RateLimiterMemory({ points: 10, diff --git a/lib/utils/request-rewriter/get.ts b/lib/utils/request-rewriter/get.ts index a5bc91e45..dc35fde38 100644 --- a/lib/utils/request-rewriter/get.ts +++ b/lib/utils/request-rewriter/get.ts @@ -1,11 +1,13 @@ -import http from 'node:http'; -import https from 'node:https'; -import logger from '@/utils/logger'; -import { config } from '@/config'; -import proxy from '@/utils/proxy'; -import { generateHeaders, generatedHeaders as HEADER_LIST } from '@/utils/header-generator'; +import type http from 'node:http'; +import type https from 'node:https'; + import type { HeaderGeneratorOptions } from 'header-generator'; +import { config } from '@/config'; +import { generatedHeaders as HEADER_LIST, generateHeaders } from '@/utils/header-generator'; +import logger from '@/utils/logger'; +import proxy from '@/utils/proxy'; + type Get = typeof http.get | typeof https.get | typeof http.request | typeof https.request; interface ExtendedRequestOptions extends http.RequestOptions { diff --git a/lib/utils/request-rewriter/index.ts b/lib/utils/request-rewriter/index.ts index 74e793167..626b4927d 100644 --- a/lib/utils/request-rewriter/index.ts +++ b/lib/utils/request-rewriter/index.ts @@ -1,7 +1,8 @@ -import { Headers, FormData, Request, Response } from 'undici'; import http from 'node:http'; import https from 'node:https'; +import { FormData, Headers, Request, Response } from 'undici'; + import fetch from '@/utils/request-rewriter/fetch'; import getWrappedGet from '@/utils/request-rewriter/get'; diff --git a/lib/utils/rss-parser.test.ts b/lib/utils/rss-parser.test.ts index 0b09b61ea..880b454d1 100644 --- a/lib/utils/rss-parser.test.ts +++ b/lib/utils/rss-parser.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import parser from '@/utils/rss-parser'; describe('rss-parser', () => { diff --git a/lib/utils/rss-parser.ts b/lib/utils/rss-parser.ts index 63a94a7aa..01b2d3063 100644 --- a/lib/utils/rss-parser.ts +++ b/lib/utils/rss-parser.ts @@ -1,6 +1,7 @@ -import { config } from '@/config'; import Parser from 'rss-parser'; +import { config } from '@/config'; + const parser = new Parser({ customFields: { item: ['magnet'], diff --git a/lib/utils/timezone.test.ts b/lib/utils/timezone.test.ts index e6217853c..4efec5bbe 100644 --- a/lib/utils/timezone.test.ts +++ b/lib/utils/timezone.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import timezone from '@/utils/timezone'; describe('timezone', () => { diff --git a/lib/utils/valid-host.test.ts b/lib/utils/valid-host.test.ts index 48945387a..b44778283 100644 --- a/lib/utils/valid-host.test.ts +++ b/lib/utils/valid-host.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import { isValidHost } from '@/utils/valid-host'; describe('valid-host', () => { diff --git a/lib/utils/wait.test.ts b/lib/utils/wait.test.ts index f40fda6b7..b9adc768e 100644 --- a/lib/utils/wait.test.ts +++ b/lib/utils/wait.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import wait from '@/utils/wait'; describe('wait', () => { diff --git a/lib/utils/wechat-mp.test.ts b/lib/utils/wechat-mp.test.ts index 2d24a2110..e22cc7bed 100644 --- a/lib/utils/wechat-mp.test.ts +++ b/lib/utils/wechat-mp.test.ts @@ -1,8 +1,10 @@ -import { describe, expect, it, vi, afterEach } from 'vitest'; import { load } from 'cheerio'; import Parser from 'rss-parser'; +import { afterEach, describe, expect, it, vi } from 'vitest'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { exportedForTestingOnly, WeChatMpError, fetchArticle, finishArticleItem, fixArticleContent, normalizeUrl } from '@/utils/wechat-mp'; +import { exportedForTestingOnly, fetchArticle, finishArticleItem, fixArticleContent, normalizeUrl, WeChatMpError } from '@/utils/wechat-mp'; + const { toggleWerror, ExtractMetadata, showTypeMapReverse } = exportedForTestingOnly; vi.mock('@/utils/request-rewriter', () => ({ default: null })); diff --git a/lib/utils/wechat-mp.ts b/lib/utils/wechat-mp.ts index 1b3d0e303..9abd4dda9 100644 --- a/lib/utils/wechat-mp.ts +++ b/lib/utils/wechat-mp.ts @@ -25,12 +25,13 @@ * For more details of these functions, please refer to the jsDoc in the source code. */ -import ofetch from '@/utils/ofetch'; import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; -import { parseDate } from '@/utils/parse-date'; + import cache from '@/utils/cache'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; class WeChatMpError extends Error { constructor(message: string) { @@ -645,4 +646,4 @@ const finishArticleItem = async (item, setMpNameAsAuthor = false, skipLink = fal }; const exportedForTestingOnly = { toggleWerror, ExtractMetadata, showTypeMapReverse }; -export { exportedForTestingOnly, WeChatMpError, fixArticleContent, fetchArticle, finishArticleItem, normalizeUrl }; +export { exportedForTestingOnly, fetchArticle, finishArticleItem, fixArticleContent, normalizeUrl, WeChatMpError }; diff --git a/lib/views/atom.tsx b/lib/views/atom.tsx index 42f5bc2fa..e2565bfe3 100644 --- a/lib/views/atom.tsx +++ b/lib/views/atom.tsx @@ -1,5 +1,6 @@ import type { FC } from 'hono/jsx'; -import { Data } from '@/types'; + +import type { Data } from '@/types'; const RSS: FC<{ data: Data }> = ({ data }) => ( diff --git a/lib/views/error.tsx b/lib/views/error.tsx index f24e9b27d..d18372bb9 100644 --- a/lib/views/error.tsx +++ b/lib/views/error.tsx @@ -1,7 +1,7 @@ import type { FC } from 'hono/jsx'; +import { gitDate, gitHash } from '@/utils/git-hash'; import { Layout } from '@/views/layout'; -import { gitHash, gitDate } from '@/utils/git-hash'; const Index: FC<{ requestPath: string; diff --git a/lib/views/index.tsx b/lib/views/index.tsx index 87659a3c3..b2ecdef28 100644 --- a/lib/views/index.tsx +++ b/lib/views/index.tsx @@ -1,9 +1,9 @@ import type { FC } from 'hono/jsx'; -import { Layout } from '@/views/layout'; import { config } from '@/config'; -import { gitHash, gitDate } from '@/utils/git-hash'; import { getDebugInfo } from '@/utils/debug-info'; +import { gitDate, gitHash } from '@/utils/git-hash'; +import { Layout } from '@/views/layout'; const startTime = Date.now(); diff --git a/lib/views/json.ts b/lib/views/json.ts index c6f00226f..fcef99eef 100644 --- a/lib/views/json.ts +++ b/lib/views/json.ts @@ -1,4 +1,4 @@ -import { Data } from '@/types'; +import type { Data } from '@/types'; /** * This function should be used by RSSHub middleware only. diff --git a/lib/views/rss.tsx b/lib/views/rss.tsx index 4d36c551e..229a573d2 100644 --- a/lib/views/rss.tsx +++ b/lib/views/rss.tsx @@ -1,5 +1,6 @@ import type { FC } from 'hono/jsx'; -import { Data } from '@/types'; + +import type { Data } from '@/types'; const RSS: FC<{ data: Data }> = ({ data }) => { const hasItunes = data.itunes_author || data.itunes_category || (data.item && data.item.some((i) => i.itunes_item_image || i.itunes_duration)); diff --git a/lib/views/rss3.test.ts b/lib/views/rss3.test.ts index c226cd2a9..693e809ec 100644 --- a/lib/views/rss3.test.ts +++ b/lib/views/rss3.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import rss3 from './rss3'; const NETWORK = 'rsshub'; diff --git a/plugins/rollup-plugin-art-templates.ts b/plugins/rollup-plugin-art-templates.ts index 3b9eed9d5..4d08ebd3f 100644 --- a/plugins/rollup-plugin-art-templates.ts +++ b/plugins/rollup-plugin-art-templates.ts @@ -1,7 +1,8 @@ // rollup-plugin-art-templates.js +import { createHash } from 'node:crypto'; import fs from 'node:fs'; import path from 'node:path'; -import { createHash } from 'node:crypto'; + import MagicString from 'magic-string'; /** diff --git a/scripts/workflow/build-docs.ts b/scripts/workflow/build-docs.ts index c24763bb3..d1fe2cc63 100644 --- a/scripts/workflow/build-docs.ts +++ b/scripts/workflow/build-docs.ts @@ -1,9 +1,10 @@ -import { namespaces } from '../../lib/registry'; import fs from 'node:fs'; import path from 'node:path'; -import { categories } from './data'; -import { getCurrentPath } from '../../lib/utils/helpers'; + import { config } from '../../lib/config'; +import { namespaces } from '../../lib/registry'; +import { getCurrentPath } from '../../lib/utils/helpers'; +import { categories } from './data'; const fullTests = await (await fetch('https://cdn.jsdelivr.net/gh/DIYgod/RSSHub@gh-pages/build/test-full-routes.json')).json(); const testResult = fullTests.testResults[0].assertionResults; diff --git a/scripts/workflow/build-routes.ts b/scripts/workflow/build-routes.ts index 9da667529..1bbb64cc5 100644 --- a/scripts/workflow/build-routes.ts +++ b/scripts/workflow/build-routes.ts @@ -1,12 +1,14 @@ -import { namespaces } from '../../lib/registry'; -import { RadarItem } from '../../lib/types'; -import { parse } from 'tldts'; import fs from 'node:fs'; import path from 'node:path'; -import toSource from 'tosource'; -import { config } from '../../lib/config'; +import { parse } from 'tldts'; +import toSource from 'tosource'; + +import { config } from '../../lib/config'; +import { namespaces } from '../../lib/registry'; +import type { RadarItem } from '../../lib/types'; import { getCurrentPath } from '../../lib/utils/helpers'; + const __dirname = getCurrentPath(import.meta.url); const foloAnalysis = await ( diff --git a/scripts/workflow/build-vercel-packagejson.ts b/scripts/workflow/build-vercel-packagejson.ts index 3bb8fecf6..730262cb5 100644 --- a/scripts/workflow/build-vercel-packagejson.ts +++ b/scripts/workflow/build-vercel-packagejson.ts @@ -1,6 +1,7 @@ -import packageJson from '../../package.json'; import fs from 'node:fs'; +import packageJson from '../../package.json'; + packageJson.name = 'rsshub-vercel'; // @ts-ignore delete packageJson.scripts; diff --git a/tsdown-lib.config.ts b/tsdown-lib.config.ts index 9f7ceaef2..fc4f32a25 100644 --- a/tsdown-lib.config.ts +++ b/tsdown-lib.config.ts @@ -1,4 +1,5 @@ import { defineConfig } from 'tsdown'; + import artTemplatesPlugin from './plugins/rollup-plugin-art-templates.ts'; export default defineConfig({ diff --git a/tsdown-vercel.config.ts b/tsdown-vercel.config.ts index 3eb8ce7d6..b137eabb3 100644 --- a/tsdown-vercel.config.ts +++ b/tsdown-vercel.config.ts @@ -1,4 +1,5 @@ import { defineConfig } from 'tsdown'; + import artTemplatesPlugin from './plugins/rollup-plugin-art-templates.ts'; export default defineConfig({ diff --git a/tsdown.config.ts b/tsdown.config.ts index ab948f15e..45a2d3485 100644 --- a/tsdown.config.ts +++ b/tsdown.config.ts @@ -1,4 +1,5 @@ import { defineConfig } from 'tsdown'; + import artTemplatesPlugin from './plugins/rollup-plugin-art-templates.ts'; export default defineConfig({ diff --git a/vitest.config.ts b/vitest.config.ts index 1f061c8f7..ad2b42010 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,9 +1,10 @@ -import { defineConfig, configDefaults } from 'vitest/config'; -import tsconfigPaths from 'vite-tsconfig-paths'; import os from 'node:os'; import path from 'node:path'; import process from 'node:process'; +import tsconfigPaths from 'vite-tsconfig-paths'; +import { configDefaults, defineConfig } from 'vitest/config'; + export default defineConfig({ plugins: [tsconfigPaths()], test: {