大连大学
This commit is contained in:
@@ -1255,6 +1255,11 @@ category 列表:
|
||||
|
||||
</route>
|
||||
|
||||
### 大连大学
|
||||
|
||||
<route name="教务处信息" author="SettingDust" example="/dlu/jiaowu/news" path="/universities/dlu/jiaowu/news">
|
||||
</route>
|
||||
|
||||
## 传统媒体
|
||||
|
||||
### 央视新闻
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
const axios = require('../../../../utils/axios');
|
||||
const iconv = require('iconv-lite');
|
||||
const cheerio = require('cheerio');
|
||||
const resolve_url = require('url').resolve;
|
||||
|
||||
const base_url = 'http://jwc1.dlu.edu.cn/';
|
||||
|
||||
// const map = {
|
||||
// 2: '/gsgg.htm',
|
||||
// 3: '/jwtz.htm',
|
||||
// 4: '/jwwj.htm',
|
||||
// 5: '/xxwj.htm'
|
||||
// };
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
// const type = ctx.params.type || '2';
|
||||
// const link = `${base_url}${map[type]}`;
|
||||
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: base_url,
|
||||
responseType: 'arraybuffer',
|
||||
headers: {
|
||||
Referer: base_url,
|
||||
},
|
||||
});
|
||||
|
||||
const $ = cheerio.load(iconv.decode(response.data, 'utf-8'));
|
||||
|
||||
ctx.state.data = {
|
||||
link: base_url,
|
||||
title: '大连大学教务处',
|
||||
item: $('td[valign="top"]>table[cellspacing="3"][width="100%"] tr')
|
||||
.map((_, elem) => ({
|
||||
link: resolve_url(base_url, $('a', elem).attr('href')),
|
||||
title: $('a', elem).attr('title'),
|
||||
pubDate: new Date(
|
||||
new Date().getFullYear() + '-' +
|
||||
$('[class*="timestyle"]', elem)
|
||||
.text()
|
||||
.replace('/', '-')
|
||||
).toUTCString(),
|
||||
}))
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user