diff --git a/docs/en/traditional-media.md b/docs/en/traditional-media.md index da95d1dd9..829a880dc 100644 --- a/docs/en/traditional-media.md +++ b/docs/en/traditional-media.md @@ -433,6 +433,18 @@ More could be found in the URL of the category/topic page. +## Rodong Sinmun + +### News + + + +| 조선어 | English | 中文 | +| ---- | ------ | --- | +| ko | en | cn | + + + ## RTHK ### News diff --git a/docs/traditional-media.md b/docs/traditional-media.md index 9619b122c..2b3eb74f0 100644 --- a/docs/traditional-media.md +++ b/docs/traditional-media.md @@ -1346,6 +1346,18 @@ category 对应的关键词有 +## 劳动新闻 + +### 新闻 + + + +| 조선어 | English | 中文 | +| --- | ------- | -- | +| ko | en | cn | + + + ## 理论网 ### 学习时报 diff --git a/lib/v2/rodong/maintainer.js b/lib/v2/rodong/maintainer.js new file mode 100644 index 000000000..e05e65c98 --- /dev/null +++ b/lib/v2/rodong/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/news/:language?': ['TonyRL'], +}; diff --git a/lib/v2/rodong/news.js b/lib/v2/rodong/news.js new file mode 100644 index 000000000..4ac45959a --- /dev/null +++ b/lib/v2/rodong/news.js @@ -0,0 +1,45 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); + +const host = 'http://www.rodong.rep.kp'; + +module.exports = async (ctx) => { + const { language = 'ko' } = ctx.params; + const link = `${host}/${language}/index.php?MkBAMkAxQA==`; + const { data: response } = await got(link); + + const $ = cheerio.load(response); + const list = $('.date_news_list .row') + .toArray() + .map((item) => { + item = $(item); + return { + title: item.find('.media-body').text(), + link: `${host}/${language}/${item.find('.media-body a').attr('href')}`, + author: item.find('.col-sm-3').text(), + pubDate: parseDate(item.find('.news_date').text(), 'YYYY.M.D.'), + }; + }); + + const items = await Promise.all( + list.map((item) => + ctx.cache.tryGet(item.link, async () => { + const { data: response } = await got(item.link); + const $ = cheerio.load(response); + + $('.news_Title, .NewsDetail, .News_Detail, #moveNews').remove(); + item.description = $('.col-sm-8').html(); + + return item; + }) + ) + ); + + ctx.state.data = { + title: $('head title').text(), + description: $('head meta[name="description"]').attr('content'), + link, + item: items, + }; +}; diff --git a/lib/v2/rodong/radar.js b/lib/v2/rodong/radar.js new file mode 100644 index 000000000..4530929c7 --- /dev/null +++ b/lib/v2/rodong/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'rodong.rep.kp': { + _name: '劳动新闻', + '.': [ + { + title: '新闻', + docs: 'https://docs.rsshub.app/traditional-media.html#lao-dong-xin-wen', + source: ['/cn/index.php', '/en/index.php', '/ko/index.php', '/cn', '/en', '/ko'], + target: '/rodong/news', + }, + ], + }, +}; diff --git a/lib/v2/rodong/router.js b/lib/v2/rodong/router.js new file mode 100644 index 000000000..30e26f151 --- /dev/null +++ b/lib/v2/rodong/router.js @@ -0,0 +1,3 @@ +module.exports = (router) => { + router.get('/news/:language?', require('./news')); +};