添加米哈游,灵梦御所 RSS (#324)
* rss: add mihoyo * rss: add reimu * modify docs readme
This commit is contained in:
parent
9247c0086e
commit
3f6a573151
|
|
@ -163,6 +163,12 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||
- 大连市
|
||||
- MIUI
|
||||
- 更新
|
||||
- 米哈游
|
||||
- 崩坏 2-游戏公告
|
||||
- 崩坏 3-游戏公告
|
||||
- 灵梦御所
|
||||
- 分类
|
||||
- 标签
|
||||
|
||||
## 鸣谢
|
||||
|
||||
|
|
|
|||
|
|
@ -1318,7 +1318,9 @@ id, 专辑 id, 可在对应专辑页面的 URL 中找到
|
|||
|
||||
参数: 无
|
||||
|
||||
### MIUI 更新
|
||||
## MIUI
|
||||
|
||||
### 更新
|
||||
|
||||
举例: [https://rsshub.app/miui/aries/](https://rsshub.app/miui/aries/)
|
||||
|
||||
|
|
@ -1337,3 +1339,51 @@ id, 专辑 id, 可在对应专辑页面的 URL 中找到
|
|||
| 稳定版 | 开发版 |
|
||||
| ------- | ------ |
|
||||
| release | dev |
|
||||
|
||||
## 米哈游
|
||||
|
||||
### 崩坏 2-游戏公告
|
||||
|
||||
举例: [https://rsshub.app/mihoyo/bh2/gach](https://rsshub.app//mihoyo/bh2/gach)
|
||||
|
||||
路由: `/mihoyo/bh2/:type`
|
||||
|
||||
参数:type,公告种类
|
||||
|
||||
| 最新公告 | 版本信息 | 祈愿信息 | 活动介绍 |
|
||||
| -------- | -------- | -------- | -------- |
|
||||
| new | version | gach | event |
|
||||
|
||||
### 崩坏 3-游戏公告
|
||||
|
||||
举例: [https://rsshub.app/mihoyo/bh3/strategy](https://rsshub.app//mihoyo/bh3/strategy)
|
||||
|
||||
路由: `/mihoyo/bh3/:type`
|
||||
|
||||
参数:type,公告种类
|
||||
|
||||
| 最新 | 公告 | 新闻 | 活动 | 攻略 |
|
||||
| ------ | ------ | ---- | -------- | -------- |
|
||||
| latest | notice | news | activity | strategy |
|
||||
|
||||
## 灵梦御所
|
||||
|
||||
### 分类
|
||||
|
||||
举例: [https://rsshub.app/reimu/category/music](https://rsshub.app/reimu/category/music)
|
||||
|
||||
路由: `/reimu/category/:category`
|
||||
|
||||
参数:category,分类名
|
||||
|
||||
| 3d | 动画 | 合集 | 图包 | 壁纸 | 御所汉化 | 游戏 | 漫画 | 独立 | 表番推荐 | 音声 |
|
||||
| --- | ----- | ---------- | ------- | --------- | -------- | ---- | ----- | ----- | --------- | ----- |
|
||||
| 3d | anime | collection | picture | wallpaper | chinese | game | comic | indie | recommend | music |
|
||||
|
||||
### 标签
|
||||
|
||||
举例: [https://rsshub.app/reimu/tag/ntr](https://rsshub.app/reimu/tag/ntr)
|
||||
|
||||
路由: `/reimu/tag/:tag`
|
||||
|
||||
参数:tag,标签名,例如: **ntr**, **rbq**, **凌辱**
|
||||
|
|
|
|||
|
|
@ -317,6 +317,13 @@ router.get('/tingshuitz/dalian', require('./routes/tingshuitz/dalian'));
|
|||
// MIUI 更新
|
||||
router.get('/miui/:device/:type?', require('./routes/miui/index'));
|
||||
|
||||
// 米哈游
|
||||
router.get('/mihoyo/bh3/:type', require('./routes/mihoyo/bh3'));
|
||||
router.get('/mihoyo/bh2/:type', require('./routes/mihoyo/bh2'));
|
||||
|
||||
// 灵梦御所
|
||||
router.get('/reimu/category/:category', require('./routes/reimu/category'));
|
||||
router.get('/reimu/tag/:tag', require('./routes/reimu/tag'));
|
||||
// 央视新闻
|
||||
router.get('/cctv/:category', require('./routes/cctv/category'));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'http://www.mihoyo.com/news/getNotice';
|
||||
let type = ctx.params.type;
|
||||
|
||||
const typeArr = ['new', 'version', 'gach', 'event'];
|
||||
|
||||
if (typeArr.indexOf(type) === -1) {
|
||||
type = typeArr[0];
|
||||
}
|
||||
|
||||
const index = typeArr.indexOf(type) + 1 || 1;
|
||||
|
||||
const response = await axios({
|
||||
method: 'post',
|
||||
url: url,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
Referer: url,
|
||||
'x-requested-with': 'XMLHttpRequest',
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data.data[type] || [];
|
||||
|
||||
const title = `崩坏2-${type}`;
|
||||
|
||||
ctx.state.data = {
|
||||
title: title,
|
||||
link: 'http://www.mihoyo.com/news',
|
||||
description: title,
|
||||
item: data.map((item) => {
|
||||
const pubDate = new Date(item.time);
|
||||
pubDate.setTime(pubDate.getTime() + 8 * 60 * 60 * 1000);
|
||||
return {
|
||||
title: item.title,
|
||||
description: item.title,
|
||||
pubDate: pubDate.toUTCString(),
|
||||
link: `http://www.mihoyo.com/news?para=${index}_${item.id}`,
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://www.bh3.com/index.php/news/_more';
|
||||
let type = ctx.params.type;
|
||||
|
||||
const typeMap = {
|
||||
latest: '',
|
||||
news: '新闻',
|
||||
notice: '公告',
|
||||
activity: '活动',
|
||||
strategy: '攻略',
|
||||
};
|
||||
|
||||
type = typeMap[type] || '';
|
||||
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: url,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
Referer: url,
|
||||
'x-requested-with': 'XMLHttpRequest',
|
||||
},
|
||||
params: {
|
||||
begin: new Date(),
|
||||
type: type,
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data.data.data;
|
||||
|
||||
const title = `崩坏3-${type ? type : '最新'}`;
|
||||
|
||||
ctx.state.data = {
|
||||
title: title,
|
||||
link: `https://www.bh3.com/index.php/news/?type=${type}`,
|
||||
description: title,
|
||||
item: data.map((item) => {
|
||||
const pubDate = new Date(item.create_time);
|
||||
pubDate.setTime(pubDate.getTime() + 8 * 60 * 60 * 1000);
|
||||
return {
|
||||
title: item.title_short ? item.title_short : item.title,
|
||||
description: item.summary,
|
||||
pubDate: pubDate.toUTCString(),
|
||||
link: `https://www.bh3.com/index.php/news/${item.id}`,
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
const util = require('./util');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
let category = ctx.params.category;
|
||||
const categoryType = ['3d', 'anime', 'collection', 'picture', 'wallpaper', 'chinese', 'game', 'comic', 'indie', 'recommend', 'music'];
|
||||
|
||||
if (categoryType.indexOf(category) === -1) {
|
||||
category = categoryType[0];
|
||||
}
|
||||
|
||||
const url = `https://blog.reimu.net/archives/category/${category}`;
|
||||
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: url,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
Referer: url,
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
const articles = $('article');
|
||||
const title = $('title').text();
|
||||
|
||||
ctx.state.data = {
|
||||
title: title,
|
||||
link: url,
|
||||
description: title,
|
||||
item: util.getArticleData(articles, $),
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
const util = require('./util');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
let tag = ctx.params.tag || 'ntr';
|
||||
|
||||
const url = `https://blog.reimu.net/archives/tag/${tag}`;
|
||||
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: encodeURI(url), // encode中文标签
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
const articles = $('article');
|
||||
const title = $('title').text();
|
||||
|
||||
ctx.state.data = {
|
||||
title: title,
|
||||
link: url,
|
||||
description: title,
|
||||
item: util.getArticleData(articles, $),
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
const util = {
|
||||
getArticleData(articles, $) {
|
||||
if (!articles) return [];
|
||||
|
||||
return articles
|
||||
.map((index, article) => {
|
||||
article = $(article);
|
||||
const title = article.find('h2').text();
|
||||
const description = article.find('.entry-content').text();
|
||||
const pubDate = new Date(article.find('.entry-date').attr('datetime')).toUTCString();
|
||||
const link = article.find('a[rel=bookmark]').attr('href');
|
||||
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
pubDate,
|
||||
link,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = util;
|
||||
Loading…
Reference in New Issue