mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(route): add 政策研究, 工作论文 and refactor to V2 (#9324)
* feat(route): add 政策研究, 工作论文 and refactor to V2 * fix: depreciated url.resolve pubDate
This commit is contained in:
+10
-2
@@ -369,11 +369,19 @@ pageClass: routes
|
||||
|
||||
### 沟通交流
|
||||
|
||||
<Route author="nczitzk" example="/pbc/goutongjiaoliu" path="/pbc/goutongjiaoliu"/>
|
||||
<Route author="nczitzk" example="/gov/pbc/goutongjiaoliu" path="/gov/pbc/goutongjiaoliu"/>
|
||||
|
||||
### 货币政策司公开市场交易公告
|
||||
|
||||
<Route author="nczitzk" example="/pbc/tradeAnnouncement" path="/pbc/tradeAnnouncement"/>
|
||||
<Route author="nczitzk" example="/gov/pbc/tradeAnnouncement" path="/gov/pbc/tradeAnnouncement"/>
|
||||
|
||||
### 政策研究
|
||||
|
||||
<Route author="Fatpandac" example="/gov/pbc/zcjl" path="/gov/pbc/zcjl"/>
|
||||
|
||||
### 工作论文
|
||||
|
||||
<Route author="Fatpandac" example="/gov/pbc/gzlw" path="/gov/pbc/gzlw"/>
|
||||
|
||||
## 中证网
|
||||
|
||||
|
||||
@@ -2837,10 +2837,6 @@ router.get('/aljazeera/news', lazyloadRouteHandler('./routes/aljazeera/news'));
|
||||
// CFD indices dividend adjustment
|
||||
router.get('/cfd/gbp_div', lazyloadRouteHandler('./routes/cfd/gbp_div'));
|
||||
|
||||
// 中国人民银行
|
||||
router.get('/pbc/goutongjiaoliu', lazyloadRouteHandler('./routes/pbc/goutongjiaoliu'));
|
||||
router.get('/pbc/tradeAnnouncement', lazyloadRouteHandler('./routes/pbc/tradeAnnouncement'));
|
||||
|
||||
// Monotype
|
||||
router.get('/monotype/article', lazyloadRouteHandler('./routes/monotype/article'));
|
||||
|
||||
|
||||
@@ -13,4 +13,8 @@ module.exports = {
|
||||
'/miit/wjgs': ['Yoge-Code'],
|
||||
'/miit/zcjd': ['Yoge-Code'],
|
||||
'/mee/ywdt?': ['liuxsdev'],
|
||||
'/pbc/goutongjiaoliu': ['nczitzk'],
|
||||
'/pbc/tradeAnnouncement': ['nczitzk'],
|
||||
'/pbc/zcyj': ['Fatpandac'],
|
||||
'/pbc/gzlw': ['Fatpandac'],
|
||||
};
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
const url = require('url');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = `http://www.pbc.gov.cn/goutongjiaoliu/113456/113469/index.html`;
|
||||
const link = 'http://www.pbc.gov.cn/goutongjiaoliu/113456/113469/index.html';
|
||||
|
||||
const browser = await require('@/utils/puppeteer')();
|
||||
const page = await browser.newPage();
|
||||
@@ -19,8 +20,7 @@ module.exports = async (ctx) => {
|
||||
const a = item.find('a[title]');
|
||||
return {
|
||||
title: a.text(),
|
||||
link: url.resolve(`http://www.pbc.gov.cn`, a.attr('href')),
|
||||
pubDate: new Date(item.next('span.hui12').text()).toUTCString(),
|
||||
link: new URL(a.attr('href'), 'http://www.pbc.gov.cn'),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
@@ -37,6 +37,7 @@ module.exports = async (ctx) => {
|
||||
);
|
||||
const content = cheerio.load(detailHtml);
|
||||
item.description = content('#zoom').html();
|
||||
item.pubDate = timezone(parseDate(content('.hui12').eq(5).text()), +8);
|
||||
return item;
|
||||
})
|
||||
)
|
||||
@@ -0,0 +1,27 @@
|
||||
const { processItems } = require('./utils');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const host = 'http://www.pbc.gov.cn';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = `${host}/redianzhuanti/118742/4122386/4122692/index.html`;
|
||||
|
||||
const response = await got.post(url);
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('li.clearfix')
|
||||
.map((_index, item) => ({
|
||||
title: $(item).find('a').text(),
|
||||
link: new URL($(item).find('a').attr('href'), host).href,
|
||||
author: $(item).find('span.fr').text().replace(/…/g, ''),
|
||||
}))
|
||||
.get();
|
||||
|
||||
const items = await processItems(list, ctx);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '中国人民银行 工作论文',
|
||||
link: url,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -1,8 +1,9 @@
|
||||
const url = require('url');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = `http://www.pbc.gov.cn/zhengcehuobisi/125207/125213/125431/125475/index.html`;
|
||||
const link = 'http://www.pbc.gov.cn/zhengcehuobisi/125207/125213/125431/125475/index.html';
|
||||
|
||||
const browser = await require('@/utils/puppeteer')();
|
||||
const page = await browser.newPage();
|
||||
@@ -19,8 +20,7 @@ module.exports = async (ctx) => {
|
||||
const a = item.find('a[title]');
|
||||
return {
|
||||
title: a.text(),
|
||||
link: url.resolve(`http://www.pbc.gov.cn`, a.attr('href')),
|
||||
pubDate: new Date(item.next('span.hui12').text()).toUTCString(),
|
||||
link: new URL(a.attr('href'), 'http://www.pbc.gov.cn'),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
@@ -37,6 +37,7 @@ module.exports = async (ctx) => {
|
||||
);
|
||||
const content = cheerio.load(detailHtml);
|
||||
item.description = content('#zoom').html();
|
||||
item.pubDate = timezone(parseDate(content('#shijian').text()), +8);
|
||||
return item;
|
||||
})
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const processItems = async (list, ctx) =>
|
||||
await Promise.all(
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got.post(item.link);
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
item.description = content('div.xxy_text').html();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
module.exports = {
|
||||
processItems,
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
const { processItems } = require('./utils');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
const host = 'http://www.pbc.gov.cn';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = `${host}/redianzhuanti/118742/4122386/4122510/index.html`;
|
||||
|
||||
const response = await got.post(url);
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('li.clearfix')
|
||||
.map((_index, item) => ({
|
||||
title: $(item).find('a').text(),
|
||||
link: new URL($(item).find('a').attr('href'), host).href,
|
||||
pubDate: timezone(parseDate($(item).find('span.fr').text(), 'YYYY-MM-DD'), +8),
|
||||
}))
|
||||
.get();
|
||||
|
||||
const items = await processItems(list, ctx);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '中国人民银行 政策研究',
|
||||
link: url,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -404,4 +404,33 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
},
|
||||
'pbc.gov.cn': {
|
||||
_name: '中国人民银行',
|
||||
'.': [
|
||||
{
|
||||
title: '沟通交流',
|
||||
docs: 'https://docs.rsshub.app/finance.html#zhong-guo-ren-min-yin-xing',
|
||||
source: ['/goutongjiaoliu/113456/113469/index.html'],
|
||||
target: '/gov/pbc/goutongjiaoliu',
|
||||
},
|
||||
{
|
||||
title: '货币政策司公开市场交易公告',
|
||||
docs: 'https://docs.rsshub.app/finance.html#zhong-guo-ren-min-yin-xing',
|
||||
source: ['/zhengcehuobisi/125207/125213/125431/125475/index.html'],
|
||||
target: '/gov/pbc/zhengcehuobisi',
|
||||
},
|
||||
{
|
||||
title: '政策研究',
|
||||
docs: 'https://docs.rsshub.app/finance.html#zhong-guo-ren-min-yin-xing',
|
||||
source: ['/redianzhuanti/118742/4122386/4122510/index.html'],
|
||||
target: '/gov/pbc/zcyj',
|
||||
},
|
||||
{
|
||||
title: '工作论文',
|
||||
docs: 'https://docs.rsshub.app/finance.html#zhong-guo-ren-min-yin-xing',
|
||||
source: ['/redianzhuanti/118742/4122386/4122692/index.html'],
|
||||
target: '/gov/pbc/gzlw',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -14,4 +14,8 @@ module.exports = function (router) {
|
||||
router.get('/miit/wjgs', require('./miit/wjgs'));
|
||||
router.get('/miit/zcjd', require('./miit/zcjd'));
|
||||
router.get('/mee/ywdt/:category?', require('./mee/ywdt'));
|
||||
router.get('/pbc/goutongjiaoliu', require('./pbc/goutongjiaoliu'));
|
||||
router.get('/pbc/tradeAnnouncement', require('./pbc/tradeAnnouncement'));
|
||||
router.get('/pbc/gzlw', require('./pbc/gzlw'));
|
||||
router.get('/pbc/zcyj', require('./pbc/zcyj'));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user