mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-19 09:52:21 +08:00
fix(route): nbd (#13794)
* fix(route): nbd * fix: update maintainer github id refs: #3197
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://www.nbd.com.cn/columns/332';
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url,
|
||||
headers: {
|
||||
Referer: 'https://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 itemUrl = 'https:' + $(item).find('a').attr('href');
|
||||
|
||||
const single = await ctx.cache.tryGet(itemUrl, async () => {
|
||||
const detail = await got({
|
||||
method: 'get',
|
||||
url: itemUrl,
|
||||
headers: {
|
||||
Referer: 'https://www.nbd.com.cn',
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(detail.data);
|
||||
return {
|
||||
title,
|
||||
link: itemUrl,
|
||||
pubDate: timezone(parseDate(detail.data.match(/"pubDate": "(.*)"/)[1]), +8),
|
||||
description: $('div.g-article').html(),
|
||||
};
|
||||
});
|
||||
return single;
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '重磅原创-每经网',
|
||||
link: url,
|
||||
item: resultItem,
|
||||
description,
|
||||
};
|
||||
};
|
||||
+4
-1
@@ -34,6 +34,9 @@ module.exports = async (ctx) => {
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
if (!detailResponse.url.startsWith(`${rootUrl}/`)) {
|
||||
return item;
|
||||
}
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
item.description = content('.g-articl-text').html();
|
||||
@@ -45,7 +48,7 @@ module.exports = async (ctx) => {
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${$('h1').text()} - 每经网`,
|
||||
title: `${$('h1').text() || $('.u-channelname').text()} - 每经网`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
'/daily': ['MeXunco'],
|
||||
'/daily': ['yuuow'],
|
||||
'/:id?': ['nczitzk'],
|
||||
};
|
||||
|
||||
+3
-3
@@ -5,13 +5,13 @@ module.exports = {
|
||||
{
|
||||
title: '分类',
|
||||
docs: 'https://docs.rsshub.app/routes/finance#mei-jing-wang',
|
||||
source: '/',
|
||||
target: '/nbd',
|
||||
source: ['/', '/columns/:id?'],
|
||||
target: '/nbd/:id?',
|
||||
},
|
||||
{
|
||||
title: '重磅原创',
|
||||
docs: 'https://docs.rsshub.app/routes/finance#mei-jing-wang',
|
||||
source: '/',
|
||||
source: ['/', '/columns/332'],
|
||||
target: '/nbd/daily',
|
||||
},
|
||||
],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/daily', require('./article'));
|
||||
router.redirect('/daily', '/nbd/332');
|
||||
router.get('/:id?', require('./index'));
|
||||
};
|
||||
|
||||
@@ -2,6 +2,6 @@ module.exports = {
|
||||
'/discover/:type?': ['junbaor', 'nczitzk'],
|
||||
'/discover/:query?': ['nczitzk'],
|
||||
'/discover/:query?/:subCate?/:hasVideo?/:city?/:college?/:recommendLevel?/:sort?': ['nczitzk'],
|
||||
'/top/:type': ['mexunco'],
|
||||
'/top/:type': ['yuuow'],
|
||||
'/user/:uid': ['junbaor'],
|
||||
};
|
||||
|
||||
@@ -387,7 +387,7 @@ UI 17
|
||||
|
||||
### 作品总榜单 {#zhan-ku-zuo-pin-zong-bang-dan}
|
||||
|
||||
<Route author="mexunco" example="/zcool/top/design" path="/zcool/top/:type" paramsDesc={['推荐类型,详见下面的表格']} radar="1" rssbud="1">
|
||||
<Route author="yuuow" example="/zcool/top/design" path="/zcool/top/:type" paramsDesc={['推荐类型,详见下面的表格']} radar="1" rssbud="1">
|
||||
|
||||
榜单类型
|
||||
|
||||
|
||||
@@ -589,7 +589,7 @@ See filters in [Report](https://www.weforum.org/reports) for Year and Platform t
|
||||
|
||||
### 重磅原创 {#mei-jing-wang-zhong-bang-yuan-chuang}
|
||||
|
||||
<Route author="MeXunco" example="/nbd/daily" path="/nbd/daily"/>
|
||||
<Route author="yuuow" example="/nbd/daily" path="/nbd/daily"/>
|
||||
|
||||
## 前瞻网 {#qian-zhan-wang}
|
||||
|
||||
|
||||
@@ -407,7 +407,7 @@ For instance, in `https://www.zagg.com/en_us/new-arrivals?brand=164&cat=3038%2C3
|
||||
|
||||
### 最新商品 {#jiu-yun-wang-zui-xin-shang-pin}
|
||||
|
||||
<Route author="MeXunco" example="/wineyun/home" path="/wineyun/:category" paramsDesc={['分类名']} >
|
||||
<Route author="yuuow" example="/wineyun/home" path="/wineyun/:category" paramsDesc={['分类名']} >
|
||||
|
||||
| 全部 | 闪购 | 秒发 | 跨境 | 尾货专场 |
|
||||
| ---- | ------- | ------ | -------- | -------- |
|
||||
|
||||
Reference in New Issue
Block a user