RSSHub/lib/v2/chaincatcher/news.js

41 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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,
};
};