Skip to content

Commit ec0cd7c

Browse files
committed
update juejin Support
1 parent bd6ede9 commit ec0cd7c

File tree

1 file changed

+5
-13
lines changed
  • src/content-script/site-adapters/juejin

1 file changed

+5
-13
lines changed

src/content-script/site-adapters/juejin/index.mjs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,14 @@ import { cropText } from '../../../utils'
33
export default {
44
inputQuery: async () => {
55
try {
6-
const title = document.querySelector(
7-
'#juejin > div.view-container > main > div > div.main-area.article-area > article > h1',
8-
)?.textContent
9-
const description = document.querySelector(
10-
'#juejin > div.view-container > main > div > div.main-area.article-area > article > div.article-content',
11-
)?.textContent
6+
const title = document.querySelector('#juejin .article-title')?.innerText
7+
const description = document.querySelector('#juejin #article-root')?.innerText
128
if (title && description) {
13-
const author = document.querySelector(
14-
'#juejin > div.view-container > main > div > div.main-area.article-area > article > div.author-info-block > div > div.author-name > a > span.name',
15-
)?.textContent
16-
const comments = document.querySelectorAll(
17-
'div.content-box > div.comment-main > div.content',
18-
)
9+
const author = document.querySelector('#juejin .author-block .info-box span')?.innerText
10+
const comments = document.querySelectorAll('.comment-list .comment-content')
1911
let comment = ''
2012
for (let i = 1; i <= comments.length && i <= 4; i++) {
21-
comment += `answer${i}: ${comment[i - 1].textContent}|`
13+
comment += `answer${i}: ${comment[i - 1].innerText}|`
2214
}
2315
return await cropText(
2416
`You are an expert content analyst and summarizer. ` +

0 commit comments

Comments
 (0)