feat(route): add 白鲸出海资讯 (#10367)
* feat(route): add 白鲸出海资讯 * fix: use https
This commit is contained in:
parent
41fc70c1f0
commit
2f77dafb04
|
|
@ -256,7 +256,7 @@
|
|||
},
|
||||
'govopendata.com': { _name: '新闻联播文字版', cn: [{ title: '新闻联播文字版', docs: 'https://docs.rsshub.app/traditional-media.html#xin-wen-lian-bo-wen-zi-ban', source: '/xinwenlianbo', target: '/xinwenlianbo/index' }] },
|
||||
'steampowered.com': { _name: 'Steam', store: [{ title: 'search', docs: 'https://docs.rsshub.app/game.html#steam', source: '/search/', target: (params, url) => `/steam/search/${new URL(url).searchParams}` }] },
|
||||
'baijingapp.com': { _name: '白鲸出海', www: [{ title: '文章', docs: 'https://docs.rsshub.app/new-media.html#bai-jing-chu-hai', source: '', target: '/baijing' }] },
|
||||
// 'baijingapp.com': { _name: '白鲸出海', www: [{ title: '文章', docs: 'https://docs.rsshub.app/new-media.html#bai-jing-chu-hai', source: '', target: '/baijing' }] },
|
||||
'xiaomi.cn': { _name: '小米社区', www: [{ title: '圈子', docs: 'https://docs.rsshub.app/bbs.html#xiao-mi-she-qu', source: '/board/:boardId', target: '/mi/bbs/board/:boardId' }] },
|
||||
'163.com': {
|
||||
_name: '网易',
|
||||
|
|
|
|||
|
|
@ -1444,9 +1444,19 @@ Supported sub-sites:
|
|||
|
||||
## 白鲸出海
|
||||
|
||||
### 首页最新帖子
|
||||
### 最新
|
||||
|
||||
<Route author="jeffcottLu" example="/baijing" path="/baijing"></Route>
|
||||
<Route author="jeffcottLu nczitzk" example="/baijing" path="/baijing" />
|
||||
|
||||
### 资讯
|
||||
|
||||
<Route author="nczitzk" example="/baijing/1" path="/baijing/:type?" :paramsDesc="['分类 id,见下表,默认为最新文章']">
|
||||
|
||||
| 最新文章 | 7×24h | 干货 | 专栏 | 手游 | 跨境电商 | 投融资 | 数据报告 | 智能手机 | 活动 |
|
||||
| ---- | ----- | -- | -- | -- | ---- | --- | ---- | ---- | -- |
|
||||
| | 1 | 2 | 4 | 3 | 5 | 10 | 9 | 7 | 6 |
|
||||
|
||||
</Route>
|
||||
|
||||
## 百度知道日报
|
||||
|
||||
|
|
|
|||
|
|
@ -584,17 +584,17 @@ module.exports = {
|
|||
},
|
||||
],
|
||||
},
|
||||
'baijingapp.com': {
|
||||
_name: '白鲸出海',
|
||||
www: [
|
||||
{
|
||||
title: '文章',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#bai-jing-chu-hai',
|
||||
source: '',
|
||||
target: '/baijing',
|
||||
},
|
||||
],
|
||||
},
|
||||
// 'baijingapp.com': {
|
||||
// _name: '白鲸出海',
|
||||
// www: [
|
||||
// {
|
||||
// title: '文章',
|
||||
// docs: 'https://docs.rsshub.app/new-media.html#bai-jing-chu-hai',
|
||||
// source: '',
|
||||
// target: '/baijing',
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
'xiaomi.cn': {
|
||||
_name: '小米社区',
|
||||
www: [
|
||||
|
|
|
|||
|
|
@ -2327,7 +2327,7 @@ router.get('/yahoo-jp-tv/:query', lazyloadRouteHandler('./routes/yahoo-jp-tv/ind
|
|||
router.get('/yahoo-author/:author', lazyloadRouteHandler('./routes/yahoo-author/index'));
|
||||
|
||||
// 白鲸出海
|
||||
router.get('/baijing', lazyloadRouteHandler('./routes/baijing'));
|
||||
// router.get('/baijing', lazyloadRouteHandler('./routes/baijing'));
|
||||
|
||||
// 低端影视
|
||||
router.get('/ddrk/update/:name/:season?', lazyloadRouteHandler('./routes/ddrk/index'));
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
const got = require('@/utils/got');
|
||||
const date = require('@/utils/date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'http://www.baijingapp.com/api/get_more_articles/',
|
||||
});
|
||||
|
||||
const data = JSON.parse(response.data.substr(1, response.data.length - 1));
|
||||
|
||||
const output = data.data.list.map((item) => {
|
||||
const title = item.title;
|
||||
const link = 'https://www.baijingapp.com/article/' + item.id;
|
||||
const pubDate = date(item.time.replace(' ', ''));
|
||||
const author = item.user_name;
|
||||
const description = `<img src="${item.image}">`;
|
||||
const single = {
|
||||
title,
|
||||
link,
|
||||
pubDate,
|
||||
author,
|
||||
description,
|
||||
};
|
||||
|
||||
return single;
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: `白鲸出海`,
|
||||
desription: '白鲸出海 - 泛互联网出海服务平台',
|
||||
item: output,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type ?? '';
|
||||
|
||||
const rootUrl = 'https://www.baijingapp.com';
|
||||
const currentUrl = `${rootUrl}/article${type ? `/type-${type}` : ''}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
let items = $('.article')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
|
||||
return {
|
||||
title: item.text(),
|
||||
link: `${rootUrl}${item.attr('href')}`,
|
||||
};
|
||||
});
|
||||
|
||||
items = await Promise.all(
|
||||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
item.author = content('.name').text();
|
||||
item.description = content('#message').html();
|
||||
item.pubDate = timezone(parseDate(content('.timeago').text()), +8);
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `白鲸出海 - ${$('.list .active').text()}`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/:type?': ['nczitzk'],
|
||||
};
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
module.exports = {
|
||||
'baijingapp.com': {
|
||||
_name: '白鲸出海',
|
||||
'.': [
|
||||
{
|
||||
title: '最新',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#bai-jing-chu-hai',
|
||||
source: ['/article', '/'],
|
||||
target: '/baijing',
|
||||
},
|
||||
{
|
||||
title: '资讯',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#bai-jing-chu-hai',
|
||||
source: ['/article', '/'],
|
||||
target: (params, url) => {
|
||||
const matches = String(new URL(url)).match(/\/article\/type-(\d+)/);
|
||||
return `/baijing${matches ? `/${matches[1]}` : ''}`;
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/:type?', require('./index'));
|
||||
};
|
||||
Loading…
Reference in New Issue