mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 05:59:00 +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 he = require('he');
|
||||
const cheerio = require('cheerio');
|
||||
const date = require('@/utils/date');
|
||||
|
||||
@@ -38,15 +39,20 @@ module.exports = async (ctx) => {
|
||||
.attr('href')}`;
|
||||
|
||||
const response = await ctx.cache.tryGet(link, async () => (await got.get(link)).data);
|
||||
|
||||
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 = {
|
||||
title: $(e)
|
||||
.find('.post-item__title')
|
||||
.text()
|
||||
.trim(),
|
||||
link,
|
||||
link: weixinLink || link,
|
||||
description: article('#content').html(),
|
||||
pubDate,
|
||||
author,
|
||||
|
||||
Reference in New Issue
Block a user