Skip to content

Icarus603/econ-atlas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Econ Atlas

顶刊文献的本地地图 — 自动爬取、机器翻译、终端阅读


覆盖 AER、JPE、QJE 等 39 本顶刊,每周四自动爬取最新文章,用 DeepSeek 并行翻译摘要,结果存为本地 JSON,随时用终端 TUI 浏览。

Econ Atlas TUI demo

快速开始

# 克隆并安装
git clone https://github.com/Icarus603/econ-atlas.git
cd econ-atlas
make setup          # uv sync + Playwright Chromium

# 配置 API 密钥(至少填 DEEPSEEK_API_KEY)
cp crawler/.env.example crawler/.env
vim crawler/.env

# 首次爬取
make crawl

# 安装 TUI 到 PATH(之后任意目录可用)
make install-tui

安装完成后,在任意目录运行:

econatlas

配置

crawler/.env 中填写:

变量 是否必填 说明
DEEPSEEK_API_KEY 推荐 摘要中文翻译,缺失则跳过
ELSEVIER_API_KEY 可选 ScienceDirect 增强摘要
BROWSER_CHANNEL 受保护站点必填 chrome,Playwright 使用
BROWSER_USER_DATA_DIR 推荐 持久化 profile,绕过 Cloudflare
OXFORD_COOKIES 按需 各来源登录态 cookie

CLI 用法

# 全量爬取(8 线程并行翻译,默认断点续跑)
make crawl

# 按来源爬取
uv run econ-atlas crawl publisher oxford

# 仅爬单刊
uv run econ-atlas crawl --include-slug nber

# 跳过翻译(只抓元数据)
uv run econ-atlas crawl --skip-translation

TUI 快捷键

按键 动作
j / k 上下选择
h / l← → 切换面板
/ 文章搜索
Tab 切换中文 / 英文摘要
o 在浏览器中打开原文链接
q 退出

自动定时爬取(macOS)

# 安装 launchd 定时任务(每周四 09:00 自动运行)
./launchd/install.sh

# 查看日志
tail -f ~/Library/Logs/econatlas-crawl.out.log

# 卸载
./launchd/uninstall.sh

launchd 在机器睡眠时不会启动任务。如果周四早上通常合盖,建议调整到惯常开机的时段。

目录结构

econ-atlas/
├── list.csv              期刊注册表(slug、source_type、RSS 链接)
├── data/                 爬取产物(每刊一个 JSON)
├── crawler/
│   ├── .env              API 密钥和浏览器配置
│   ├── .cache/           断点续跑进度 & 浏览器 profile
│   └── econatlas/
│       ├── crawlers/     各发布商爬虫(CNKI / Oxford / Wiley / Chicago …)
│       ├── enrichers/    摘要增强(ScienceDirect / Oxford / CNKI / NBER)
│       ├── translation/  DeepSeek 并行翻译(8 并发)
│       ├── storage/      JSON 持久化
│       ├── browser/      Playwright 基础设施
│       └── cli/          命令行入口 & 爬取编排
└── tui/                  终端 UI(TypeScript + Ink)

开发

make lint       # ruff check . --fix
make typecheck  # pyright .
make test       # pytest -q
make tui        # 开发模式启动 TUI(不需安装)
make install-tui  # 编译并安装 econatlas 到 ~/.local/bin

常见问题

翻译没有生效 — 检查 crawler/.env 中是否有 DEEPSEEK_API_KEY,以及未传 --skip-translation

ScienceDirect 摘要为空 — 需要 ELSEVIER_API_KEY,部分刊物须在机构网络内访问。

Playwright 爬虫报错 — 设置 BROWSER_CHANNEL=chrome 并用真实 Chrome profile(BROWSER_USER_DATA_DIR),在 headful 模式下手动完成一次登录后再切回 headless。

About

经管类顶刊文献爬虫自动化

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors