style: auto format
This commit is contained in:
+6
-6
@@ -482,6 +482,12 @@ xskb1 对应 <http://www.auto.uestc.edu.cn/index/xskb1.htm>
|
||||
|
||||
<Route author="Xiaotouming" example="/gdoujwc" path="/gdoujwc"/>
|
||||
|
||||
## 广州大学
|
||||
|
||||
## 广州大学研招网通知公告
|
||||
|
||||
<Route author="sushengmao" example="/gzyjs" path="/gzyjs" />
|
||||
|
||||
## 广州航海学院
|
||||
|
||||
## 广州航海学院教务处通知公告
|
||||
@@ -492,12 +498,6 @@ xskb1 对应 <http://www.auto.uestc.edu.cn/index/xskb1.htm>
|
||||
|
||||
<Route author="skyedai910" example="/gzmtu/tsg" path="/gzmtu/tsg" />
|
||||
|
||||
## 广州大学
|
||||
|
||||
## 广州大学研招网通知公告
|
||||
|
||||
<Route author="sushengmao" example="/gzyjs" path="/gzyjs" />
|
||||
|
||||
## 桂林电子科技大学
|
||||
|
||||
### 新闻资讯
|
||||
|
||||
@@ -3,12 +3,12 @@ const cheerio = require('cheerio');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = 'http://jwc.gzmtu.edu.cn/';// 教务处URL
|
||||
const response = await got.get(link);// 获取HTML
|
||||
const link = 'http://jwc.gzmtu.edu.cn/'; // 教务处URL
|
||||
const response = await got.get(link); // 获取HTML
|
||||
const data = response.data; // 请求返回的HTML
|
||||
const $ = cheerio.load(data);// cheerio加载数据
|
||||
const list = $('div .center_article_list').find('td').get();// 筛选出每则通知作为列表索引
|
||||
const result = await utils.ProcessFeed(list, ctx.cache, link);// 加载每则通知详情内容
|
||||
const $ = cheerio.load(data); // cheerio加载数据
|
||||
const list = $('div .center_article_list').find('td').get(); // 筛选出每则通知作为列表索引
|
||||
const result = await utils.ProcessFeed(list, ctx.cache, link); // 加载每则通知详情内容
|
||||
|
||||
ctx.state.data = {
|
||||
title: '广州航海学院教务处通知公告', // RSS名称
|
||||
@@ -18,4 +18,4 @@ module.exports = async (ctx) => {
|
||||
allowEmpty: false, // 是否允许RSS内容为空
|
||||
language: 'zh-cn', // 频道语言
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -5,7 +5,8 @@ const url = require('url');
|
||||
const ProcessFeed = async (list, cache, link) =>
|
||||
await Promise.all(
|
||||
list
|
||||
.filter(function (item) {// 查询是否具有文章链接,没有则跳过
|
||||
.filter(function (item) {
|
||||
// 查询是否具有文章链接,没有则跳过
|
||||
const $ = cheerio.load(item);
|
||||
if ($('a').length > 0) {
|
||||
return true;
|
||||
@@ -14,18 +15,17 @@ const ProcessFeed = async (list, cache, link) =>
|
||||
})
|
||||
.map(async (item) => {
|
||||
let $ = cheerio.load(item);
|
||||
const $url = url.resolve(link, $('a').attr('href'));// 原文链接
|
||||
const $url = url.resolve(link, $('a').attr('href')); // 原文链接
|
||||
const key = $url;
|
||||
// 查询是否有未过期缓存
|
||||
const value = await cache.get(key);
|
||||
if (value) {
|
||||
// 查询返回未过期缓存
|
||||
return JSON.parse(value);
|
||||
}
|
||||
else {
|
||||
const response = await got.get($url);// 获取HTML
|
||||
const data = response.data;// 请求返回的HTML
|
||||
$ = cheerio.load(data);// cheerio加载数据
|
||||
} else {
|
||||
const response = await got.get($url); // 获取HTML
|
||||
const data = response.data; // 请求返回的HTML
|
||||
$ = cheerio.load(data); // cheerio加载数据
|
||||
|
||||
// 去除样式
|
||||
$('img, div, span, p, table, td, tr').removeAttr('style');
|
||||
|
||||
@@ -3,12 +3,12 @@ const cheerio = require('cheerio');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = 'http://tsg.gzmtu.edu.cn/';// 图书馆URL
|
||||
const response = await got.get(link);// 获取HTML
|
||||
const link = 'http://tsg.gzmtu.edu.cn/'; // 图书馆URL
|
||||
const response = await got.get(link); // 获取HTML
|
||||
const data = response.data; // 请求返回的HTML
|
||||
const $ = cheerio.load(data);// cheerio加载数据
|
||||
const list = $('ul .picture_ul').find('li').get();// 筛选出每则通知作为列表索引
|
||||
const result = await utils.ProcessFeed(list, ctx.cache, link);// 加载每则通知详情内容
|
||||
const $ = cheerio.load(data); // cheerio加载数据
|
||||
const list = $('ul .picture_ul').find('li').get(); // 筛选出每则通知作为列表索引
|
||||
const result = await utils.ProcessFeed(list, ctx.cache, link); // 加载每则通知详情内容
|
||||
|
||||
ctx.state.data = {
|
||||
title: '广州航海学院图书馆通知公告', // RSS名称
|
||||
@@ -18,4 +18,4 @@ module.exports = async (ctx) => {
|
||||
allowEmpty: false, // 是否允许RSS内容为空
|
||||
language: 'zh-cn', // 频道语言
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -5,7 +5,8 @@ const url = require('url');
|
||||
const ProcessFeed = async (list, cache, link) =>
|
||||
await Promise.all(
|
||||
list
|
||||
.filter(function (item) {// 查询是否具有文章链接,没有则跳过
|
||||
.filter(function (item) {
|
||||
// 查询是否具有文章链接,没有则跳过
|
||||
const $ = cheerio.load(item);
|
||||
if ($('a').length > 0) {
|
||||
return true;
|
||||
@@ -14,18 +15,17 @@ const ProcessFeed = async (list, cache, link) =>
|
||||
})
|
||||
.map(async (item) => {
|
||||
let $ = cheerio.load(item);
|
||||
const $url = url.resolve(link, $('a').attr('href'));// 原文链接
|
||||
const $url = url.resolve(link, $('a').attr('href')); // 原文链接
|
||||
const key = $url;
|
||||
// 查询是否有未过期缓存
|
||||
const value = await cache.get(key);
|
||||
if (value) {
|
||||
// 查询返回未过期缓存
|
||||
return JSON.parse(value);
|
||||
}
|
||||
else {
|
||||
const response = await got.get($url);// 获取HTML
|
||||
const data = response.data;// 请求返回的HTML
|
||||
$ = cheerio.load(data);// cheerio加载数据
|
||||
} else {
|
||||
const response = await got.get($url); // 获取HTML
|
||||
const data = response.data; // 请求返回的HTML
|
||||
$ = cheerio.load(data); // cheerio加载数据
|
||||
|
||||
// 去除样式
|
||||
$('img, div, span, p, table, td, tr').removeAttr('style');
|
||||
|
||||
Reference in New Issue
Block a user