diff --git a/lib/router.js b/lib/router.js index 27c88b56f..d95c415e9 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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')); diff --git a/lib/routes/cfd/gbp_div.js b/lib/routes/cfd/gbp_div.js deleted file mode 100644 index d1978a30c..000000000 --- a/lib/routes/cfd/gbp_div.js +++ /dev/null @@ -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, - }, - ], - }; -}; diff --git a/lib/routes/weforum/report.js b/lib/routes/weforum/report.js deleted file mode 100644 index 26ef70d2a..000000000 --- a/lib/routes/weforum/report.js +++ /dev/null @@ -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: `Download PDF`, - }; - }) - .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, - }; -}; diff --git a/lib/v2/chinacef/experts.js b/lib/v2/chinacef/experts.js deleted file mode 100644 index a578b3c64..000000000 --- a/lib/v2/chinacef/experts.js +++ /dev/null @@ -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, - }; -}; diff --git a/lib/v2/chinacef/hot.js b/lib/v2/chinacef/hot.js deleted file mode 100644 index 24717b2c4..000000000 --- a/lib/v2/chinacef/hot.js +++ /dev/null @@ -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, - }; -}; diff --git a/lib/v2/chinacef/index.js b/lib/v2/chinacef/index.js deleted file mode 100644 index 93ecc1343..000000000 --- a/lib/v2/chinacef/index.js +++ /dev/null @@ -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, - }; -}; diff --git a/lib/v2/chinacef/maintainer.js b/lib/v2/chinacef/maintainer.js deleted file mode 100644 index d2813e175..000000000 --- a/lib/v2/chinacef/maintainer.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - '/': ['FledgeXu'], - '/:experts_id': ['kdanfly'], - '/portal/hot': ['kdanfly'], -}; diff --git a/lib/v2/chinacef/radar.js b/lib/v2/chinacef/radar.js deleted file mode 100644 index 07e642cb5..000000000 --- a/lib/v2/chinacef/radar.js +++ /dev/null @@ -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', - }, - ], - }, -}; diff --git a/lib/v2/chinacef/router.js b/lib/v2/chinacef/router.js deleted file mode 100644 index 6a78094f4..000000000 --- a/lib/v2/chinacef/router.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = function (router) { - router.get('/:experts_id', require('./experts')); - router.get('/portal/hot', require('./hot')); - router.get('/', require('./index')); -}; diff --git a/lib/v2/chinacef/templates/description.art b/lib/v2/chinacef/templates/description.art deleted file mode 100644 index 7755ee9f6..000000000 --- a/lib/v2/chinacef/templates/description.art +++ /dev/null @@ -1 +0,0 @@ -{{@ desc }} diff --git a/lib/v2/chinacef/utils.js b/lib/v2/chinacef/utils.js deleted file mode 100644 index 611eedc2a..000000000 --- a/lib/v2/chinacef/utils.js +++ /dev/null @@ -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, -}; diff --git a/website/docs/routes/finance.mdx b/website/docs/routes/finance.mdx index ba00b36c8..660fde0dc 100644 --- a/website/docs/routes/finance.mdx +++ b/website/docs/routes/finance.mdx @@ -77,12 +77,6 @@ -## CFD {#cfd} - -### Indices Dividend Adjustment {#cfd-indices-dividend-adjustment} - - - ## 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} - - - 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. - - ## 巴伦周刊中文版 {#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} - + | 头条 | 要闻 | 图片新闻 | 推荐 | | ---- | ---- | -------- | ---- | | 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 | -## 首席经济学家论坛 {#shou-xi-jing-ji-xue-jia-lun-tan} - -### 最新更新 {#shou-xi-jing-ji-xue-jia-lun-tan-zui-xin-geng-xin} - - - -### 专家 {#shou-xi-jing-ji-xue-jia-lun-tan-zhuan-jia} - - - | 李迅雷 | 夏斌 | - | ------ | ---- | - | 17 | 35 | - - -### 金融热点 {#shou-xi-jing-ji-xue-jia-lun-tan-jin-rong-re-dian} - - - ## 淘股吧 {#tao-gu-ba} ### 淘股论坛 {#tao-gu-ba-tao-gu-lun-tan}