# 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/` 拷进来。