adjust routers

This commit is contained in:
fengkx
2019-02-28 21:52:19 +08:00
parent a1259483cd
commit 78f3972e56
42 changed files with 49 additions and 49 deletions
+1 -1
View File
@@ -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');
+1 -1
View File
@@ -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');
+2 -2
View File
@@ -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');
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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/',
},
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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');
+1 -1
View File
@@ -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' },
});
+1 -1
View File
@@ -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'));
+1 -1
View File
@@ -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',
+1 -1
View File
@@ -10,7 +10,7 @@ module.exports = async (ctx) => {
const response = await axios({
method: 'get',
url: link,
responseType: 'arraybuffer',
responseType: 'buffer',
headers: {
Cookie: `guestJs=${timestamp};`,
},
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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');
+2 -2
View File
@@ -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');
+1 -1
View File
@@ -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')
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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) {
+2 -2
View File
@@ -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) {
+1 -1
View File
@@ -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`;
+1 -1
View File
@@ -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',
},
+1 -1
View File
@@ -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,
});
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -19,7 +19,7 @@ module.exports = async (ctx) => {
method: 'get',
url: base_url,
// url:link,
responseType: 'arraybuffer',
responseType: 'buffer',
headers: {
Referer: base_url,
},
+1 -1
View File
@@ -18,7 +18,7 @@ module.exports = async (ctx) => {
const response = await axios({
method: 'get',
url: link,
responseType: 'arraybuffer',
responseType: 'buffer',
headers: {
Referer: base_url,
},
+1 -1
View File
@@ -17,7 +17,7 @@ module.exports = async (ctx) => {
const response = await axios({
method: 'get',
url: link,
responseType: 'arraybuffer',
responseType: 'buffer',
headers: {
Referer: base_url,
},
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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/',
},
@@ -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/',
},
@@ -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/',
},
+1 -1
View File
@@ -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/',
},
+1 -1
View File
@@ -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',
},
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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/';
+1 -1
View File
@@ -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/';
+1 -1
View File
@@ -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');
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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,
},
+1 -1
View File
@@ -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,
},