mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-07 13:39:35 +08:00
feat: add gradCafe(一个比较流行的国外研究生录取结果通知) (#2035)
* add gradCafe(国外一个比较流行的研究生录取结果论坛) * add gradCafe(国外一个比较流行的研究生录取结果论坛)
This commit is contained in:
@@ -503,3 +503,8 @@ type 为 all 时,category 参数不支持 cost 和 free
|
|||||||
## 毕马威
|
## 毕马威
|
||||||
|
|
||||||
<Route name="洞察" author="LogicJake" example="/kpmg/insights" path="/kpmg/insights" />
|
<Route name="洞察" author="LogicJake" example="/kpmg/insights" path="/kpmg/insights" />
|
||||||
|
|
||||||
|
## gradCafe(一个比较流行的国外研究生录取结果通知)
|
||||||
|
|
||||||
|
<Route name="gradCafe result" author="liecn" example="/gradcafe/result" path="/gradcafe/result" />
|
||||||
|
<Route name="gradCafe result by key words" author="liecn" example="/gradcafe/result/computer" path="/gradcafe/result/:type" :paramsDesc="['按关键词进行搜索,如 computer']/>
|
||||||
|
|||||||
@@ -1302,4 +1302,8 @@ router.get('/kpmg/insights', require('./routes/kpmg/insights'));
|
|||||||
// Saraba1st
|
// Saraba1st
|
||||||
router.get('/saraba1st/thread/:tid', require('./routes/saraba1st/thread'));
|
router.get('/saraba1st/thread/:tid', require('./routes/saraba1st/thread'));
|
||||||
|
|
||||||
|
// gradcafe
|
||||||
|
router.get('/gradcafe/result/:type', require('./routes/gradcafe/result'));
|
||||||
|
router.get('/gradcafe/result', require('./routes/gradcafe/result'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
49
lib/routes/gradcafe/result.js
Normal file
49
lib/routes/gradcafe/result.js
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
const cheerio = require('cheerio');
|
||||||
|
const axios = require('../../utils/axios');
|
||||||
|
const url = 'https://www.thegradcafe.com/survey/';
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const type = ctx.params.type;
|
||||||
|
const res = await axios.get(url, {
|
||||||
|
params: {
|
||||||
|
q: type,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const $ = cheerio.load(res.data);
|
||||||
|
const list = $('table.submission-table tbody tr');
|
||||||
|
const out = list
|
||||||
|
.slice(0, 10)
|
||||||
|
.map(function() {
|
||||||
|
const title = $(this)
|
||||||
|
.find('.tcol1 ')
|
||||||
|
.text();
|
||||||
|
const author = $(this)
|
||||||
|
.find('.tcol2')
|
||||||
|
.text();
|
||||||
|
const description =
|
||||||
|
$(this)
|
||||||
|
.find($('strong').parents('.tcol3'))
|
||||||
|
.text() +
|
||||||
|
' Note:' +
|
||||||
|
$(this)
|
||||||
|
.find('.tcol6')
|
||||||
|
.text();
|
||||||
|
const pubDate = $(this)
|
||||||
|
.find('.tcol5')
|
||||||
|
.text();
|
||||||
|
const item = {
|
||||||
|
title,
|
||||||
|
author,
|
||||||
|
description,
|
||||||
|
pubDate,
|
||||||
|
// note
|
||||||
|
};
|
||||||
|
return item;
|
||||||
|
})
|
||||||
|
.get();
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: 'gradCafe',
|
||||||
|
link: url,
|
||||||
|
item: out,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user