用codex浏览器自动化功能,自动抓取亚马逊特定搜索词的竞品差评,用户可以输入搜索词、采集商品数量、差评数量,这个skill会自动跑脚本进行采集并输出excel表格
成果
---
name: amazon-review-excel-scraper
description: Collect Amazon product reviews from Amazon search results or ASIN lists and export them to a fixed Excel workbook. Use when the user asks to scrape Amazon reviews, collect reviews for Amazon search keywords such as "wireless charger", gather the first N products and first M reviews, or create an Excel file with ASIN-wide review columns.
---
# Amazon Review Excel Scraper
## Overview
Use this skill to collect Amazon product reviews through the browser and create a standardized wide Excel workbook. The default task shape is: search Amazon for a keyword, take the first 20 products, collect up to 10 visible reviews per ASIN, and export one row per ASIN.
## Safety And Access
- Use the browser the user requested. If they mention the in-app browser UI mention, use the in-app Browser skill.
- Do not bypass CAPTCHA, login walls, account verification, paywalls, or Amazon safety interstitials.
- If Amazon requires login to view reviews, ask the user to sign in in the selected browser, then continue after they confirm.
- If Amazon displays a limited review selection or a "send a request" link, do not send the request on the user's behalf. Export the visible reviews and note the limitation if reporting back.
- Do not perform side-effect actions such as marking reviews helpful, reporting reviews, changing account settings, adding to cart, or purchasing.
## Collection Workflow
1. Determine inputs:
- Search keyword, default from the user request.
- Product count, default `20`.
- Reviews per ASIN, default `10`.
- Sort order, default Amazon's helpful/top review order via `sortBy=helpful`.
2. Open Amazon search:
- Use `https://www.amazon.com/s?k=<encoded query>`.
- Extract product cards with `data-component-type="s-search-result"` and `data-asin`.
- Preserve visible search order, including sponsored cards unless the user asks to exclude them.
- Store at minimum: `asin`, `productTitle`, `productUrl`, `searchRank`.
3. For each ASIN, open review pages:
- Use `https://www.amazon.com/product-reviews/<ASIN>/?ie=UTF8&reviewerType=all_reviews&sortBy=helpful&filterByStar=all_stars&pageNumber=1`.
- Read visible review cards from `[data-hook="review"]` and `div[id^="customer_review-"]`.
- Deduplicate cards by review ID after removing the `customer_review-` prefix.
- Extract for each review:
- `reviewer`
- `productRating`: the star rating for that review, e.g. `5.0`
- `reviewBody`
- `reviewDate`
- `reviewId` when available
- `sourceUrl`
- Continue to additional pages only when Amazon exposes real pagination or visible additional reviews. Stop when the requested review count is reached or no more reviews are visible.
4. Save a JSON payload containing `products` and `reviews`, then run the workbook script.
## Required Excel Format
Create one worksheet named `Amazon Reviews` in wide format:
- One row per ASIN.
- First columns:
- `ASIN`
- `product title`
- Repeat review columns up to the requested review count:
- `reviewer 1`
- `product rating 1`
- `review body 1`
- `review date 1`
- `reviewer 2`
- `product rating 2`
- `review body 2`
- `review date 2`
- and so on
- Final column:
- `product url`
The canonical user-facing fields are: `ASIN`, `product title`, `reviewer`, `product rating`, `review body`, `review date`, `product url`. Because an ASIN can have multiple reviews, repeat the review-specific fields horizontally.
## JSON Shape For The Script
The script accepts either of these common field variants and normalizes them:
```json
{
"products": [
{
"asin": "B07YBV3P8W",
"productTitle": "Product title",
"title": "Product title",
"productUrl": "https://www.amazon.com/dp/B07YBV3P8W",
"url": "https://www.amazon.com/dp/B07YBV3P8W"
}
],
"reviews": [
{
"asin": "B07YBV3P8W",
"reviewer": "Reviewer name",
"reviewerName": "Reviewer name",
"productRating": 5,
"reviewRating": 5,
"reviewBody": "Review text",
"reviewDate": "Reviewed in the United States on July 4, 2026",
"reviewDateRaw": "Reviewed in the United States on July 4, 2026"
}
]
}
```
## Workbook Script
Use `scripts/build_reviews_wide_workbook.mjs` to create the Excel file.
Example:
```powershell
$env:CODEX_NODE_MODULES = "<bundled node_modules path from load_workspace_dependencies>"
node scripts/build_reviews_wide_workbook.mjs --input reviews.json --output amazon_reviews.xlsx --max-reviews 10
```
If using the Spreadsheets skill in Codex, follow its dependency setup and use the bundled Node.js plus bundled `@oai/artifact-tool`. The script can also run from a copied location in the output folder.
## Final Response
Report:
- The generated `.xlsx` path.
- Number of ASINs and visible reviews exported.
- Any access limitation, such as Amazon showing only a limited selection of reviews.