add psnine (#1816)

[ADD]添加psnine rss: https://github.com/DIYgod/RSSHub/issues/1319
[CHA]修改游研社接口: 将原来的一个接口改为通用订阅接口
This commit is contained in:
Betta
2019-03-24 22:26:05 +08:00
committed by DIYgod
parent 6ec2346be4
commit da72f7f02f
8 changed files with 318 additions and 2 deletions
+13 -1
View File
@@ -2618,7 +2618,19 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
### 游研社
<route name="游研社推游" author="LightStrawberry" example="/yystv/recommend" path="/yystv/recommend"/>
<route name="游研社" author="LightStrawberry" example="/yystv/category/:category" path="/yystv/category/:category" :paramsDesc="['专栏类型']"/>
| 推游 | 游戏史 | 大事件 | 文化 | 趣闻 | 经典回顾 |
| --------- | ------- | ------ | ------- | ---- | -------- |
| recommend | history | big | culture | news | retro |
### psnine
<route name="首页-白金攻略/游戏开箱" author="LightStrawberry" example="/psnine/index" path="/psnine/index"/>
<route name="新闻-游戏资讯" author="LightStrawberry" example="/psnine/news" path="/psnine/news"/>
<route name="数折-折扣信息推送" author="LightStrawberry" example="/psnine/shuzhe" path="/psnine/shuzhe"/>
<route name="闲游-二手盘信息" author="LightStrawberry" example="/psnine/trade" path="/psnine/trade"/>
<route name="游戏-新游戏奖杯信息" author="LightStrawberry" example="/psnine/game" path="/psnine/game"/>
## 小说·文学·阅读
+8 -1
View File
@@ -1192,7 +1192,14 @@ router.get('/people/opinion/:id', require('./routes/people/opinion'));
router.get('/gamersky/news', require('./routes/gamersky/news'));
// 游研社
router.get('/yystv/recommend/', require('./routes/yystv/recommend'));
router.get('/yystv/category/:category', require('./routes/yystv/category'));
// psnine
router.get('/psnine/index', require('./routes/psnine/index'));
router.get('/psnine/shuzhe', require('./routes/psnine/shuzhe'));
router.get('/psnine/trade', require('./routes/psnine/trade'));
router.get('/psnine/game', require('./routes/psnine/game'));
router.get('/psnine/news', require('./routes/psnine/news'));
// 浙江大学
router.get('/zju/physics/:type', require('./routes/universities/zju/physics'));
+47
View File
@@ -0,0 +1,47 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
const date = require('../../utils/date');
module.exports = async (ctx) => {
const url = 'https://www.psnine.com/psngame';
const response = await axios({
method: 'get',
url: url,
});
const data = response.data;
const $ = cheerio.load(data);
const out = $('table tr')
.map(function() {
const info = {
title: $(this)
.find('.title a')
.text(),
link: $(this)
.find('.title a')
.attr('href'),
pubDate: date(
$(this)
.find('.meta')
.text()
),
description:
$(this)
.find('.title span')
.text() +
' ' +
$(this)
.find('.twoge')
.text(),
};
return info;
})
.get();
ctx.state.data = {
title: 'psnine-' + $('title').text(),
link: 'https://www.psnine.com/',
item: out,
};
};
+43
View File
@@ -0,0 +1,43 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
const date = require('../../utils/date');
module.exports = async (ctx) => {
const url = 'https://www.psnine.com/';
const response = await axios({
method: 'get',
url: url,
});
const data = response.data;
const $ = cheerio.load(data);
const out = $('.list li')
.slice(0, 20)
.map(function() {
const info = {
title: $(this)
.find('.title')
.text(),
link: $(this)
.find('.title a')
.attr('href'),
pubDate: date(
$(this)
.find('.meta')
.text()
),
author: $(this)
.find('.meta a')
.text(),
};
return info;
})
.get();
ctx.state.data = {
title: 'psnine-' + $('title').text(),
link: 'https://www.psnine.com/',
item: out,
};
};
+42
View File
@@ -0,0 +1,42 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
const date = require('../../utils/date');
module.exports = async (ctx) => {
const url = 'https://www.psnine.com/news';
const response = await axios({
method: 'get',
url: url,
});
const data = response.data;
const $ = cheerio.load(data);
const out = $('.box li')
.map(function() {
const info = {
title: $(this)
.find('.content')
.text(),
link: $(this)
.find('.touch')
.attr('href'),
pubDate: date(
$(this)
.find('.meta')
.text()
),
author: $(this)
.find('.meta a')
.text(),
};
return info;
})
.get();
ctx.state.data = {
title: 'psnine-' + $('title').text(),
link: 'https://www.psnine.com/',
item: out,
};
};
+45
View File
@@ -0,0 +1,45 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
const date = require('../../utils/date');
module.exports = async (ctx) => {
const url = 'https://www.psnine.com/dd';
const response = await axios({
method: 'get',
url: url,
});
const data = response.data;
const $ = cheerio.load(data);
const out = $('.dd_ul li')
.map(function() {
const info = {
title: $(this)
.find('.dd_title')
.text(),
link: $(this)
.find('.dd_title a')
.attr('href'),
description: $(this)
.find('.dd_status')
.text(),
pubDate: date(
$(this)
.find('.meta')
.text()
),
author: $(this)
.find('.meta a')
.text(),
};
return info;
})
.get();
ctx.state.data = {
title: 'psnine-' + $('title').text(),
link: 'https://www.psnine.com/',
item: out,
};
};
+49
View File
@@ -0,0 +1,49 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
const date = require('../../utils/date');
module.exports = async (ctx) => {
const url = 'https://www.psnine.com/trade';
const response = await axios({
method: 'get',
url: url,
});
const data = response.data;
const $ = cheerio.load(data);
const out = $('.list li')
.map(function() {
const desc = [];
$(this)
.find('.meta a')
.each(function(i) {
desc[i] = $(this).text();
});
const info = {
title: $(this)
.find('.content')
.text(),
link: $(this)
.find('.touch')
.attr('href'),
description: desc.join(' '),
pubDate: date(
$(this)
.find('.meta')
.text()
),
author: $(this)
.find('.psnnode')
.text(),
};
return info;
})
.get();
ctx.state.data = {
title: 'psnine-' + $('title').text(),
link: 'https://www.psnine.com/',
item: out,
};
};
+71
View File
@@ -0,0 +1,71 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
const date = require('../../utils/date');
module.exports = async (ctx) => {
const category = ctx.params.category;
const url = `http://www.yystv.cn/b/${category}`;
const response = await axios({
method: 'get',
url: url,
});
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, 18)
.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: '游研社-' + $('title').text(),
link: 'http://www.yystv.cn/b/recommend',
item: first_part.concat(second_part),
};
};