Skip to content

shilong20/getbib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

getbib

低幻觉的学术论文 BibTeX 获取工具。

getbib 通过实际抓取权威来源(DBLP、OpenReview、arXiv、NeurIPS、PMLR、IEEE 等)的引用信息,将论文标题转化为可靠的 BibTeX 条目,而不是让 LLM 凭记忆猜测。

工作原理

  1. 搜索 — 为每篇论文找到最权威的发表链接。默认由 AI agent 使用自带的搜索工具完成;也可以配置 Grok / OpenAI 兼容的搜索 API 实现全自动搜索。
  2. 提取 — Playwright 驱动的浏览器访问推荐链接,从页面或元数据中提取 BibTeX。
  3. 输出 — 生成最终 BibTeX 文件(playwright_route.bib),使用搜索 API 时还会生成可审阅的链接文档(bib_link_candidates.md)。

环境要求

  • Python ≥ 3.10
  • Node.js ≥ 18

安装

git clone https://github.com/YOUR_USERNAME/getbib.git
cd getbib

Playwright 浏览器会在首次运行时自动安装。如需手动安装:

cd scripts/.playwright_runtime
npm install
npx playwright install chromium

可选:配置搜索 API

默认情况下,getbib 需要 AI agent(或用户)提供论文的发表链接。如需通过 Grok API 或其他 OpenAI 兼容端点实现全自动搜索:

cp config.example.json config.json
# 编辑 config.json — 填入 base_url 和 api_key

base_url 字段支持任意 OpenAI 兼容端点,不限于 Grok。

使用方法

提供预搜索链接(默认,无需 API key)

通过链接 JSON 文件直接提供发表 URL。作为 agent skill 使用时,agent 会用自带搜索工具找到链接:

cat > links.json << 'EOF'
[
  {"title": "Attention Is All You Need", "url": "https://dblp.org/rec/conf/nips/VaswaniSPUJGKP17.html"}
]
EOF

python3 scripts/getbib.py --title "Attention Is All You Need" --links-json links.json

使用搜索 API(需要 config.json)

配置好 config.json 后,getbib 会自动搜索链接:

python3 scripts/getbib.py --title "Attention Is All You Need"

带作者提示:

python3 scripts/getbib.py --title "Attention Is All You Need" --author "Vaswani"

多篇论文

python3 scripts/getbib.py \
  --title "Attention Is All You Need" \
  --title "BERT: Pre-training of Deep Bidirectional Transformers" \
  --links-json links.json

批量处理

python3 scripts/getbib.py --input papers.csv [--links-json links.json]

支持格式:csvtsvjsonjsonltxt(每行一个标题,或 标题<TAB>作者)。

参数说明

参数 说明
--output-dir <dir> 输出目录(默认:./getbib-output-<时间戳>
--mode links 仅生成可审阅的链接文档
--mode both 同时生成链接文档和 BibTeX(默认)
--links-json <file> 使用预搜索链接 JSON,跳过搜索 API
--keep-cache 保留中间 JSON 缓存

输出文件

文件 说明
playwright_route.bib 通过浏览器提取的 BibTeX 条目
bib_link_candidates.md 推荐链接及选择理由
.cache/grok_bib_links/*.json 原始搜索结果
.cache/playwright_results.json 逐篇提取结果
summary.json 运行摘要

作为 Agent Skill 使用

本项目可以作为 Cursor agent skill 使用。将整个目录复制到 ~/.agents/skills/getbib/,AI agent 会在你请求 BibTeX 引用时自动调用它。

支持的来源

来源 提取策略
DBLP 从条目 URL 获取 .bib
OpenReview API note + _bibtex,修复标题不一致
arXiv 页面元数据
NeurIPS / PMLR 页面内 BibTeX 区块
AMS 页面元数据提取 DOI → DOI BibTeX
IEEE 页面元数据提取 DOI → DOI BibTeX
doi.org 直接内容协商
GitHub 从 README 提取 @misc 或自动生成

许可证

MIT

About

一个让agent无幻觉获取bib的skill

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages