fix: 东北大学新闻网rss (#4273)

This commit is contained in:
Jeason Lau 2020-03-24 11:23:41 +08:00 committed by GitHub
parent 03760eb1ee
commit 9a2e1b42f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -265,9 +265,9 @@ xskb1 对应 http://www.auto.uestc.edu.cn/index/xskb1.htm
<Route author="JeasonLau" example="/neu/news/ddyw" path="/neu/news/:type" :paramsDesc="['种类名']">
| 东大要闻 | 媒体东大 | 通知公告 | 新闻纵横 | 人才培养 | 学术科研 | 英文新闻 | 招生就业 | 考研出国 | 校园文学 | 校友风采 |
| -------- | -------- | -------- | -------- | -------: | -------- | -------- | -------- | -------- | -------- | -------- |
| ddyw | mtdd | tzgg | xwzh | rcpy | xsky | 217 | zsjy | kycg | xywx | xyfc |
| 东大要闻 | 媒体东大 | 通知公告 | 新闻纵横 | 人才培养 | 学术科研 | 英文新闻 | 招生就业 | 考研出国 | 校园文学 | 校友风采 | 时事热点 | 教育前沿 | 文化体育 | 最新科技 |
| -------- | -------- | -------- | -------- | -------: | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| ddyw | mtdd | tzgg | xwzh | rcpy | xsky | 217 | zsjy | kycg | xywx | xyfc | ssrd | jyqy | whty | zxkj |
</Route>

View File

@ -1,7 +1,7 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const baseUrl = 'http://neunews.neu.edu.cn';
const baseUrl = 'https://neunews.neu.edu.cn';
module.exports = async (ctx) => {
const type = ctx.params.type;
const newsUrl = `${baseUrl}/${type}/list.htm`;
@ -15,7 +15,7 @@ module.exports = async (ctx) => {
const title = $('title').text();
const items = $('.column-news-list > .news_list > .news > .news_title')
.slice(0, 10)
.slice(0, 5)
.get();
const results = await Promise.all(
items.map(async (item) => {
@ -54,11 +54,12 @@ module.exports = async (ctx) => {
description: description,
link: url,
};
Promise.resolve(result);
return Promise.resolve(result);
})
);
ctx.state.data = {
title: `东北大学新闻网-${title}`,
link: newsUrl,
item: results,
};
};