From 87a79be6bbbda5d3f80766c9322ec9016f9f32c9 Mon Sep 17 00:00:00 2001 From: Shun Zi Date: Thu, 12 Nov 2020 23:41:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BD=91=E6=98=93=E5=8F=B7=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=BC=93=E5=AD=98=E5=87=BA=E9=94=99=20&=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=85=A8=E6=96=87=20CSS=20=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=20(#6128)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/new-media.md | 4 ++-- lib/routes/netease/dy.js | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/new-media.md b/docs/new-media.md index fd811137f..665f1e7b1 100644 --- a/docs/new-media.md +++ b/docs/new-media.md @@ -1406,8 +1406,8 @@ column 为 third 时可选的 category: 1. 在[网易号搜索页面](https://dy.163.com/v2/media/tosearch.html) 搜索想要订阅的网易号。 -2. 打开网易号文章页面。 -3. 通过浏览器控制台执行 `$('#contain').dataset.wemediaid`,返回的即为网易号 ID。 +2. 打开网易号的任意文章。 +3. 查看源代码,搜索 `data-wemediaid`,查看紧随其后的引号内的属性值(类似 `W1966190042455428950`)即为网易号 ID。 diff --git a/lib/routes/netease/dy.js b/lib/routes/netease/dy.js index 8443ef73f..51364c675 100644 --- a/lib/routes/netease/dy.js +++ b/lib/routes/netease/dy.js @@ -19,19 +19,19 @@ module.exports = async (ctx) => { author = e.source ? e.source : ''; - const response = await ctx.cache.tryGet( - e.link, - async () => + const html = await ctx.cache.tryGet(e.link, async () => + iconv.decode( ( await got.get(e.link, { responseType: 'buffer', }) - ).data + ).data, + 'gbk' + ) ); - const html = iconv.decode(response, 'gbk'); const $ = cheerio.load(html, { decodeEntities: false }); - const article = $('div.article_box > div.content'); + const article = $('.post_body'); const single = { title: e.title,