feat: remove sehuangtang picture (#4705)

This commit is contained in:
hoilc 2020-05-09 12:11:47 +08:00 committed by GitHub
parent 35270e8099
commit 9811992073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 113 deletions

View File

@ -391,19 +391,17 @@ pageClass: routes
## 色花堂中文论坛
### 原创 BT 电影
### 分区帖子
<Route author="qiwihui junfengP" example="/dsndsht23/36/368" path="/dsndsht23/:subforumid?/:type?" supportBT="1" :paramsDesc="['版块 id 或板块名称(见下表), 为空默认高清中文字幕', '类型 id, 可在分区类型过滤后的 URL 中找到']">
**原创 BT 电影**
| 每日合集 | 国产原创 | 亚洲无码原创 | 亚洲有码原创 | 高清中文字幕 | 三级写真 | 亚洲名站有码 | VR 系列 | 欧美无码 | 动漫原创 | AI 换脸电影 | 原档收藏 WMV |
| -------- | -------- | ------------ | ------------ | ------------ | -------- | ------------ | ------- | -------- | -------- | ----------- | ------------ |
| mrhj | gcyc | yzwmyc | yzymyc | gqzwzm | sjxz | yzmzym | vr | omwm | dmyc | ai | ydsc |
</Route>
### 色花图片
<Route author="junfengP" example="/dsndsht23/picture/hrxazp" path="/dsndsht23/picture/:subforumid" :paramsDesc="['子版块 id']">
**色花图片**
| 华人性爱自拍 | 华人街拍区 | 亚洲性爱 | 欧美性爱 | 卡通动漫 |
| ------------ | ---------- | -------- | -------- | -------- |

View File

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

View File

@ -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) => {

View File

@ -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(`<img src="${$(images[k]).attr('file')}" />`);
description += `<img src="${$(images[k]).attr('file')}" />`;
}
}
// 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,
};
};