diff --git a/docs/traditional-media.md b/docs/traditional-media.md index 9bac16da18..67dfe4faa6 100644 --- a/docs/traditional-media.md +++ b/docs/traditional-media.md @@ -259,6 +259,8 @@ Category 列表: +无料全文,综合页添加分类标签,可用于过滤。 + | 総合 | 社会 | 政治 | 経済 | スポーツ | 国際 | 科学・IT | 選挙・世論調査 | エンタメ・文化 | 囲碁・将棋 | ライフ | 地域 | 社説 | | ---- | -------- | -------- | ------- | -------- | ----- | ---------- | -------------- | -------------- | ---------- | ------ | ----- | --------- | | news | national | politics | economy | sports | world | science | election | culture | igoshougi | life | local | editorial | diff --git a/lib/router.js b/lib/router.js index 0409e35230..9bd69676dd 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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新闻 diff --git a/lib/routes/yomiuri/news.js b/lib/routes/yomiuri/news.js index 80c2b755e9..e61dcabc96 100644 --- a/lib/routes/yomiuri/news.js +++ b/lib/routes/yomiuri/news.js @@ -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, };