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 ccdda40471..7220f4d95b 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 52b60d2190..a6c77fc92c 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 b74bb01268..588fcad5be 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 ea02104e02..de3d4330a9 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 265f50c64d..f130c6d398 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 4d3489659d..a4fd3b640c 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 ef51d10e07..db957e9a75 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 dadfe41df7..cc4190e927 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 f2d155efca..906bf1ffb7 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 cb8d644318..d14f41d1ec 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 740672b208..99fe5f8175 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 4edf76d8c6..2d59bff023 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 71fe0c05a0..60963e0e35 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 719fdd599f..2dfa7cd486 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 3835d7a03a..b061f0a4ae 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 05f08504ca..47901f3ed3 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 313c242d45..cbe8e4b9f9 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 51a28192bb..17299b2964 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 9157a611af..a693cabcdc 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 9bd9e42772..b4435b0824 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 a26c16e2ca..6336bf4a13 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 7d43c65b8c..70c3c41f07 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 8bfb7b336c..519d47c19c 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 a857e6af0c..5779100ae8 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 674ee3359a..b036c98d1e 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 5398f354b8..61df41962f 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 83a3f47842..7a0d9f379e 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 6f21fe699f..1c134cb755 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 7cdd03d3c8..af99ca4545 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 c202f4b45c..b97447e7e2 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 7d5e2476a7..01c372ff08 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 bdeea7dc46..ba023fe440 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 1866ddd51b..21411ce7f9 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 3526596a4e..9af5c90575 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 18a21ef756..cfaebbe281 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 a2a854ba5e..3f34f36b0c 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 1aa200da08..07af9906db 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 2ece2c84b4..27b91186b6 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 fb218d45ce..6bf3f17386 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 56e5660d9e..c82debfa1a 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 50f0c482f9..0dbee2951f 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 b2fffa2ca3..009b65a8e0 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 77b7566386..78ca8ab45d 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 e19377a9cd..b4fd67bb5a 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 7a9670e224..4c68849d0d 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 6e09a87edb..ada8385582 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 2861d111c3..1ac58601fe 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 34071b3239..2c3b6b9f3f 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 8c1bd77028..ddd129d99e 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 e98467a1a2..01b9383f7e 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 1ed4497a02..06393c38c8 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 7cbf49d765..8f5a3aa039 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 7723977849..5622a7cc00 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 124b406923..52ec827a88 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 e0a83ed449..7d1ea3a84d 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 013b581286..6867394e37 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 fc1bbe4a22..0dc3aa1f5c 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 0f71a7de56..67ce94625c 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 c9a8167b79..7bbaddf2dc 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 98335b88ad..0459995691 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 36e2130d65..2048e56a26 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 7fc5cc73cd..bdb508d564 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 d8c850d590..ab418875c7 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 e71007c6b1..343cd4e06a 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 4020b28b22..abbe8fc2ae 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 3f6aa93239..4b3455a9e2 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 a365f8ef09..e29be5dc74 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 47f750e310..3a87d3a1d2 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 465d610a21..0e35b11943 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 bb032a53c2..0d3753f67e 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 ccf6b29fc7..e75fa17c89 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 a2167576fa..e578c5e390 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 0cf3e59067..9cfc87fc1f 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 d96f5ff94d..0e6a6b7ac4 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 ae5bc01cc4..31a4dc3218 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 e3ddbbf098..42605d4a3e 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 87b8b264e1..ea16780a75 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 6d5533e7d8..95c136bb0f 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 fbba1274c0..73d18a4618 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 f5176df2bd..55c3316d7f 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 343dcc00ff..d91a1b1bc2 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 acfe8cf1bf..7ddd96eaec 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 8140ec9a16..2fb44da0ed 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 3a4bcdcc90..4b85566137 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 db5c970eac..2cbb2ef704 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 5a8a36ea1b..af02d036aa 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 e3ca19e11f..4dd2686f64 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 c0c504b6ed..5ef1e43b32 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 d7a3197801..87f5571d9b 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 74a1e24516..c3c44926bf 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 25fa507793..cec493a0bb 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 216d16d4a3..92e3fd2dc3 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 5aaf1486ec..063131a808 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 7c73e4b130..2e71eaa67e 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 3c8f51c99b..dca357353a 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 93747b94b2..52d9dae272 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 b3e62db342..f9d2ede7d3 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 4f2883815a..4eb81fb268 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 d8840dde5a..e4896848fe 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 ae10905409..344db4399c 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 8586103250..76d75de92d 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 7f57837087..fe01fc3d49 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 9f657595c3..e7bc4b1a25 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 aecb9a6dfd..14bf2fd4e3 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 895056ca05..c5c0f1abb3 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 edaa312e01..e345301e3b 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 d2b0f229b4..1c188b3464 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 98b2ec57eb..4e36754ac3 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 85caa503f0..180a8327b4 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 8b5123b610..d8bc65896b 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 cbb185d539..e4cbd5b6b8 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 7e97325b8d..b34f98d859 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 36751eb66f..5106d76a34 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 9fb3170d5c..1debe3f125 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 2aa2d11e2f..4a78b77f6e 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 6c1bf2813f..c4bd347457 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 606b33792a..c3987a9f22 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 6eb5660173..bbedb16151 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 6747f9815d..7a96d81c3f 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 9ab92f7612..42d98aa5b7 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 ef50428f2b..a05d68c5d6 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 3e4222c40a..8c11b31c9d 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 e5eabf48d1..e65336819f 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 582962e79b..a0c00ad7ae 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 f08a04c989..56bd37f0cc 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 c7fe291742..421c1f24b2 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 c1d94765fa..489b978598 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 8b26aab028..8b5b3884e2 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 1d77655f3e..12dc823818 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 86f4aaec3f..d8af4b1bd8 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 d4aff24bfb..2fd1e5cc7e 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 ec594bdf0a..dd55fad4ee 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 bd57c7ebde..b2d80478fd 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 f223004854..781e2b5416 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 3fcd63fdce..90dbcf8a36 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 dab4a50f5d..0107e96116 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 cba32cb778..8ff46a84ad 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 0952c976ff..6e7baf6c6f 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 e5037e5d3c..3ab15451d7 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 1fdf10d086..7d548180c5 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 343e8c0886..1998d02e59 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 0ae93cab12..2883a77fe7 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 ce68dac587..415db406b2 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 c9623f88ed..a1e223bee3 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 a098a09336..35ed864e6a 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 b89132d60d..a64e316755 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 ddc0e1a74f..63b301b1c6 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 c556e872bb..b0b0bed5a8 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 ffa7ec6637..1f90368704 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 175d3d3cb8..1bf3c96aa2 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 50fa4cdbdc..b8d9f6922a 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 4ddc5f23d6..fd2b13fcfd 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 85d180f805..03118f6ff5 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 338add822b..2a5fc0ecd8 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 81b27921ee..753f83c684 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 4739a6428f..4e5f823c98 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 bb55b3f6f2..5902de7deb 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 87aece86e3..8d315fdbce 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 476a63ba8e..52046e8546 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 ec1133866c..8a27dea671 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 7056bd6d27..4bd1c7fa1b 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 4793463f1e..76bec65460 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 f33b670cca..914630d847 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 f2d4e3ba43..9f027ab980 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 7c6cfe9af4..b8717291c2 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 4720692adb..5b7fd632e3 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 024bcd076e..5295de56d6 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 8505e9b1ab..93fce91053 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 6556063b04..bec737d8bd 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');