增加煎蛋妹子圖 (#357)

This commit is contained in:
kobemtl 2018-07-11 09:24:41 -04:00 committed by DIYgod
parent d445bc73c2
commit 8e56ff1a79
4 changed files with 23 additions and 5 deletions

View File

@ -84,6 +84,7 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
- 小组
- 煎蛋
- 无聊图
- 妹子图
- 喷嚏
- 图卦
- Dockone

View File

@ -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`
参数: 无

View File

@ -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'));

View File

@ -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,
};
};