diff --git a/docs/social-media.md b/docs/social-media.md
index a33af792e..d86729714 100644
--- a/docs/social-media.md
+++ b/docs/social-media.md
@@ -809,7 +809,7 @@ YouTube 官方亦有提供频道 RSS,形如
+
### 浏览发现分栏目
diff --git a/lib/v2/douban/other/explore.js b/lib/v2/douban/other/explore.js
index fa56b2faf..d4e6a1d7e 100644
--- a/lib/v2/douban/other/explore.js
+++ b/lib/v2/douban/other/explore.js
@@ -1,5 +1,7 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
+const { art } = require('@/utils/render');
+const path = require('path');
module.exports = async (ctx) => {
const response = await got({
@@ -10,8 +12,7 @@ module.exports = async (ctx) => {
const data = response.data;
const $ = cheerio.load(data);
- const list = $('div[data-item_id]');
- let itemPicUrl;
+ const list = $('div.item');
ctx.state.data = {
title: '豆瓣-浏览发现',
@@ -19,13 +20,29 @@ module.exports = async (ctx) => {
item:
list &&
list
- .map((index, item) => {
+ .map((_, item) => {
item = $(item);
- itemPicUrl = item.find('a.cover').attr('style').replace('background-image:url(', '').replace(')', '');
+
+ const title = item.find('.title a').first().text() ? item.find('.title a').first().text() : '#' + item.find('.icon-topic').text();
+ const desc = item.find('.content p').text();
+ const itemPic = item.find('a.cover').attr('style')
+ ? item
+ .find('a.cover')
+ .attr('style')
+ .match(/\('(.*?)'\)/)[1]
+ : '';
+ const author = item.find('.usr-pic a').last().text();
+ const link = item.find('.title a').attr('href') ?? item.find('.icon-topic a').attr('href');
+
return {
- title: item.find('.title a').first().text(),
- description: `作者:${item.find('.usr-pic a').last().text()}
描述:${item.find('.content p').text()}
`,
- link: item.find('.title a').attr('href'),
+ title,
+ author,
+ description: art(path.join(__dirname, '../templates/explore.art'), {
+ author,
+ desc,
+ itemPic,
+ }),
+ link,
};
})
.get(),
diff --git a/lib/v2/douban/templates/explore.art b/lib/v2/douban/templates/explore.art
new file mode 100644
index 000000000..13d5b89c6
--- /dev/null
+++ b/lib/v2/douban/templates/explore.art
@@ -0,0 +1,7 @@
+作者:{{author}}
+
+描述:{{desc}}
+
+{{ if itemPic }}
+
+{{ /if }}