diff --git a/docs/en/shopping.md b/docs/en/shopping.md index 099fc598f..2c04463c3 100644 --- a/docs/en/shopping.md +++ b/docs/en/shopping.md @@ -48,6 +48,12 @@ Parameter `time` only works when `mostwanted` is chosen as the category. +## hotukdeals + +### thread + + + ## IKEA ### UK - New Product Release diff --git a/docs/shopping.md b/docs/shopping.md index ad773c822..57b87513b 100644 --- a/docs/shopping.md +++ b/docs/shopping.md @@ -75,6 +75,12 @@ pageClass: routes +## hotukdeals + +### thread + + + ## LeBonCoin ### Ads diff --git a/lib/v2/hotukdeals/index.js b/lib/v2/hotukdeals/index.js new file mode 100644 index 000000000..1ec7f9282 --- /dev/null +++ b/lib/v2/hotukdeals/index.js @@ -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()}
${item.find('.cept-vote-temp').html()}
${item.find('.overflow--fade').html()}
${item.find('.cept-description-container').html()}`, + link: item.find('.cept-tt').attr('href'), + }; + }) + .get() + .reverse(), + }; +}; diff --git a/lib/v2/hotukdeals/maintainer.js b/lib/v2/hotukdeals/maintainer.js new file mode 100644 index 000000000..edfe7b208 --- /dev/null +++ b/lib/v2/hotukdeals/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/:type': ['DIYgod'], +}; diff --git a/lib/v2/hotukdeals/router.js b/lib/v2/hotukdeals/router.js new file mode 100644 index 000000000..7170a4c83 --- /dev/null +++ b/lib/v2/hotukdeals/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/:type', require('./index')); +};