Merge remote-tracking branch 'origin/master' into feature/esm-2

This commit is contained in:
DIYgod
2024-03-07 01:24:18 +08:00
7 changed files with 44 additions and 48 deletions
+3 -3
View File
@@ -14,8 +14,8 @@ export default async (ctx) => {
const list = $('item')
.toArray()
.map((item) => {
item = $(item);
.map((elem) => {
const item = $(elem);
const enclosure = item.find('enclosure').first();
const mediaContent = item.find('media\\:content').toArray()[0];
const thumbnail = item.find('media\\:thumbnail').toArray()[0];
@@ -43,7 +43,7 @@ export default async (ctx) => {
};
});
const items = await Promise.all(list.map((item) => cache.tryGet(item.link, () => parseItem)));
const items = await Promise.all(list.map((item) => cache.tryGet(item.link, () => parseItem(item))));
ctx.set('json', {
items,
+2 -4
View File
@@ -2,7 +2,7 @@ import { load } from 'cheerio';
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
const renderHTML = (node) => {
export const renderHTML = (node) => {
if (!node) {
return '';
}
@@ -59,7 +59,7 @@ const renderHTML = (node) => {
}
};
const parseItem = async (item) => {
export const parseItem = async (item) => {
const { data: response, url } = await got(item.link);
if (new URL(url).hostname !== 'www.scmp.com') {
@@ -85,5 +85,3 @@ const parseItem = async (item) => {
return item;
};
export { renderHTML, parseItem };
+13 -15
View File
@@ -1,28 +1,26 @@
import got from '@/utils/got';
import timezone from '@/utils/timezone';
import { parseDate } from '@/utils/parse-date';
import { unescapeAll } from 'markdown-it/lib/common/utils.mjs';
import dayjs from 'dayjs';
export default async (ctx) => {
const rootUrl = 'https://www.techflowpost.com';
const apiRootUrl = 'https://data.techflowpost.com';
const currentUrl = `${rootUrl}/express`;
const apiUrl = `${apiRootUrl}/api/pc/express/all?pageIndex=0&pageSize=${ctx.req.query('limit') ?? 50}`;
const currentUrl = `${rootUrl}/newsletter/index.html`;
const response = await got({
method: 'post',
url: apiUrl,
json: {
createTime: [],
const { data: response } = await got.post('https://www.techflowpost.com/ashx/newflash_index.ashx', {
form: {
pageindex: 1,
pagesize: ctx.req.query('limit') ?? 50,
time: dayjs().format('YYYY/M/D HH:mm:ss'),
},
});
const items = response.data.content.map((item) => ({
title: item.title,
link: `${rootUrl}/express/${item.id}`,
category: item.tags?.split(',') ?? [],
pubDate: timezone(parseDate(item.createTime), +8),
description: unescapeAll(item.content),
const items = response.content.map((item) => ({
title: item.stitle,
link: `${rootUrl}/newsletter/detail_${item.nnewflash_id}.html`,
pubDate: timezone(parseDate(item.dcreate_time), +8),
updated: timezone(parseDate(item.dmodi_time), +8),
description: item.scontent,
}));
ctx.set('data', {
+13 -13
View File
@@ -1,25 +1,25 @@
import got from '@/utils/got';
import timezone from '@/utils/timezone';
import { parseDate } from '@/utils/parse-date';
import { unescapeAll } from 'markdown-it/lib/common/utils.mjs';
export default async (ctx) => {
const rootUrl = 'https://www.techflowpost.com';
const apiRootUrl = 'https://data.techflowpost.com';
const apiUrl = `${apiRootUrl}/api/pc/home/more?pageIndex=0&pageSize=${ctx.req.query('limit') ?? 50}`;
const response = await got({
method: 'get',
url: apiUrl,
const { data: response } = await got.post('https://www.techflowpost.com/ashx/index.ashx', {
form: {
pageindex: 1,
pagesize: ctx.req.query('limit') ?? 50,
},
});
const items = response.data.content.map((item) => ({
title: item.title,
author: item.source,
link: `${rootUrl}/article/${item.id}`,
category: item.tagList.map((t) => t.name),
pubDate: timezone(parseDate(item.createTime), +8),
description: unescapeAll(item.content),
const items = response.content.map((item) => ({
title: item.stitle,
author: item.sauthor_name,
link: `${rootUrl}/article/detail_${item.narticle_id}.html`,
category: [item.new_scata_name],
pubDate: timezone(parseDate(item.dcreate_time), +8),
updated: timezone(parseDate(item.dmodi_time), +8),
description: item.scontent,
}));
ctx.set('data', {
+3 -3
View File
@@ -4,14 +4,14 @@ export default {
'.': [
{
title: '首页',
docs: 'https://docs.rsshub.app/routes/new-media#shen-chao-techflow-shou-ye',
docs: 'https://docs.rsshub.app/routes/finance#shen-chao-techflow-shou-ye',
source: ['/'],
target: '/techflowpost',
},
{
title: '快讯',
docs: 'https://docs.rsshub.app/routes/new-media#shen-chao-techflow-kuai-xun',
source: ['/express'],
docs: 'https://docs.rsshub.app/routes/finance#shen-chao-techflow-kuai-xun',
source: ['/newsletter/index.html'],
target: '/techflowpost/express',
},
],
+10
View File
@@ -617,6 +617,16 @@ TokenInsight also provides official RSS, you can take a look at [https://api.tok
<Route author="Jeason0228" example="/sse/inquire" path="/sse/inquire" radar="1" />
## 深潮 TechFlow {#shen-chao-techflow}
### 首页 {#shen-chao-techflow-shou-ye}
<Route author="nczitzk" example="/techflowpost" path="/techflowpost" radar="1" />
### 快讯 {#shen-chao-techflow-kuai-xun}
<Route author="nczitzk" example="/techflowpost/express" path="/techflowpost/express" radar="1" />
## 深圳证券交易所 {#shen-zhen-zheng-quan-jiao-yi-suo}
### 上市公告 - 可转换债券 {#shen-zhen-zheng-quan-jiao-yi-suo-shang-shi-gong-gao-ke-zhuan-huan-zhai-quan}
-10
View File
@@ -4240,16 +4240,6 @@
<Route author="Jeason0228" example="/sspai/tag/apple" path="/sspai/tag/:keyword" paramsDesc={['关键词']} radar="1" />
## 深潮 TechFlow {#shen-chao-techflow}
### 首页 {#shen-chao-techflow-shou-ye}
<Route author="nczitzk" example="/techflowpost" path="/techflowpost" notOperational="1" />
### 快讯 {#shen-chao-techflow-kuai-xun}
<Route author="nczitzk" example="/techflowpost/express" path="/techflowpost/express" notOperational="1" />
## 深圳新闻网 {#shen-zhen-xin-wen-wang}
### 深圳市政府新闻发布厅 {#shen-zhen-xin-wen-wang-shen-zhen-shi-zheng-fu-xin-wen-fa-bu-ting}