跳到主要內容

Arxiv

使用 arXiv 的免費 REST API 搜索和檢索學術論文。無需 API 密鑰。支持按關鍵詞、作者、類別或 ID 進行搜索。可與 web_extractocr-and-documents 技能結合使用以閱讀完整的論文內容。

技能元數據

來源捆綁(默認安裝)
路徑skills/research/arxiv
版本1.0.0
作者Hermes Agent
許可證MIT
標籤Research, Arxiv, Papers, Academic, Science, API
相關技能ocr-and-documents

參考:完整 SKILL.md

信息

以下是 Hermes 在觸發此技能時加載的完整技能定義。這是技能激活時代理所看到的指令。

arXiv 研究

通過 arXiv 的免費 REST API 搜索和檢索學術論文。無需 API 密鑰,無依賴項——只需 curl。

快速參考

操作命令
搜索論文curl "https://export.arxiv.org/api/query?search_query=all:QUERY&max_results=5"
獲取特定論文curl "https://export.arxiv.org/api/query?id_list=2402.03300"
閱讀摘要(網頁)web_extract(urls=["https://arxiv.org/abs/2402.03300"])
閱讀完整論文(PDF)web_extract(urls=["https://arxiv.org/pdf/2402.03300"])

搜索論文

API 返回 Atom XML。使用 grep/sed 解析,或通過管道傳遞給 python3 以獲得清晰的輸出。

curl -s "https://export.arxiv.org/api/query?search_query=all:GRPO+reinforcement+learning&max_results=5"

清晰輸出(將 XML 解析為可讀格式)

curl -s "https://export.arxiv.org/api/query?search_query=all:GRPO+reinforcement+learning&max_results=5&sortBy=submittedDate&sortOrder=descending" | python3 -c "
import sys, xml.etree.ElementTree as ET
ns = {'a': 'http://www.w3.org/2005/Atom'}
root = ET.parse(sys.stdin).getroot()
for i, entry in enumerate(root.findall('a:entry', ns)):
title = entry.find('a:title', ns).text.strip().replace('\n', ' ')
arxiv_id = entry.find('a:id', ns).text.strip().split('/abs/')[-1]
published = entry.find('a:published', ns).text[:10]
authors = ', '.join(a.find('a:name', ns).text for a in entry.findall('a:author', ns))
summary = entry.find('a:summary', ns).text.strip()[:200]
cats = ', '.join(c.get('term') for c in entry.findall('a:category', ns))
print(f'{i+1}. [{arxiv_id}] {title}')
print(f' Authors: {authors}')
print(f' Published: {published} | Categories: {cats}')
print(f' Abstract: {summary}...')
print(f' PDF: https://arxiv.org/pdf/{arxiv_id}')
print()
"

搜索查詢語法

前綴搜索範圍示例
all:所有字段all:transformer+attention
ti:標題ti:large+language+models
au:作者au:vaswani
abs:摘要abs:reinforcement+learning
cat:類別cat:cs.AI
co:評論co:accepted+NeurIPS

布爾運算符

# AND (default when using +)
search_query=all:transformer+attention

# OR
search_query=all:GPT+OR+all:BERT

# AND NOT
search_query=all:language+model+ANDNOT+all:vision

# Exact phrase
search_query=ti:"chain+of+thought"

# Combined
search_query=au:hinton+AND+cat:cs.LG

排序與分頁

參數選項
sortByrelevance, lastUpdatedDate, submittedDate
sortOrderascending, descending
start結果偏移量(從 0 開始)
max_results結果數量(默認 10,最大 30000)
# Latest 10 papers in cs.AI
curl -s "https://export.arxiv.org/api/query?search_query=cat:cs.AI&sortBy=submittedDate&sortOrder=descending&max_results=10"

獲取特定論文

# By arXiv ID
curl -s "https://export.arxiv.org/api/query?id_list=2402.03300"

# Multiple papers
curl -s "https://export.arxiv.org/api/query?id_list=2402.03300,2401.12345,2403.00001"

BibTeX 生成

獲取論文的元數據後,生成 BibTeX 條目:

{% raw %}

curl -s "https://export.arxiv.org/api/query?id_list=1706.03762" | python3 -c "
import sys, xml.etree.ElementTree as ET
ns = {'a': 'http://www.w3.org/2005/Atom', 'arxiv': 'http://arxiv.org/schemas/atom'}
root = ET.parse(sys.stdin).getroot()
entry = root.find('a:entry', ns)
if entry is None: sys.exit('Paper not found')
title = entry.find('a:title', ns).text.strip().replace('\n', ' ')
authors = ' and '.join(a.find('a:name', ns).text for a in entry.findall('a:author', ns))
year = entry.find('a:published', ns).text[:4]
raw_id = entry.find('a:id', ns).text.strip().split('/abs/')[-1]
cat = entry.find('arxiv:primary_category', ns)
primary = cat.get('term') if cat is not None else 'cs.LG'
last_name = entry.find('a:author', ns).find('a:name', ns).text.split()[-1]
print(f'@article{{{last_name}{year}_{raw_id.replace(\".\", \"\")},')
print(f' title = {{{title}}},')
print(f' author = {{{authors}}},')
print(f' year = {{{year}}},')
print(f' eprint = {{{raw_id}}},')
print(f' archivePrefix = {{arXiv}},')
print(f' primaryClass = {{{primary}}},')
print(f' url = {{https://arxiv.org/abs/{raw_id}}}')
print('}')
"

{% endraw %}

閱讀論文內容

找到論文後,閱讀其內容:

# Abstract page (fast, metadata + abstract)
web_extract(urls=["https://arxiv.org/abs/2402.03300"])

# Full paper (PDF → markdown via Firecrawl)
web_extract(urls=["https://arxiv.org/pdf/2402.03300"])

對於本地 PDF 處理,請參閱 ocr-and-documents 技能。

常見類別

類別領域
cs.AI人工智能
cs.CL計算與語言(NLP)
cs.CV計算機視覺
cs.LG機器學習
cs.CR密碼學與安全
stat.ML機器學習(統計學)
math.OC優化與控制
physics.comp-ph計算物理學

完整列表:https://arxiv.org/category_taxonomy

輔助腳本

scripts/search_arxiv.py 腳本處理 XML 解析並提供清晰的輸出:

python scripts/search_arxiv.py "GRPO reinforcement learning"
python scripts/search_arxiv.py "transformer attention" --max 10 --sort date
python scripts/search_arxiv.py --author "Yann LeCun" --max 5
python scripts/search_arxiv.py --category cs.AI --sort date
python scripts/search_arxiv.py --id 2402.03300
python scripts/search_arxiv.py --id 2402.03300,2401.12345

無依賴項——僅使用 Python 標準庫。


arXiv 不提供引用數據或推薦信息。為此請使用 Semantic Scholar API——免費,基本使用無需密鑰(1 次請求/秒),返回 JSON 格式。

獲取論文詳情 + 引用

# By arXiv ID
curl -s "https://api.semanticscholar.org/graph/v1/paper/arXiv:2402.03300?fields=title,authors,citationCount,referenceCount,influentialCitationCount,year,abstract" | python3 -m json.tool

# By Semantic Scholar paper ID or DOI
curl -s "https://api.semanticscholar.org/graph/v1/paper/DOI:10.1234/example?fields=title,citationCount"

獲取某篇論文的引用(誰引用了它)

curl -s "https://api.semanticscholar.org/graph/v1/paper/arXiv:2402.03300/citations?fields=title,authors,year,citationCount&limit=10" | python3 -m json.tool

獲取某篇論文的參考文獻(它引用了什麼)

curl -s "https://api.semanticscholar.org/graph/v1/paper/arXiv:2402.03300/references?fields=title,authors,year,citationCount&limit=10" | python3 -m json.tool

搜索論文(arXiv 搜索的替代方案,返回 JSON)

curl -s "https://api.semanticscholar.org/graph/v1/paper/search?query=GRPO+reinforcement+learning&limit=5&fields=title,authors,year,citationCount,externalIds" | python3 -m json.tool

獲取論文推薦

curl -s -X POST "https://api.semanticscholar.org/recommendations/v1/papers/" \
-H "Content-Type: application/json" \
-d '{"positivePaperIds": ["arXiv:2402.03300"], "negativePaperIds": []}' | python3 -m json.tool

作者檔案

curl -s "https://api.semanticscholar.org/graph/v1/author/search?query=Yann+LeCun&fields=name,hIndex,citationCount,paperCount" | python3 -m json.tool

有用的 Semantic Scholar 字段

title, authors, year, abstract, citationCount, referenceCount, influentialCitationCount, isOpenAccess, openAccessPdf, fieldsOfStudy, publicationVenue, externalIds(包含 arXiv ID、DOI 等)


完整研究工作流

  1. 發現python scripts/search_arxiv.py "your topic" --sort date --max 10
  2. 評估影響力curl -s "https://api.semanticscholar.org/graph/v1/paper/arXiv:ID?fields=citationCount,influentialCitationCount"
  3. 閱讀摘要web_extract(urls=["https://arxiv.org/abs/ID"])
  4. 閱讀完整論文web_extract(urls=["https://arxiv.org/pdf/ID"])
  5. 查找相關工作curl -s "https://api.semanticscholar.org/graph/v1/paper/arXiv:ID/references?fields=title,citationCount&limit=20"
  6. 獲取推薦:POST 請求發送至 Semantic Scholar 推薦端點
  7. 追蹤作者curl -s "https://api.semanticscholar.org/graph/v1/author/search?query=NAME"

速率限制

API速率限制認證
arXiv~1 次請求 / 3 秒無需認證
Semantic Scholar1 次請求 / 秒無(使用 API 密鑰可達 100 次/秒)

注意事項

  • arXiv 返回 Atom XML — 請使用輔助腳本或解析代碼片段以獲得整潔的輸出
  • Semantic Scholar 返回 JSON — 可通過管道傳遞給 python3 -m json.tool 以提高可讀性
  • arXiv ID:舊格式(hep-th/0601001)與新格式(2402.03300
  • PDF:https://arxiv.org/pdf/{id} — 摘要:https://arxiv.org/abs/{id}
  • HTML(如果可用):https://arxiv.org/html/{id}
  • 對於本地 PDF 處理,請參閱 ocr-and-documents 技能

ID 版本控制

  • arxiv.org/abs/1706.03762 始終解析為最新版本
  • arxiv.org/abs/1706.03762v1 指向特定的不可變版本
  • 在生成引用時,請保留你實際閱讀的版本後綴,以防止引用漂移(後續版本可能會大幅更改內容)
  • API 的 <id> 字段返回帶版本號的 URL(例如,http://arxiv.org/abs/1706.03762v7

撤稿論文

論文在提交後可能會被撤稿。發生這種情況時:

  • <summary> 字段包含撤稿通知(查找 "withdrawn" 或 "retracted")
  • 元數據字段可能不完整
  • 在將結果視為有效論文之前,務必檢查摘要