feat: add The Economist 经济学人下载 (#5964)
This commit is contained in:
parent
8a180b264e
commit
9535fe83d2
|
|
@ -162,6 +162,7 @@ This route adds the missing photo and Link element. (Offical RSS doesn't have Li
|
|||
See the [official RSS page](https://www.scmp.com/rss) to get the ID of each category. This route provides fulltext that the offical feed doesn't.
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## The Economist
|
||||
|
||||
### Category
|
||||
|
|
@ -172,6 +173,14 @@ See the [official RSS page](https://www.scmp.com/rss) to get the ID of each cate
|
|||
|
||||
<RouteEn author="xyqfer" example="/the-economist/gre-vocabulary" path="/the-economist/gre-vocabulary" />
|
||||
|
||||
### Download
|
||||
|
||||
<RouteEn author="nczitzk" example="/the-economist/download" path="/the-economist/download" >
|
||||
|
||||
The download site: http://www.cgx02.xyz/index.php?dir=/te
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## The Guardian
|
||||
|
||||
### Editorial
|
||||
|
|
|
|||
|
|
@ -177,6 +177,14 @@ Solidot 提供的 feed:
|
|||
|
||||
<Route author="xyqfer" example="/the-economist/gre-vocabulary" path="/the-economist/gre-vocabulary" />
|
||||
|
||||
### 下载
|
||||
|
||||
<Route author="nczitzk" example="/the-economist/download" path="/the-economist/download" >
|
||||
|
||||
下载站:<http://www.cgx02.xyz/index.php?dir=/te>
|
||||
|
||||
</Route>
|
||||
|
||||
## Yahoo
|
||||
|
||||
### 新聞
|
||||
|
|
|
|||
|
|
@ -1621,6 +1621,7 @@ router.get('/gradcafe/result/:type', require('./routes/gradcafe/result'));
|
|||
router.get('/gradcafe/result', require('./routes/gradcafe/result'));
|
||||
|
||||
// The Economist
|
||||
router.get('/the-economist/download', require('./routes/the-economist/download'));
|
||||
router.get('/the-economist/gre-vocabulary', require('./routes/the-economist/gre-vocabulary'));
|
||||
router.get('/the-economist/:endpoint', require('./routes/the-economist/full'));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
const url = require('url');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const link = 'http://www.cgx02.xyz/index.php?dir=/te';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const items = $('tbody tr').not('#id1').not('#id2').not('#id3').get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: '经济学人 the Economist',
|
||||
link: link,
|
||||
item: items.map((item) => {
|
||||
item = $(item);
|
||||
const one = item.find('td').eq(0);
|
||||
return {
|
||||
title: one.find('a').text(),
|
||||
link: url.resolve('http://www.cgx02.xyz/', one.find('a').attr('href')),
|
||||
pubDate: new Date(item.find('td.layui-hide-xs').eq(1).text()).toUTCString(),
|
||||
enclosure_url: item.link,
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue