mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 23:34:38 +08:00
feat: original link from WeChat and better performance (#2660)
* fix: original link from wechat * fix: original link from wechat * fix: original link from wechat * fix: original link from WeChat and better performance
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
const got = require('@/utils/got');
|
const got = require('@/utils/got');
|
||||||
|
const he = require('he');
|
||||||
const cheerio = require('cheerio');
|
const cheerio = require('cheerio');
|
||||||
const date = require('@/utils/date');
|
const date = require('@/utils/date');
|
||||||
|
|
||||||
@@ -38,15 +39,20 @@ module.exports = async (ctx) => {
|
|||||||
.attr('href')}`;
|
.attr('href')}`;
|
||||||
|
|
||||||
const response = await ctx.cache.tryGet(link, async () => (await got.get(link)).data);
|
const response = await ctx.cache.tryGet(link, async () => (await got.get(link)).data);
|
||||||
|
|
||||||
const article = cheerio.load(response);
|
const article = cheerio.load(response);
|
||||||
|
|
||||||
|
const matchs = /"(url|temp_url)":"([^"]+mp\.weixin\.qq\.com[^"]+)"/.exec(response);
|
||||||
|
let weixinLink = '';
|
||||||
|
if (matchs && matchs[2]) {
|
||||||
|
weixinLink = he.unescape(unescape(matchs[2].replace(/\\u/g, '%u')));
|
||||||
|
}
|
||||||
|
|
||||||
const single = {
|
const single = {
|
||||||
title: $(e)
|
title: $(e)
|
||||||
.find('.post-item__title')
|
.find('.post-item__title')
|
||||||
.text()
|
.text()
|
||||||
.trim(),
|
.trim(),
|
||||||
link,
|
link: weixinLink || link,
|
||||||
description: article('#content').html(),
|
description: article('#content').html(),
|
||||||
pubDate,
|
pubDate,
|
||||||
author,
|
author,
|
||||||
|
|||||||
Reference in New Issue
Block a user