Skip to content

Commit fb6b088

Browse files
wizicerjosStorer
authored andcommitted
implement arxiv adapter
1 parent 487e1f8 commit fb6b088

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

src/config/index.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ export const defaultConfig = {
279279
'juejin',
280280
'mp.weixin.qq',
281281
'followin',
282+
'arxiv',
282283
],
283284
accessToken: '',
284285
tokenSavedOn: 0,
@@ -330,6 +331,7 @@ export const defaultConfig = {
330331
'juejin',
331332
'mp.weixin.qq',
332333
'followin',
334+
'arxiv',
333335
],
334336
}
335337

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
//TODO
1+
import { cropText } from '../../../utils'
2+
3+
export default {
4+
inputQuery: async () => {
5+
try {
6+
const title = document.querySelector('.title')?.textContent.trim()
7+
const authors = document.querySelector('.authors')?.textContent
8+
const abstract = document.querySelector('blockquote.abstract')?.textContent.trim()
9+
10+
return await cropText(
11+
`Below is the paper abstract from a preprint site, summarize the key findings, methodology, and conclusions, especially highlight the contributions.` +
12+
`${title}\n${authors}\n${abstract}`,
13+
)
14+
} catch (e) {
15+
console.log(e)
16+
}
17+
},
18+
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import weixin from './weixin'
1212
import followin from './followin'
1313
import duckduckgo from './duckduckgo'
1414
import brave from './brave'
15+
import arxiv from './arxiv'
1516

1617
/**
1718
* @typedef {object} SiteConfigAction
@@ -208,4 +209,10 @@ export const config = {
208209
appendContainerQuery: [],
209210
resultsContainerQuery: ['#article-content', '#thead-gallery'],
210211
},
212+
arxiv: {
213+
inputQuery: arxiv.inputQuery,
214+
sidebarContainerQuery: ['.extra-services'],
215+
appendContainerQuery: [],
216+
resultsContainerQuery: ['.extra-services'],
217+
},
211218
}

0 commit comments

Comments
 (0)