fix: 読売新聞, add title tag (#5825)

This commit is contained in:
Arracc
2020-10-08 21:32:14 +01:00
committed by GitHub
parent 35f37a6d62
commit 271e2750e2
3 changed files with 26 additions and 2 deletions
+2
View File
@@ -259,6 +259,8 @@ Category 列表:
<Route author="Arracc" example="/yomiuri/news" path="/yomiuri/:category" :paramsDesc="['分类']">
无料全文,综合页添加分类标签,可用于过滤。
| 総合 | 社会 | 政治 | 経済 | スポーツ | 国際 | 科学・IT | 選挙・世論調査 | エンタメ・文化 | 囲碁・将棋 | ライフ | 地域 | 社説 |
| ---- | -------- | -------- | ------- | -------- | ----- | ---------- | -------------- | -------------- | ---------- | ------ | ----- | --------- |
| news | national | politics | economy | sports | world | science | election | culture | igoshougi | life | local | editorial |
+1 -1
View File
@@ -3314,7 +3314,7 @@ router.get('/nobelprize/:caty?', require('./routes/nobelprize/index'));
router.get('/gov/taiwan/mnd', require('./routes/gov/taiwan/mnd'));
// 読売新聞
router.get('/yomiuri/:category?', require('./routes/yomiuri/news'));
router.get('/yomiuri/:category', require('./routes/yomiuri/news'));
// 巴哈姆特
// GNN新闻
+23 -1
View File
@@ -32,8 +32,30 @@ module.exports = async (ctx) => {
const $ = cheerio.load(response.data);
return $('div.p-main-contents').html();
});
let tag = '';
if (category_name === '総合') {
const tag_table = {
news: '総合',
national: '社会',
politics: '政治',
economy: '経済',
sports: 'スポーツ',
world: '国際',
science: '科学・IT',
election: '選挙・世論調査',
culture: 'エンタメ・文化',
igoshougi: '囲碁・将棋',
life: 'ライフ',
local: '地域',
editorial: '社説',
medical: '医療・健康',
};
const tag_value = tag_table[link.split('/')[3]];
tag = tag_value ? tag_value : 'その他';
tag = '[' + tag + '] ';
}
return {
title: item.find('a').text(),
title: tag + item.find('a').text(),
description,
link,
};