add gamersky and 游研社 (#1784)

[ADD]游民星空今日推荐rss
[ADD]游研社推游栏目rss
This commit is contained in:
Betta
2019-03-20 11:57:31 +08:00
committed by DIYgod
parent f0c4708799
commit 2b4e3c048c
4 changed files with 127 additions and 0 deletions

View File

@@ -2570,6 +2570,14 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
<route name="游戏时光游戏发售表" author="MyFaith" example="/vgtime/release" path="vgtime/release"/> <route name="游戏时光游戏发售表" author="MyFaith" example="/vgtime/release" path="vgtime/release"/>
### 游民星空
<route name="游民星空今日推荐" author="LightStrawberry" example="/gamersky/news" path="/gamersky/news"/>
### 游研社
<route name="游研社推游" author="LightStrawberry" example="/yystv/recommend" path="/yystv/recommend"/>
## 小说·文学·阅读 ## 小说·文学·阅读
### 观止(每日一文) ### 观止(每日一文)

View File

@@ -1174,4 +1174,10 @@ router.get('/zjgsu/tzgg', require('./routes/universities/zjgsu/tzgg/scripts'));
router.get('/zjgsu/gsgg', require('./routes/universities/zjgsu/gsgg/scripts')); router.get('/zjgsu/gsgg', require('./routes/universities/zjgsu/gsgg/scripts'));
router.get('/zjgsu/xszq', require('./routes/universities/zjgsu/xszq/scripts')); router.get('/zjgsu/xszq', require('./routes/universities/zjgsu/xszq/scripts'));
// gamersky
router.get('/gamersky/news', require('./routes/gamersky/news'));
// 游研社
router.get('/yystv/recommend/', require('./routes/yystv/recommend'));
module.exports = router; module.exports = router;

View File

@@ -0,0 +1,44 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await axios({
method: 'get',
url: 'https://www.gamersky.com/news/',
headers: {
Referer: 'https://www.gamersky.com/news/',
},
});
const data = response.data;
const $ = cheerio.load(data);
const out = $('.Mid2L_con li')
.slice(0, 10)
.map(function() {
const info = {
title: $(this)
.find('.tt')
.text(),
link: $(this)
.find('.tt')
.attr('href'),
pubDate: new Date(
$(this)
.find('.time')
.text()
).toUTCString(),
description: $(this)
.find('.txt')
.text(),
};
return info;
})
.get();
ctx.state.data = {
title: '游民星空-今日推荐',
link: 'https://www.gamersky.com/news/',
item: out,
};
};

View File

@@ -0,0 +1,69 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
const date = require('../../utils/date');
module.exports = async (ctx) => {
const response = await axios({
method: 'get',
url: 'http://www.yystv.cn/b/recommend',
});
const data = response.data;
const $ = cheerio.load(data);
const first_part = $('.b-list-main-item')
.slice(0, 2)
.map(function() {
const info = {
title: $(this)
.find('.b-main-info-title')
.text(),
link:
'http://www.yystv.cn' +
$(this)
.find('.b-main-info-title a')
.attr('href'),
pubDate: date(
$(this)
.find('.b-main-createtime')
.text()
),
author: $(this)
.find('.b-author')
.text(),
};
return info;
})
.get();
const second_part = $('.b-list li')
.slice(0, 8)
.map(function() {
const info = {
title: $(this)
.find('.b-item-title')
.text(),
link:
'http://www.yystv.cn' +
$(this)
.find('.b-item-title a')
.attr('href'),
pubDate: date(
$(this)
.find('.fl')
.text()
),
author: $(this)
.find('.author-icon-list')
.text(),
};
return info;
})
.get();
ctx.state.data = {
title: '游研社-推游',
link: 'http://www.yystv.cn/b/recommend',
item: first_part.concat(second_part),
};
};