diff --git a/docs/finance.md b/docs/finance.md
index 0b3b171cd6..423e7cd1ef 100644
--- a/docs/finance.md
+++ b/docs/finance.md
@@ -12,6 +12,16 @@ pageClass: routes
## DT 财经
+### 数据洞察
+
+
+
+| 城数 | NEXT 情报局 | 专业精选 |
+| -- | -------- | ---- |
+| 3 | 1 | 4 |
+
+
+
### 数据侠专栏
diff --git a/lib/router.js b/lib/router.js
index d0d95b6023..ef293356e5 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -3891,8 +3891,9 @@ router.get('/jlbtc/kyc/:category?', lazyloadRouteHandler('./routes/universities/
router.get('/jlbtc/jwc/:id?', lazyloadRouteHandler('./routes/universities/jlbtc/jwc'));
router.get('/jlbtc/:category?', lazyloadRouteHandler('./routes/universities/jlbtc/index'));
-// DT 财经
-router.get('/dtcj/datahero/:category?', lazyloadRouteHandler('./routes/dtcj/datahero'));
+// DT 财经 migrated to v2
+// router.get('/dtcj/datahero/:category?', lazyloadRouteHandler('./routes/dtcj/datahero'));
+// router.get('/dtcj/datainsight/:id?', lazyloadRouteHandler('./routes/dtcj/datainsight'));
// 劍心.回憶
router.get('/kenshin/:category?/:type?', lazyloadRouteHandler('./routes/kenshin/index'));
diff --git a/lib/routes/dtcj/datahero.js b/lib/v2/dtcj/datahero.js
similarity index 90%
rename from lib/routes/dtcj/datahero.js
rename to lib/v2/dtcj/datahero.js
index dc5b6057dd..b1ca837a4c 100644
--- a/lib/routes/dtcj/datahero.js
+++ b/lib/v2/dtcj/datahero.js
@@ -1,5 +1,6 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
+const { parseDate } = require('@/utils/parse-date');
const titles = {
5: '侠创',
@@ -9,7 +10,7 @@ const titles = {
};
module.exports = async (ctx) => {
- const category = ctx.params.category || '';
+ const category = ctx.params.category ?? '';
const rootUrl = 'https://dtcj.com';
const currentUrl = `${rootUrl}/api/v1/data_hero_informations?per=15&page=1&topic_id=${category}`;
@@ -22,7 +23,7 @@ module.exports = async (ctx) => {
title: item.title,
author: item.author,
link: `https://dtcj.com/topic/${item.id}`,
- pubDate: new Date(item.date).toUTCString(),
+ pubDate: parseDate(item.date),
}));
const items = await Promise.all(
diff --git a/lib/v2/dtcj/datainsight.js b/lib/v2/dtcj/datainsight.js
new file mode 100644
index 0000000000..5824508589
--- /dev/null
+++ b/lib/v2/dtcj/datainsight.js
@@ -0,0 +1,53 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+const { parseDate } = require('@/utils/parse-date');
+
+module.exports = async (ctx) => {
+ const id = ctx.params.id ?? '';
+
+ const rootUrl = 'https://dtcj.com';
+ const currentUrl = `${rootUrl}/${id ? `insighttopic/${id}` : 'datainsight'}`;
+
+ const response = await got({
+ method: 'get',
+ url: currentUrl,
+ });
+
+ const $ = cheerio.load(response.data);
+
+ const list = $('.info-2_P1UM a')
+ .slice(0, 10)
+ .map((_, item) => {
+ item = $(item);
+
+ return {
+ title: item.text(),
+ link: `${rootUrl}${item.attr('href')}`,
+ };
+ })
+ .get();
+
+ const items = await Promise.all(
+ list.map(
+ async (item) =>
+ await ctx.cache.tryGet(item.link, async () => {
+ const detailResponse = await got({
+ method: 'get',
+ url: item.link,
+ });
+ const content = cheerio.load(detailResponse.data);
+
+ item.description = content('.content-3mNFyi').html();
+ item.pubDate = parseDate(detailResponse.data.match(/"date":"(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}\+\d{2}:\d{2})","thumbnail_url":/)[1]);
+
+ return item;
+ })
+ )
+ );
+
+ ctx.state.data = {
+ title: $('title').text(),
+ link: currentUrl,
+ item: items,
+ };
+};
diff --git a/lib/v2/dtcj/maintainer.js b/lib/v2/dtcj/maintainer.js
new file mode 100644
index 0000000000..4b9ccc28fd
--- /dev/null
+++ b/lib/v2/dtcj/maintainer.js
@@ -0,0 +1,4 @@
+module.exports = {
+ '/datahero/:category?': ['nczitzk'],
+ '/datainsight/:id?': ['nczitzk'],
+};
diff --git a/lib/v2/dtcj/radar.js b/lib/v2/dtcj/radar.js
new file mode 100644
index 0000000000..5df944e98c
--- /dev/null
+++ b/lib/v2/dtcj/radar.js
@@ -0,0 +1,25 @@
+module.exports = {
+ 'dtcj.com': {
+ _name: 'DT 财经',
+ '.': [
+ {
+ title: '数据侠专栏',
+ docs: 'https://docs.rsshub.app/finance.html#dt-cai-jing',
+ source: ['/datahero/topic'],
+ target: (_params, url) => `/dtcj/datahero/${new URL(url).searchParams.get('topic_id')}`,
+ },
+ {
+ title: '数据洞察',
+ docs: 'https://docs.rsshub.app/finance.html#dt-cai-jing',
+ source: ['/dtcj/datainsight'],
+ target: '/dtcj/datainsight',
+ },
+ {
+ title: '数据洞察',
+ docs: 'https://docs.rsshub.app/finance.html#dt-cai-jing',
+ source: ['/insighttopic/:id'],
+ target: '/dtcj/datainsight/:id',
+ },
+ ],
+ },
+};
diff --git a/lib/v2/dtcj/router.js b/lib/v2/dtcj/router.js
new file mode 100644
index 0000000000..8c56982301
--- /dev/null
+++ b/lib/v2/dtcj/router.js
@@ -0,0 +1,4 @@
+module.exports = (router) => {
+ router.get('/datahero/:category?', require('./datahero'));
+ router.get('/datainsight/:id?', require('./datainsight'));
+};