diff --git a/docs/en/shopping.md b/docs/en/shopping.md index 356870d45..7f992bc7e 100644 --- a/docs/en/shopping.md +++ b/docs/en/shopping.md @@ -77,6 +77,10 @@ Parameter `time` only works when `mostwanted` is chosen as the category. +### hottest + + + ## IKEA ### UK - New Product Release diff --git a/docs/shopping.md b/docs/shopping.md index cfe551d28..ec7867fc1 100644 --- a/docs/shopping.md +++ b/docs/shopping.md @@ -91,6 +91,10 @@ pageClass: routes +### hottest + + + ## lativ ### 订阅价格 diff --git a/lib/v2/hotukdeals/hottest.js b/lib/v2/hotukdeals/hottest.js new file mode 100644 index 000000000..117699b9b --- /dev/null +++ b/lib/v2/hotukdeals/hottest.js @@ -0,0 +1,25 @@ +const got = require('@/utils/got'); +const { JSDOM } = require('jsdom'); + +module.exports = async (ctx) => { + const data = await got.get(`https://www.hotukdeals.com/`, { + headers: { + Referer: `https://www.hotukdeals.com/`, + }, + }); + + const dom = new JSDOM(data.data, { + runScripts: 'dangerously', + }); + const threads = dom.window.__INITIAL_STATE__.widgets.hottestWidget.threads; + + ctx.state.data = { + title: `hotukdeals hottest`, + link: `https://www.hotukdeals.com/`, + item: threads.map((item) => ({ + title: item.title, + description: `
${item.temperature}° ${item.title}
${item.displayPrice}`, + link: item.url, + })), + }; +}; diff --git a/lib/v2/hotukdeals/maintainer.js b/lib/v2/hotukdeals/maintainer.js index edfe7b208..1740e2ee7 100644 --- a/lib/v2/hotukdeals/maintainer.js +++ b/lib/v2/hotukdeals/maintainer.js @@ -1,3 +1,4 @@ module.exports = { '/:type': ['DIYgod'], + '/hottest': ['DIYgod'], }; diff --git a/lib/v2/hotukdeals/radar.js b/lib/v2/hotukdeals/radar.js index 420dbc9d2..fe79c0667 100644 --- a/lib/v2/hotukdeals/radar.js +++ b/lib/v2/hotukdeals/radar.js @@ -26,6 +26,12 @@ module.exports = { source: ['/'], target: '/hotukdeals/discussed', }, + { + title: 'hottest', + docs: 'https://docs.rsshub.app/shopping.html#hotukdeals', + source: ['/'], + target: '/hotukdeals/hottest', + }, ], }, }; diff --git a/lib/v2/hotukdeals/router.js b/lib/v2/hotukdeals/router.js index 7170a4c83..febcb5437 100644 --- a/lib/v2/hotukdeals/router.js +++ b/lib/v2/hotukdeals/router.js @@ -1,3 +1,4 @@ module.exports = function (router) { + router.get('/hottest', require('./hottest')); router.get('/:type', require('./index')); };