mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 05:59:00 +08:00
chore(deps): replace @postlight/mercury-parser with @postlight/parser (#10862)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const entities = require('entities');
|
||||
const cheerio = require('cheerio');
|
||||
const { simplecc } = require('simplecc-wasm');
|
||||
// const got = require('@/utils/got');
|
||||
const got = require('@/utils/got');
|
||||
const config = require('@/config').value;
|
||||
const RE2 = require('re2');
|
||||
|
||||
@@ -252,17 +252,12 @@ module.exports = async (ctx, next) => {
|
||||
const parsed_result = await ctx.cache.tryGet(`mercury-cache-${link}`, async () => {
|
||||
// if parser failed, return default description and not report error
|
||||
try {
|
||||
mercury_parser = mercury_parser || require('@postlight/mercury-parser');
|
||||
mercury_parser = mercury_parser || require('@postlight/parser');
|
||||
|
||||
// const res = await got(link);
|
||||
// const $ = cheerio.load(res.data, {
|
||||
// xmlMode: true,
|
||||
// });
|
||||
const { data: res } = await got(link);
|
||||
const $ = cheerio.load(res);
|
||||
const result = await mercury_parser.parse(link, {
|
||||
// html: $.html(),
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
},
|
||||
html: $.html(),
|
||||
});
|
||||
return result;
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user