# car_price **Repository Path**: co-code/car_price ## Basic Information - **Project Name**: car_price - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-28 - **Last Updated**: 2026-03-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Car Price Watcher (TS) 从懂车帝接口抓取车辆价格信息。通过 `cars.config.json` 配置要观察的车型与提取规则。 ## 使用 ```bash npm i npm run dev -- --config cars.config.json ``` 运行后会在 `output/` 生成 JSON 文件,并在控制台输出路径。 ## 配置说明 `cars.config.json` 里每个 `target` 对应一个车型页面。 ```json { "id": "autohome-my-car", "site": "dongchedi", "url": "https://www.dongchedi.com/xxx", "api": { "url": "https://www.dongchedi.com/motor/pc/car/series/car_dealer_price", "params": { "aid": 1839, "app_name": "auto_web_pc", "car_ids": 252605, "city_name": "洛阳" } }, "rules": { "fields": { "车辆名称": { "jsonPath": "data.252605.car_name" }, "指导价": { "jsonPath": "data.252605.official_price" }, "经销商报价": { "jsonPath": "data.252605.dealer_price" }, "最高降幅": { "jsonPath": "data.252605.cut_price" } } } } ``` 说明: - `rules.fields` 用于提取接口字段,仅支持 `jsonPath` - 字段名可自定义 - `api.params.city_name` 是 URL 编码城市名 - `request` 可设置 Cookie、Header、代理等(反爬场景常用) `jsonPath` 用点号路径访问字段,例如 `data.252605.dealer_price`。 ## 重要提示 接口返回结构可能会变化。若某字段为空,说明接口未返回该字段或 JSONPath 不匹配。 页面价格仅供参考,实际成交价以到店为准。 如果需要更稳定的方案,可以改成抓取其公开接口或通过浏览器自动化(Playwright)渲染后抽取。