feat: add hotukdeals
This commit is contained in:
parent
43e7e24899
commit
80aa29ff28
|
|
@ -48,6 +48,12 @@ Parameter `time` only works when `mostwanted` is chosen as the category.
|
|||
|
||||
<RouteEn author="nczitzk" example="/guiltfree/onsale" path="/guiltfree/onsale"/>
|
||||
|
||||
## hotukdeals
|
||||
|
||||
### thread
|
||||
|
||||
<Route author="DIYgod" example="/hotukdeals/hot" path="/hotukdeals/:type" :paramsDesc="['should be one of highlights, hot, new, discussed']" ></Route>
|
||||
|
||||
## IKEA
|
||||
|
||||
### UK - New Product Release
|
||||
|
|
|
|||
|
|
@ -75,6 +75,12 @@ pageClass: routes
|
|||
|
||||
<Route author="nczitzk" example="/guiltfree/onsale" path="/guiltfree/onsale"/>
|
||||
|
||||
## hotukdeals
|
||||
|
||||
### thread
|
||||
|
||||
<Route author="DIYgod" example="/hotukdeals/hot" path="/hotukdeals/:type" :paramsDesc="['should be one of highlights, hot, new, discussed']" ></Route>
|
||||
|
||||
## LeBonCoin
|
||||
|
||||
### Ads
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
let type = ctx.params.type;
|
||||
if (type === 'highlights') {
|
||||
type = '';
|
||||
}
|
||||
|
||||
const data = await got.get(`https://www.hotukdeals.com/${type}?page=1&ajax=true&layout=horizontal`, {
|
||||
headers: {
|
||||
Referer: `https://www.hotukdeals.com/${type}`,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(data.data.data.content);
|
||||
|
||||
const list = $('article.thread');
|
||||
|
||||
ctx.state.data = {
|
||||
title: `hotukdeals ${type}`,
|
||||
link: `https://www.hotukdeals.com/${type}`,
|
||||
item: list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('.cept-tt').text(),
|
||||
description: `${item.find('.cept-thread-image-link').html()}<br>${item.find('.cept-vote-temp').html()}<br>${item.find('.overflow--fade').html()}<br>${item.find('.cept-description-container').html()}`,
|
||||
link: item.find('.cept-tt').attr('href'),
|
||||
};
|
||||
})
|
||||
.get()
|
||||
.reverse(),
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/:type': ['DIYgod'],
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/:type', require('./index'));
|
||||
};
|
||||
Loading…
Reference in New Issue