diff --git a/README.md b/README.md index 8a64e04fe..26ee6022b 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇 - 小组 - 煎蛋 - 无聊图 + - 妹子图 - 喷嚏 - 图卦 - Dockone diff --git a/docs/README.md b/docs/README.md index 9bcca3ff4..3fb858bb6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -746,6 +746,10 @@ groupid: 豆瓣小组的 id 举例: [https://rsshub.app/jandan/pic](https://rsshub.app/jandan/pic) +### 妹子图 + +举例: [https://rsshub.app/jandan/ooxx](https://rsshub.app/jandan/ooxx) + 路由: `/jandan/pic` 参数: 无 diff --git a/router.js b/router.js index 491fce99a..98c883a29 100644 --- a/router.js +++ b/router.js @@ -170,7 +170,7 @@ router.get('/douban/movie/ustop', require('./routes/douban/ustop')); router.get('/douban/group/:groupid', require('./routes/douban/group')); // 煎蛋 -router.get('/jandan/pic', require('./routes/jandan/pic')); +router.get('/jandan/:sub_model', require('./routes/jandan/pic')); // 喷嚏 router.get('/dapenti/tugua', require('./routes/dapenti/tugua')); diff --git a/routes/jandan/pic.js b/routes/jandan/pic.js index 4aba1afca..fdc3875ea 100644 --- a/routes/jandan/pic.js +++ b/routes/jandan/pic.js @@ -6,11 +6,14 @@ const base64_decode = (i) => Buffer.from(i, 'base64').toString('binary'); // jandan_decode is borrowed from jandan.net, which is used in function jandan_load_img. const jandan_decode = (m) => base64_decode(m); +const baseUrl = 'http://jandan.net/'; module.exports = async (ctx) => { + const sub_model = ctx.params.sub_model; + const response = await axios({ method: 'get', - url: 'http://jandan.net/pic', + url: `${baseUrl}${sub_model}/`, headers: { 'User-Agent': config.ua, Referer: 'http://jandan.net', @@ -57,10 +60,20 @@ module.exports = async (ctx) => { }); }); + let rss_title; + let description; + if (sub_model === 'pic') { + rss_title = '煎蛋无聊图'; + description = '煎蛋官方无聊图,无限活力的热门图区。'; + } else if (sub_model === 'ooxx') { + rss_title = '煎蛋妹子图'; + description = '这儿才是正版妹子图。'; + } + ctx.state.data = { - title: '煎蛋无聊图', - link: 'http://jandan.net/pic', - description: '煎蛋官方无聊图,无限活力的热门图区。', + title: `${rss_title}`, + link: `${baseUrl}${sub_model}/`, + description: `${description}`, item: items, }; };