mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-18 13:36:36 +08:00
feat(add): 深圳新闻网深圳市政府新闻发布厅 (#7733)
This commit is contained in:
@@ -1806,6 +1806,10 @@ column 为 third 时可选的 category:
|
||||
|
||||
## 深圳新闻网
|
||||
|
||||
### 深圳市政府新闻发布厅
|
||||
|
||||
<Route author="nczitzk" example="/sznews/press" path="/sznews/press"/>
|
||||
|
||||
### 排行榜
|
||||
|
||||
<Route author="nczitzk" example="/sznews/ranking" path="/sznews/ranking"/>
|
||||
|
||||
@@ -3964,6 +3964,7 @@ router.get('/babehub/search/:keyword?', require('./routes/babehub/search'));
|
||||
router.get('/babehub/:category?', require('./routes/babehub/index'));
|
||||
|
||||
// 深圳新闻网
|
||||
router.get('/sznews/press', require('./routes/sznews/press'));
|
||||
router.get('/sznews/ranking', require('./routes/sznews/ranking'));
|
||||
|
||||
// Shuax
|
||||
|
||||
51
lib/routes/sznews/press.js
Normal file
51
lib/routes/sznews/press.js
Normal file
@@ -0,0 +1,51 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'http://www.sznews.com';
|
||||
const currentUrl = `${rootUrl}/zhuanti/node_210611.htm`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $('.list-pt-li a h3')
|
||||
.slice(0, 10)
|
||||
.map((_, item) => {
|
||||
item = $(item).parent();
|
||||
|
||||
return {
|
||||
title: item.text(),
|
||||
link: item.attr('href'),
|
||||
pubDate: timezone(new Date(item.parent().find('.date').text()), +8),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
item.description = content('#picBox').html() + content('.pos').html();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '往期回顾 - 深圳市政府新闻发布厅',
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -42,7 +42,7 @@ module.exports = async (ctx) => {
|
||||
|
||||
item.description = content('.article-content').html();
|
||||
item.author = content('.a_source').text().replace('来源: ', '');
|
||||
item.pubDate = new Date(content('.a_time').text() + ' GMT+8').toUTCString();
|
||||
item.pubDate = Date.parse(content('.a_time').text());
|
||||
|
||||
return item;
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user