feat: 新增BOOKWALKER台湾站新上架书籍 (#5071)
This commit is contained in:
@@ -727,3 +727,9 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
### はてな匿名ダイアリー - 人気記事アーカイブ
|
||||
|
||||
<Route author="masakichi" example="/hatena/anonymous_diary/archive" path="/hatena/anonymous_diary/archive"/>
|
||||
|
||||
## BOOKWALKERTW
|
||||
|
||||
### 热门新书
|
||||
|
||||
<Route author="wushijishan" example="/bookwalkertw/news" path="/bookwalkertw/news"/>
|
||||
@@ -2874,6 +2874,9 @@ router.get('/changku', require('./routes/changku/index'));
|
||||
// 上海市生态环境局
|
||||
router.get('/gov/shanghai/sthj', require('./routes/gov/shanghai/sthj'));
|
||||
|
||||
// BookwalkerTW热门新书
|
||||
router.get('/bookwalkertw/news', require('./routes/bookwalkertw/news'));
|
||||
|
||||
// Amazfit Watch Faces
|
||||
router.get('/amazfitwatchfaces/fresh/:model/:type?/:lang?', require('./routes/amazfitwatchfaces/fresh'));
|
||||
router.get('/amazfitwatchfaces/updated/:model/:type?/:lang?', require('./routes/amazfitwatchfaces/updated'));
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://www.bookwalker.com.tw/more/index/1',
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('div[class="bwbookitem"]');
|
||||
let bookid;
|
||||
ctx.state.data = {
|
||||
title: 'BOOKWALKERTW热门新书',
|
||||
link: 'https://www.bookwalker.com.tw/more/index/1',
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
bookid = item.find('a').attr('href').substring(38, 43);
|
||||
return {
|
||||
title: item.find('.bookname').text(),
|
||||
description: `${item.find('.booknamesub').text()} | ${item.find('.bprice').text()}<br><img src="https://image.bookwalker.com.tw/upload/product/${bookid}/zoom_big_${bookid}.jpg">`,
|
||||
link: item.find('a').attr('href'),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user