mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-12 16:20:27 +08:00
Add(route): add ulapia (#8881)
This commit is contained in:
@@ -183,6 +183,22 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="zidekuls" example="/eastmoney/user/6551094298949188" path="/eastmoney/user/:uid" :paramsDesc="['用户 id, 可在用户主页 URL 中找到']"/>
|
<Route author="zidekuls" example="/eastmoney/user/6551094298949188" path="/eastmoney/user/:uid" :paramsDesc="['用户 id, 可在用户主页 URL 中找到']"/>
|
||||||
|
|
||||||
|
## 乌拉邦
|
||||||
|
|
||||||
|
### 最新研报
|
||||||
|
|
||||||
|
<Route author="Fatpandac" example="/ulapia/research/latest" path="/ulapia/research/latest"/>
|
||||||
|
|
||||||
|
### 频道
|
||||||
|
|
||||||
|
<Route author="Fatpandac" example="/ulapia/reports/stock_research" path="/ulapia/reports/:category?" :paramsDesc="['频道类型,默认为券商晨报(今日晨报)']">
|
||||||
|
|
||||||
|
| 个股研报 | 行业研报 | 策略研报 | 宏观研报 | 新股研报 | 券商晨报(今日晨报) |
|
||||||
|
| :------------: | :---------------: | :---------------: | :------------: | :----------: | :------------------: |
|
||||||
|
| stock_research | industry_research | strategy_research | macro_research | ipo_research | brokerage_news |
|
||||||
|
|
||||||
|
</Route>
|
||||||
|
|
||||||
## 新浪财经
|
## 新浪财经
|
||||||
|
|
||||||
### 新浪财经-国內
|
### 新浪财经-国內
|
||||||
|
|||||||
47
lib/v2/ulapia/index.js
Normal file
47
lib/v2/ulapia/index.js
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
const { parseDate } = require('@/utils/parse-date');
|
||||||
|
|
||||||
|
const rootUrl = 'http://www.ulapia.com';
|
||||||
|
|
||||||
|
const titleMap = {
|
||||||
|
brokerage_news: '券商晨报',
|
||||||
|
stock_research: '个股研报',
|
||||||
|
industry_research: '行业研报',
|
||||||
|
strategy_research: '策略研报',
|
||||||
|
macro_research: '宏观研报',
|
||||||
|
ipo_research: 'IPO研报',
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectorMap = {
|
||||||
|
brokerage_news: 'div.col-md-4',
|
||||||
|
stock_research: 'div.col-md-6',
|
||||||
|
industry_research: 'div.col-md-6',
|
||||||
|
strategy_research: 'div.col-md-6',
|
||||||
|
macro_research: 'div.col-md-6',
|
||||||
|
ipo_research: 'div.col-md-6',
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const category = ctx.params.category ?? 'brokerage_news';
|
||||||
|
const url = `${rootUrl}/reports/${category}`;
|
||||||
|
|
||||||
|
const response = await got.get(url);
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
const items = $(String(selectorMap[category]))
|
||||||
|
.filter((_, item) => $(item).find('img').attr('src'))
|
||||||
|
.map((_, item) => ({
|
||||||
|
title: `${$(item).find('strong').text()} ${$(item).find('h5.mb-1').text()}`,
|
||||||
|
author: $(item).find('div.col.p-8.d-flex.px-3.py-3.flex-column.position-static > div:nth-child(4) > span:nth-child(2)').text(),
|
||||||
|
link: $(item).find('h5.mb-1 > a').attr('href'),
|
||||||
|
description: `<img src="${$(item).find('img').attr('src').split('!')[0]}">`,
|
||||||
|
pubDate: parseDate($(item).find('div.mb-0.text-muted').last().text().split(':')[1], 'YYYY-MM-DD'),
|
||||||
|
}))
|
||||||
|
.get();
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: ` ulapia - ${titleMap[category]}`,
|
||||||
|
link: url,
|
||||||
|
item: items,
|
||||||
|
};
|
||||||
|
};
|
||||||
3
lib/v2/ulapia/maintainer.js
Normal file
3
lib/v2/ulapia/maintainer.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
'/reports/:category?': ['Fatpandac'],
|
||||||
|
};
|
||||||
55
lib/v2/ulapia/radar.js
Normal file
55
lib/v2/ulapia/radar.js
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
module.exports = {
|
||||||
|
'ulapia.com': {
|
||||||
|
_name: '乌拉邦 ulapia',
|
||||||
|
www: [
|
||||||
|
{
|
||||||
|
title: '今日晨报',
|
||||||
|
docs: 'https://docs.rsshub.app/finance.html#wu-la-bang-pin-dao',
|
||||||
|
source: ['/'],
|
||||||
|
target: '/ulapia/reports/brokerage_news',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '最新研报',
|
||||||
|
docs: 'https://docs.rsshub.app/finance.html#wu-la-bang-zui-xin-yan-bao',
|
||||||
|
source: ['/'],
|
||||||
|
target: '/ulapia/research/latest',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '个股研报',
|
||||||
|
docs: 'https://docs.rsshub.app/finance.html#wu-la-bang-pin-dao',
|
||||||
|
source: ['/reports/stock_research'],
|
||||||
|
target: '/ulapia/reports/stock_research',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '行业研报',
|
||||||
|
docs: 'https://docs.rsshub.app/finance.html#wu-la-bang-pin-dao',
|
||||||
|
source: ['/reports/industry_research'],
|
||||||
|
target: '/ulapia/reports/industry_research',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '策略研报',
|
||||||
|
docs: 'https://docs.rsshub.app/finance.html#wu-la-bang-pin-dao',
|
||||||
|
source: ['/reports/strategy_research'],
|
||||||
|
target: '/ulapia/reports/strategy_research',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '宏观研报',
|
||||||
|
docs: 'https://docs.rsshub.app/finance.html#wu-la-bang-pin-dao',
|
||||||
|
source: ['/reports/macro_research'],
|
||||||
|
target: '/ulapia/reports/macro_research',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '新股研报',
|
||||||
|
docs: 'https://docs.rsshub.app/finance.html#wu-la-bang-pin-dao',
|
||||||
|
source: ['/reports/ipo_research'],
|
||||||
|
target: '/ulapia/reports/ipo_research',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '券商晨报',
|
||||||
|
docs: 'https://docs.rsshub.app/finance.html#wu-la-bang-pin-dao',
|
||||||
|
source: ['/reports/brokerage_news'],
|
||||||
|
target: '/ulapia/reports/brokerage_news',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
38
lib/v2/ulapia/research.js
Normal file
38
lib/v2/ulapia/research.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
const { parseDate } = require('@/utils/parse-date');
|
||||||
|
|
||||||
|
const rootUrl = 'http://www.ulapia.com';
|
||||||
|
|
||||||
|
const researchList = ['stock_research', 'industry_research', 'strategy_research', 'macro_research', 'ipo_research'];
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const items = await Promise.all(
|
||||||
|
researchList.map((item) => {
|
||||||
|
const url = `${rootUrl}/reports/${item}`;
|
||||||
|
|
||||||
|
return ctx.cache.tryGet(url, async () => {
|
||||||
|
const response = await got.get(url);
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
const items = $('div.row > div.col-md-6')
|
||||||
|
.slice(0, 6)
|
||||||
|
.map((_, item) => ({
|
||||||
|
title: `${$(item).find('strong').text()} ${$(item).find('h5.mb-1').text()}`,
|
||||||
|
author: $(item).find('div.col.p-8.d-flex.px-3.py-3.flex-column.position-static > div:nth-child(4) > span:nth-child(2)').text(),
|
||||||
|
link: $(item).find('h5.mb-1 > a').attr('href'),
|
||||||
|
description: `<img src="${$(item).find('img').attr('src').split('!')[0]}">`,
|
||||||
|
pubDate: parseDate($(item).find('div.mb-0.text-muted').last().text().split(':')[1], 'YYYY-MM-DD'),
|
||||||
|
}))
|
||||||
|
.get();
|
||||||
|
|
||||||
|
return items;
|
||||||
|
});
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: 'Ulapia - 最新研报',
|
||||||
|
link: rootUrl,
|
||||||
|
item: items.flat(),
|
||||||
|
};
|
||||||
|
};
|
||||||
4
lib/v2/ulapia/router.js
Normal file
4
lib/v2/ulapia/router.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
module.exports = function (router) {
|
||||||
|
router.get('/reports/:category?', require('./index'));
|
||||||
|
router.get('/research/latest', require('./research'));
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user