feat: Add Umass Amherst CICS/news and ECE/news (#4740)

This commit is contained in:
Steven Tang
2020-05-12 14:28:22 +08:00
committed by GitHub
parent ab59be55aa
commit 96d51751fe
6 changed files with 108 additions and 0 deletions
+19
View File
@@ -1879,6 +1879,25 @@
},
],
},
'umass.edu': {
_name: 'UMASS Amherst',
ece: [
{
title: 'ECE News',
docs: 'http://docs.rsshub.app/en/university.html#umass-amherst',
source: '/news',
target: '/umass/amherst/ecenews',
},
],
'www.cics': [
{
title: 'CICS News',
docs: 'http://docs.rsshub.app/en/university.html#umass-amherst',
source: '/news',
target: '/umass/amherst/csnews',
},
],
},
'lofter.com': {
_name: 'Lofter',
www: [
+10
View File
@@ -23,3 +23,13 @@ pageClass: routes
### News
<RouteEn author="exuanbo" example="/polimi/news" path="/polimi/news/:language?" :paramsDesc="['English language code en']" />
## UMASS Amherst
### College of Electrical and Computer Engineering News
<Route author="gammapi" example="/umass/amherst/ecenews" path="/umass/amherst/ecenews" radar="1"/>
### College of Information & Computer Sciences News
<Route author="gammapi" example="/umass/amherst/csnews" path="/umass/amherst/csnews" radar="1"/>
+10
View File
@@ -750,6 +750,16 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
</Route>
## 马萨诸塞大学 阿默斯特分校 (UMASS Amherst)
### 电子与计算机工程系新闻
<Route author="gammapi" example="/umass/amherst/ecenews" path="/umass/amherst/ecenews" radar="1"/>
### 信息与计算机科学系新闻
<Route author="gammapi" example="/umass/amherst/csnews" path="/umass/amherst/csnews" radar="1"/>
## 南昌航空大学
### 教务处公告与新闻
+4
View File
@@ -2665,6 +2665,10 @@ router.get('/qingting/channel/:id', require('./routes/qingting/channel'));
// 金色财经
router.get('/jinse/lives', require('./routes/jinse/lives'));
// University of Massachusetts Amherst
router.get('/umass/amherst/ecenews', require('./routes/umass/amherst/ecenews'));
router.get('/umass/amherst/csnews', require('./routes/umass/amherst/csnews'));
// 飘花电影网
router.get('/piaohua/hot', require('./routes/piaohua/hot'));
+32
View File
@@ -0,0 +1,32 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'https://www.cics.umass.edu/news',
});
const data = response.data;
const $ = cheerio.load(data);
const list = $('.view-mt-latest-news .views-row');
let itemPicUrl;
ctx.state.data = {
title: 'UMAmherst-CSNews',
link: 'https://www.cics.umass.edu/news',
item:
list &&
list
.map((index, item) => {
item = $(item);
itemPicUrl = item.find('.views-field-field-image img').attr('src');
return {
title: item.find('.views-field-title a').first().text(),
description: `<img src="${itemPicUrl}"><br>` + item.find('.views-field-body .field-content').first().text(),
link: item.find('.views-more-link').attr('href'),
};
})
.get(),
};
};
+33
View File
@@ -0,0 +1,33 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'https://ece.umass.edu/news',
});
const data = response.data;
const $ = cheerio.load(data);
const list = $('.view-news .views-row');
let itemPicUrl;
ctx.state.data = {
title: 'UMAmherst-ECENews',
link: 'https://ece.umass.edu/news',
item:
list &&
list
.map((index, item) => {
item = $(item);
itemPicUrl = item.find('.image-style-thumbnail').attr('src');
return {
title: item.find('.views-field-title a').first().text(),
description: `<img src="${itemPicUrl}"><br>` + item.find('div.field-content').last().text(),
link: item.find('.views-field-title a').attr('href'),
};
})
.get(),
};
};