feat: remove notOperational routes - finance
This commit is contained in:
parent
302aa350b9
commit
6a133c8e61
|
|
@ -1285,9 +1285,6 @@ router.get('/199it/tag/:tag', lazyloadRouteHandler('./routes/199it/tag'));
|
|||
// Grub Street
|
||||
// router.get('/grubstreet', lazyloadRouteHandler('./routes/grubstreet/index'));
|
||||
|
||||
// CFD indices dividend adjustment
|
||||
router.get('/cfd/gbp_div', lazyloadRouteHandler('./routes/cfd/gbp_div'));
|
||||
|
||||
// Monotype
|
||||
router.get('/monotype/article', lazyloadRouteHandler('./routes/monotype/article'));
|
||||
|
||||
|
|
@ -1505,9 +1502,6 @@ router.get('/cktest/policy', lazyloadRouteHandler('./routes/cktest/policy'));
|
|||
// 妈咪帮
|
||||
router.get('/mamibuy/:caty?/:age?/:sort?', lazyloadRouteHandler('./routes/mamibuy/index'));
|
||||
|
||||
// World Economic Forum
|
||||
router.get('/weforum/report/:lang?/:year?/:platform?', lazyloadRouteHandler('./routes/weforum/report'));
|
||||
|
||||
// Nobel Prize
|
||||
router.get('/nobelprize/:caty?', lazyloadRouteHandler('./routes/nobelprize/index'));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const dateParser = require('@/utils/dateParser');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = 'https://www.cmcmarkets.com/en-gb/news-and-analysis/upcoming-indices-dividend-drop-points';
|
||||
const response = await got.get(link);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const title = $($('.news-table-wrapper')[0]).prev().text().replace('*', '');
|
||||
|
||||
const pubDate = dateParser($('meta[itemprop="datePublished"]').attr('content'), 'YYYY-MM-DD-HH:mm');
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'Upcoming CFD indices dividend adjustments',
|
||||
link,
|
||||
item: [
|
||||
{
|
||||
title,
|
||||
description: $('.news-table-wrapper').html(),
|
||||
pubDate,
|
||||
link,
|
||||
guid: title + pubDate,
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { isValidHost } = require('@/utils/valid-host');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const lang = ctx.params.lang || 'www';
|
||||
const platform = ctx.params.platform || '';
|
||||
const year = ctx.params.year || '';
|
||||
if (!isValidHost(lang)) {
|
||||
throw Error('Invalid lang');
|
||||
}
|
||||
|
||||
const rootUrl = `https://${lang === 'en' ? 'www' : lang}.weforum.org`;
|
||||
const currentUrl = `${rootUrl}/reports?platform=${platform}&year=${year}`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $('.report-listing-tout__content')
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('.report-listing-tout__title').text(),
|
||||
link: `${rootUrl}${item.find('.report-listing-tout__cta').attr('href')}`,
|
||||
description: `<a href="${item.find('.report__link').attr('href')}">Download PDF</a>`,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
content('.report__meta').remove();
|
||||
|
||||
item.description += content('.report__display-info').html();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got(`http://www.chinacef.cn/index.php/experts/zjmain/experts_id/${ctx.params.experts_id}`);
|
||||
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
const domArray = $('div[class^="leftnews"]');
|
||||
const rssTitle = $('title').text().trim();
|
||||
|
||||
const itemArray = await Promise.all(
|
||||
domArray
|
||||
.filter((index, item) => undefined !== $(item).find('h2 > a').attr('href'))
|
||||
.map(async (index, item) => {
|
||||
item = $(item);
|
||||
const itemLink = utils.siteLink + item.find('h2 > a').attr('href');
|
||||
const detail = await ctx.cache.tryGet(itemLink, () => utils.getArticleDetail(itemLink));
|
||||
|
||||
return {
|
||||
title: detail.title,
|
||||
description: detail.description,
|
||||
link: itemLink,
|
||||
pubDate: detail.time,
|
||||
author: detail.author,
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: rssTitle,
|
||||
link: utils.siteLink,
|
||||
item: itemArray,
|
||||
};
|
||||
};
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got.get('http://www.chinacef.cn/index.php/index/index');
|
||||
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
const domArray = $('#boardright ul');
|
||||
const rssTitle = '金融热点 - 首席经济学家论坛';
|
||||
|
||||
const itemArray = await Promise.all(
|
||||
domArray
|
||||
.map(async (index, item) => {
|
||||
item = $(item);
|
||||
const itemLink = utils.siteLink + item.find('li a').attr('href');
|
||||
const detail = await ctx.cache.tryGet(itemLink, () => utils.getArticleDetail(itemLink));
|
||||
|
||||
return {
|
||||
title: detail.title,
|
||||
description: detail.description,
|
||||
link: itemLink,
|
||||
pubDate: detail.time,
|
||||
author: detail.author,
|
||||
};
|
||||
})
|
||||
.get()
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: rssTitle,
|
||||
link: utils.siteLink,
|
||||
item: itemArray,
|
||||
};
|
||||
};
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
const utils = require('./utils');
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rssTitle = '最新更新 - 首席经济学家论坛';
|
||||
const regex = /^\/index\.php\/index\/article\/article_id\/\d+/g;
|
||||
|
||||
const response = await got.get('http://www.chinacef.cn/index.php/index/index');
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const articlesLinkListNode = $('a[target=_black]')
|
||||
.filter((_, item) => item.attribs.href.match(regex))
|
||||
.map((_, item) => item.attribs.href);
|
||||
const articlesLinkList = Array.from(new Set(articlesLinkListNode));
|
||||
|
||||
const articles = await Promise.all(
|
||||
articlesLinkList.map(async (item) => {
|
||||
const articlesLink = utils.siteLink + item;
|
||||
|
||||
const detail = await ctx.cache.tryGet(articlesLink, () => utils.getArticleDetail(articlesLink));
|
||||
|
||||
const element = {
|
||||
title: detail.title,
|
||||
author: detail.author,
|
||||
pubDate: detail.time,
|
||||
description: detail.description,
|
||||
link: articlesLink,
|
||||
};
|
||||
return element;
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: rssTitle,
|
||||
link: utils.siteLink,
|
||||
item: articles,
|
||||
};
|
||||
};
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
module.exports = {
|
||||
'/': ['FledgeXu'],
|
||||
'/:experts_id': ['kdanfly'],
|
||||
'/portal/hot': ['kdanfly'],
|
||||
};
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
module.exports = {
|
||||
'chinacef.cn': {
|
||||
_name: '首席经济学家论坛',
|
||||
'.': [
|
||||
{
|
||||
title: '最新文章列表',
|
||||
docs: 'https://docs.rsshub.app/routes/finance#shou-xi-jing-ji-xue-jia-lun-tan',
|
||||
source: ['/'],
|
||||
target: '/chinacef',
|
||||
},
|
||||
{
|
||||
title: '专家文章',
|
||||
docs: 'https://docs.rsshub.app/routes/finance#shou-xi-jing-ji-xue-jia-lun-tan-zhuan-jia',
|
||||
source: ['/index.php/experts/zjmain/experts_id/:experts_id'],
|
||||
target: '/chinacef/:experts_id',
|
||||
},
|
||||
{
|
||||
title: '金融热点',
|
||||
docs: 'https://docs.rsshub.app/routes/finance#shou-xi-jing-ji-xue-jia-lun-tan-jin-rong-re-dian',
|
||||
source: ['/index.php/index/index'],
|
||||
target: '/chinacef/portal/hot',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/:experts_id', require('./experts'));
|
||||
router.get('/portal/hot', require('./hot'));
|
||||
router.get('/', require('./index'));
|
||||
};
|
||||
|
|
@ -1 +0,0 @@
|
|||
{{@ desc }}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const siteLink = 'http://www.chinacef.cn';
|
||||
|
||||
const renderDesc = (desc) =>
|
||||
art(path.join(__dirname, 'templates/description.art'), {
|
||||
desc,
|
||||
});
|
||||
|
||||
const cleanDom = (dom) => {
|
||||
dom('*[style]').removeAttr('style');
|
||||
dom('br').remove();
|
||||
dom('span:empty').remove();
|
||||
dom('p:empty').remove();
|
||||
dom('p').each((_, el) => {
|
||||
if (dom(el).html().trim() === '') {
|
||||
dom(el).remove();
|
||||
}
|
||||
});
|
||||
return dom;
|
||||
};
|
||||
|
||||
const getArticleDetail = async (link) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
const $ = cleanDom(cheerio.load(response.data));
|
||||
|
||||
const title = $('span[class=contenttitle]').first().text().trim();
|
||||
const author = $('a[rel=author]').first().text().trim();
|
||||
const time = parseDate($('.divwidth').text().trim().split(' ')[3], 'YYYY-MM-DD');
|
||||
const description = $('div[class=newsmaintext]').html();
|
||||
return new ArticleDetail(title, author, time, renderDesc(description));
|
||||
};
|
||||
class ArticleDetail {
|
||||
constructor(title, author, time, description) {
|
||||
this.title = title;
|
||||
this.author = author;
|
||||
this.time = time;
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
siteLink,
|
||||
renderDesc,
|
||||
cleanDom,
|
||||
getArticleDetail,
|
||||
ArticleDetail,
|
||||
};
|
||||
|
|
@ -77,12 +77,6 @@
|
|||
|
||||
<Route author="josh" example="/bloomberg/authors/ARbTQlRLRjE/matthew-s-levine" path="/bloomberg/authors/:id/:slug/:source?" paramsDesc={['Author ID, can be found in URL', 'Author Slug, can be found in URL', 'Data source, either `api` or `rss`,`api` by default']} anticrawler="1" radar="1" />
|
||||
|
||||
## CFD {#cfd}
|
||||
|
||||
### Indices Dividend Adjustment {#cfd-indices-dividend-adjustment}
|
||||
|
||||
<Route author="HenryQW" example="/cfd/div_gbp" path="/cfd/div_gbp" notOperational="1" />
|
||||
|
||||
## DL NEWS {#dl-news}
|
||||
|
||||
### All Articles {#dl-news-all-articles}
|
||||
|
|
@ -321,18 +315,6 @@ TokenInsight also provides official RSS, you can take a look at [https://api.tok
|
|||
|
||||
## World Economic Forum 世界经济论坛 {#world-economic-forum-shi-jie-jing-ji-lun-tan}
|
||||
|
||||
### Report {#world-economic-forum-shi-jie-jing-ji-lun-tan-report}
|
||||
|
||||
<Route author="nczitzk" example="/weforum/report" path="/weforum/report/:lang?/:year?/:platform?" paramsDesc={['Language, see below, `en` by default', 'Year, filter by year, all by default', 'Platform, filter by platform, all by default']} notOperational="1">
|
||||
Languages
|
||||
|
||||
| English | Español | Français | 中文 | 日本語 |
|
||||
| ------- | ------- | -------- | ---- | ------ |
|
||||
| en | es | fr | cn | jp |
|
||||
|
||||
See filters in [Report](https://www.weforum.org/reports) for Year and Platform these two parameters.
|
||||
</Route>
|
||||
|
||||
## 巴伦周刊中文版 {#ba-lun-zhou-kan-zhong-wen-ban}
|
||||
|
||||
### 栏目 {#ba-lun-zhou-kan-zhong-wen-ban-lan-mu}
|
||||
|
|
@ -530,7 +512,7 @@ TokenInsight also provides official RSS, you can take a look at [https://api.tok
|
|||
|
||||
### 分类 {#mei-jing-wang-fen-lei}
|
||||
|
||||
<Route author="nczitzk" example="/nbd" path="/nbd/:id?" paramsDesc={['分类 id,见下表,默认为要闻']} notOperational="1">
|
||||
<Route author="nczitzk" example="/nbd" path="/nbd/:id?" paramsDesc={['分类 id,见下表,默认为要闻']}>
|
||||
| 头条 | 要闻 | 图片新闻 | 推荐 |
|
||||
| ---- | ---- | -------- | ---- |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
|
|
@ -649,24 +631,6 @@ TokenInsight also provides official RSS, you can take a look at [https://api.tok
|
|||
| 80 | 90 | 95 |
|
||||
</Route>
|
||||
|
||||
## 首席经济学家论坛 {#shou-xi-jing-ji-xue-jia-lun-tan}
|
||||
|
||||
### 最新更新 {#shou-xi-jing-ji-xue-jia-lun-tan-zui-xin-geng-xin}
|
||||
|
||||
<Route author="FledgeXu" example="/chinacef" path="/chinacef" notOperational="1" />
|
||||
|
||||
### 专家 {#shou-xi-jing-ji-xue-jia-lun-tan-zhuan-jia}
|
||||
|
||||
<Route author="kdanfly" example="/chinacef/17/" path="/chinacef/:experts_id/" paramsDesc={['专家编号']} radar="1" notOperational="1">
|
||||
| 李迅雷 | 夏斌 |
|
||||
| ------ | ---- |
|
||||
| 17 | 35 |
|
||||
</Route>
|
||||
|
||||
### 金融热点 {#shou-xi-jing-ji-xue-jia-lun-tan-jin-rong-re-dian}
|
||||
|
||||
<Route author="kdanfly" example="/chinacef/portal/hot" path="/chinacef/portal/hot" radar="1" notOperational="1" />
|
||||
|
||||
## 淘股吧 {#tao-gu-ba}
|
||||
|
||||
### 淘股论坛 {#tao-gu-ba-tao-gu-lun-tan}
|
||||
|
|
|
|||
Loading…
Reference in New Issue