fix: 网易号获取缓存出错 & 修复全文 CSS 选择器 (#6128)

This commit is contained in:
Shun Zi 2020-11-12 23:41:16 +08:00 committed by GitHub
parent 03344eed86
commit 87a79be6bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -1406,8 +1406,8 @@ column 为 third 时可选的 category:
<Route author="HendricksZheng" example="/netease/dy/W4983108759592548559" path="/netease/dy/:id" :paramsDesc="['网易号 ID', '见如下说明']">
1. 在[网易号搜索页面](https://dy.163.com/v2/media/tosearch.html) 搜索想要订阅的网易号。
2. 打开网易号文章页面
3. 通过浏览器控制台执行 `$('#contain').dataset.wemediaid`,返回的即为网易号 ID。
2. 打开网易号的任意文章。
3. 查看源代码,搜索 `data-wemediaid`,查看紧随其后的引号内的属性值(类似 `W1966190042455428950`即为网易号 ID。
</Route>

View File

@ -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,