mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
fix: creaders 解码错误 (#5853)
This commit is contained in:
@@ -4,10 +4,11 @@ const iconv = require('iconv-lite');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const currentUrl = 'http://news.creaders.net/headline/';
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
|
||||
const response = await got.get(currentUrl, {
|
||||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const $ = cheerio.load(iconv.decode(response.data, 'gbk'));
|
||||
const list = $('ul.newslist li')
|
||||
.slice(0, 10)
|
||||
@@ -26,9 +27,8 @@ module.exports = async (ctx) => {
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const res = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
const res = await got.get(item.link, {
|
||||
responseType: 'buffer',
|
||||
});
|
||||
const content = cheerio.load(iconv.decode(res.data, 'gbk'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user