diff --git a/lib/routes/12306/zxdt.js b/lib/routes/12306/zxdt.js index 58d96a5f2..d3e7c0183 100644 --- a/lib/routes/12306/zxdt.js +++ b/lib/routes/12306/zxdt.js @@ -1,4 +1,4 @@ -const axios = require('@/utils/axios'); +const got = require('@/utils/got'); const cheerio = require('cheerio'); const url = require('url'); @@ -12,7 +12,7 @@ module.exports = async (ctx) => { link = `https://www.12306.cn/mormhweb/1/${id}/index_fl.html`; } - const response = await axios.get(link); + const response = await got.get(link); const data = response.data; const $ = cheerio.load(data); const name = $('div.nav_center > a:nth-child(4)').text(); @@ -46,7 +46,7 @@ module.exports = async (ctx) => { return Promise.resolve(JSON.parse(cache)); } - const response = await axios.get(itemUrl); + const response = await got.get(itemUrl); const $ = cheerio.load(response.data); let description = $('.article-box').html(); if (description) { diff --git a/lib/routes/1point3acres/posts.js b/lib/routes/1point3acres/posts.js index 73b52bef6..6f72157fa 100644 --- a/lib/routes/1point3acres/posts.js +++ b/lib/routes/1point3acres/posts.js @@ -1,9 +1,9 @@ -const axios = require('@/utils/axios'); +const got = require('@/utils/got'); module.exports = async (ctx) => { const { id } = ctx.params; - const { posts } = (await axios.get(`https://instant.1point3acres.com/v2/api/user/post?pg=1&ps=10&user_id=${id}`)).data; + const { posts } = (await got.get(`https://instant.1point3acres.com/v2/api/user/post?pg=1&ps=10&user_id=${id}`)).data; const [{ author_name: author }] = posts; ctx.state.data = { diff --git a/lib/routes/1point3acres/threads.js b/lib/routes/1point3acres/threads.js index 0be023e3a..fc55ede5d 100644 --- a/lib/routes/1point3acres/threads.js +++ b/lib/routes/1point3acres/threads.js @@ -1,9 +1,9 @@ -const axios = require('@/utils/axios'); +const got = require('@/utils/got'); module.exports = async (ctx) => { const { id } = ctx.params; - const { threads } = (await axios.get(`https://instant.1point3acres.com/v2/api/user/thread?pg=1&ps=10&user_id=${id}`)).data; + const { threads } = (await got.get(`https://instant.1point3acres.com/v2/api/user/thread?pg=1&ps=10&user_id=${id}`)).data; const [{ author_name: author }] = threads; ctx.state.data = { diff --git a/lib/routes/21caijing/channel.js b/lib/routes/21caijing/channel.js index 94f725d30..dadf365f9 100644 --- a/lib/routes/21caijing/channel.js +++ b/lib/routes/21caijing/channel.js @@ -1,4 +1,4 @@ -const axios = require('@/utils/axios'); +const got = require('@/utils/got'); const date = require('@/utils/date'); const cheerio = require('cheerio'); @@ -6,7 +6,7 @@ module.exports = async (ctx) => { const channel = ctx.params.name; const pageUrl = `https://m.21jingji.com/channel/${channel}`; - const response = await axios({ + const response = await got({ method: 'get', url: pageUrl, }); @@ -25,7 +25,7 @@ module.exports = async (ctx) => { return Promise.resolve(JSON.parse(cache)); } - const response = await axios({ + const response = await got({ method: 'get', url: link, headers: { diff --git a/lib/routes/36kr/search/article.js b/lib/routes/36kr/search/article.js index 5f09fa910..410c14d43 100644 --- a/lib/routes/36kr/search/article.js +++ b/lib/routes/36kr/search/article.js @@ -1,14 +1,14 @@ -const axios = require('@/utils/axios'); +const got = require('@/utils/got'); module.exports = async (ctx) => { const { keyword = '' } = ctx.params; - const response = await axios({ + const response = await got({ method: 'get', url: `https://36kr.com/pp/api/search/entity-search?page=1&per_page=20&sort=date&entity_type=post&keyword=${encodeURIComponent(keyword)}`, }); const load = async (link) => { - const response = await axios.get(link); + const response = await got.get(link); const description = response.data.data.content; return { description }; }; diff --git a/lib/routes/3dm/game.js b/lib/routes/3dm/game.js index 31a962553..4bbca4516 100644 --- a/lib/routes/3dm/game.js +++ b/lib/routes/3dm/game.js @@ -1,4 +1,4 @@ -const axios = require('@/utils/axios'); +const got = require('@/utils/got'); const cheerio = require('cheerio'); module.exports = async (ctx) => { @@ -6,7 +6,7 @@ module.exports = async (ctx) => { const type = ctx.params.type; const url = `http://www.3dmgame.com/games/${name}/${type}`; - const response = await axios({ + const response = await got({ method: 'get', url: url, }); diff --git a/lib/routes/3dm/news_center.js b/lib/routes/3dm/news_center.js index 99930d208..48857f1b5 100644 --- a/lib/routes/3dm/news_center.js +++ b/lib/routes/3dm/news_center.js @@ -1,10 +1,10 @@ -const axios = require('@/utils/axios'); +const got = require('@/utils/got'); const cheerio = require('cheerio'); const sourceTimezoneOffset = -8; module.exports = async (ctx) => { const url = 'http://www.3dmgame.com/news/'; - const res = await axios({ + const res = await got({ method: 'get', url: url, }); diff --git a/lib/routes/99percentinvisible/transcript.js b/lib/routes/99percentinvisible/transcript.js index 8fa429bbe..fd56cb00d 100644 --- a/lib/routes/99percentinvisible/transcript.js +++ b/lib/routes/99percentinvisible/transcript.js @@ -1,4 +1,4 @@ -const axios = require('@/utils/axios'); +const got = require('@/utils/got'); const cheerio = require('cheerio'); const url = require('url'); @@ -6,7 +6,7 @@ const host = 'https://99percentinvisible.org/'; module.exports = async (ctx) => { const link = url.resolve(host, 'archives/'); - const response = await axios.get(link); + const response = await got.get(link); const $ = cheerio.load(response.data); @@ -24,7 +24,7 @@ module.exports = async (ctx) => { return Promise.resolve(JSON.parse(cache)); } - const response = await axios.get(itemUrl); + const response = await got.get(itemUrl); const $ = cheerio.load(response.data); const single = { diff --git a/lib/routes/9to5/subsite.js b/lib/routes/9to5/subsite.js index 08851724c..63930fd24 100644 --- a/lib/routes/9to5/subsite.js +++ b/lib/routes/9to5/subsite.js @@ -1,4 +1,4 @@ -const axios = require('@/utils/axios'); +const got = require('@/utils/got'); const parser = require('@/utils/rss-parser'); const utils = require('./utils'); @@ -34,7 +34,7 @@ module.exports = async (ctx) => { const items = await Promise.all( feed.items.splice(0, 10).map(async (item) => { - const response = await axios({ + const response = await got({ method: 'get', url: item.link, }); diff --git a/lib/routes/a9vg/a9vg.js b/lib/routes/a9vg/a9vg.js index ed0eb162e..29e07ee4c 100644 --- a/lib/routes/a9vg/a9vg.js +++ b/lib/routes/a9vg/a9vg.js @@ -1,8 +1,8 @@ -const axios = require('@/utils/axios'); +const got = require('@/utils/got'); const cheerio = require('cheerio'); module.exports = async (ctx) => { - const response = await axios({ + const response = await got({ method: 'get', url: 'http://www.a9vg.com/list/news', headers: { diff --git a/lib/routes/acfun/bangumi.js b/lib/routes/acfun/bangumi.js index 7dc0e4b70..019dab4ed 100644 --- a/lib/routes/acfun/bangumi.js +++ b/lib/routes/acfun/bangumi.js @@ -1,10 +1,10 @@ -const axios = require('@/utils/axios'); +const got = require('@/utils/got'); module.exports = async (ctx) => { const { id } = ctx.params; const url = `http://www.acfun.cn/bangumi/aa${id}`; - const bangumiPage = await axios({ + const bangumiPage = await got({ method: 'get', url, headers: { @@ -14,7 +14,7 @@ module.exports = async (ctx) => { const albumInfo = JSON.parse(bangumiPage.data.match(/