Skip to content

Commit

Permalink
implement arxiv adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
wizicer committed May 22, 2024
1 parent 487e1f8 commit 866dcb0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/config/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ export const defaultConfig = {
'juejin',
'mp.weixin.qq',
'followin',
'arxiv',
],
accessToken: '',
tokenSavedOn: 0,
Expand Down Expand Up @@ -330,6 +331,7 @@ export const defaultConfig = {
'juejin',
'mp.weixin.qq',
'followin',
'arxiv',
],
}

Expand Down
19 changes: 18 additions & 1 deletion src/content-script/site-adapters/arxiv/index.mjs
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
//TODO
import { cropText } from '../../../utils'

export default {
inputQuery: async () => {
try {
const title = document.querySelector('.title')?.textContent.trim()
const authors = document.querySelector('.authors')?.textContent
const abstract = document.querySelector('blockquote.abstract')?.textContent.trim()

return await cropText(
`Below is the paper abstract from a preprint site, summarize the key findings, methodology, and conclusions, especially highlight the contributions.` +
`${title}\n${authors}\n${abstract}`,
)
} catch (e) {
console.log(e)
}
},
}
7 changes: 7 additions & 0 deletions src/content-script/site-adapters/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import weixin from './weixin'
import followin from './followin'
import duckduckgo from './duckduckgo'
import brave from './brave'
import arxiv from './arxiv'

/**
* @typedef {object} SiteConfigAction
Expand Down Expand Up @@ -208,4 +209,10 @@ export const config = {
appendContainerQuery: [],
resultsContainerQuery: ['#article-content', '#thead-gallery'],
},
arxiv: {
inputQuery: arxiv.inputQuery,
sidebarContainerQuery: ['.extra-services'],
appendContainerQuery: [],
resultsContainerQuery: ['.extra-services'],
},
}

0 comments on commit 866dcb0

Please sign in to comment.