From db9e515c7caed39b10336d05a3ad06cae5029e20 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Wed, 28 Feb 2024 19:31:09 +0800 Subject: [PATCH] feat: v3 migration - 5/n --- lib/v2/19lou/index.js | 2 +- lib/v2/591/list.js | 2 +- lib/v2/9to5/subsite.js | 2 +- lib/v2/aiea/index.js | 2 +- lib/v2/aip/journal-pupp.js | 2 +- lib/v2/airchina/index.js | 2 +- lib/v2/apkpure/versions.js | 2 +- lib/v2/bangumi/tv/subject/comments.js | 2 +- lib/v2/bangumi/tv/subject/index.js | 2 +- lib/v2/bbc/index.js | 2 +- lib/v2/bendibao/news.js | 2 +- lib/v2/bilibili/cache.js | 2 +- lib/v2/bilibili/dynamic.js | 2 +- lib/v2/bilibili/followings-dynamic.js | 2 +- lib/v2/bilibili/video.js | 2 +- lib/v2/bilibili/vsearch.js | 2 +- lib/v2/bing/search.js | 2 +- lib/v2/bloomberg/authors.js | 2 +- lib/v2/brooklynmuseum/exhibitions.js | 2 +- lib/v2/caixin/blog.js | 2 +- lib/v2/caixin/category.js | 2 +- lib/v2/chinathinktanks/viewpoint.js | 2 +- lib/v2/cnbc/rss.js | 2 +- lib/v2/csdn/blog.js | 2 +- lib/v2/cw/utils.js | 4 ++-- lib/v2/dayanzai/index.js | 2 +- lib/v2/deepmind/blog.js | 2 +- lib/v2/discourse/posts.js | 2 +- lib/v2/dnaindia/category.js | 2 +- lib/v2/douban/other/list.js | 2 +- lib/v2/douban/other/recommended.js | 2 +- lib/v2/douban/people/status.js | 2 +- lib/v2/douyin/hashtag.js | 2 +- lib/v2/douyin/live.js | 2 +- lib/v2/douyin/user.js | 2 +- lib/v2/douyin/utils.js | 2 +- lib/v2/dut/index.js | 2 +- lib/v2/eagle/blog.js | 2 +- lib/v2/eastday/sh.js | 2 +- lib/v2/economist/full.js | 2 +- lib/v2/ehentai/ehapi.js | 2 +- lib/v2/elasticsearch-cn/index.js | 2 +- lib/v2/eprice/rss.js | 2 +- lib/v2/ff14/ff14-global.js | 2 +- lib/v2/finology/most-viewed.js | 2 +- lib/v2/finology/tag.js | 2 +- lib/v2/fortnite/news.js | 2 +- lib/v2/fortunechina/index.js | 2 +- lib/v2/freewechat/profile.js | 2 +- lib/v2/ft/myft.js | 2 +- lib/v2/ft/utils.js | 2 +- lib/v2/gameapps/index.js | 2 +- lib/v2/gamme/category.js | 4 ++-- lib/v2/gamme/tag.js | 2 +- lib/v2/gelonghui/utils.js | 2 +- lib/v2/gov/general/general.js | 2 +- lib/v2/gov/moe/moe.js | 2 +- lib/v2/gov/news/index.js | 2 +- lib/v2/gov/nmpa/generic.js | 2 +- lib/v2/gov/zhengce/zhengceku.js | 2 +- lib/v2/gumroad/index.js | 2 +- lib/v2/hkej/index.js | 2 +- lib/v2/hoyolab/news.js | 2 +- lib/v2/hrbeu/job/list.js | 2 +- lib/v2/hrbeu/uae/news.js | 2 +- lib/v2/huanqiu/index.js | 2 +- lib/v2/hupu/all.js | 2 +- lib/v2/iiilab/index.js | 2 +- lib/v2/inoreader/rss.js | 2 +- lib/v2/instagram/private-api/index.js | 2 +- lib/v2/instagram/private-api/utils.js | 2 +- lib/v2/iqiyi/video.js | 2 +- lib/v2/itch/devlog.js | 2 +- lib/v2/jandan/index.js | 2 +- lib/v2/jewishmuseum/exhibitions.js | 2 +- lib/v2/jike/topic.js | 2 +- lib/v2/jsu/jwc.js | 2 +- lib/v2/jsu/math.js | 2 +- lib/v2/jsu/rjxy.js | 2 +- lib/v2/latepost/index.js | 2 +- lib/v2/line/utils.js | 2 +- lib/v2/liveuamap/index.js | 2 +- lib/v2/lofter/user.js | 2 +- lib/v2/mail/imap.js | 2 +- lib/v2/mangadex/index.js | 5 ++--- lib/v2/medsci/index.js | 2 +- lib/v2/mingpao/index.js | 4 ++-- lib/v2/mirror/index.js | 2 +- lib/v2/modb/topic.js | 2 +- lib/v2/mydrivers/cid.js | 2 +- lib/v2/myfigurecollection/activity.js | 2 +- lib/v2/myfigurecollection/index.js | 2 +- lib/v2/newmuseum/exhibitions.js | 2 +- lib/v2/newrank/wechat.js | 2 +- lib/v2/nikkei/cn/index.js | 2 +- lib/v2/notion/database.js | 2 +- lib/v2/npr/full.js | 2 +- lib/v2/nua/utils.js | 2 +- lib/v2/nuaa/utils/pypasswaf.js | 4 ++-- lib/v2/nytimes/index.js | 2 +- lib/v2/onet/news.js | 2 +- lib/v2/oschina/news.js | 2 +- lib/v2/oschina/topic.js | 2 +- lib/v2/oschina/user.js | 2 +- lib/v2/people/index.js | 2 +- lib/v2/phoronix/index.js | 2 +- lib/v2/pingwest/utils.js | 2 +- lib/v2/pixiv/pixiv-got.js | 2 +- lib/v2/pixiv/token.js | 2 +- lib/v2/pku/nsd.js | 2 +- lib/v2/pnas/index.js | 4 ++-- lib/v2/pornhub/category-url.js | 2 +- lib/v2/pornhub/model.js | 2 +- lib/v2/pornhub/pornstar.js | 2 +- lib/v2/pornhub/users.js | 2 +- lib/v2/pwc/sustainability.js | 2 +- lib/v2/qbitai/category.js | 2 +- lib/v2/qbitai/tag.js | 2 +- lib/v2/qidian/author.js | 2 +- lib/v2/quicker/qa.js | 2 +- lib/v2/quicker/share.js | 2 +- lib/v2/quicker/user.js | 2 +- lib/v2/sdu/cs.js | 2 +- lib/v2/segmentfault/utils.js | 2 +- lib/v2/sjtu/gs.js | 2 +- lib/v2/slowmist/slowmist.js | 2 +- lib/v2/solidot/main.js | 2 +- lib/v2/stratechery/index.js | 2 +- lib/v2/sysu/ygafz.js | 2 +- lib/v2/techcrunch/news.js | 2 +- lib/v2/telegram/channel.js | 2 +- lib/v2/theverge/index.js | 2 +- lib/v2/tiktok/user.js | 2 +- lib/v2/tju/oaa/index.js | 2 +- lib/v2/toodaylab/index.js | 2 +- lib/v2/twitter/api-fallback-common.js | 2 +- lib/v2/twitter/collection.js | 2 +- lib/v2/twitter/followings.js | 2 +- lib/v2/twitter/utils.js | 2 +- lib/v2/twitter/web-api/login.js | 2 +- lib/v2/twitter/web-api/tweet.js | 2 +- lib/v2/twitter/web-api/twitter-api.js | 2 +- lib/v2/uchicago/current.js | 4 ++-- lib/v2/uptimerobot/rss.js | 2 +- lib/v2/ustb/yjsy/news.js | 2 +- lib/v2/wechat/ce.js | 4 ++-- lib/v2/wechat/data258.js | 7 +++---- lib/v2/wechat/ershcimi.js | 2 +- lib/v2/wechat/feeddd.js | 2 +- lib/v2/wechat/feeds.js | 4 ++-- lib/v2/wechat/mp.js | 2 +- lib/v2/wechat/msgalbum.js | 2 +- lib/v2/wechat/sogou.js | 2 +- lib/v2/wechat/tgchannel.js | 2 +- lib/v2/wechat/wechat2rss.js | 4 ++-- lib/v2/weibo/friends.js | 2 +- lib/v2/weibo/group.js | 2 +- lib/v2/weibo/keyword.js | 2 +- lib/v2/weibo/oasis/user.js | 2 +- lib/v2/weibo/timeline.js | 2 +- lib/v2/weibo/user.js | 2 +- lib/v2/weibo/utils.js | 2 +- lib/v2/xiaohongshu/util.js | 2 +- lib/v2/xunhupay/index.js | 2 +- lib/v2/yahoo/news/us/index.js | 4 ++-- lib/v2/yystv/category.js | 2 +- lib/v2/zcool/user.js | 2 +- lib/v2/zhubai/index.js | 2 +- lib/v2/zhubai/top20.js | 2 +- 169 files changed, 182 insertions(+), 184 deletions(-) diff --git a/lib/v2/19lou/index.js b/lib/v2/19lou/index.js index ccdda4047..7220f4d95 100644 --- a/lib/v2/19lou/index.js +++ b/lib/v2/19lou/index.js @@ -4,7 +4,7 @@ import { load } from 'cheerio'; import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; const iconv = require('iconv-lite'); -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; const setCookie = function (cookieName, cookieValue, seconds, path, domain, secure) { let expires = null; diff --git a/lib/v2/591/list.js b/lib/v2/591/list.js index 52b60d219..a6c77fc92 100644 --- a/lib/v2/591/list.js +++ b/lib/v2/591/list.js @@ -5,7 +5,7 @@ import { load } from 'cheerio'; import got from '@/utils/got'; import { art } from '@/utils/render'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; const cookieJar = new CookieJar(); diff --git a/lib/v2/9to5/subsite.js b/lib/v2/9to5/subsite.js index b74bb0126..588fcad5b 100644 --- a/lib/v2/9to5/subsite.js +++ b/lib/v2/9to5/subsite.js @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; const utils = require('./utils'); module.exports = async (ctx) => { diff --git a/lib/v2/aiea/index.js b/lib/v2/aiea/index.js index ea02104e0..de3d4330a 100644 --- a/lib/v2/aiea/index.js +++ b/lib/v2/aiea/index.js @@ -1,4 +1,4 @@ -const buildData = require('@/utils/common-config'); +import buildData from '@/utils/common-config'; module.exports = async (ctx) => { const link = 'http://www.aiea.org/0504'; diff --git a/lib/v2/aip/journal-pupp.js b/lib/v2/aip/journal-pupp.js index 265f50c64..f130c6d39 100644 --- a/lib/v2/aip/journal-pupp.js +++ b/lib/v2/aip/journal-pupp.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import { load } from 'cheerio'; const { puppeteerGet, renderDesc } = require('./utils'); import { config } from '@/config'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; import puppeteer from '@/utils/puppeteer'; module.exports = async (ctx) => { diff --git a/lib/v2/airchina/index.js b/lib/v2/airchina/index.js index 4d3489659..a4fd3b640 100644 --- a/lib/v2/airchina/index.js +++ b/lib/v2/airchina/index.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const buildData = require('@/utils/common-config'); +import buildData from '@/utils/common-config'; const baseUrl = 'https://www.airchina.com.cn'; module.exports = async (ctx) => { diff --git a/lib/v2/apkpure/versions.js b/lib/v2/apkpure/versions.js index ef51d10e0..db957e9a7 100644 --- a/lib/v2/apkpure/versions.js +++ b/lib/v2/apkpure/versions.js @@ -1,5 +1,5 @@ import { load } from 'cheerio'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/v2/bangumi/tv/subject/comments.js b/lib/v2/bangumi/tv/subject/comments.js index dadfe41df..cc4190e92 100644 --- a/lib/v2/bangumi/tv/subject/comments.js +++ b/lib/v2/bangumi/tv/subject/comments.js @@ -1,6 +1,6 @@ import got from '@/utils/got'; import { load } from 'cheerio'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; module.exports = async (subjectID, minLength) => { // bangumi.tv未提供获取“吐槽(comments)”的API,因此仍需要通过抓取网页来获取 diff --git a/lib/v2/bangumi/tv/subject/index.js b/lib/v2/bangumi/tv/subject/index.js index f2d155efc..906bf1ffb 100644 --- a/lib/v2/bangumi/tv/subject/index.js +++ b/lib/v2/bangumi/tv/subject/index.js @@ -1,7 +1,7 @@ const getComments = require('./comments.js'); const getFromAPI = require('./offcial-subject-api.js'); const getEps = require('./ep.js'); -const { queryToBoolean } = require('@/utils/readable-social'); +import { queryToBoolean } from '@/utils/readable-social'; module.exports = async (ctx) => { const id = ctx.req.param('id'); diff --git a/lib/v2/bbc/index.js b/lib/v2/bbc/index.js index cb8d64431..d14f41d1e 100644 --- a/lib/v2/bbc/index.js +++ b/lib/v2/bbc/index.js @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; const utils = require('./utils'); diff --git a/lib/v2/bendibao/news.js b/lib/v2/bendibao/news.js index 740672b20..99fe5f817 100644 --- a/lib/v2/bendibao/news.js +++ b/lib/v2/bendibao/news.js @@ -3,7 +3,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { const city = ctx.req.param('city'); diff --git a/lib/v2/bilibili/cache.js b/lib/v2/bilibili/cache.js index 4edf76d8c..2d59bff02 100644 --- a/lib/v2/bilibili/cache.js +++ b/lib/v2/bilibili/cache.js @@ -3,7 +3,7 @@ import got from '@/utils/got'; const utils = require('./utils'); import { load } from 'cheerio'; import { config } from '@/config'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; module.exports = { getCookie: () => { diff --git a/lib/v2/bilibili/dynamic.js b/lib/v2/bilibili/dynamic.js index 71fe0c05a..60963e0e3 100644 --- a/lib/v2/bilibili/dynamic.js +++ b/lib/v2/bilibili/dynamic.js @@ -3,7 +3,7 @@ import got from '@/utils/got'; const JSONbig = require('json-bigint'); const utils = require('./utils'); import { parseDate } from '@/utils/parse-date'; -const { fallback, queryToBoolean } = require('@/utils/readable-social'); +import { fallback, queryToBoolean } from '@/utils/readable-social'; const cacheIn = require('./cache'); /** diff --git a/lib/v2/bilibili/followings-dynamic.js b/lib/v2/bilibili/followings-dynamic.js index 719fdd599..2dfa7cd48 100644 --- a/lib/v2/bilibili/followings-dynamic.js +++ b/lib/v2/bilibili/followings-dynamic.js @@ -3,7 +3,7 @@ const cache = require('./cache'); import { config } from '@/config'; const utils = require('./utils'); const JSONbig = require('json-bigint'); -const { fallback, queryToBoolean } = require('@/utils/readable-social'); +import { fallback, queryToBoolean } from '@/utils/readable-social'; const querystring = require('querystring'); module.exports = async (ctx) => { diff --git a/lib/v2/bilibili/video.js b/lib/v2/bilibili/video.js index 3835d7a03..b061f0a4a 100644 --- a/lib/v2/bilibili/video.js +++ b/lib/v2/bilibili/video.js @@ -1,7 +1,7 @@ import got from '@/utils/got'; const cache = require('./cache'); const utils = require('./utils'); -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; module.exports = async (ctx) => { const uid = ctx.req.param('uid'); diff --git a/lib/v2/bilibili/vsearch.js b/lib/v2/bilibili/vsearch.js index 05f08504c..47901f3ed 100644 --- a/lib/v2/bilibili/vsearch.js +++ b/lib/v2/bilibili/vsearch.js @@ -5,7 +5,7 @@ import { parseDate } from '@/utils/parse-date'; const utils = require('./utils'); const { CookieJar } = require('tough-cookie'); const cookieJar = new CookieJar(); -const { queryToBoolean } = require('@/utils/readable-social'); +import { queryToBoolean } from '@/utils/readable-social'; module.exports = async (ctx) => { const kw = ctx.req.param('kw'); diff --git a/lib/v2/bing/search.js b/lib/v2/bing/search.js index 313c242d4..cbe8e4b9f 100644 --- a/lib/v2/bing/search.js +++ b/lib/v2/bing/search.js @@ -1,4 +1,4 @@ -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import { parseDate } from '@/utils/parse-date'; const dayjs = require('dayjs'); const localizedFormat = require('dayjs/plugin/localizedFormat'); diff --git a/lib/v2/bloomberg/authors.js b/lib/v2/bloomberg/authors.js index 51a28192b..17299b296 100644 --- a/lib/v2/bloomberg/authors.js +++ b/lib/v2/bloomberg/authors.js @@ -1,6 +1,6 @@ import { load } from 'cheerio'; import got from '@/utils/got'; -const rssParser = require('@/utils/rss-parser'); +import rssParser from '@/utils/rss-parser'; const { asyncPoolAll, parseArticle } = require('./utils'); const parseAuthorNewsList = async (slug) => { diff --git a/lib/v2/brooklynmuseum/exhibitions.js b/lib/v2/brooklynmuseum/exhibitions.js index 9157a611a..a693cabcd 100644 --- a/lib/v2/brooklynmuseum/exhibitions.js +++ b/lib/v2/brooklynmuseum/exhibitions.js @@ -1,4 +1,4 @@ -const buildData = require('@/utils/common-config'); +import buildData from '@/utils/common-config'; module.exports = async (ctx) => { let link; diff --git a/lib/v2/caixin/blog.js b/lib/v2/caixin/blog.js index 9bd9e4277..b4435b082 100644 --- a/lib/v2/caixin/blog.js +++ b/lib/v2/caixin/blog.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; import { parseDate } from '@/utils/parse-date'; const { parseBlogArticle } = require('./utils'); diff --git a/lib/v2/caixin/category.js b/lib/v2/caixin/category.js index a26c16e2c..6336bf4a1 100644 --- a/lib/v2/caixin/category.js +++ b/lib/v2/caixin/category.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const { parseArticle } = require('./utils'); diff --git a/lib/v2/chinathinktanks/viewpoint.js b/lib/v2/chinathinktanks/viewpoint.js index 7d43c65b8..70c3c41f0 100644 --- a/lib/v2/chinathinktanks/viewpoint.js +++ b/lib/v2/chinathinktanks/viewpoint.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const { CookieJar } = require('tough-cookie'); diff --git a/lib/v2/cnbc/rss.js b/lib/v2/cnbc/rss.js index 8bfb7b336..519d47c19 100644 --- a/lib/v2/cnbc/rss.js +++ b/lib/v2/cnbc/rss.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; module.exports = async (ctx) => { const { id = '100003114' } = ctx.params; diff --git a/lib/v2/csdn/blog.js b/lib/v2/csdn/blog.js index a857e6af0..5779100ae 100644 --- a/lib/v2/csdn/blog.js +++ b/lib/v2/csdn/blog.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const rssParser = require('@/utils/rss-parser'); +import rssParser from '@/utils/rss-parser'; module.exports = async (ctx) => { const user = ctx.req.param('user'); diff --git a/lib/v2/cw/utils.js b/lib/v2/cw/utils.js index 674ee3359..b036c98d1 100644 --- a/lib/v2/cw/utils.js +++ b/lib/v2/cw/utils.js @@ -1,8 +1,8 @@ import cache from '@/utils/cache'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -const { getCookies, setCookies } = require('@/utils/puppeteer-utils'); -const logger = require('@/utils/logger'); +import { getCookies, setCookies } from '@/utils/puppeteer-utils'; +import logger from '@/utils/logger'; let cookie; const baseUrl = 'https://www.cw.com.tw'; diff --git a/lib/v2/dayanzai/index.js b/lib/v2/dayanzai/index.js index 5398f354b..61df41962 100644 --- a/lib/v2/dayanzai/index.js +++ b/lib/v2/dayanzai/index.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const rootUrl = 'http://www.dayanzai.me/'; diff --git a/lib/v2/deepmind/blog.js b/lib/v2/deepmind/blog.js index 83a3f4784..7a0d9f379 100644 --- a/lib/v2/deepmind/blog.js +++ b/lib/v2/deepmind/blog.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; module.exports = async (ctx) => { const feed = await parser.parseURL('https://www.deepmind.com/blog/rss.xml'); diff --git a/lib/v2/discourse/posts.js b/lib/v2/discourse/posts.js index 6f21fe699..1c134cb75 100644 --- a/lib/v2/discourse/posts.js +++ b/lib/v2/discourse/posts.js @@ -1,6 +1,6 @@ const { getConfig } = require('./utils'); import got from '@/utils/got'; -const RSSParser = require('@/utils/rss-parser'); +import RSSParser from '@/utils/rss-parser'; module.exports = async (ctx) => { const { link, key } = getConfig(ctx); diff --git a/lib/v2/dnaindia/category.js b/lib/v2/dnaindia/category.js index 7cdd03d3c..af99ca454 100644 --- a/lib/v2/dnaindia/category.js +++ b/lib/v2/dnaindia/category.js @@ -3,7 +3,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; module.exports = async (ctx) => { const { category, topic } = ctx.params; diff --git a/lib/v2/douban/other/list.js b/lib/v2/douban/other/list.js index c202f4b45..b97447e7e 100644 --- a/lib/v2/douban/other/list.js +++ b/lib/v2/douban/other/list.js @@ -1,7 +1,7 @@ import got from '@/utils/got'; const path = require('path'); import { art } from '@/utils/render'; -const { fallback, queryToInteger } = require('@/utils/readable-social'); +import { fallback, queryToInteger } from '@/utils/readable-social'; module.exports = async (ctx) => { const type = ctx.req.param('type') || 'subject_real_time_hotest'; diff --git a/lib/v2/douban/other/recommended.js b/lib/v2/douban/other/recommended.js index 7d5e2476a..01c372ff0 100644 --- a/lib/v2/douban/other/recommended.js +++ b/lib/v2/douban/other/recommended.js @@ -1,7 +1,7 @@ import got from '@/utils/got'; const path = require('path'); import { art } from '@/utils/render'; -const { fallback, queryToInteger } = require('@/utils/readable-social'); +import { fallback, queryToInteger } from '@/utils/readable-social'; module.exports = async (ctx) => { const subjectType = ctx.req.param('type') || 'tv'; diff --git a/lib/v2/douban/people/status.js b/lib/v2/douban/people/status.js index bdeea7dc4..ba023fe44 100644 --- a/lib/v2/douban/people/status.js +++ b/lib/v2/douban/people/status.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; const querystring = require('querystring'); import got from '@/utils/got'; -const { fallback, queryToBoolean, queryToInteger } = require('@/utils/readable-social'); +import { fallback, queryToBoolean, queryToInteger } from '@/utils/readable-social'; import { config } from '@/config'; const headers = { Referer: `https://m.douban.com/` }; diff --git a/lib/v2/douyin/hashtag.js b/lib/v2/douyin/hashtag.js index 1866ddd51..21411ce7f 100644 --- a/lib/v2/douyin/hashtag.js +++ b/lib/v2/douyin/hashtag.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; import { config } from '@/config'; -const { fallback, queryToBoolean } = require('@/utils/readable-social'); +import { fallback, queryToBoolean } from '@/utils/readable-social'; const { templates, resolveUrl, proxyVideo, getOriginAvatar } = require('./utils'); import puppeteer from '@/utils/puppeteer'; diff --git a/lib/v2/douyin/live.js b/lib/v2/douyin/live.js index 3526596a4..9af5c9057 100644 --- a/lib/v2/douyin/live.js +++ b/lib/v2/douyin/live.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import { config } from '@/config'; const { getOriginAvatar } = require('./utils'); -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import puppeteer from '@/utils/puppeteer'; module.exports = async (ctx) => { diff --git a/lib/v2/douyin/user.js b/lib/v2/douyin/user.js index 18a21ef75..cfaebbe28 100644 --- a/lib/v2/douyin/user.js +++ b/lib/v2/douyin/user.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; import { config } from '@/config'; -const { fallback, queryToBoolean } = require('@/utils/readable-social'); +import { fallback, queryToBoolean } from '@/utils/readable-social'; const { templates, resolveUrl, proxyVideo, getOriginAvatar, universalGet } = require('./utils'); module.exports = async (ctx) => { diff --git a/lib/v2/douyin/utils.js b/lib/v2/douyin/utils.js index a2a854ba5..3f34f36b0 100644 --- a/lib/v2/douyin/utils.js +++ b/lib/v2/douyin/utils.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; const path = require('path'); import got from '@/utils/got'; import { load } from 'cheerio'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import { config } from '@/config'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/v2/dut/index.js b/lib/v2/dut/index.js index 1aa200da0..07af9906d 100644 --- a/lib/v2/dut/index.js +++ b/lib/v2/dut/index.js @@ -4,7 +4,7 @@ import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const defaults = require('./defaults'); const shortcuts = require('./shortcuts'); -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { const site = ctx.params[0] ?? 'news'; diff --git a/lib/v2/eagle/blog.js b/lib/v2/eagle/blog.js index 2ece2c84b..27b91186b 100644 --- a/lib/v2/eagle/blog.js +++ b/lib/v2/eagle/blog.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; const cateList = new Set(['all', 'design-resources', 'learn-design', 'inside-eagle']); module.exports = async (ctx) => { diff --git a/lib/v2/eastday/sh.js b/lib/v2/eastday/sh.js index fb218d45c..6bf3f1738 100644 --- a/lib/v2/eastday/sh.js +++ b/lib/v2/eastday/sh.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/v2/economist/full.js b/lib/v2/economist/full.js index 56e5660d9..c82debfa1 100644 --- a/lib/v2/economist/full.js +++ b/lib/v2/economist/full.js @@ -1,5 +1,5 @@ import cache from '@/utils/cache'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import got from '@/utils/got'; import { load } from 'cheerio'; diff --git a/lib/v2/ehentai/ehapi.js b/lib/v2/ehentai/ehapi.js index 50f0c482f..0dbee2951 100644 --- a/lib/v2/ehentai/ehapi.js +++ b/lib/v2/ehentai/ehapi.js @@ -1,5 +1,5 @@ import got from '@/utils/got'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import timezone from '@/utils/timezone'; import { load } from 'cheerio'; const path = require('path'); diff --git a/lib/v2/elasticsearch-cn/index.js b/lib/v2/elasticsearch-cn/index.js index b2fffa2ca..009b65a8e 100644 --- a/lib/v2/elasticsearch-cn/index.js +++ b/lib/v2/elasticsearch-cn/index.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; import timezone from '@/utils/timezone'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; module.exports = async (ctx) => { const params = ctx.req.param('params') ?? ''; diff --git a/lib/v2/eprice/rss.js b/lib/v2/eprice/rss.js index 77b756638..78ca8ab45 100644 --- a/lib/v2/eprice/rss.js +++ b/lib/v2/eprice/rss.js @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; diff --git a/lib/v2/ff14/ff14-global.js b/lib/v2/ff14/ff14-global.js index e19377a9c..b4fd67bb5 100644 --- a/lib/v2/ff14/ff14-global.js +++ b/lib/v2/ff14/ff14-global.js @@ -2,7 +2,7 @@ import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const path = require('path'); -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { const lang = ctx.req.param('lang'); diff --git a/lib/v2/finology/most-viewed.js b/lib/v2/finology/most-viewed.js index 7a9670e22..4c68849d0 100644 --- a/lib/v2/finology/most-viewed.js +++ b/lib/v2/finology/most-viewed.js @@ -1,4 +1,4 @@ -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; const { getItems } = require('./utils'); module.exports = async (ctx) => { diff --git a/lib/v2/finology/tag.js b/lib/v2/finology/tag.js index 6e09a87ed..ada838558 100644 --- a/lib/v2/finology/tag.js +++ b/lib/v2/finology/tag.js @@ -1,4 +1,4 @@ -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; const { getItems } = require('./utils'); module.exports = async (ctx) => { diff --git a/lib/v2/fortnite/news.js b/lib/v2/fortnite/news.js index 2861d111c..1ac58601f 100644 --- a/lib/v2/fortnite/news.js +++ b/lib/v2/fortnite/news.js @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import puppeteer from '@/utils/puppeteer'; module.exports = async (ctx) => { diff --git a/lib/v2/fortunechina/index.js b/lib/v2/fortunechina/index.js index 34071b323..2c3b6b9f3 100644 --- a/lib/v2/fortunechina/index.js +++ b/lib/v2/fortunechina/index.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; module.exports = async (ctx) => { const category = ctx.req.param('category') ?? ''; diff --git a/lib/v2/freewechat/profile.js b/lib/v2/freewechat/profile.js index 8c1bd7702..ddd129d99 100644 --- a/lib/v2/freewechat/profile.js +++ b/lib/v2/freewechat/profile.js @@ -3,7 +3,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -const { fixArticleContent } = require('@/utils/wechat-mp'); +import { fixArticleContent } from '@/utils/wechat-mp'; const baseUrl = 'https://freewechat.com'; module.exports = async (ctx) => { diff --git a/lib/v2/ft/myft.js b/lib/v2/ft/myft.js index e98467a1a..01b9383f7 100644 --- a/lib/v2/ft/myft.js +++ b/lib/v2/ft/myft.js @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; module.exports = async (ctx) => { diff --git a/lib/v2/ft/utils.js b/lib/v2/ft/utils.js index 1ed4497a0..06393c38c 100644 --- a/lib/v2/ft/utils.js +++ b/lib/v2/ft/utils.js @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; const ProcessFeed = (i, $, link) => { diff --git a/lib/v2/gameapps/index.js b/lib/v2/gameapps/index.js index 7cbf49d76..8f5a3aa03 100644 --- a/lib/v2/gameapps/index.js +++ b/lib/v2/gameapps/index.js @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; diff --git a/lib/v2/gamme/category.js b/lib/v2/gamme/category.js index 772397784..5622a7cc0 100644 --- a/lib/v2/gamme/category.js +++ b/lib/v2/gamme/category.js @@ -1,8 +1,8 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const parser = require('@/utils/rss-parser'); -const { isValidHost } = require('@/utils/valid-host'); +import parser from '@/utils/rss-parser'; +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { const { domain = 'news', category } = ctx.params; diff --git a/lib/v2/gamme/tag.js b/lib/v2/gamme/tag.js index 124b40692..52ec827a8 100644 --- a/lib/v2/gamme/tag.js +++ b/lib/v2/gamme/tag.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { const { domain = 'news', tag } = ctx.params; diff --git a/lib/v2/gelonghui/utils.js b/lib/v2/gelonghui/utils.js index e0a83ed44..7d1ea3a84 100644 --- a/lib/v2/gelonghui/utils.js +++ b/lib/v2/gelonghui/utils.js @@ -1,6 +1,6 @@ import got from '@/utils/got'; import { load } from 'cheerio'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const parseItem = (item, tryGet) => diff --git a/lib/v2/gov/general/general.js b/lib/v2/gov/general/general.js index 013b58128..6867394e3 100644 --- a/lib/v2/gov/general/general.js +++ b/lib/v2/gov/general/general.js @@ -186,7 +186,7 @@ const gdgov = async (info, ctx) => { }; }); } else if (idlink.host === 'mp.weixin.qq.com') { - const { finishArticleItem } = require('@/utils/wechat-mp'); + import { finishArticleItem } from '@/utils/wechat-mp'; return finishArticleItem({ link }); } else { return cache.tryGet(link, async () => { diff --git a/lib/v2/gov/moe/moe.js b/lib/v2/gov/moe/moe.js index fc1bbe4a2..0dc3aa1f5 100644 --- a/lib/v2/gov/moe/moe.js +++ b/lib/v2/gov/moe/moe.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; const moeUrl = 'https://www.moe.gov.cn/'; diff --git a/lib/v2/gov/news/index.js b/lib/v2/gov/news/index.js index 0f71a7de5..67ce94625 100644 --- a/lib/v2/gov/news/index.js +++ b/lib/v2/gov/news/index.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/v2/gov/nmpa/generic.js b/lib/v2/gov/nmpa/generic.js index c9a8167b7..7bbaddf2d 100644 --- a/lib/v2/gov/nmpa/generic.js +++ b/lib/v2/gov/nmpa/generic.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import { load } from 'cheerio'; import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -const { finishArticleItem } = require('@/utils/wechat-mp'); +import { finishArticleItem } from '@/utils/wechat-mp'; import { config } from '@/config'; const baseUrl = 'https://www.nmpa.gov.cn'; import got from '@/utils/got'; diff --git a/lib/v2/gov/zhengce/zhengceku.js b/lib/v2/gov/zhengce/zhengceku.js index 98335b88a..045999569 100644 --- a/lib/v2/gov/zhengce/zhengceku.js +++ b/lib/v2/gov/zhengce/zhengceku.js @@ -1,4 +1,4 @@ -const buildData = require('@/utils/common-config'); +import buildData from '@/utils/common-config'; module.exports = async (ctx) => { const department = ctx.req.param('department'); diff --git a/lib/v2/gumroad/index.js b/lib/v2/gumroad/index.js index 36e2130d6..2048e56a2 100644 --- a/lib/v2/gumroad/index.js +++ b/lib/v2/gumroad/index.js @@ -2,7 +2,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; import { art } from '@/utils/render'; const path = require('path'); -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { const username = ctx.req.param('username'); diff --git a/lib/v2/hkej/index.js b/lib/v2/hkej/index.js index 7fc5cc73c..bdb508d56 100644 --- a/lib/v2/hkej/index.js +++ b/lib/v2/hkej/index.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; const path = require('path'); diff --git a/lib/v2/hoyolab/news.js b/lib/v2/hoyolab/news.js index d8c850d59..ab418875c 100644 --- a/lib/v2/hoyolab/news.js +++ b/lib/v2/hoyolab/news.js @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const path = require('path'); diff --git a/lib/v2/hrbeu/job/list.js b/lib/v2/hrbeu/job/list.js index e71007c6b..343cd4e06 100644 --- a/lib/v2/hrbeu/job/list.js +++ b/lib/v2/hrbeu/job/list.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -const { finishArticleItem } = require('@/utils/wechat-mp'); +import { finishArticleItem } from '@/utils/wechat-mp'; const rootUrl = 'http://job.hrbeu.edu.cn'; const idMap = { diff --git a/lib/v2/hrbeu/uae/news.js b/lib/v2/hrbeu/uae/news.js index 4020b28b2..abbe8fc2a 100644 --- a/lib/v2/hrbeu/uae/news.js +++ b/lib/v2/hrbeu/uae/news.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -const { finishArticleItem } = require('@/utils/wechat-mp'); +import { finishArticleItem } from '@/utils/wechat-mp'; module.exports = async (ctx) => { const id = ctx.req.param('id').replaceAll('-', '/'); diff --git a/lib/v2/huanqiu/index.js b/lib/v2/huanqiu/index.js index 3f6aa9323..4b3455a9e 100644 --- a/lib/v2/huanqiu/index.js +++ b/lib/v2/huanqiu/index.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; function getKeysRecursive(dic, key, attr, array) { for (const v of Object.values(dic)) { diff --git a/lib/v2/hupu/all.js b/lib/v2/hupu/all.js index a365f8ef0..e29be5dc7 100644 --- a/lib/v2/hupu/all.js +++ b/lib/v2/hupu/all.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; import timezone from '@/utils/timezone'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const path = require('path'); diff --git a/lib/v2/iiilab/index.js b/lib/v2/iiilab/index.js index 47f750e31..3a87d3a1d 100644 --- a/lib/v2/iiilab/index.js +++ b/lib/v2/iiilab/index.js @@ -1,4 +1,4 @@ -const buildData = require('@/utils/common-config'); +import buildData from '@/utils/common-config'; const baseUrl = 'https://www.iiilab.com/'; module.exports = async (ctx) => { diff --git a/lib/v2/inoreader/rss.js b/lib/v2/inoreader/rss.js index 465d610a2..0e35b1194 100644 --- a/lib/v2/inoreader/rss.js +++ b/lib/v2/inoreader/rss.js @@ -1,4 +1,4 @@ -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; module.exports = async (ctx) => { diff --git a/lib/v2/instagram/private-api/index.js b/lib/v2/instagram/private-api/index.js index bb032a53c..0d3753f67 100644 --- a/lib/v2/instagram/private-api/index.js +++ b/lib/v2/instagram/private-api/index.js @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; const { ig, login } = require('./utils'); -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import { config } from '@/config'; const { renderItems } = require('../common-utils'); diff --git a/lib/v2/instagram/private-api/utils.js b/lib/v2/instagram/private-api/utils.js index ccf6b29fc..e75fa17c8 100644 --- a/lib/v2/instagram/private-api/utils.js +++ b/lib/v2/instagram/private-api/utils.js @@ -1,5 +1,5 @@ const { IgApiClient } = require('instagram-private-api'); -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import { config } from '@/config'; const ig = new IgApiClient(); diff --git a/lib/v2/iqiyi/video.js b/lib/v2/iqiyi/video.js index a2167576f..e578c5e39 100644 --- a/lib/v2/iqiyi/video.js +++ b/lib/v2/iqiyi/video.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import { load } from 'cheerio'; import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import puppeteer from '@/utils/puppeteer'; // /iqiyi/user/video/:uid diff --git a/lib/v2/itch/devlog.js b/lib/v2/itch/devlog.js index 0cf3e5906..9cfc87fc1 100644 --- a/lib/v2/itch/devlog.js +++ b/lib/v2/itch/devlog.js @@ -5,7 +5,7 @@ import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const path = require('path'); -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { const user = ctx.req.param('user') ?? ''; diff --git a/lib/v2/jandan/index.js b/lib/v2/jandan/index.js index d96f5ff94..0e6a6b7ac 100644 --- a/lib/v2/jandan/index.js +++ b/lib/v2/jandan/index.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; module.exports = async (ctx) => { const rootUrl = 'http://i.jandan.net'; diff --git a/lib/v2/jewishmuseum/exhibitions.js b/lib/v2/jewishmuseum/exhibitions.js index ae5bc01cc..31a4dc321 100644 --- a/lib/v2/jewishmuseum/exhibitions.js +++ b/lib/v2/jewishmuseum/exhibitions.js @@ -1,4 +1,4 @@ -const buildData = require('@/utils/common-config'); +import buildData from '@/utils/common-config'; module.exports = async (ctx) => { const link = 'https://thejewishmuseum.org/exhibitions'; diff --git a/lib/v2/jike/topic.js b/lib/v2/jike/topic.js index e3ddbbf09..42605d4a3 100644 --- a/lib/v2/jike/topic.js +++ b/lib/v2/jike/topic.js @@ -3,7 +3,7 @@ import got from '@/utils/got'; const { topicDataHanding } = require('./utils'); import { load } from 'cheerio'; const dayjs = require('dayjs'); -const { constructTopicEntry } = require('@/v2/jike/utils'); +const { constructTopicEntry } = require('./utils'); const urlRegex = /(https?:\/\/[^\s"'<>]+)/g; diff --git a/lib/v2/jsu/jwc.js b/lib/v2/jsu/jwc.js index 87b8b264e..ea16780a7 100644 --- a/lib/v2/jsu/jwc.js +++ b/lib/v2/jsu/jwc.js @@ -3,7 +3,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; // 自订的 got import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; -const { getPageItemAndDate } = require('@/v2/jsu/utils'); +const { getPageItemAndDate } = require('./utils'); module.exports = async (ctx) => { const baseUrl = 'https://jwc.jsu.edu.cn/'; diff --git a/lib/v2/jsu/math.js b/lib/v2/jsu/math.js index 6d5533e7d..95c136bb0 100644 --- a/lib/v2/jsu/math.js +++ b/lib/v2/jsu/math.js @@ -3,7 +3,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; // 自订的 got import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; -const { getPageItemAndDate } = require('@/v2/jsu/utils'); +const { getPageItemAndDate } = require('./utils'); module.exports = async (ctx) => { const baseUrl = 'https://stxy.jsu.edu.cn/'; diff --git a/lib/v2/jsu/rjxy.js b/lib/v2/jsu/rjxy.js index fbba1274c..73d18a461 100644 --- a/lib/v2/jsu/rjxy.js +++ b/lib/v2/jsu/rjxy.js @@ -3,7 +3,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; // 自订的 got import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; -const { getPageItemAndDate } = require('@/v2/jsu/utils'); +const { getPageItemAndDate } = require('./utils'); module.exports = async (ctx) => { const baseUrl = 'https://rjxy.jsu.edu.cn/'; diff --git a/lib/v2/latepost/index.js b/lib/v2/latepost/index.js index f5176df2b..55c3316d7 100644 --- a/lib/v2/latepost/index.js +++ b/lib/v2/latepost/index.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; import timezone from '@/utils/timezone'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; /** * Convert an array into a dictionary object. diff --git a/lib/v2/line/utils.js b/lib/v2/line/utils.js index 343dcc00f..d91a1b1bc 100644 --- a/lib/v2/line/utils.js +++ b/lib/v2/line/utils.js @@ -1,7 +1,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; const baseUrl = 'https://today.line.me'; const parseList = (items) => diff --git a/lib/v2/liveuamap/index.js b/lib/v2/liveuamap/index.js index acfe8cf1b..7ddd96eae 100644 --- a/lib/v2/liveuamap/index.js +++ b/lib/v2/liveuamap/index.js @@ -1,6 +1,6 @@ import got from '@/utils/got'; import { load } from 'cheerio'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { let region = ctx.req.param('region') ?? 'ukraine'; diff --git a/lib/v2/lofter/user.js b/lib/v2/lofter/user.js index 8140ec9a1..2fb44da0e 100644 --- a/lib/v2/lofter/user.js +++ b/lib/v2/lofter/user.js @@ -1,6 +1,6 @@ import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { const name = ctx.req.param('name') ?? 'i'; diff --git a/lib/v2/mail/imap.js b/lib/v2/mail/imap.js index 3a4bcdcc9..4b8556613 100644 --- a/lib/v2/mail/imap.js +++ b/lib/v2/mail/imap.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; const { ImapFlow } = require('imapflow'); import { config } from '@/config'; const { simpleParser } = require('mailparser'); -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; module.exports = async (ctx) => { diff --git a/lib/v2/mangadex/index.js b/lib/v2/mangadex/index.js index db5c970ea..2cbb2ef70 100644 --- a/lib/v2/mangadex/index.js +++ b/lib/v2/mangadex/index.js @@ -1,12 +1,11 @@ import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -const { RequestInProgressError } = require('@/errors'); module.exports = async (ctx) => { const { id, lang } = ctx.params; let { data } = await got.get(`https://api.mangadex.org/manga/${id}`); if (data.result === 'error') { - throw new RequestInProgressError(data.errors[0].detail); + throw new Error(data.errors[0].detail); } data = data.data; let title; @@ -42,7 +41,7 @@ module.exports = async (ctx) => { } data = (await got.get(url)).data; if (data.result === 'error') { - throw new RequestInProgressError(data.errors[0].detail); + throw new Error(data.errors[0].detail); } ctx.set('data', { title: `${title} - MangaDex`, diff --git a/lib/v2/medsci/index.js b/lib/v2/medsci/index.js index 5a8a36ea1..af02d036a 100644 --- a/lib/v2/medsci/index.js +++ b/lib/v2/medsci/index.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; module.exports = async (ctx) => { let sid = ctx.req.param('sid') ?? ''; diff --git a/lib/v2/mingpao/index.js b/lib/v2/mingpao/index.js index e3ca19e11..4dd2686f6 100644 --- a/lib/v2/mingpao/index.js +++ b/lib/v2/mingpao/index.js @@ -1,11 +1,11 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const path = require('path'); -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; const renderFanBox = (media) => art(path.join(__dirname, 'templates/fancybox.art'), { diff --git a/lib/v2/mirror/index.js b/lib/v2/mirror/index.js index c0c504b6e..5ef1e43b3 100644 --- a/lib/v2/mirror/index.js +++ b/lib/v2/mirror/index.js @@ -4,7 +4,7 @@ const md = require('markdown-it')({ html: true, linkify: true, }); -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { const id = ctx.req.param('id'); diff --git a/lib/v2/modb/topic.js b/lib/v2/modb/topic.js index d7a319780..87f5571d9 100644 --- a/lib/v2/modb/topic.js +++ b/lib/v2/modb/topic.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import { load } from 'cheerio'; import got from '@/utils/got'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/v2/mydrivers/cid.js b/lib/v2/mydrivers/cid.js index 74a1e2451..c3c44926b 100644 --- a/lib/v2/mydrivers/cid.js +++ b/lib/v2/mydrivers/cid.js @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; const { rootUrl, rootRSSUrl, title, categories, getInfo, processItems } = require('./util'); diff --git a/lib/v2/myfigurecollection/activity.js b/lib/v2/myfigurecollection/activity.js index 25fa50779..cec493a0b 100644 --- a/lib/v2/myfigurecollection/activity.js +++ b/lib/v2/myfigurecollection/activity.js @@ -4,7 +4,7 @@ import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const path = require('path'); -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { const category = ctx.req.param('category') ?? '-1'; diff --git a/lib/v2/myfigurecollection/index.js b/lib/v2/myfigurecollection/index.js index 216d16d4a..92e3fd2dc 100644 --- a/lib/v2/myfigurecollection/index.js +++ b/lib/v2/myfigurecollection/index.js @@ -3,7 +3,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; import { art } from '@/utils/render'; const path = require('path'); -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; const shortcuts = { potd: 'picture/browse/potd/', diff --git a/lib/v2/newmuseum/exhibitions.js b/lib/v2/newmuseum/exhibitions.js index 5aaf1486e..063131a80 100644 --- a/lib/v2/newmuseum/exhibitions.js +++ b/lib/v2/newmuseum/exhibitions.js @@ -1,4 +1,4 @@ -const buildData = require('@/utils/common-config'); +import buildData from '@/utils/common-config'; module.exports = async (ctx) => { let link; diff --git a/lib/v2/newrank/wechat.js b/lib/v2/newrank/wechat.js index 7c73e4b13..2e71eaa67 100644 --- a/lib/v2/newrank/wechat.js +++ b/lib/v2/newrank/wechat.js @@ -1,5 +1,5 @@ import got from '@/utils/got'; -const { finishArticleItem } = require('@/utils/wechat-mp'); +import { finishArticleItem } from '@/utils/wechat-mp'; import { load } from 'cheerio'; const utils = require('./utils'); import { config } from '@/config'; diff --git a/lib/v2/nikkei/cn/index.js b/lib/v2/nikkei/cn/index.js index 3c8f51c99..dca357353 100644 --- a/lib/v2/nikkei/cn/index.js +++ b/lib/v2/nikkei/cn/index.js @@ -3,7 +3,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; module.exports = async (ctx) => { let language = ''; diff --git a/lib/v2/notion/database.js b/lib/v2/notion/database.js index 93747b94b..52d9dae27 100644 --- a/lib/v2/notion/database.js +++ b/lib/v2/notion/database.js @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; const { Client, isNotionClientError, APIErrorCode } = require('@notionhq/client'); -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; import got from '@/utils/got'; diff --git a/lib/v2/npr/full.js b/lib/v2/npr/full.js index b3e62db34..f9d2ede7d 100644 --- a/lib/v2/npr/full.js +++ b/lib/v2/npr/full.js @@ -1,5 +1,5 @@ import cache from '@/utils/cache'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import got from '@/utils/got'; import { load } from 'cheerio'; diff --git a/lib/v2/nua/utils.js b/lib/v2/nua/utils.js index 4f2883815..4eb81fb26 100644 --- a/lib/v2/nua/utils.js +++ b/lib/v2/nua/utils.js @@ -3,7 +3,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -const { fetchArticle } = require('@/utils/wechat-mp'); +import { fetchArticle } from '@/utils/wechat-mp'; const pageType = (href) => { if (!href.startsWith('http')) { diff --git a/lib/v2/nuaa/utils/pypasswaf.js b/lib/v2/nuaa/utils/pypasswaf.js index d8840dde5..e4896848f 100644 --- a/lib/v2/nuaa/utils/pypasswaf.js +++ b/lib/v2/nuaa/utils/pypasswaf.js @@ -1,4 +1,4 @@ -const puppeteerUtils = require('@/utils/puppeteer-utils'); +import { getCookies } from '@/utils/puppeteer-utils'; import puppeteer from '@/utils/puppeteer'; /** @@ -17,7 +17,7 @@ module.exports = async function getCookie(host) { waitUntil: 'networkidle0', }); - const cookie = await puppeteerUtils.getCookies(page); + const cookie = await getCookies(page); await browser.close(); return cookie; }; diff --git a/lib/v2/nytimes/index.js b/lib/v2/nytimes/index.js index ae1090540..344db4399 100644 --- a/lib/v2/nytimes/index.js +++ b/lib/v2/nytimes/index.js @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; const utils = require('./utils'); import { load } from 'cheerio'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/v2/onet/news.js b/lib/v2/onet/news.js index 858610325..76d75de92 100644 --- a/lib/v2/onet/news.js +++ b/lib/v2/onet/news.js @@ -1,5 +1,5 @@ import cache from '@/utils/cache'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/v2/oschina/news.js b/lib/v2/oschina/news.js index 7f5783708..fe01fc3d4 100644 --- a/lib/v2/oschina/news.js +++ b/lib/v2/oschina/news.js @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; import { load } from 'cheerio'; diff --git a/lib/v2/oschina/topic.js b/lib/v2/oschina/topic.js index 9f657595c..e7bc4b1a2 100644 --- a/lib/v2/oschina/topic.js +++ b/lib/v2/oschina/topic.js @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; import { load } from 'cheerio'; diff --git a/lib/v2/oschina/user.js b/lib/v2/oschina/user.js index aecb9a6df..14bf2fd4e 100644 --- a/lib/v2/oschina/user.js +++ b/lib/v2/oschina/user.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; module.exports = async (ctx) => { diff --git a/lib/v2/people/index.js b/lib/v2/people/index.js index 895056ca0..c5c0f1abb 100644 --- a/lib/v2/people/index.js +++ b/lib/v2/people/index.js @@ -4,7 +4,7 @@ import { load } from 'cheerio'; const iconv = require('iconv-lite'); import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { const { site = 'www' } = ctx.params; diff --git a/lib/v2/phoronix/index.js b/lib/v2/phoronix/index.js index edaa312e0..e345301e3 100644 --- a/lib/v2/phoronix/index.js +++ b/lib/v2/phoronix/index.js @@ -1,5 +1,5 @@ import cache from '@/utils/cache'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; import got from '@/utils/got'; const dayjs = require('dayjs'); diff --git a/lib/v2/pingwest/utils.js b/lib/v2/pingwest/utils.js index d2b0f229b..1c188b346 100644 --- a/lib/v2/pingwest/utils.js +++ b/lib/v2/pingwest/utils.js @@ -1,6 +1,6 @@ import { load } from 'cheerio'; import got from '@/utils/got'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const modifiedLink = (link) => (link.startsWith('http') ? link : `https:${link}`); diff --git a/lib/v2/pixiv/pixiv-got.js b/lib/v2/pixiv/pixiv-got.js index 98b2ec57e..4e36754ac 100644 --- a/lib/v2/pixiv/pixiv-got.js +++ b/lib/v2/pixiv/pixiv-got.js @@ -1,7 +1,7 @@ const tls = require('tls'); const ipRegex = require('ip-regex'); import got from '@/utils/got'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import { config } from '@/config'; async function dohResolve(name, jsonDohEndpoint) { diff --git a/lib/v2/pixiv/token.js b/lib/v2/pixiv/token.js index 85caa503f..180a8327b 100644 --- a/lib/v2/pixiv/token.js +++ b/lib/v2/pixiv/token.js @@ -1,5 +1,5 @@ import { config } from '@/config'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; const got = require('./pixiv-got'); const { maskHeader } = require('./constants'); diff --git a/lib/v2/pku/nsd.js b/lib/v2/pku/nsd.js index 8b5123b61..d8bc65896 100644 --- a/lib/v2/pku/nsd.js +++ b/lib/v2/pku/nsd.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const { finishArticleItem } = require('@/utils/wechat-mp'); +import { finishArticleItem } from '@/utils/wechat-mp'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://nsd.pku.edu.cn/sylm/gd/'; diff --git a/lib/v2/pnas/index.js b/lib/v2/pnas/index.js index cbb185d53..e4cbd5b6b 100644 --- a/lib/v2/pnas/index.js +++ b/lib/v2/pnas/index.js @@ -4,9 +4,9 @@ import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const path = require('path'); -const { setCookies } = require('@/utils/puppeteer-utils'); +import { setCookies } from '@/utils/puppeteer-utils'; const { CookieJar } = require('tough-cookie'); -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import puppeteer from '@/utils/puppeteer'; module.exports = async (ctx) => { diff --git a/lib/v2/pornhub/category-url.js b/lib/v2/pornhub/category-url.js index 7e97325b8..b34f98d85 100644 --- a/lib/v2/pornhub/category-url.js +++ b/lib/v2/pornhub/category-url.js @@ -1,6 +1,6 @@ import got from '@/utils/got'; import { load } from 'cheerio'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; const { headers, parseItems } = require('./utils'); module.exports = async (ctx) => { diff --git a/lib/v2/pornhub/model.js b/lib/v2/pornhub/model.js index 36751eb66..5106d76a3 100644 --- a/lib/v2/pornhub/model.js +++ b/lib/v2/pornhub/model.js @@ -1,6 +1,6 @@ import got from '@/utils/got'; import { load } from 'cheerio'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; const { headers, parseItems } = require('./utils'); module.exports = async (ctx) => { diff --git a/lib/v2/pornhub/pornstar.js b/lib/v2/pornhub/pornstar.js index 9fb3170d5..1debe3f12 100644 --- a/lib/v2/pornhub/pornstar.js +++ b/lib/v2/pornhub/pornstar.js @@ -1,6 +1,6 @@ import got from '@/utils/got'; import { load } from 'cheerio'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; const { headers, parseItems } = require('./utils'); module.exports = async (ctx) => { diff --git a/lib/v2/pornhub/users.js b/lib/v2/pornhub/users.js index 2aa2d11e2..4a78b77f6 100644 --- a/lib/v2/pornhub/users.js +++ b/lib/v2/pornhub/users.js @@ -1,6 +1,6 @@ import got from '@/utils/got'; import { load } from 'cheerio'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; const { headers, parseItems } = require('./utils'); module.exports = async (ctx) => { diff --git a/lib/v2/pwc/sustainability.js b/lib/v2/pwc/sustainability.js index 6c1bf2813..c4bd34745 100644 --- a/lib/v2/pwc/sustainability.js +++ b/lib/v2/pwc/sustainability.js @@ -1,5 +1,5 @@ import { load } from 'cheerio'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/v2/qbitai/category.js b/lib/v2/qbitai/category.js index 606b33792..c3987a9f2 100644 --- a/lib/v2/qbitai/category.js +++ b/lib/v2/qbitai/category.js @@ -1,4 +1,4 @@ -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/v2/qbitai/tag.js b/lib/v2/qbitai/tag.js index 6eb566017..bbedb1615 100644 --- a/lib/v2/qbitai/tag.js +++ b/lib/v2/qbitai/tag.js @@ -1,4 +1,4 @@ -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/v2/qidian/author.js b/lib/v2/qidian/author.js index 6747f9815..7a96d81c3 100644 --- a/lib/v2/qidian/author.js +++ b/lib/v2/qidian/author.js @@ -1,6 +1,6 @@ import got from '@/utils/got'; import { load } from 'cheerio'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const path = require('path'); import timezone from '@/utils/timezone'; diff --git a/lib/v2/quicker/qa.js b/lib/v2/quicker/qa.js index 9ab92f761..42d98aa5b 100644 --- a/lib/v2/quicker/qa.js +++ b/lib/v2/quicker/qa.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; import timezone from '@/utils/timezone'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; module.exports = async (ctx) => { const category = ctx.req.param('category') ?? 'all'; diff --git a/lib/v2/quicker/share.js b/lib/v2/quicker/share.js index ef50428f2..a05d68c5d 100644 --- a/lib/v2/quicker/share.js +++ b/lib/v2/quicker/share.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; import timezone from '@/utils/timezone'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; module.exports = async (ctx) => { const category = ctx.req.param('category') ?? 'Recent'; diff --git a/lib/v2/quicker/user.js b/lib/v2/quicker/user.js index 3e4222c40..8c11b31c9 100644 --- a/lib/v2/quicker/user.js +++ b/lib/v2/quicker/user.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; import timezone from '@/utils/timezone'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; module.exports = async (ctx) => { const category = ctx.req.param('category'); diff --git a/lib/v2/sdu/cs.js b/lib/v2/sdu/cs.js index e5eabf48d..e65336819 100644 --- a/lib/v2/sdu/cs.js +++ b/lib/v2/sdu/cs.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -const { finishArticleItem } = require('@/utils/wechat-mp'); +import { finishArticleItem } from '@/utils/wechat-mp'; const host = 'https://www.cs.sdu.edu.cn/'; const typelist = ['学院公告', '学术报告', '科技简讯']; diff --git a/lib/v2/segmentfault/utils.js b/lib/v2/segmentfault/utils.js index 582962e79..a0c00ad7a 100644 --- a/lib/v2/segmentfault/utils.js +++ b/lib/v2/segmentfault/utils.js @@ -3,7 +3,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { config } from '@/config'; -const { getAcwScV2ByArg1 } = require('@/v2/5eplay/utils'); +const { getAcwScV2ByArg1 } = require('../5eplay/utils'); const host = 'https://segmentfault.com'; diff --git a/lib/v2/sjtu/gs.js b/lib/v2/sjtu/gs.js index f08a04c98..56bd37f0c 100644 --- a/lib/v2/sjtu/gs.js +++ b/lib/v2/sjtu/gs.js @@ -3,7 +3,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -const { fetchArticle } = require('@/utils/wechat-mp'); +import { fetchArticle } from '@/utils/wechat-mp'; module.exports = async (ctx) => { const type = ctx.req.param('type'); diff --git a/lib/v2/slowmist/slowmist.js b/lib/v2/slowmist/slowmist.js index c7fe29174..421c1f24b 100644 --- a/lib/v2/slowmist/slowmist.js +++ b/lib/v2/slowmist/slowmist.js @@ -1,7 +1,7 @@ import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://www.slowmist.com'; -const { finishArticleItem } = require('@/utils/wechat-mp'); +import { finishArticleItem } from '@/utils/wechat-mp'; module.exports = async (ctx) => { let type = ctx.req.param('type'); diff --git a/lib/v2/solidot/main.js b/lib/v2/solidot/main.js index c1d94765f..489b97859 100644 --- a/lib/v2/solidot/main.js +++ b/lib/v2/solidot/main.js @@ -7,7 +7,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; // get web content import { load } from 'cheerio'; // html parser const get_article = require('./_article'); -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { const type = ctx.req.param('type') ?? 'www'; diff --git a/lib/v2/stratechery/index.js b/lib/v2/stratechery/index.js index 8b26aab02..8b5b3884e 100644 --- a/lib/v2/stratechery/index.js +++ b/lib/v2/stratechery/index.js @@ -1,4 +1,4 @@ -const buildData = require('@/utils/common-config'); +import buildData from '@/utils/common-config'; module.exports = async (ctx) => { const link = 'https://stratechery.com/'; diff --git a/lib/v2/sysu/ygafz.js b/lib/v2/sysu/ygafz.js index 1d77655f3..12dc82381 100644 --- a/lib/v2/sysu/ygafz.js +++ b/lib/v2/sysu/ygafz.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; const { CookieJar } = require('tough-cookie'); import puppeteer from '@/utils/puppeteer'; diff --git a/lib/v2/techcrunch/news.js b/lib/v2/techcrunch/news.js index 86f4aaec3..d8af4b1bd 100644 --- a/lib/v2/techcrunch/news.js +++ b/lib/v2/techcrunch/news.js @@ -1,5 +1,5 @@ import cache from '@/utils/cache'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import got from '@/utils/got'; import { load } from 'cheerio'; const host = 'https://techcrunch.com'; diff --git a/lib/v2/telegram/channel.js b/lib/v2/telegram/channel.js index d4aff24bf..2fd1e5cc7 100644 --- a/lib/v2/telegram/channel.js +++ b/lib/v2/telegram/channel.js @@ -6,7 +6,7 @@ import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const path = require('path'); const querystring = require('querystring'); -const { fallback, queryToBoolean } = require('@/utils/readable-social'); +import { fallback, queryToBoolean } from '@/utils/readable-social'; /* message types */ const REPLY = 'REPLY'; diff --git a/lib/v2/theverge/index.js b/lib/v2/theverge/index.js index ec594bdf0..dd55fad4e 100644 --- a/lib/v2/theverge/index.js +++ b/lib/v2/theverge/index.js @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; module.exports = async (ctx) => { diff --git a/lib/v2/tiktok/user.js b/lib/v2/tiktok/user.js index bd57c7ebd..b2d80478f 100644 --- a/lib/v2/tiktok/user.js +++ b/lib/v2/tiktok/user.js @@ -3,7 +3,7 @@ import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const path = require('path'); -const { queryToBoolean } = require('@/utils/readable-social'); +import { queryToBoolean } from '@/utils/readable-social'; import puppeteer from '@/utils/puppeteer'; const baseUrl = 'https://www.tiktok.com'; diff --git a/lib/v2/tju/oaa/index.js b/lib/v2/tju/oaa/index.js index f22300485..781e2b541 100644 --- a/lib/v2/tju/oaa/index.js +++ b/lib/v2/tju/oaa/index.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const { finishArticleItem } = require('@/utils/wechat-mp'); +import { finishArticleItem } from '@/utils/wechat-mp'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/v2/toodaylab/index.js b/lib/v2/toodaylab/index.js index 3fcd63fdc..90dbcf8a3 100644 --- a/lib/v2/toodaylab/index.js +++ b/lib/v2/toodaylab/index.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; import timezone from '@/utils/timezone'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; module.exports = async (ctx) => { const { params = 'posts' } = ctx.params; diff --git a/lib/v2/twitter/api-fallback-common.js b/lib/v2/twitter/api-fallback-common.js index dab4a50f5..0107e9611 100644 --- a/lib/v2/twitter/api-fallback-common.js +++ b/lib/v2/twitter/api-fallback-common.js @@ -1,5 +1,5 @@ import { config } from '@/config'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; const utils = require('./utils'); module.exports = async (ctx, devApiImpl, webApiImpl) => { diff --git a/lib/v2/twitter/collection.js b/lib/v2/twitter/collection.js index cba32cb77..8ff46a84a 100644 --- a/lib/v2/twitter/collection.js +++ b/lib/v2/twitter/collection.js @@ -2,7 +2,7 @@ const utils = require('./utils'); import { config } from '@/config'; const T = {}; const { TwitterApi } = require('twitter-api-v2'); -const { fallback, queryToBoolean } = require('@/utils/readable-social'); +import { fallback, queryToBoolean } from '@/utils/readable-social'; module.exports = async (ctx) => { const uid = ctx.req.param('uid'); diff --git a/lib/v2/twitter/followings.js b/lib/v2/twitter/followings.js index 0952c976f..6e7baf6c6 100644 --- a/lib/v2/twitter/followings.js +++ b/lib/v2/twitter/followings.js @@ -2,7 +2,7 @@ const utils = require('./utils'); import { config } from '@/config'; const T = {}; const { TwitterApi } = require('twitter-api-v2'); -const { fallback, queryToBoolean } = require('@/utils/readable-social'); +import { fallback, queryToBoolean } from '@/utils/readable-social'; module.exports = async (ctx) => { const id = ctx.req.param('id'); diff --git a/lib/v2/twitter/utils.js b/lib/v2/twitter/utils.js index e5037e5d3..3ab15451d 100644 --- a/lib/v2/twitter/utils.js +++ b/lib/v2/twitter/utils.js @@ -1,7 +1,7 @@ const URL = require('url'); import { config } from '@/config'; const { TwitterApi } = require('twitter-api-v2'); -const { fallback, queryToBoolean, queryToInteger } = require('@/utils/readable-social'); +import { fallback, queryToBoolean, queryToInteger } from '@/utils/readable-social'; import { parseDate } from '@/utils/parse-date'; const getQueryParams = (url) => URL.parse(url, true).query; diff --git a/lib/v2/twitter/web-api/login.js b/lib/v2/twitter/web-api/login.js index 1fdf10d08..7d548180c 100644 --- a/lib/v2/twitter/web-api/login.js +++ b/lib/v2/twitter/web-api/login.js @@ -6,7 +6,7 @@ const crypto = require('crypto'); import { config } from '@/config'; const { v5: uuidv5 } = require('uuid'); const { authenticator } = require('otplib'); -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; const NAMESPACE = 'd41d092b-b007-48f7-9129-e9538d2d8fe9'; const username = config.twitter.username; diff --git a/lib/v2/twitter/web-api/tweet.js b/lib/v2/twitter/web-api/tweet.js index 343e8c088..1998d02e5 100644 --- a/lib/v2/twitter/web-api/tweet.js +++ b/lib/v2/twitter/web-api/tweet.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; // import { config } from '@/config'; const { getUser, getUserTweet } = require('./twitter-api'); const utils = require('../utils'); -const { fallback, queryToBoolean } = require('@/utils/readable-social'); +import { fallback, queryToBoolean } from '@/utils/readable-social'; import { config } from '@/config'; const { initToken } = require('./token'); diff --git a/lib/v2/twitter/web-api/twitter-api.js b/lib/v2/twitter/web-api/twitter-api.js index 0ae93cab1..2883a77fe 100644 --- a/lib/v2/twitter/web-api/twitter-api.js +++ b/lib/v2/twitter/web-api/twitter-api.js @@ -1,6 +1,6 @@ const { baseUrl, gqlMap, gqlFeatures, consumerKey, consumerSecret } = require('./constants'); import { config } from '@/config'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import got from '@/utils/got'; const OAuth = require('oauth-1.0a'); const CryptoJS = require('crypto-js'); diff --git a/lib/v2/uchicago/current.js b/lib/v2/uchicago/current.js index ce68dac58..415db406b 100644 --- a/lib/v2/uchicago/current.js +++ b/lib/v2/uchicago/current.js @@ -1,8 +1,8 @@ import cache from '@/utils/cache'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -const { getCookies, setCookies } = require('@/utils/puppeteer-utils'); -const logger = require('@/utils/logger'); +import { getCookies, setCookies } from '@/utils/puppeteer-utils'; +import logger from '@/utils/logger'; import puppeteer from '@/utils/puppeteer'; module.exports = async (ctx) => { diff --git a/lib/v2/uptimerobot/rss.js b/lib/v2/uptimerobot/rss.js index c9623f88e..a1e223bee 100644 --- a/lib/v2/uptimerobot/rss.js +++ b/lib/v2/uptimerobot/rss.js @@ -2,7 +2,7 @@ const Parser = require('rss-parser'); import { art } from '@/utils/render'; const path = require('path'); const dayjs = require('dayjs'); -const { fallback, queryToBoolean } = require('@/utils/readable-social'); +import { fallback, queryToBoolean } from '@/utils/readable-social'; const titleRegex = /(.+)\s+is\s+([A-Z]+)\s+\((.+)\)/; diff --git a/lib/v2/ustb/yjsy/news.js b/lib/v2/ustb/yjsy/news.js index a098a0933..35ed864e6 100644 --- a/lib/v2/ustb/yjsy/news.js +++ b/lib/v2/ustb/yjsy/news.js @@ -2,7 +2,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; const iconv = require('iconv-lite'); import { parseDate } from '@/utils/parse-date'; -// const logger = require('@/utils/logger'); +// import logger from '@/utils/logger'; module.exports = async (ctx) => { const type = ctx.req.param('type'); diff --git a/lib/v2/wechat/ce.js b/lib/v2/wechat/ce.js index b89132d60..a64e31675 100644 --- a/lib/v2/wechat/ce.js +++ b/lib/v2/wechat/ce.js @@ -1,8 +1,8 @@ import cache from '@/utils/cache'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import got from '@/utils/got'; import { load } from 'cheerio'; -const { fixArticleContent } = require('@/utils/wechat-mp'); +import { fixArticleContent } from '@/utils/wechat-mp'; import { parseDate } from '@/utils/parse-date'; // any UA containing "RSS" can pass the check diff --git a/lib/v2/wechat/data258.js b/lib/v2/wechat/data258.js index ddc0e1a74..63b301b1c 100644 --- a/lib/v2/wechat/data258.js +++ b/lib/v2/wechat/data258.js @@ -3,8 +3,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -const { finishArticleItem } = require('@/utils/wechat-mp'); -const { RequestInProgressError } = require('@/errors'); +import { finishArticleItem } from '@/utils/wechat-mp'; import wait from '@/utils/wait'; const parsePage = ($item, hyperlinkSelector, timeSelector) => { @@ -22,7 +21,7 @@ const parsePage = ($item, hyperlinkSelector, timeSelector) => { module.exports = async (ctx) => { // !!! here we must use a lock to prevent other requests to break the anti-anti-crawler workarounds !!! if ((await cache.get('data258:lock', false)) === '1') { - throw new RequestInProgressError('Another request is in progress, please try again later.'); + throw new Error('Another request is in progress, please try again later.'); } // !!! here no need to acquire the lock, because the MP/category page has no crawler detection !!! @@ -56,7 +55,7 @@ module.exports = async (ctx) => { // !!! double-check !!! if ((await cache.get('data258:lock', false)) === '1') { - throw new RequestInProgressError('Another request is in progress, please try again later.'); + throw new Error('Another request is in progress, please try again later.'); } else { // !!! here we acquire the lock because the jump page has crawler detection !!! await cache.set('data258:lock', '1', 60); diff --git a/lib/v2/wechat/ershcimi.js b/lib/v2/wechat/ershcimi.js index c556e872b..b0b0bed5a 100644 --- a/lib/v2/wechat/ershcimi.js +++ b/lib/v2/wechat/ershcimi.js @@ -1,6 +1,6 @@ import got from '@/utils/got'; import { load } from 'cheerio'; -const { finishArticleItem } = require('@/utils/wechat-mp'); +import { finishArticleItem } from '@/utils/wechat-mp'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/v2/wechat/feeddd.js b/lib/v2/wechat/feeddd.js index ffa7ec663..1f9036870 100644 --- a/lib/v2/wechat/feeddd.js +++ b/lib/v2/wechat/feeddd.js @@ -1,6 +1,6 @@ import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -const { finishArticleItem } = require('@/utils/wechat-mp'); +import { finishArticleItem } from '@/utils/wechat-mp'; module.exports = async (ctx) => { const id = ctx.req.param('id'); diff --git a/lib/v2/wechat/feeds.js b/lib/v2/wechat/feeds.js index 175d3d3cb..1bf3c96aa 100644 --- a/lib/v2/wechat/feeds.js +++ b/lib/v2/wechat/feeds.js @@ -1,5 +1,5 @@ -const parser = require('@/utils/rss-parser'); -const { finishArticleItem } = require('@/utils/wechat-mp'); +import parser from '@/utils/rss-parser'; +import { finishArticleItem } from '@/utils/wechat-mp'; module.exports = async (ctx) => { const { id } = ctx.params; diff --git a/lib/v2/wechat/mp.js b/lib/v2/wechat/mp.js index 50fa4cdbd..b8d9f6922 100755 --- a/lib/v2/wechat/mp.js +++ b/lib/v2/wechat/mp.js @@ -1,7 +1,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; const dayjs = require('dayjs'); -const { finishArticleItem } = require('@/utils/wechat-mp'); +import { finishArticleItem } from '@/utils/wechat-mp'; module.exports = async (ctx) => { const { biz, hid, cid } = ctx.params; diff --git a/lib/v2/wechat/msgalbum.js b/lib/v2/wechat/msgalbum.js index 4ddc5f23d..fd2b13fcf 100644 --- a/lib/v2/wechat/msgalbum.js +++ b/lib/v2/wechat/msgalbum.js @@ -1,7 +1,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; const dayjs = require('dayjs'); -const { finishArticleItem } = require('@/utils/wechat-mp'); +import { finishArticleItem } from '@/utils/wechat-mp'; module.exports = async (ctx) => { const { biz, aid } = ctx.params; diff --git a/lib/v2/wechat/sogou.js b/lib/v2/wechat/sogou.js index 85d180f80..03118f6ff 100644 --- a/lib/v2/wechat/sogou.js +++ b/lib/v2/wechat/sogou.js @@ -1,7 +1,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; const host = 'https://weixin.sogou.com'; -const { finishArticleItem } = require('@/utils/wechat-mp'); +import { finishArticleItem } from '@/utils/wechat-mp'; module.exports = async (ctx) => { const wechatId = ctx.req.param('id'); let url = `${host}/weixin`; diff --git a/lib/v2/wechat/tgchannel.js b/lib/v2/wechat/tgchannel.js index 338add822..2a5fc0ecd 100644 --- a/lib/v2/wechat/tgchannel.js +++ b/lib/v2/wechat/tgchannel.js @@ -1,6 +1,6 @@ import got from '@/utils/got'; import { load } from 'cheerio'; -const { finishArticleItem } = require('@/utils/wechat-mp'); +import { finishArticleItem } from '@/utils/wechat-mp'; module.exports = async (ctx) => { const id = ctx.req.param('id'); diff --git a/lib/v2/wechat/wechat2rss.js b/lib/v2/wechat/wechat2rss.js index 81b27921e..753f83c68 100644 --- a/lib/v2/wechat/wechat2rss.js +++ b/lib/v2/wechat/wechat2rss.js @@ -1,6 +1,6 @@ -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import { parseDate } from '@/utils/parse-date'; -const { finishArticleItem } = require('@/utils/wechat-mp'); +import { finishArticleItem } from '@/utils/wechat-mp'; module.exports = async (ctx) => { const { id } = ctx.params; diff --git a/lib/v2/weibo/friends.js b/lib/v2/weibo/friends.js index 4739a6428..4e5f823c9 100644 --- a/lib/v2/weibo/friends.js +++ b/lib/v2/weibo/friends.js @@ -3,7 +3,7 @@ const querystring = require('querystring'); import got from '@/utils/got'; import { config } from '@/config'; const weiboUtils = require('./utils'); -const { fallback, queryToBoolean } = require('@/utils/readable-social'); +import { fallback, queryToBoolean } from '@/utils/readable-social'; module.exports = async (ctx) => { if (!config.weibo.cookies) { diff --git a/lib/v2/weibo/group.js b/lib/v2/weibo/group.js index bb55b3f6f..5902de7de 100644 --- a/lib/v2/weibo/group.js +++ b/lib/v2/weibo/group.js @@ -3,7 +3,7 @@ const querystring = require('querystring'); import got from '@/utils/got'; import { config } from '@/config'; const weiboUtils = require('./utils'); -const { fallback, queryToBoolean } = require('@/utils/readable-social'); +import { fallback, queryToBoolean } from '@/utils/readable-social'; module.exports = async (ctx) => { if (!config.weibo.cookies) { diff --git a/lib/v2/weibo/keyword.js b/lib/v2/weibo/keyword.js index 87aece86e..8d315fdbc 100644 --- a/lib/v2/weibo/keyword.js +++ b/lib/v2/weibo/keyword.js @@ -3,7 +3,7 @@ const querystring = require('querystring'); import got from '@/utils/got'; const weiboUtils = require('./utils'); import timezone from '@/utils/timezone'; -const { fallback, queryToBoolean } = require('@/utils/readable-social'); +import { fallback, queryToBoolean } from '@/utils/readable-social'; import { config } from '@/config'; module.exports = async (ctx) => { diff --git a/lib/v2/weibo/oasis/user.js b/lib/v2/weibo/oasis/user.js index 476a63ba8..52046e854 100644 --- a/lib/v2/weibo/oasis/user.js +++ b/lib/v2/weibo/oasis/user.js @@ -1,4 +1,4 @@ -const buildData = require('@/utils/common-config'); +import buildData from '@/utils/common-config'; const weiboUtils = require('../utils'); module.exports = async (ctx) => { diff --git a/lib/v2/weibo/timeline.js b/lib/v2/weibo/timeline.js index ec1133866..8a27dea67 100644 --- a/lib/v2/weibo/timeline.js +++ b/lib/v2/weibo/timeline.js @@ -4,7 +4,7 @@ import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { config } from '@/config'; const weiboUtils = require('./utils'); -const { fallback, queryToBoolean } = require('@/utils/readable-social'); +import { fallback, queryToBoolean } from '@/utils/readable-social'; module.exports = async (ctx) => { const uid = ctx.req.param('uid'); diff --git a/lib/v2/weibo/user.js b/lib/v2/weibo/user.js index 7056bd6d2..4bd1c7fa1 100644 --- a/lib/v2/weibo/user.js +++ b/lib/v2/weibo/user.js @@ -5,7 +5,7 @@ const weiboUtils = require('./utils'); import { config } from '@/config'; import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -const { fallback, queryToBoolean } = require('@/utils/readable-social'); +import { fallback, queryToBoolean } from '@/utils/readable-social'; module.exports = async (ctx) => { const uid = ctx.req.param('uid'); diff --git a/lib/v2/weibo/utils.js b/lib/v2/weibo/utils.js index 4793463f1..76bec6546 100644 --- a/lib/v2/weibo/utils.js +++ b/lib/v2/weibo/utils.js @@ -2,7 +2,7 @@ import cache from '@/utils/cache'; const querystring = require('querystring'); import got from '@/utils/got'; import { load } from 'cheerio'; -const { fallback, queryToBoolean, queryToInteger } = require('@/utils/readable-social'); +import { fallback, queryToBoolean, queryToInteger } from '@/utils/readable-social'; const weiboUtils = { formatTitle: (html) => diff --git a/lib/v2/xiaohongshu/util.js b/lib/v2/xiaohongshu/util.js index f33b670cc..914630d84 100644 --- a/lib/v2/xiaohongshu/util.js +++ b/lib/v2/xiaohongshu/util.js @@ -1,5 +1,5 @@ import { config } from '@/config'; -const logger = require('@/utils/logger'); +import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/v2/xunhupay/index.js b/lib/v2/xunhupay/index.js index f2d4e3ba4..9f027ab98 100644 --- a/lib/v2/xunhupay/index.js +++ b/lib/v2/xunhupay/index.js @@ -1,4 +1,4 @@ -const buildData = require('@/utils/common-config'); +import buildData from '@/utils/common-config'; const baseUrl = 'https://www.xunhupay.com'; module.exports = async (ctx) => { diff --git a/lib/v2/yahoo/news/us/index.js b/lib/v2/yahoo/news/us/index.js index 7c6cfe9af..b8717291c 100644 --- a/lib/v2/yahoo/news/us/index.js +++ b/lib/v2/yahoo/news/us/index.js @@ -1,8 +1,8 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; -const parser = require('@/utils/rss-parser'); +import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { const region = ctx.req.param('region') === 'en' ? '' : ctx.req.param('region').toLowerCase(); diff --git a/lib/v2/yystv/category.js b/lib/v2/yystv/category.js index 4720692ad..5b7fd632e 100644 --- a/lib/v2/yystv/category.js +++ b/lib/v2/yystv/category.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; module.exports = async (ctx) => { const category = ctx.req.param('category'); diff --git a/lib/v2/zcool/user.js b/lib/v2/zcool/user.js index 024bcd076..5295de56d 100644 --- a/lib/v2/zcool/user.js +++ b/lib/v2/zcool/user.js @@ -3,7 +3,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const { extractArticle, extractWork } = require('./utils'); -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { const { uid } = ctx.params; diff --git a/lib/v2/zhubai/index.js b/lib/v2/zhubai/index.js index 8505e9b1a..93fce9105 100644 --- a/lib/v2/zhubai/index.js +++ b/lib/v2/zhubai/index.js @@ -1,6 +1,6 @@ import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -const { isValidHost } = require('@/utils/valid-host'); +import { isValidHost } from '@/utils/valid-host'; module.exports = async (ctx) => { const { id } = ctx.params; diff --git a/lib/v2/zhubai/top20.js b/lib/v2/zhubai/top20.js index 6556063b0..bec737d8b 100644 --- a/lib/v2/zhubai/top20.js +++ b/lib/v2/zhubai/top20.js @@ -1,7 +1,7 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; import { load } from 'cheerio'; -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const path = require('path');