Skip to content

Commit 7f6e054

Browse files
committed
feat: extract article description
1 parent a28db6d commit 7f6e054

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

content-perplexity.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ async function extract() {
9191
console.log('📌 主标题:', mainTitle);
9292
let md = `# ${mainTitle}\n\n`;
9393

94+
// 获取描述
95+
const descXPath = '//*[@id="__next"]/main/div[1]/div/div[2]/div/div[1]/div[4]/div/div/div[1]/div[2]/div/div[2]/div[1]/div/div[2]';
96+
const descEl = getElementByXPath(descXPath);
97+
if (descEl) {
98+
const description = processContent(descEl);
99+
console.log('📝 文章描述:', description);
100+
if (description) {
101+
md += `> ${description}\n\n`;
102+
}
103+
}
104+
94105
// 获取大图
95106
const imgXPath = '//*[@id="__next"]/main/div[1]/div/div[2]/div/div[1]/div[4]/div/div/div[1]/div[2]/div/div[2]/div[2]/div/div/div/div/div/div/div/div[1]/div/div/div/img';
96107
const img = getElementByXPath(imgXPath);

0 commit comments

Comments
 (0)