diff --git a/docs/blog.md b/docs/blog.md
index cbc4d2d1e..95ddd68a0 100644
--- a/docs/blog.md
+++ b/docs/blog.md
@@ -520,3 +520,7 @@ Tag 有很多,可从首页点进 Tag 以后的 URL 获取,例如 `https://me
:::
+
+### TOP 20
+
+
\ No newline at end of file
diff --git a/lib/v2/zhubai/maintainer.js b/lib/v2/zhubai/maintainer.js
index 151d9b468..851ae1036 100644
--- a/lib/v2/zhubai/maintainer.js
+++ b/lib/v2/zhubai/maintainer.js
@@ -1,3 +1,4 @@
module.exports = {
+ '/top20': ['nczitzk'],
'/:id': ['naixy28'],
};
diff --git a/lib/v2/zhubai/radar.js b/lib/v2/zhubai/radar.js
index 45d13c4d7..3ae60c7af 100644
--- a/lib/v2/zhubai/radar.js
+++ b/lib/v2/zhubai/radar.js
@@ -8,5 +8,12 @@ module.exports = {
source: ['/'],
},
],
+ analy: [
+ {
+ title: 'TOP 20',
+ docs: 'https://docs.rsshub.app/blog.html#zhu-bai',
+ source: ['/'],
+ },
+ ],
},
};
diff --git a/lib/v2/zhubai/router.js b/lib/v2/zhubai/router.js
index 641c23df3..81002f5c8 100644
--- a/lib/v2/zhubai/router.js
+++ b/lib/v2/zhubai/router.js
@@ -1,3 +1,4 @@
module.exports = function (router) {
+ router.get('/top20', require('./top20'));
router.get('/:id', require('./index'));
};
diff --git a/lib/v2/zhubai/templates/description.art b/lib/v2/zhubai/templates/description.art
new file mode 100644
index 000000000..a503cee21
--- /dev/null
+++ b/lib/v2/zhubai/templates/description.art
@@ -0,0 +1,31 @@
+{{ each content c }}
+ {{ if c.text }}
+ {{ c.text }}
+ {{ else if c.type === 'paragraph' }}
+
{{@ c.children | parseContent }}
+ {{ else if c.type === 'link' }}
+ {{@ c.children | parseContent }}
+ {{ else if c.type === 'image' }}
+
+ {{ else if c.type === 'list-item' }}
+ {{@ c.children | parseContent }}
+ {{ else if c.type === 'bulleted-list' }}
+ {{@ c.children | parseContent }}
+ {{ else if c.type === 'numbered-list' }}
+ {{@ c.children | parseContent }}
+ {{ else if c.type === 'block-quote' }}
+ {{@ c.children | parseContent }}
+ {{ else if c.type === 'heading-one' }}
+ {{@ c.children | parseContent }}
+ {{ else if c.type === 'heading-two' }}
+ {{@ c.children | parseContent }}
+ {{ else if c.type === 'heading-three' }}
+ {{@ c.children | parseContent }}
+ {{ else if c.type === 'heading-four' }}
+ {{@ c.children | parseContent }}
+ {{ else if c.type === 'heading-five' }}
+ {{@ c.children | parseContent }}
+ {{ else if c.type === 'heading-six' }}
+ {{@ c.children | parseContent }}
+ {{ /if }}
+{{ /each }}
\ No newline at end of file
diff --git a/lib/v2/zhubai/top20.js b/lib/v2/zhubai/top20.js
new file mode 100644
index 000000000..34d7a5c3d
--- /dev/null
+++ b/lib/v2/zhubai/top20.js
@@ -0,0 +1,57 @@
+const got = require('@/utils/got');
+const { parseDate } = require('@/utils/parse-date');
+const { art } = require('@/utils/render');
+const path = require('path');
+
+const parseContent = (content) =>
+ art(path.join(__dirname, 'templates/description.art'), {
+ content,
+ });
+
+art.defaults.imports.parseContent = parseContent;
+
+module.exports = async (ctx) => {
+ const limit = ctx.query.limit ? parseInt(ctx.query.limit) : 20;
+
+ const rootUrl = 'https://analy.zhubai.wiki';
+ const apiRootUrl = 'https://open.zhubai.wiki';
+ const apiUrl = `${apiRootUrl}/a/zb/s/ht/pl/wk`;
+
+ const response = await got({
+ method: 'post',
+ url: apiUrl,
+ });
+
+ let items = response.data.data.slice(0, limit).map((item) => ({
+ link: item.fp ?? item.pq ?? item.pu,
+ }));
+
+ items = await Promise.all(
+ items.map((item) =>
+ ctx.cache.tryGet(item.link, async () => {
+ const matches = item.link.match(/\/(fp|pq|pu)\/([\w-]+)\/(\d+)/);
+
+ const detailResponse = await got({
+ method: 'get',
+ url: `https://${matches[2]}.zhubai.love/api/posts/${matches[3]}`,
+ });
+
+ const data = detailResponse.data;
+
+ item.title = data.title;
+ item.author = data.author.name;
+ item.pubDate = parseDate(data.created_at);
+ item.description = parseContent(JSON.parse(data.content));
+ item.link = `https://${matches[2]}.zhubai.love/posts/${matches[3]}`;
+
+ return item;
+ })
+ )
+ );
+
+ ctx.state.data = {
+ title: '竹白 - TOP20',
+ link: rootUrl,
+ item: items,
+ };
+};