Files
陈世睿 917613c5ce 初始化 dish-image-toolkit:菜品图爬虫 + 图片名称检索平台
- crawler/:豆果(主)/下厨房/Bing 爬虫 + dishes.jsonl(3056 菜→9167 图映射)+ verify_repair 按 URL 重下
- retrieval/:三路检索(BM25 + 本地 BGE-M3 向量 + RRF 融合),FastAPI + 前端;
  写死图片目录(默认 crawler/images,可 IMAGE_DIR 覆盖)、绑 0.0.0.0 局域网访问、
  启动自动建索引、服务器 serve 图片
- 图片(1.7G)与向量模型(2.3G)不进 git

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 10:27:51 +08:00

24 lines
1.4 KiB
Markdown

# crawler — 菜品图爬虫
给菜名爬多图,记录"菜→哪些图"到 `dishes.jsonl`
## 源(优先级从高到低)
- **`scrape_douguo.py` — 豆果 App 接口(最终采用,质量最好)**:`POST api.douguo.net/recipe/search`,960px 高清,无需签名。⚠ 图床 `i1.douguo.com` 有防盗链(下约 1100 张后返 HTTP 493),脚本已自动改走镜像 `i1.douguo.net`(http)。
- `scrape_xiachufang.py` — 下厨房(菜谱真实图,质量好;但搜索接口硬限速,备用)。
- `scrape_bing.py` — Bing 图搜(通用图搜,质量差、很多不是菜品,已弃用)。
## 用法
```
python scrape_douguo.py --input 菜名.txt --out dishes.jsonl --download --per-dish 3 --workers 8 --replace
```
- 图片 → `images/<菜名>_NN.jpg`;映射 → `dishes.jsonl`,每行:
`{dish, found, count, images:[{image_url, image_file, ...}], ...}`
- **断点续爬**:只跳 `found:true` 的菜,失败的会重试。菜名也可直接作命令行参数传。
## 工具
- `verify_repair.py [--repair]` — 校验 `dishes.jsonl``image_file` 的完好率;`--repair``image_url` 重下缺失/损坏图(应对杀软定期清图)。
- `probe_status.py` — 统计 `dishes.jsonl` 的成功/失败数。
## 现状
`dishes.jsonl` 已含 **3056 道**(下厨房 974 + 豆果 2082),对应 **9167 张图**。图不在 git 里 —— `--download` 重爬,或把已有 `images/` 拷进来。