fix: 修复多知网内容获取 (#3282)

This commit is contained in:
Huiru
2019-10-18 14:41:13 +08:00
committed by DIYgod
parent d8be065855
commit 8f51bbbe78
+3 -4
View File
@@ -4,16 +4,14 @@ const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await got('http://www.duozhi.com/');
const $ = cheerio.load(response.data);
const postList = $('.post-list .post').get();
const postList = $('.list-post .post-item').get();
const result = await Promise.all(
postList.map(async (item) => {
const title = $(item)
.find('.post-title')
.find('a')
.text();
const link = $(item)
.find('.post-title')
.find('a')
.attr('href');
const guid = link;
@@ -41,8 +39,9 @@ module.exports = async (ctx) => {
.replace(/alt="\\"/g, '');
single.pubDate = new Date(
$(temp.data)
.find('.meta-date')
.find('.subject-meta')
.text()
.trim()
.substr(0, 18)
).toUTCString();