From 0abd80a9a78f4f4bdab576ea01dc8eaa80662411 Mon Sep 17 00:00:00 2001 From: ciaran <760218327@qq.com> Date: Mon, 11 Mar 2019 10:47:49 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=90=8E=E7=BB=ADapp=20route=20(#1705)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 随着页面元素的更新而更新 --- lib/routes/houxu/lives.js | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/lib/routes/houxu/lives.js b/lib/routes/houxu/lives.js index acfa2ef02..247c96af7 100644 --- a/lib/routes/houxu/lives.js +++ b/lib/routes/houxu/lives.js @@ -7,34 +7,22 @@ module.exports = async (ctx) => { const res = await axios.get(baseUrl); const $ = cheerio.load(res.data); - const list = $('div.list > div'); + const list = $('div.container > div'); const out = list .map((_, el) => { const each = $(el); + + const p = each.find('p'); return { - title: - each - .find('cite') - .text() - .trim() + - ' | ' + - each - .find('a') - .first() - .text() - .trim(), - description: each - .find('p > a') - .contents() - .filter(function() { - return this.nodeType === 3; - }) + title: each + .find('h3') .text() .trim(), + description: p.html() + p.next().html(), link: 'https://houxu.app' + each - .find('a') + .find('h3 > a') .first() .attr('href'), };