feat: add bbs路由 eTOLAND (#4465)
This commit is contained in:
parent
2ae5e666a9
commit
ba06c26875
|
|
@ -82,6 +82,12 @@ pageClass: routes
|
|||
|
||||
</Route>
|
||||
|
||||
## eTOLAND
|
||||
|
||||
### 主题贴
|
||||
|
||||
<Route author="mengx8" example="/etoland/star01" path="/etoland/:boardId" :paramsDesc="['板块 id,可在板块 URL 找到']"/>
|
||||
|
||||
## LearnKu
|
||||
|
||||
### 社区
|
||||
|
|
|
|||
|
|
@ -2536,4 +2536,7 @@ router.get('/iyouport/article', require('./routes/iyouport'));
|
|||
// girlimg
|
||||
router.get('/girlimg/album/:tag?/:mode?', require('./routes/girlimg/album'));
|
||||
|
||||
// etoland
|
||||
router.get('/etoland/:bo_table', require('./routes/etoland/board'));
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const iconv = require('iconv-lite');
|
||||
const date = require('@/utils/date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { bo_table } = ctx.params;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `http://www.etoland.co.kr/bbs/board.php?bo_table=${bo_table}`,
|
||||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const data = iconv.decode(response.data, 'euc-kr');
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('form[name="fboardlist"]>table tr[align="center"]').filter((index, item) => {
|
||||
item = $(item);
|
||||
return item.find('td').first().find('span.mw_basic_list_num').length > 0;
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'eTOLAND',
|
||||
link: 'http://www.etoland.co.kr',
|
||||
language: 'ko-KR',
|
||||
description: 'eTOLAND',
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
const title = item.find('td.mw_basic_list_subject a:nth-child(3) span').text();
|
||||
const description = `点赞数:${item.find('td.mw_basic_list_good').text()}<br>浏览数:${item.find('td.mw_basic_list_hit').text()}`;
|
||||
const link = item.find('td.mw_basic_list_subject a:nth-child(3)').attr('href');
|
||||
|
||||
return {
|
||||
title: title,
|
||||
description: description,
|
||||
link: link,
|
||||
pubDate: date(item.find('td.mw_basic_list_datetime').text()),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue