fix(route): china.com military xpath (#13465)

This commit is contained in:
King
2023-10-05 22:09:14 +00:00
committed by GitHub
parent 67d4a7ed3f
commit b5e0223fe2
2 changed files with 5 additions and 6 deletions
View File
+5 -6
View File
@@ -7,8 +7,7 @@ module.exports = async (ctx) => {
const response = await got(websiteUrl);
const data = response.data;
const $ = cheerio.load(data);
const commonList = $('.listItem');
const commonList = $('.item_list li');
ctx.state.data = {
title: '中华网-军事新闻',
link: 'https://military.china.com/news/',
@@ -18,12 +17,12 @@ module.exports = async (ctx) => {
.map((_, item) => {
item = $(item);
return {
title: item.find('.tit a').text(),
title: item.find('h3.item_title').text(),
author: '中华网军事',
category: '中华网军事',
pubDate: parseDate(item.find('.time').text()),
description: item.find('.tag').text(),
link: item.find('.tit a').attr('href'),
pubDate: parseDate(item.find('em.item_time').text()),
description: item.find('.item_source').text(),
link: item.find('h3.item_title a').attr('href'),
};
})
.get(),