From 1bd45821c094a7662d81dc0e459ecfa2d51da803 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Wed, 15 Aug 2018 18:31:21 +0800 Subject: [PATCH] rss: remove reimu --- README.md | 3 --- docs/README.md | 22 ---------------------- router.js | 4 ---- routes/reimu/category.js | 37 ------------------------------------- routes/reimu/tag.js | 31 ------------------------------- routes/reimu/util.js | 26 -------------------------- 6 files changed, 123 deletions(-) delete mode 100644 routes/reimu/category.js delete mode 100644 routes/reimu/tag.js delete mode 100644 routes/reimu/util.js diff --git a/README.md b/README.md index 60b8313c1..2b59a93b6 100644 --- a/README.md +++ b/README.md @@ -178,9 +178,6 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇 - 米哈游 - 崩坏 2-游戏公告 - 崩坏 3-游戏公告 -- 灵梦御所 - - 分类 - - 标签 - 草榴 - 分区帖子 - 科技星球 diff --git a/docs/README.md b/docs/README.md index dd6c65ddf..3095f2e95 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1488,28 +1488,6 @@ id, 专辑 id, 可在对应专辑页面的 URL 中找到 | ------ | ------ | ---- | -------- | -------- | | 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**, **凌辱** - ## 草榴社区 ### 分区帖子 diff --git a/router.js b/router.js index 5815e7e4e..0c0c013d9 100755 --- a/router.js +++ b/router.js @@ -325,10 +325,6 @@ 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')); diff --git a/routes/reimu/category.js b/routes/reimu/category.js deleted file mode 100644 index a49725696..000000000 --- a/routes/reimu/category.js +++ /dev/null @@ -1,37 +0,0 @@ -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, $), - }; -}; diff --git a/routes/reimu/tag.js b/routes/reimu/tag.js deleted file mode 100644 index 138c83c65..000000000 --- a/routes/reimu/tag.js +++ /dev/null @@ -1,31 +0,0 @@ -const axios = require('../../utils/axios'); -const cheerio = require('cheerio'); -const config = require('../../config'); -const util = require('./util'); - -module.exports = async (ctx) => { - const 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, $), - }; -}; diff --git a/routes/reimu/util.js b/routes/reimu/util.js deleted file mode 100644 index ea20edf5f..000000000 --- a/routes/reimu/util.js +++ /dev/null @@ -1,26 +0,0 @@ -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;