diff --git a/docs/new-media.md b/docs/new-media.md index e0db8a10a..ce66dc72e 100644 --- a/docs/new-media.md +++ b/docs/new-media.md @@ -2318,6 +2318,12 @@ others = 热点新闻 + 滚动新闻 +## 观点网 + +### 资讯 + + + ## 观海新闻 ### 首页 diff --git a/lib/v2/guandian/index.js b/lib/v2/guandian/index.js new file mode 100644 index 000000000..9697e2318 --- /dev/null +++ b/lib/v2/guandian/index.js @@ -0,0 +1,37 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); +const timezone = require('@/utils/timezone'); + +const baseUrl = 'https://www.guandian.cn'; + +module.exports = async (ctx) => { + const cat = ctx.params.category; + const reqUrl = `${baseUrl}/${cat}/`; + const response = await got(reqUrl); + const $ = cheerio.load(response.data); + + const items = $('.con_l li') + .toArray() + .map((item) => { + item = $(item); + const a = item.find('.con_l_con_r a'); + const link = a.attr('href'); + const title = a.find('h3').text(); + const desc = item.find('.con_l_con_r p').text(); + + const dateStr = item.find('#keyword span').text(); + return { + title, + link, + description: desc, + pubDate: timezone(parseDate(dateStr), 8), + }; + }); + + ctx.state.data = { + title: $('head title').text(), + link: reqUrl, + item: items, + }; +}; diff --git a/lib/v2/guandian/maintainer.js b/lib/v2/guandian/maintainer.js new file mode 100644 index 000000000..41b9175da --- /dev/null +++ b/lib/v2/guandian/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/:category': ['drgnchan'], +}; diff --git a/lib/v2/guandian/radar.js b/lib/v2/guandian/radar.js new file mode 100644 index 000000000..e22627bfc --- /dev/null +++ b/lib/v2/guandian/radar.js @@ -0,0 +1,11 @@ +module.exports = { + 'guandian.cn': { + _name: '观点网', + www: { + title: '资讯', + docs: 'https://docs.rsshub.app/new-media.html#guan-dian-wang-zi-xun', + source: ['/:category'], + target: '/guandian/:category', + }, + }, +}; diff --git a/lib/v2/guandian/router.js b/lib/v2/guandian/router.js new file mode 100644 index 000000000..a539e1336 --- /dev/null +++ b/lib/v2/guandian/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/:category', require('./index')); +};