From dc95d7386366e7aa3c4174a0fb4f25ddab88214e Mon Sep 17 00:00:00 2001 From: Cloud Date: Wed, 25 Sep 2019 11:58:21 +0800 Subject: [PATCH] fix: zzz can't get content (#3129) --- lib/routes/zzz/index.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/routes/zzz/index.js b/lib/routes/zzz/index.js index 375744456..d9a8783fd 100644 --- a/lib/routes/zzz/index.js +++ b/lib/routes/zzz/index.js @@ -4,16 +4,12 @@ const cheerio = require('cheerio'); module.exports = async (ctx) => { const response = await got.get('https://z-z-z.vip'); const $ = cheerio.load(response.data); - const list = $('.media-list .az-article-wrapper').get(); + const list = $('.posts-wrapper article').get(); const ProcessFeed = (data) => { const $ = cheerio.load(data); - const content = $('div.bpp-post-content'); - - content.find('img').each((i, e) => { - $(e).attr('src', $(e).attr('data-echo')); - }); + const content = $('.nv-content-wrap.entry-content'); return content.html(); }; @@ -21,7 +17,7 @@ module.exports = async (ctx) => { const items = await Promise.all( list.map(async (item) => { const $ = cheerio.load(item); - const $a = $('.media-heading a'); + const $a = $('.blog-entry-title a'); const link = $a.attr('href'); const cache = await ctx.cache.get(link); @@ -38,11 +34,8 @@ module.exports = async (ctx) => { title: $a.text(), description: ProcessFeed(response.data), link: link, - pubDate: $('.glyphicon-calendar') - .toArray()[0] - .nextSibling.data.replace(/年|月/g, '-') - .replace('日', ''), - author: $('.glyphicon-user').toArray()[0].nextSibling.data, + pubDate: new Date($('time.published').attr('datetime')).toUTCString(), + author: $('.author-name > a').text(), }; ctx.cache.set(link, JSON.stringify(single));