feat(route): chaincatcher (#11761)
* feat(route): chaincatcher * fix: add logo
This commit is contained in:
parent
1513cdb8c5
commit
247643e019
|
|
@ -2863,6 +2863,16 @@ column 为 third 时可选的 category:
|
|||
|
||||
</Route>
|
||||
|
||||
## 链捕手 ChainCatcher
|
||||
|
||||
### 首页
|
||||
|
||||
<Route author="TonyRL" example="/chaincatcher" path="/chaincatcher" radar="1" rssbud="1"/>
|
||||
|
||||
### 快讯
|
||||
|
||||
<Route author="TonyRL" example="/chaincatcher/news" path="/chaincatcher/news" radar="1" rssbud="1"/>
|
||||
|
||||
## 链新闻 ABMedia
|
||||
|
||||
### 首页最新新闻
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
const rootUrl = 'https://www.chaincatcher.com';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { data } = await got.post(`${rootUrl}/api/article/lists`, {
|
||||
form: {
|
||||
page: 1,
|
||||
home: 1,
|
||||
},
|
||||
});
|
||||
|
||||
const list = data.data.map((item) => ({
|
||||
title: item.title,
|
||||
description: item.description,
|
||||
link: `${rootUrl}/article/${item.id}`,
|
||||
pubDate: parseDate(item.add_time, 'X'),
|
||||
categoryId: item.categoryid,
|
||||
category: [...item.keywords.split(','), item.category_name],
|
||||
}));
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
if (item.categoryId !== 3) {
|
||||
const { data: response } = await got(item.link);
|
||||
const $ = cheerio.load(response);
|
||||
item.description = art(path.join(__dirname, 'templates/home.art'), {
|
||||
summary: item.description,
|
||||
article: $('.article-container').html(),
|
||||
});
|
||||
}
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '链捕手ChainCatcher — 专业的区块链技术研究与资讯平台-Chain Catcher',
|
||||
description: '链捕手ChainCatcher为区块链技术爱好者与项目决策者提供NFT、Web3社交、DID、Layer2等专业的资讯与研究内容,Chain Catcher输出对Scroll、Sui、Aptos、ENS等项目的思考,拓宽读者对区块链与数字经济认知的边界。',
|
||||
image: `${rootUrl}/logo.png`,
|
||||
link: rootUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
'/': ['TonyRL'],
|
||||
'/news': ['TonyRL'],
|
||||
};
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
const rootUrl = 'https://www.chaincatcher.com';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { data } = await got.post(`${rootUrl}/index/content/lists`, {
|
||||
form: {
|
||||
page: 1,
|
||||
categoryid: 3,
|
||||
},
|
||||
});
|
||||
|
||||
const $ = cheerio.load(data.data, null, false);
|
||||
|
||||
$('.share').remove();
|
||||
const items = $('.block')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
item.find('.tips').remove();
|
||||
const act = !!item.find('.act-title').text();
|
||||
return {
|
||||
title: `${act ? '[重] ' : ''}${item.find('.title').text()}`,
|
||||
description: item.find('.summary').text(),
|
||||
link: `${rootUrl}${item.find('a').first().attr('href')}`,
|
||||
pubDate: timezone(parseDate(item.find('.time').text(), 'YYYY-MM-DD HH:mm:ss'), 8),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: '最新资讯-ChainCatcher',
|
||||
description: '链捕手ChainCatcher为区块链技术爱好者与项目决策者提供NFT、Web3社交、DID、Layer2等专业的资讯与研究内容,Chain Catcher输出对Scroll、Sui、Aptos、ENS等项目的思考,拓宽读者对区块链与数字经济认知的边界。',
|
||||
image: `${rootUrl}/logo.png`,
|
||||
link: `${rootUrl}/news`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
module.exports = {
|
||||
'chaincatcher.com': {
|
||||
_name: '链捕手 ChainCatcher',
|
||||
'.': [
|
||||
{
|
||||
title: '首页',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#lian-bu-shou-chaincatcher',
|
||||
source: ['/'],
|
||||
target: '/chaincatcher',
|
||||
},
|
||||
{
|
||||
title: '快讯',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#lian-bu-shou-chaincatcher',
|
||||
source: ['/news', '/'],
|
||||
target: '/chaincatcher/news',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/', require('./home'));
|
||||
router.get('/news', require('./news'));
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{{ if summary }}
|
||||
<blockquote>{{ summary }}</blockquote><br>
|
||||
{{ /if }}
|
||||
{{@ article }}
|
||||
Loading…
Reference in New Issue