arraybuffer to buffer
This commit is contained in:
parent
632459d647
commit
de32ba0ffe
|
|
@ -8,7 +8,7 @@ async function load(link, ctx) {
|
|||
return cache;
|
||||
}
|
||||
const response = await axios.get(link, {
|
||||
responseType: 'arraybuffer',
|
||||
responseType: 'buffer',
|
||||
});
|
||||
response.data = iconv.decode(response.data, 'gb2312');
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const link = `http://opinion.people.com.cn/GB/${id}/index.html`;
|
||||
const response = await axios.get(link, {
|
||||
responseType: 'arraybuffer',
|
||||
responseType: 'buffer',
|
||||
});
|
||||
response.data = iconv.decode(response.data, 'gbk');
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ module.exports = async (ctx) => {
|
|||
}
|
||||
|
||||
const response = await axios.get(itemUrl, {
|
||||
responseType: 'arraybuffer',
|
||||
responseType: 'buffer',
|
||||
});
|
||||
response.data = iconv.decode(response.data, 'gbk');
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ module.exports = async (ctx) => {
|
|||
headers: {
|
||||
Referer: pcUrl,
|
||||
},
|
||||
responseType: 'arraybuffer',
|
||||
responseType: 'buffer',
|
||||
});
|
||||
const $ = cheerio.load(iconv.decode(storyDetail.data, 'gb2312'));
|
||||
$('#articleContent img').each(function(_, item) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ module.exports = async (ctx) => {
|
|||
}
|
||||
|
||||
const response = await axios.get(itemUrl, {
|
||||
responseType: 'arraybuffer',
|
||||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
response.data = iconv.decode(response.data, 'gbk');
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ module.exports = async (ctx) => {
|
|||
const response = await axios({
|
||||
method: 'get',
|
||||
url: host,
|
||||
responseType: 'arraybuffer',
|
||||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const responseHtml = iconv.decode(response.data, 'gbk');
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ module.exports = async (ctx) => {
|
|||
const res = await axios({
|
||||
method: 'get',
|
||||
url: 'http://jww.zjgsu.edu.cn/ArticleList.asp?nid=83',
|
||||
responseType: 'arraybuffer',
|
||||
responseType: 'buffer',
|
||||
});
|
||||
res.data = iconv.decode(res.data, 'gb2312');
|
||||
const $ = cheerio.load(res.data);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ module.exports = async (ctx) => {
|
|||
const res = await axios({
|
||||
method: 'get',
|
||||
url: 'http://jww.zjgsu.edu.cn/ArticleList.asp?nid=6',
|
||||
responseType: 'arraybuffer',
|
||||
responseType: 'buffer',
|
||||
});
|
||||
res.data = iconv.decode(res.data, 'gb2312');
|
||||
const $ = cheerio.load(res.data);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ module.exports = async (ctx) => {
|
|||
const res = await axios({
|
||||
method: 'get',
|
||||
url: host + `${id}`,
|
||||
responseType: 'arraybuffer',
|
||||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const $ = cheerio.load(iconv.decode(res.data, 'gb2312'));
|
||||
|
|
|
|||
Loading…
Reference in New Issue