# 示例：批量采集并可选写飞书

完整脚本：[amazon-product-batch-collector.user.js](https://github.com/omococola/script/blob/main/examples/amazon-product-batch-collector.user.js)

## 工作方式

该 `offscreen` 脚本接收一个必填 ASIN。插件精灵的批量任务把多行 ASIN 展开为多次调用；脚本通过 `SellerFeeds.fetch` 请求 Amazon 美国站详情页，用与页面示例相同的解析器处理 HTML。

遇到 HTTP 失败、Robot Check、ASIN 不一致或标题缺失时任务明确失败。价格缺失可以作为 `null` 返回。仅当 本次飞书参数组填写完整时，脚本调用飞书 `batch_create` 追加一行；关闭写入时不读取飞书配置。

## 复现验证

```bash
pnpm run verify:userscript -- examples/amazon-product-batch-collector.user.js
node --test tests/amazon-product-detail.test.mjs tests/offscreen-runtime.test.mjs
```

真实批量访问可能遇到地区、登录、限流或挑战页。首次验收应使用少量自有测试 ASIN，保留失败页面证据，不应承诺任意 ASIN 都能立即采集。
