forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Unix Socket Support && rss: Add shmtu route (DIYgod#285)
* feat: Add Unix Socket Support * rss: Add shmtu route * fix: docs & bugs
- Loading branch information
Showing
9 changed files
with
191 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const axios = require('../../utils/axios'); | ||
const cheerio = require('cheerio'); | ||
const config = require('../../config'); | ||
|
||
module.exports = async (ctx) => { | ||
const host = 'http://www.shmtu.edu.cn'; | ||
|
||
const response = await axios({ | ||
method: 'get', | ||
url: host + '/events', | ||
headers: { | ||
'User-Agent': config.ua, | ||
Referer: host, | ||
}, | ||
}); | ||
|
||
const $ = cheerio.load(response.data); | ||
const text = $('tr', 'tbody'); | ||
|
||
ctx.state.data = { | ||
title: '上海海事大学 学术讲座', | ||
link: host + '/events', | ||
description: '上海海事大学 学术讲座', | ||
item: | ||
text && | ||
text | ||
.map((index, item) => { | ||
item = $(item); | ||
return { | ||
title: item.find('.title').text(), | ||
description: '发布部门 - ' + item.find('.department').text(), | ||
pubDate: item | ||
.find('span') | ||
.find('span') | ||
.attr('content'), | ||
link: host + item.find('a').attr('href'), | ||
}; | ||
}) | ||
.get(), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const axios = require('../../utils/axios'); | ||
const cheerio = require('cheerio'); | ||
const config = require('../../config'); | ||
|
||
module.exports = async (ctx) => { | ||
const host = 'http://jwc.shmtu.edu.cn/Information/'; | ||
let type = ctx.params.type; | ||
let info = '教务新闻'; | ||
if (type === '2') { | ||
info = '教务公告'; | ||
} else { | ||
type = '1'; | ||
} | ||
|
||
const response = await axios({ | ||
method: 'get', | ||
url: host + `MoreInfo.aspx?type=${type}`, | ||
headers: { | ||
'User-Agent': config.ua, | ||
Referer: host, | ||
}, | ||
}); | ||
|
||
const $ = cheerio.load(response.data); | ||
const text = $('.gvRow', '.tdMCViewList'); | ||
|
||
ctx.state.data = { | ||
title: `上海海事大学 ${info}`, | ||
link: host + `MoreInfo.aspx?type=${type}`, | ||
description: `上海海事大学 ${info}`, | ||
item: | ||
text && | ||
text | ||
.map((index, item) => { | ||
item = $(item); | ||
return { | ||
title: item.find('a').attr('title'), | ||
description: | ||
'信息类别 - ' + | ||
$('.gvItemNormal', item) | ||
.slice(1, 2) | ||
.text(), | ||
pubDate: $('.gvItemNormal', item) | ||
.slice(4) | ||
.text(), | ||
link: host + item.find('a').attr('href'), | ||
}; | ||
}) | ||
.get(), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const axios = require('../../utils/axios'); | ||
const cheerio = require('cheerio'); | ||
const config = require('../../config'); | ||
|
||
module.exports = async (ctx) => { | ||
const host = 'http://www.shmtu.edu.cn'; | ||
|
||
const response = await axios({ | ||
method: 'get', | ||
url: host + '/notes', | ||
headers: { | ||
'User-Agent': config.ua, | ||
Referer: host, | ||
}, | ||
}); | ||
|
||
const $ = cheerio.load(response.data); | ||
const text = $('tr', 'tbody'); | ||
|
||
ctx.state.data = { | ||
title: '上海海事大学 通知公告', | ||
link: host + '/notes', | ||
description: '上海海事大学 通知公告', | ||
item: | ||
text && | ||
text | ||
.map((index, item) => { | ||
item = $(item); | ||
return { | ||
title: item.find('.title').text(), | ||
description: '发布部门 - ' + item.find('.department').text(), | ||
pubDate: item | ||
.find('span') | ||
.find('span') | ||
.attr('content'), | ||
link: host + item.find('a').attr('href'), | ||
}; | ||
}) | ||
.get(), | ||
}; | ||
}; |