diff --git a/lib/routes/tencent/wechat/wemp.js b/lib/routes/tencent/wechat/wemp.js index eadfae64db..ae96f8269b 100644 --- a/lib/routes/tencent/wechat/wemp.js +++ b/lib/routes/tencent/wechat/wemp.js @@ -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,