diff --git a/lib/v2/hebtv/maintainer.js b/lib/v2/hebtv/maintainer.js
index 512d2c7404201d..9d045f696d31b6 100644
--- a/lib/v2/hebtv/maintainer.js
+++ b/lib/v2/hebtv/maintainer.js
@@ -1,3 +1,3 @@
module.exports = {
- '/nbszxd': ['iamqiz'],
+ '/nbszxd': ['iamqiz', 'nczitzk'],
};
diff --git a/lib/v2/hebtv/nong-bo-shi-zai-xing-dong.js b/lib/v2/hebtv/nong-bo-shi-zai-xing-dong.js
index 5d35a1a78556eb..6a6e83c963a6a0 100644
--- a/lib/v2/hebtv/nong-bo-shi-zai-xing-dong.js
+++ b/lib/v2/hebtv/nong-bo-shi-zai-xing-dong.js
@@ -2,11 +2,17 @@ const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
+const { art } = require('@/utils/render');
+const path = require('path');
const baseUrl = 'https://web.cmc.hebtv.com/cms/rmt0336/19/19js/st/ds/nmpd/nbszxd/index.shtml';
-const sizeTitle = '农博士在行动-河北广播电视台';
module.exports = async (ctx) => {
+ const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 40;
+
+ const apiRootUrl = 'http://api.cmc.hebtv.com';
+ const apiUrl = new URL('cmsback/api/article/getMyArticleDetail', apiRootUrl).href;
+
const response = await got(baseUrl);
const $ = cheerio.load(response.data);
@@ -30,10 +36,74 @@ module.exports = async (ctx) => {
};
});
+ const items = await Promise.all(
+ list.slice(0, limit).map((item) =>
+ ctx.cache.tryGet(item.link, async () => {
+ const { data: detailResponse } = await got(item.link);
+
+ const tenantId = detailResponse.match(/tenantid = '(\w+)';/)[1];
+ const articleId = item.link.match(/\/nbszxd\/(\d+)/)[1];
+
+ const { data: apiResponse } = await got(apiUrl, {
+ searchParams: {
+ tenantId,
+ articleId,
+ },
+ });
+
+ const data = apiResponse.data;
+
+ let videoData;
+ if (data.articleContentDto?.videoDtoList?.length > 0) {
+ videoData = data.articleContentDto?.videoDtoList[0];
+ }
+
+ item.title = data.title;
+ item.author = data.source;
+ item.guid = `hebtv-nbszxd-${articleId}`;
+ item.pubDate = timezone(parseDate(data.publishDate), +8);
+ item.updated = timezone(parseDate(data.modifyTime), +8);
+
+ if (videoData) {
+ item.itunes_item_image = videoData.poster;
+ item.itunes_duration = data.articleContentDto?.videoEditDtoList[0]?.sourceMediaInfo?.duration;
+ item.enclosure_url = videoData.formats[0]?.url;
+ item.enclosure_length = data.articleContentDto?.videoEditDtoList[0].sourceMediaInfo?.fileSize;
+ item.enclosure_type = item.enclosure_url ? `video/${item.enclosure_url?.split(/\./)?.pop()}` : undefined;
+ }
+
+ item.description = art(path.join(__dirname, 'templates/description.art'), {
+ video: videoData
+ ? {
+ src: item.enclosure_url,
+ type: item.enclosure_type,
+ poster: item.itunes_item_image,
+ }
+ : undefined,
+ });
+
+ return item;
+ })
+ )
+ );
+
+ const description = $('meta[name="description"]').prop('content');
+ const author = description.split(/,/)[0];
+ const icon = $('link[rel="shortcut icon"]').prop('href');
+
ctx.state.data = {
- title: sizeTitle,
+ item: items,
+ title: $('title').text(),
link: baseUrl,
- description: '农博士在行动-河北广播电视台',
- item: list,
+ description,
+ language: $('html').prop('lang'),
+ image: $('div.logo a img').prop('src'),
+ icon,
+ logo: icon,
+ subtitle: $('meta[name="keywords"]').prop('content'),
+ author,
+ itunes_author: author,
+ itunes_category: 'News',
+ allowEmpty: true,
};
};
diff --git a/lib/v2/hebtv/templates/description.art b/lib/v2/hebtv/templates/description.art
new file mode 100644
index 00000000000000..7acb0d0189f63e
--- /dev/null
+++ b/lib/v2/hebtv/templates/description.art
@@ -0,0 +1,24 @@
+{{ if image?.src }}
+
+{{ /if }}
+
+{{ if video?.src }}
+
+{{ /if }}
\ No newline at end of file
diff --git a/website/docs/routes/traditional-media.mdx b/website/docs/routes/traditional-media.mdx
index d32a0ee8b6f886..fdf69f7e91cd7d 100644
--- a/website/docs/routes/traditional-media.mdx
+++ b/website/docs/routes/traditional-media.mdx
@@ -1542,7 +1542,7 @@ IT・科学 tech_science
### 农博士在行动 {#he-bei-wang-luo-guang-bo-dian-shi-tai-nong-bo-shi-zai-xing-dong}
-
+
## 衡阳全搜索 {#heng-yang-quan-sou-suo}