From 78f3972e56d06199584ba7a41f792582e234ada2 Mon Sep 17 00:00:00 2001 From: fengkx Date: Thu, 28 Feb 2019 21:52:19 +0800 Subject: [PATCH] adjust routers --- lib/routes/aisixiang/column.js | 2 +- lib/routes/aisixiang/ranking.js | 2 +- lib/routes/aisixiang/utils.js | 4 ++-- lib/routes/bilibili/cache.js | 2 +- lib/routes/bilibili/partion-ranking.js | 2 +- lib/routes/cartoonmad/comic.js | 2 +- lib/routes/dapenti/utils.js | 4 ++-- lib/routes/dongqiudi/utils.js | 2 +- lib/routes/dytt/index.js | 2 +- lib/routes/juejin/trending.js | 2 +- lib/routes/ltaaa/_article.js | 2 +- lib/routes/nga/forum.js | 2 +- lib/routes/nga/post.js | 2 +- lib/routes/novel/biquge.js | 2 +- lib/routes/novel/booksky.js | 2 +- lib/routes/novel/uukanshu.js | 2 +- lib/routes/novel/wenxuemi.js | 4 ++-- lib/routes/oilprice/index.js | 2 +- lib/routes/sexinsex/index.js | 4 ++-- lib/routes/t66y/index.js | 4 ++-- lib/routes/t66y/post.js | 4 ++-- lib/routes/telegram/stickerpack.js | 2 +- lib/routes/thepaper/utils.js | 2 +- lib/routes/tingshuitz/guangzhou.js | 2 +- lib/routes/tingshuitz/xian.js | 2 +- lib/routes/tingshuitz/yangjiang.js | 2 +- lib/routes/universities/dlu/jiaowu/news.js | 2 +- lib/routes/universities/dpu/jiaowu/news.js | 2 +- lib/routes/universities/dpu/wlfw/news.js | 2 +- lib/routes/universities/nchu/jwc.js | 2 +- lib/routes/universities/nku/jwc/index.js | 2 +- .../universities/sctu/information-engineer-faculty/context.js | 2 +- .../universities/sctu/information-engineer-faculty/index.js | 2 +- lib/routes/universities/sctu/jwc/context.js | 2 +- lib/routes/universities/sctu/jwc/index.js | 2 +- lib/routes/universities/swust/cs.js | 4 ++-- lib/routes/universities/swust/jwc_news.js | 2 +- lib/routes/universities/swust/jwc_notice.js | 2 +- lib/routes/wenku8/chapter.js | 2 +- lib/routes/ximalaya/album.js | 2 +- lib/routes/zaobao/realtime.js | 2 +- lib/routes/zaobao/znews.js | 2 +- 42 files changed, 49 insertions(+), 49 deletions(-) diff --git a/lib/routes/aisixiang/column.js b/lib/routes/aisixiang/column.js index c2c1068e43..8067d8576a 100644 --- a/lib/routes/aisixiang/column.js +++ b/lib/routes/aisixiang/column.js @@ -10,7 +10,7 @@ module.exports = async (ctx) => { const host = `http://www.aisixiang.com/data/search.php?lanmu=${id}`; const response = await axios.get(host, { - responseType: 'arraybuffer', + responseType: 'buffer', }); response.data = iconv.decode(response.data, 'gbk'); diff --git a/lib/routes/aisixiang/ranking.js b/lib/routes/aisixiang/ranking.js index f6b9fe2db1..15286e4d10 100644 --- a/lib/routes/aisixiang/ranking.js +++ b/lib/routes/aisixiang/ranking.js @@ -10,7 +10,7 @@ module.exports = async (ctx) => { const host = `http://www.aisixiang.com/toplist/index.php?id=${type}&period=${range}`; const response = await axios.get(host, { - responseType: 'arraybuffer', + responseType: 'buffer', }); response.data = iconv.decode(response.data, 'gbk'); diff --git a/lib/routes/aisixiang/utils.js b/lib/routes/aisixiang/utils.js index 3c1bb1e4f7..fd26691c6d 100644 --- a/lib/routes/aisixiang/utils.js +++ b/lib/routes/aisixiang/utils.js @@ -10,13 +10,13 @@ const ProcessFeed = async (link) => { .split('.')[0]; let response = await axios.get(`http://www.aisixiang.com/data/view_json.php?id=${id}`, { - responseType: 'arraybuffer', + responseType: 'buffer', }); const description = JSON.parse(iconv.decode(response.data, 'gbk')).content; link = `http://www.aisixiang.com${link}`; response = await axios.get(link, { - responseType: 'arraybuffer', + responseType: 'buffer', }); response.data = iconv.decode(response.data, 'gbk'); diff --git a/lib/routes/bilibili/cache.js b/lib/routes/bilibili/cache.js index 21c7f1b124..a27bad591a 100644 --- a/lib/routes/bilibili/cache.js +++ b/lib/routes/bilibili/cache.js @@ -65,7 +65,7 @@ module.exports = { const nameResponse = await axios({ method: 'get', url: `https://www.bilibili.com/video/av${aid}`, - responseType: 'arraybuffer', + responseType: 'buffer', }); const responseHtml = iconv.decode(nameResponse.data, 'UTF-8'); const $ = cheerio.load(responseHtml); diff --git a/lib/routes/bilibili/partion-ranking.js b/lib/routes/bilibili/partion-ranking.js index 5222d677e2..7ac6ec4931 100644 --- a/lib/routes/bilibili/partion-ranking.js +++ b/lib/routes/bilibili/partion-ranking.js @@ -1,5 +1,5 @@ const axios = require('../../utils/axios'); -const axios_ins = axios.create({ +const axios_ins = axios.extend({ headers: { Referer: 'https://www.bilibili.com/', }, diff --git a/lib/routes/cartoonmad/comic.js b/lib/routes/cartoonmad/comic.js index 66b6bc0106..7cffec136d 100644 --- a/lib/routes/cartoonmad/comic.js +++ b/lib/routes/cartoonmad/comic.js @@ -21,7 +21,7 @@ const getChapters = ($) => module.exports = async (ctx) => { const { id } = ctx.params; - const { data } = await axios.get(`https://www.cartoonmad.com/comic/${id}`, { responseType: 'arraybuffer' }); + const { data } = await axios.get(`https://www.cartoonmad.com/comic/${id}`, { responseType: 'buffer' }); const content = iconv.decode(new Buffer.from(data), 'big5'); const $ = cheerio.load(content); diff --git a/lib/routes/dapenti/utils.js b/lib/routes/dapenti/utils.js index b02253cccd..1f086fd28f 100644 --- a/lib/routes/dapenti/utils.js +++ b/lib/routes/dapenti/utils.js @@ -14,7 +14,7 @@ module.exports = { // 喷嚏网编码为GBK,需要转码 // 转码需要设定返回数据的格式,其可选项是arraybuffer,blob,document,json,text,stream // 默认为json - responseType: 'arraybuffer', + responseType: 'buffer', }); // 转码 const data = iconv.decode(listRes.data, 'gb2312'); @@ -34,7 +34,7 @@ module.exports = { headers: { Referer: url, }, - responseType: 'arraybuffer', + responseType: 'buffer', }); const convert_data = iconv.decode(original_data.data, 'gbk'); const detail_data = cheerio diff --git a/lib/routes/dongqiudi/utils.js b/lib/routes/dongqiudi/utils.js index afc2a415ca..83965d62db 100644 --- a/lib/routes/dongqiudi/utils.js +++ b/lib/routes/dongqiudi/utils.js @@ -35,7 +35,7 @@ const ProcessHref = (content) => { }; const ProcessFeed = async (ctx, link, api) => { - const axios_ins = axios.create({ + const axios_ins = axios.extend({ headers: { 'X-Requested-With': 'XMLHttpRequest', Referer: link, diff --git a/lib/routes/dytt/index.js b/lib/routes/dytt/index.js index c89bfd63f4..7a837fcd4c 100644 --- a/lib/routes/dytt/index.js +++ b/lib/routes/dytt/index.js @@ -3,7 +3,7 @@ const cheerio = require('cheerio'); const iconv = require('iconv-lite'); module.exports = async (ctx) => { const response = await axios.get('http://www.dytt8.net', { - responseType: 'arraybuffer', + responseType: 'buffer', }); response.data = iconv.decode(response.data, 'gb2312'); diff --git a/lib/routes/juejin/trending.js b/lib/routes/juejin/trending.js index c22fe47441..56906f823a 100644 --- a/lib/routes/juejin/trending.js +++ b/lib/routes/juejin/trending.js @@ -1,7 +1,7 @@ const axios = require('../../utils/axios'); const querystring = require('querystring'); -const axios_ins = axios.create({ +const axios_ins = axios.extend({ responseType: 'json', headers: { 'X-Juejin-Src': 'web' }, }); diff --git a/lib/routes/ltaaa/_article.js b/lib/routes/ltaaa/_article.js index 7cf5247d64..96efc17804 100644 --- a/lib/routes/ltaaa/_article.js +++ b/lib/routes/ltaaa/_article.js @@ -12,7 +12,7 @@ module.exports = async function get_article(url) { method: 'get', url: url, 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0', - responseType: 'arraybuffer', + responseType: 'buffer', }); const data = response.data; const $ = cheerio.load(iconv.decode(data, 'CP936')); diff --git a/lib/routes/nga/forum.js b/lib/routes/nga/forum.js index 3bffd25d2f..7c67667355 100644 --- a/lib/routes/nga/forum.js +++ b/lib/routes/nga/forum.js @@ -3,7 +3,7 @@ const qs = require('querystring'); module.exports = async (ctx) => { const { fid } = ctx.params; - const axiosInstance = axios.create({ + const axiosInstance = axios.extend({ baseURL: 'https://ngabbs.com/app_api.php', headers: { 'Content-Type': 'application/x-www-form-urlencoded', diff --git a/lib/routes/nga/post.js b/lib/routes/nga/post.js index cf180b1e53..1f00ad0862 100644 --- a/lib/routes/nga/post.js +++ b/lib/routes/nga/post.js @@ -10,7 +10,7 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: link, - responseType: 'arraybuffer', + responseType: 'buffer', headers: { Cookie: `guestJs=${timestamp};`, }, diff --git a/lib/routes/novel/biquge.js b/lib/routes/novel/biquge.js index 89d1832f33..f94eb2f597 100644 --- a/lib/routes/novel/biquge.js +++ b/lib/routes/novel/biquge.js @@ -15,7 +15,7 @@ module.exports = async (ctx) => { Referer: `${baseUrl}${id}/`, }, // responseEncoding: 'gbk', //该配置项在 0.18版本中没有打包进去 - responseType: 'arraybuffer', + responseType: 'buffer', }); const responseHtml = iconv.decode(response.data, 'GBK'); const $ = cheerio.load(responseHtml); diff --git a/lib/routes/novel/booksky.js b/lib/routes/novel/booksky.js index c48039216c..b9bf2b724c 100644 --- a/lib/routes/novel/booksky.js +++ b/lib/routes/novel/booksky.js @@ -14,7 +14,7 @@ module.exports = async (ctx) => { Host: 'booksky.so', Referer: 'http://booksky.so/', }, - responseType: 'arraybuffer', + responseType: 'buffer', }); const responseHtml = iconv.decode(response.data, 'GBK'); const $ = cheerio.load(responseHtml); diff --git a/lib/routes/novel/uukanshu.js b/lib/routes/novel/uukanshu.js index 1189e63a89..0f49403ddb 100644 --- a/lib/routes/novel/uukanshu.js +++ b/lib/routes/novel/uukanshu.js @@ -11,7 +11,7 @@ module.exports = async (ctx) => { headers: { Referer: 'https://www.uukanshu.com/b/${uid}', }, - responseType: 'arraybuffer', + responseType: 'buffer', }); const data = iconv.decode(response.data, 'gb2312'); diff --git a/lib/routes/novel/wenxuemi.js b/lib/routes/novel/wenxuemi.js index 5f03f3a2d1..64cbf9e755 100644 --- a/lib/routes/novel/wenxuemi.js +++ b/lib/routes/novel/wenxuemi.js @@ -9,11 +9,11 @@ module.exports = async (ctx) => { const id1 = ctx.params.id1; // 小说id const id2 = ctx.params.id2; const id = '/' + id1 + '/' + id2; - const axios_ins = axios.create({ + const axios_ins = axios.extend({ headers: { Referer: `${mbaseUrl}${id}/`, }, - responseType: 'arraybuffer', + responseType: 'buffer', }); const response = await axios_ins.get(`${mbaseUrl}${id}/`); const responseHtml = iconv.decode(response.data, 'GBK'); diff --git a/lib/routes/oilprice/index.js b/lib/routes/oilprice/index.js index c6010a3784..4ec5d570c7 100644 --- a/lib/routes/oilprice/index.js +++ b/lib/routes/oilprice/index.js @@ -8,7 +8,7 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: link, - responseType: 'arraybuffer', + responseType: 'buffer', }); const $ = cheerio.load(iconv.decode(response.data, 'gb2312')); const $list = $('.pp') diff --git a/lib/routes/sexinsex/index.js b/lib/routes/sexinsex/index.js index 5ec4c7b9de..e2f651db50 100644 --- a/lib/routes/sexinsex/index.js +++ b/lib/routes/sexinsex/index.js @@ -5,11 +5,11 @@ const url = require('url'); const base = 'http://sexinsex.net'; const section = '/bbs/forumdisplay.php?fid='; -const axios_ins = axios.create({ +const axios_ins = axios.extend({ headers: { Referer: base, }, - responseType: 'arraybuffer', + responseType: 'buffer', }); const sourceTimezoneOffset = -8; diff --git a/lib/routes/t66y/index.js b/lib/routes/t66y/index.js index 96cd6898e0..217b70097e 100644 --- a/lib/routes/t66y/index.js +++ b/lib/routes/t66y/index.js @@ -5,11 +5,11 @@ const url = require('url'); const base = 'http://www.t66y.com'; const section = 'thread0806.php?fid='; -const axios_ins = axios.create({ +const axios_ins = axios.extend({ headers: { Referer: base, }, - responseType: 'arraybuffer', + responseType: 'buffer', }); function killViidii(originUrl) { diff --git a/lib/routes/t66y/post.js b/lib/routes/t66y/post.js index 1e4452b082..73ce9b53f8 100644 --- a/lib/routes/t66y/post.js +++ b/lib/routes/t66y/post.js @@ -4,11 +4,11 @@ const iconv = require('iconv-lite'); const url = require('url'); const base = 'http://www.t66y.com'; -const axios_ins = axios.create({ +const axios_ins = axios.extend({ headers: { Referer: base, }, - responseType: 'arraybuffer', + responseType: 'buffer', }); function killViidii(originUrl) { diff --git a/lib/routes/telegram/stickerpack.js b/lib/routes/telegram/stickerpack.js index 7be28fa6f8..6d1423519b 100644 --- a/lib/routes/telegram/stickerpack.js +++ b/lib/routes/telegram/stickerpack.js @@ -36,7 +36,7 @@ module.exports = async (ctx) => { const fileResponse = await axios({ method: 'get', url: `https://api.telegram.org/file/bot${config.telegram.token}/${path}`, - responseType: 'arraybuffer', + responseType: 'buffer', }); const filePath = `tmp/${item.file_id}.png`; diff --git a/lib/routes/thepaper/utils.js b/lib/routes/thepaper/utils.js index 09059bc985..d5127bb0c6 100644 --- a/lib/routes/thepaper/utils.js +++ b/lib/routes/thepaper/utils.js @@ -5,7 +5,7 @@ const axios = require('../../utils/axios'); module.exports = { ProcessFeed: async (link, ctx) => { - const axios_ins = axios.create({ + const axios_ins = axios.extend({ headers: { 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A356 Safari/604.1', }, diff --git a/lib/routes/tingshuitz/guangzhou.js b/lib/routes/tingshuitz/guangzhou.js index 8b4b94b375..68a3daeda4 100644 --- a/lib/routes/tingshuitz/guangzhou.js +++ b/lib/routes/tingshuitz/guangzhou.js @@ -5,7 +5,7 @@ const iconv = require('iconv-lite'); module.exports = async (ctx) => { const url = 'http://www.gzwatersupply.com/stop/stopgl.html2'; const response = await axios({ - responseType: 'arraybuffer', + responseType: 'buffer', method: 'get', url: url, }); diff --git a/lib/routes/tingshuitz/xian.js b/lib/routes/tingshuitz/xian.js index 9caddd69e3..6243a0e33a 100644 --- a/lib/routes/tingshuitz/xian.js +++ b/lib/routes/tingshuitz/xian.js @@ -5,7 +5,7 @@ const iconv = require('iconv-lite'); module.exports = async (ctx) => { const url = 'http://www.xazls.com/tsgg/index.htm'; const response = await axios.get(url, { - responseType: 'arraybuffer', + responseType: 'buffer', }); const data = response.data; diff --git a/lib/routes/tingshuitz/yangjiang.js b/lib/routes/tingshuitz/yangjiang.js index fbbdeea5a5..07d29574d3 100644 --- a/lib/routes/tingshuitz/yangjiang.js +++ b/lib/routes/tingshuitz/yangjiang.js @@ -5,7 +5,7 @@ const iconv = require('iconv-lite'); module.exports = async (ctx) => { const url = 'http://www.yjsswjt.com/zxdt_list.jsp?flbz=7'; const response = await axios.get(url, { - responseType: 'arraybuffer', + responseType: 'buffer', }); const data = response.data; diff --git a/lib/routes/universities/dlu/jiaowu/news.js b/lib/routes/universities/dlu/jiaowu/news.js index 69b21957d3..15e4bfafd8 100644 --- a/lib/routes/universities/dlu/jiaowu/news.js +++ b/lib/routes/universities/dlu/jiaowu/news.js @@ -19,7 +19,7 @@ module.exports = async (ctx) => { method: 'get', url: base_url, // url:link, - responseType: 'arraybuffer', + responseType: 'buffer', headers: { Referer: base_url, }, diff --git a/lib/routes/universities/dpu/jiaowu/news.js b/lib/routes/universities/dpu/jiaowu/news.js index 777e83aa79..8744c8cba5 100644 --- a/lib/routes/universities/dpu/jiaowu/news.js +++ b/lib/routes/universities/dpu/jiaowu/news.js @@ -18,7 +18,7 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: link, - responseType: 'arraybuffer', + responseType: 'buffer', headers: { Referer: base_url, }, diff --git a/lib/routes/universities/dpu/wlfw/news.js b/lib/routes/universities/dpu/wlfw/news.js index daa69d19f5..fddfea9fe7 100644 --- a/lib/routes/universities/dpu/wlfw/news.js +++ b/lib/routes/universities/dpu/wlfw/news.js @@ -17,7 +17,7 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: link, - responseType: 'arraybuffer', + responseType: 'buffer', headers: { Referer: base_url, }, diff --git a/lib/routes/universities/nchu/jwc.js b/lib/routes/universities/nchu/jwc.js index d6e1e5e723..b39e1ce8a8 100644 --- a/lib/routes/universities/nchu/jwc.js +++ b/lib/routes/universities/nchu/jwc.js @@ -18,7 +18,7 @@ module.exports = async (ctx) => { headers: { Referer: host, }, - responseType: 'arraybuffer', + responseType: 'buffer', }); const responseHtml = iconv.decode(response.data, 'GBK'); const $ = cheerio.load(responseHtml); diff --git a/lib/routes/universities/nku/jwc/index.js b/lib/routes/universities/nku/jwc/index.js index 0a1055f76d..cf10967612 100644 --- a/lib/routes/universities/nku/jwc/index.js +++ b/lib/routes/universities/nku/jwc/index.js @@ -15,7 +15,7 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: `${dirname}${index}/list.htm`, - responseType: 'arraybuffer', + responseType: 'buffer', headers: { Referer: 'http://jwc.nankai.edu.cn/', }, diff --git a/lib/routes/universities/sctu/information-engineer-faculty/context.js b/lib/routes/universities/sctu/information-engineer-faculty/context.js index 1a4ffaa9e5..82236c5fa0 100644 --- a/lib/routes/universities/sctu/information-engineer-faculty/context.js +++ b/lib/routes/universities/sctu/information-engineer-faculty/context.js @@ -6,7 +6,7 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: `http://it.sctu.edu.cn/data.asp?fa=2&fl=12&zi=0&id=${ctx.params.id}`, - responseType: 'arraybuffer', + responseType: 'buffer', headers: { Referer: 'http://it.sctu.edu.cn/', }, diff --git a/lib/routes/universities/sctu/information-engineer-faculty/index.js b/lib/routes/universities/sctu/information-engineer-faculty/index.js index 1a99f8f257..33e9bc6b2a 100644 --- a/lib/routes/universities/sctu/information-engineer-faculty/index.js +++ b/lib/routes/universities/sctu/information-engineer-faculty/index.js @@ -6,7 +6,7 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: 'http://it.sctu.edu.cn/list.asp?fa=2&fl=12&zi=0', - responseType: 'arraybuffer', + responseType: 'buffer', headers: { Referer: 'http://it.sctu.edu.cn/', }, diff --git a/lib/routes/universities/sctu/jwc/context.js b/lib/routes/universities/sctu/jwc/context.js index cbe073b973..1a69549f0c 100644 --- a/lib/routes/universities/sctu/jwc/context.js +++ b/lib/routes/universities/sctu/jwc/context.js @@ -6,7 +6,7 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: `http://www.sctu.edu.cn/jwc/content.asp?type=12&fl=${ctx.params.type}&id=${ctx.params.id}`, - responseType: 'arraybuffer', + responseType: 'buffer', headers: { Referer: 'http://sctu.edu.cn/', }, diff --git a/lib/routes/universities/sctu/jwc/index.js b/lib/routes/universities/sctu/jwc/index.js index 4cb6cb9bad..679a394db1 100644 --- a/lib/routes/universities/sctu/jwc/index.js +++ b/lib/routes/universities/sctu/jwc/index.js @@ -7,7 +7,7 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: `${dirname}list.asp?type=12&fl=${+ctx.params.type === 14 ? 14 : 13}`, - responseType: 'arraybuffer', + responseType: 'buffer', headers: { Referer: 'http://www.sctu.edu.cn', }, diff --git a/lib/routes/universities/swust/cs.js b/lib/routes/universities/swust/cs.js index 11aa3e37a0..f3b5157c41 100644 --- a/lib/routes/universities/swust/cs.js +++ b/lib/routes/universities/swust/cs.js @@ -3,11 +3,11 @@ const cheerio = require('cheerio'); const host = 'http://www.cs.swust.edu.cn/'; module.exports = async (ctx) => { - const axios_ins = axios.create({ + const axios_ins = axios.extend({ headers: { Referer: host, }, - responseType: 'arraybuffer', + responseType: 'buffer', }); let type = ctx.params.type || 1; diff --git a/lib/routes/universities/swust/jwc_news.js b/lib/routes/universities/swust/jwc_news.js index d84ca31790..87fb6471d4 100644 --- a/lib/routes/universities/swust/jwc_news.js +++ b/lib/routes/universities/swust/jwc_news.js @@ -2,7 +2,7 @@ const axios = require('../../../utils/axios'); // 转码需要设定返回数据的格式,其可选项是arraybuffer,blob,document,json,text,stream // 默认为json -const axios_ins = axios.create({ responseType: 'blob' }); +const axios_ins = axios.extend({ responseType: 'text' }); const api = 'http://www.dean.swust.edu.cn/cms/portal/news.json'; const host = 'http://www.dean.swust.edu.cn/'; diff --git a/lib/routes/universities/swust/jwc_notice.js b/lib/routes/universities/swust/jwc_notice.js index 1b2ad95b11..f5b488230d 100644 --- a/lib/routes/universities/swust/jwc_notice.js +++ b/lib/routes/universities/swust/jwc_notice.js @@ -2,7 +2,7 @@ const axios = require('../../../utils/axios'); // 转码需要设定返回数据的格式,其可选项是arraybuffer,blob,document,json,text,stream // 默认为json -const axios_ins = axios.create({ responseType: 'blob' }); +const axios_ins = axios.extend({ responseType: 'text' }); const api = 'http://www.dean.swust.edu.cn/cms/portal/notice.json'; const page = 'http://www.dean.swust.edu.cn/notice/page/'; diff --git a/lib/routes/wenku8/chapter.js b/lib/routes/wenku8/chapter.js index 20a640d22d..00ce4ddccd 100644 --- a/lib/routes/wenku8/chapter.js +++ b/lib/routes/wenku8/chapter.js @@ -9,7 +9,7 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: `https://www.wenku8.net/novel/${index}/${id}/index.htm`, - responseType: 'arraybuffer', + responseType: 'buffer', }); const responseHtml = iconv.decode(response.data, 'gbk'); diff --git a/lib/routes/ximalaya/album.js b/lib/routes/ximalaya/album.js index 1c442f82b5..312f4b2792 100644 --- a/lib/routes/ximalaya/album.js +++ b/lib/routes/ximalaya/album.js @@ -1,6 +1,6 @@ const axios = require('../../utils/axios'); const baseUrl = 'http://www.ximalaya.com'; -const axios_ins = axios.create({}); +const axios_ins = axios.extend({}); module.exports = async (ctx) => { const id = ctx.params.id; // 专辑id diff --git a/lib/routes/zaobao/realtime.js b/lib/routes/zaobao/realtime.js index b7ca8ca0a1..dd46fe8b16 100644 --- a/lib/routes/zaobao/realtime.js +++ b/lib/routes/zaobao/realtime.js @@ -2,7 +2,7 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); const baseUrl = 'https://www.zaobao.com.sg'; const host = 'https://www.zaobao.com.sg/realtime'; -const axios_ins = axios.create({ +const axios_ins = axios.extend({ headers: { Referer: host, }, diff --git a/lib/routes/zaobao/znews.js b/lib/routes/zaobao/znews.js index 95046deb25..cdc5f2f1d0 100644 --- a/lib/routes/zaobao/znews.js +++ b/lib/routes/zaobao/znews.js @@ -1,7 +1,7 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); const baseUrl = 'https://www.zaobao.com.sg'; -const axios_ins = axios.create({ +const axios_ins = axios.extend({ headers: { Referer: baseUrl, },