diff --git a/docs/picture.md b/docs/picture.md index 949e7bd34d..59af8d4a26 100644 --- a/docs/picture.md +++ b/docs/picture.md @@ -332,6 +332,32 @@ R18 显示 | ------ | ---------- | ---------- | | pic | top | top-4h | +## 酷 18 + +### 分站 + + + +| 性趣贴图 | 色色动漫 | 情色靓影 | 私房自拍 | 禁忌书屋 | 性趣论坛 | 情色无忌 | 成人影视 | +| -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | +| bbs | bbs7 | bbs2 | bbs6 | bbs4 | bj | bbs5 | bbs3 | + +::: tip 提示 + +禁忌书屋文档参见 [此处](https://docs.rsshub.app/reading.html#jin-ji-shu-wu) + +::: + + + +### 精华区 + + + +### 搜索关键字 + + + ### 妹子图 diff --git a/docs/reading.md b/docs/reading.md index 236d6e990a..638ad45efb 100644 --- a/docs/reading.md +++ b/docs/reading.md @@ -63,6 +63,10 @@ pageClass: routes +## 归档 + + + ## UU 看书 ### 小说更新 @@ -192,9 +196,30 @@ count 的取值范围为 1-12,为防止请求次数过多,推荐设置为 5 ## 观止(每日一文) -## 归档 + - +## 禁忌书屋 + +### 首页 + + + +### 精华区 + + + +### 栏目分类 + + + +| 都市 | 校园 | 乡野 | 古风 | 异国 | 玄幻 | 红杏 | 伦理 | 浪漫 | 暴虐 | 摄心 | 其他 | +| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | + + + +### 搜索关键字 + + ## 孔夫子旧书网 diff --git a/lib/router.js b/lib/router.js index b23383f69c..b971f87f89 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3670,6 +3670,9 @@ router.get('/proletar/:type?/:id?', require('./routes/proletar/index')); // QTTabBar router.get('/qttabbar/change-log', require('./routes/qttabbar/change-log')); +// 酷18 +router.get('/cool18/:id?/:type?/:keyword?', require('./routes/cool18/index')); + // 美国贸易代表办公室 router.get('/ustr/press-releases/:year?/:month?', require('./routes/us/ustr/press-releases')); diff --git a/lib/routes/cool18/index.js b/lib/routes/cool18/index.js new file mode 100644 index 0000000000..7291a6c377 --- /dev/null +++ b/lib/routes/cool18/index.js @@ -0,0 +1,58 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const id = ctx.params.id || 'bbs4'; + const type = ctx.params.type || ''; + const keyword = ctx.params.keyword || ''; + + const rootUrl = 'https://www.cool18.com'; + const indexUrl = `${rootUrl}/${id}/index.php`; + const currentUrl = `${indexUrl}${type === '' || keyword === '' ? '' : type === 'gold' ? '?app=forum&act=gold' : `?action=search&act=threadsearch&app=forum&${type}=${keyword}&submit=${type === 'type' ? '查询' : '栏目搜索'}`}`; + + const response = await got({ + method: 'get', + url: currentUrl, + }); + + const $ = cheerio.load(response.data); + + const list = $('#d_list ul li, #thread_list li, .t_l .t_subject') + .slice(0, 10) + .map((_, item) => { + item = $(item); + const a = item.find('a').eq(0); + return { + link: `${rootUrl}/${id}/${a.attr('href')}`, + }; + }) + .get(); + + const items = await Promise.all( + list.map( + async (item) => + await ctx.cache.tryGet(item.link, async () => { + const detailResponse = await got({ + method: 'get', + url: item.link, + }); + const content = cheerio.load(detailResponse.data); + + item.title = content('title').text().replace(' - cool18.com', ''); + item.author = detailResponse.data.match(/送交者: .*>(.*)<.*\[/)[1]; + item.pubDate = new Date(detailResponse.data.match(/于 (.*) 已读/)[1]).toUTCString(); + item.description = content('pre') + .html() + .replace(/cool18.com<\/font>/g, ''); + + return item; + }) + ) + ); + + ctx.state.data = { + title: $('title').text(), + link: currentUrl, + item: items, + }; +};