fix: 网易 encoding issue (#5983)
This commit is contained in:
parent
97b12d11e0
commit
6083f0f250
|
|
@ -115,12 +115,15 @@ module.exports = async (ctx) => {
|
|||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
try {
|
||||
const res = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
responseType: 'buffer',
|
||||
});
|
||||
const content = cheerio.load(iconv.decode(res.data, 'gbk'));
|
||||
let res;
|
||||
let content;
|
||||
if (item.link.startsWith('https://ent.163.com')) {
|
||||
res = await got({ method: 'get', url: item.link, responseType: 'buffer' });
|
||||
content = cheerio.load(iconv.decode(res.data, 'gbk'));
|
||||
} else {
|
||||
res = await got.get(item.link);
|
||||
content = cheerio.load(res.data);
|
||||
}
|
||||
|
||||
if (content('#ne_wrap').attr('data-publishtime')) {
|
||||
// To get pubDate from most pages.
|
||||
|
|
|
|||
Loading…
Reference in New Issue