From 9811992073d29d038282ed6a28c38f4e2735cceb Mon Sep 17 00:00:00 2001 From: hoilc Date: Sat, 9 May 2020 12:11:47 +0800 Subject: [PATCH] feat: remove sehuangtang picture (#4705) --- docs/multimedia.md | 10 ++- lib/router.js | 6 +- lib/routes/dsndsht23/index.js | 5 ++ lib/routes/dsndsht23/pictures.js | 103 ------------------------------- 4 files changed, 11 insertions(+), 113 deletions(-) delete mode 100644 lib/routes/dsndsht23/pictures.js diff --git a/docs/multimedia.md b/docs/multimedia.md index 238d7bac9..3d6c85400 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -391,19 +391,17 @@ pageClass: routes ## 色花堂中文论坛 -### 原创 BT 电影 +### 分区帖子 +**原创 BT 电影** + | 每日合集 | 国产原创 | 亚洲无码原创 | 亚洲有码原创 | 高清中文字幕 | 三级写真 | 亚洲名站有码 | VR 系列 | 欧美无码 | 动漫原创 | AI 换脸电影 | 原档收藏 WMV | | -------- | -------- | ------------ | ------------ | ------------ | -------- | ------------ | ------- | -------- | -------- | ----------- | ------------ | | mrhj | gcyc | yzwmyc | yzymyc | gqzwzm | sjxz | yzmzym | vr | omwm | dmyc | ai | ydsc | - - -### 色花图片 - - +**色花图片** | 华人性爱自拍 | 华人街拍区 | 亚洲性爱 | 欧美性爱 | 卡通动漫 | | ------------ | ---------- | -------- | -------- | -------- | diff --git a/lib/router.js b/lib/router.js index dd7e4babc..bcbfb7421 100755 --- a/lib/router.js +++ b/lib/router.js @@ -1576,10 +1576,8 @@ router.get('/enclavebooks/category/:id?', require('./routes/enclavebooks/categor router.get('/enclavebooks/user/:uid', require('./routes/enclavebooks/user.js')); router.get('/enclavebooks/collection/:uid', require('./routes/enclavebooks/collection.js')); -// 色花堂 - 色花图片版块 -router.get('/dsndsht23/picture/:subforumid', require('./routes/dsndsht23/pictures')); - -// 色花堂 - 原创bt电影 +// 色花堂 +router.get('/dsndsht23/picture/:subforumid', require('./routes/dsndsht23/index')); router.get('/dsndsht23/bt/:subforumid?', require('./routes/dsndsht23/index')); router.get('/dsndsht23/:subforumid?/:type?', require('./routes/dsndsht23/index')); router.get('/dsndsht23/:subforumid?', require('./routes/dsndsht23/index')); diff --git a/lib/routes/dsndsht23/index.js b/lib/routes/dsndsht23/index.js index 76fb8fcac..44f0e0359 100644 --- a/lib/routes/dsndsht23/index.js +++ b/lib/routes/dsndsht23/index.js @@ -16,6 +16,11 @@ const forumIdMaps = { dmyc: '39', ai: '113', ydsc: '111', + hrxazp: '98', + hrjpq: '50', + yzxa: '48', + omxa: '49', + ktdm: '117', }; module.exports = async (ctx) => { diff --git a/lib/routes/dsndsht23/pictures.js b/lib/routes/dsndsht23/pictures.js deleted file mode 100644 index 59a660d9b..000000000 --- a/lib/routes/dsndsht23/pictures.js +++ /dev/null @@ -1,103 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const host = 'https://www.sehuatang.net/'; - -const map = { - hrxazp: 'forum-98-1.html', - hrjpq: 'forum-50-1.html', - yzxa: 'forum-48-1.html', - omxa: 'forum-49-1.html', - ktdm: 'forum-117-1.html', -}; - -module.exports = async (ctx) => { - const subforumid = ctx.params.subforumid || 'hrxazp'; - - const link = `${host}${map[subforumid]}`; - const headers = { - 'Accept-Encoding': 'gzip, deflate, br', - 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8', - }; - let c; - const response = await got({ - method: 'get', - url: link, - headers: headers, - hooks: { - beforeRedirect: [ - (options, response) => { - const cookie = response.headers['set-cookie']; - if (cookie) { - const cook = cookie.map((c) => c.split(';')[0]).join('; '); - options.headers.Cookie = cook; - c = cook; - options.headers.Referer = response.url; - } - }, - ], - }, - }); - headers.Cookie = c; - const $ = cheerio.load(response.body); - - const list = $('#threadlisttableid tbody') - .slice(1, 21) - .filter(function () { - // 去除置顶帖子和分割线 - const threadID = $(this).attr('id'); - return typeof threadID !== 'undefined' && threadID !== 'separatorline' && !threadID.startsWith('stickthread'); - }) - .map(function () { - const info = { - title: $(this).find('a.xst').text(), - link: $(this).find('a.xst').attr('href'), - date: $(this).find('td.by').find('em span span').attr('title'), - }; - return info; - }) - .get(); - - const out = await Promise.all( - list.map(async (info) => { - const title = info.title; - const date = info.date; - const itemUrl = host + info.link; - - const cache = await ctx.cache.get(itemUrl); - if (cache) { - return Promise.resolve(JSON.parse(cache)); - } - - const response = await got.get(itemUrl, { headers: headers }); - - const $ = cheerio.load(response.data); - const postMessage = $("td[id^='postmessage']").slice(0, 1); - const images = $(postMessage).find('img'); - let description = ''; - for (let k = 0; k < images.length; k++) { - if (!$(images[k]).attr('file') || $(images[k]).attr('file') === 'undefined') { - $(images[k]).replaceWith(''); - } else { - // $(images[k]).replaceWith(``); - description += ``; - } - } - // const description = postMessage.html(); - - const single = { - title: title, - link: itemUrl, - description: description, - pubDate: new Date(date).toUTCString(), - }; - ctx.cache.set(itemUrl, JSON.stringify(single)); - return Promise.resolve(single); - }) - ); - - ctx.state.data = { - title: `色花堂 - ${$('#pt > div:nth-child(1) > a:last-child').text()}`, - link: link, - item: out, - }; -};