diff --git a/assets/radar-rules.js b/assets/radar-rules.js index 4c1af4c624..afd2cf6e0b 100644 --- a/assets/radar-rules.js +++ b/assets/radar-rules.js @@ -535,4 +535,15 @@ }, ], }, + 'wineyun.com': { + _name: '酒云网', + www: [ + { + title: '最新商品', + description: 'https://docs.rsshub.app/other.html#jiu-yun-wang', + source: ['/:category'], + target: '/wineyun/:category', + }, + ], + }, }); diff --git a/docs/shopping.md b/docs/shopping.md index 8ba4116c10..030cf0a63e 100644 --- a/docs/shopping.md +++ b/docs/shopping.md @@ -187,3 +187,14 @@ pageClass: routes ### 商品上新 + +## 酒云网 + +### 最新商品 + + +| 全部 | 闪购 | 秒发 | 跨境 | +| -------- | ------- | --- | ------- | +| home | shangou | miaofa | csborder | + + diff --git a/docs/traditional-media.md b/docs/traditional-media.md index 7ef57a8d6f..198cb57dab 100644 --- a/docs/traditional-media.md +++ b/docs/traditional-media.md @@ -228,6 +228,12 @@ category 对应的关键词有 +## 每经网 + +### 重磅原创 + + + ## 南方周末 ### 新闻分类 diff --git a/lib/router.js b/lib/router.js index 95f5d526f4..6bbfb7dd67 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1793,6 +1793,12 @@ router.get('/watchface/:watch_type?/:list_type?', require('./routes/watchface/up router.get('/cnu/selected', require('./routes/cnu/selected')); router.get('/cnu/discovery/:type?/:category?', require('./routes/cnu/discovery')); +// 酒云网 +router.get('/wineyun/:category', require('./routes/wineyun')); + +// 重磅原创-每经网 +router.get('/nbd/daily', require('./routes/nbd/article')); + // 快知 router.get('/kzfeed/topic/:id', require('./routes/kzfeed/topic')); diff --git a/lib/routes/nbd/article.js b/lib/routes/nbd/article.js new file mode 100644 index 0000000000..dce84262fb --- /dev/null +++ b/lib/routes/nbd/article.js @@ -0,0 +1,72 @@ +const cheerio = require('cheerio'); +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const url = 'http://www.nbd.com.cn/columns/332'; + const response = await got({ + method: 'get', + url: url, + headers: { + Referer: 'http://www.nbd.com.cn', + }, + }); + + const $ = cheerio.load(response.data); + const $list = $('li.u-news-title') + .slice(0, 15) + .get(); + const description = $('head title') + .text() + .trim(); + + const resultItem = await Promise.all( + $list.map(async (item) => { + const title = $(item) + .find('a') + .text() + .trim(); + const pubDate = $(item) + .find('span') + .text() + .trim(); + const itemUrl = $(item) + .find('a') + .attr('href'); + + const single = { + title: title, + link: itemUrl, + pubDate: pubDate, + description: '', + }; + + const cache = await ctx.cache.get(itemUrl); + if (cache) { + return Promise.resolve(JSON.parse(cache)); + } + + const detail = await got({ + method: 'get', + url: itemUrl, + headers: { + Referer: 'http://www.nbd.com.cn', + }, + }); + + { + const $ = cheerio.load(detail.data); + single.description = $('div.g-article').html(); + } + + ctx.cache.set(itemUrl, JSON.stringify(single)); + return Promise.resolve(single); + }) + ); + + ctx.state.data = { + title: '重磅原创-每经网', + link: url, + item: resultItem, + description: description, + }; +}; diff --git a/lib/routes/wineyun/index.js b/lib/routes/wineyun/index.js new file mode 100644 index 0000000000..783022e685 --- /dev/null +++ b/lib/routes/wineyun/index.js @@ -0,0 +1,98 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const category = ctx.params.category; + const url = 'http://www.wineyun.com/' + category; + const flag = category === 'csborder'; + + const response = await got({ + method: 'get', + url: url, + headers: { + Referer: 'http://www.wineyun.com', + }, + }); + + const $ = cheerio.load(response.data); + + const $list = !flag + ? $('div.groupinfo') + .slice(0, 10) + .get() + : $('div a.topitem') + .slice(0, 10) + .get(); + + const description = $('head title'); + + const resultItem = await Promise.all( + $list.map(async (item) => { + const title = !flag + ? $(item) + .find('h1.bti') + .text() + .trim() + : $(item).attr('title'); + const itemPicUrl = !flag + ? $(item) + .find('div.fl img') + .attr('src') + : $(item) + .find('div.fl img') + .attr('src'); + const href = !flag + ? $(item) + .find('dt.fl a') + .attr('href') + : $(item).attr('href'); + const price = !flag + ? $(item) + .find('dt.fl a i.fl') + .text() + .trim() + : $(item) + .find('span.price') + .text() + .trim(); + + const itemDetailurl = 'http://www.wineyun.com' + href; + + const cache = await ctx.cache.get(itemDetailurl); + if (cache) { + return Promise.resolve(JSON.parse(cache)); + } + + const single = { + title: `${price} ${title}`, + link: itemDetailurl, + description: '', + }; + + const detail = await got({ + method: 'get', + url: itemDetailurl, + headers: { + Referer: 'http://www.wineyun.com', + }, + }); + + { + const detailData = detail.data; + const $ = cheerio.load(detailData); + $('div#htmlDetails p img').replaceWith(''); + single.description = `
` + $('div#htmlDetails').html(); + } + + ctx.cache.set(itemDetailurl, JSON.stringify(single)); + return Promise.resolve(single); + }) + ); + + ctx.state.data = { + title: '酒云网-最新商品', + link: url, + item: resultItem, + description: description, + }; +};