Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .agents/skills/scrapingbee-cli/reference/amazon/product.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ scrapingbee amazon-product --output-file product.json B0DPDRNSXV --domain com
| `--language` | string | e.g. en_US, es_US, fr_FR. |
| `--currency` | string | USD, EUR, GBP, etc. |
| `--add-html` | true/false | Include full HTML. |
| `--autoselect-variant` | true/false | Auto-select the default/most-popular variant (undocumented API param, verified accepted). |
| `--light-request` | true/false | Light request. |
| `--screenshot` | true/false | Take screenshot. |
| `--tag` | string | Optional label included in API response headers. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ scrapingbee google --output-file serp.json "pizza new york" --country-code us
| `--device` | string | `desktop` or `mobile`. |
| `--page` | int | Page number (default 1). |
| `--pages` | int | Consecutive pages to fetch starting at `--page` (default 1, max 10; 3 or fewer recommended). Combined into one response; cost is per fetched page. |
| `--nb-results` | int | Requested results per page (undocumented API param, verified accepted; Google may return more or fewer). |
| `--language` | string | Language code (e.g. en, fr, de). |
| `--date-range` | string | `past-hour`, `past-day`, `past-week`, `past-month`, `past-year`. Restrict results by recency. |
| `--nfpr` | true/false | Disable autocorrection. |
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/scrapingbee-cli/reference/scrape/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Blocked? See [reference/proxy/strategies.md](reference/proxy/strategies.md).
|-----------|------|-------------|
| `--device` | desktop \| mobile | Device type (CLI validates). |
| `--timeout` | int | Timeout ms (1000–140000). Scrape job timeout on ScrapingBee. The CLI sets the HTTP client (aiohttp) timeout to this value in seconds plus 30 s (for send/receive) so the client does not give up before the API responds. |
| `--custom-google` / `--transparent-status-code` | — | Google (15 credits), target status. |
| `--custom-google` / `--transparent-status-code` | — | Google (20 credits), target status. |
| `--tag` | string | Optional label included in API response headers. |
| `--mode` | auto | Auto-Mode: API picks the cheapest config that succeeds; charged only for the winning config. GET only. See [Auto-Mode](#auto-mode). |
| `--max-cost` | int | Cap credits a request may cost (≥ 1). Requires `--mode auto`; omit = uncapped. |
Expand Down
1 change: 1 addition & 0 deletions .github/skills/scrapingbee-cli/reference/amazon/product.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ scrapingbee amazon-product --output-file product.json B0DPDRNSXV --domain com
| `--language` | string | e.g. en_US, es_US, fr_FR. |
| `--currency` | string | USD, EUR, GBP, etc. |
| `--add-html` | true/false | Include full HTML. |
| `--autoselect-variant` | true/false | Auto-select the default/most-popular variant (undocumented API param, verified accepted). |
| `--light-request` | true/false | Light request. |
| `--screenshot` | true/false | Take screenshot. |
| `--tag` | string | Optional label included in API response headers. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ scrapingbee google --output-file serp.json "pizza new york" --country-code us
| `--device` | string | `desktop` or `mobile`. |
| `--page` | int | Page number (default 1). |
| `--pages` | int | Consecutive pages to fetch starting at `--page` (default 1, max 10; 3 or fewer recommended). Combined into one response; cost is per fetched page. |
| `--nb-results` | int | Requested results per page (undocumented API param, verified accepted; Google may return more or fewer). |
| `--language` | string | Language code (e.g. en, fr, de). |
| `--date-range` | string | `past-hour`, `past-day`, `past-week`, `past-month`, `past-year`. Restrict results by recency. |
| `--nfpr` | true/false | Disable autocorrection. |
Expand Down
2 changes: 1 addition & 1 deletion .github/skills/scrapingbee-cli/reference/scrape/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Blocked? See [reference/proxy/strategies.md](reference/proxy/strategies.md).
|-----------|------|-------------|
| `--device` | desktop \| mobile | Device type (CLI validates). |
| `--timeout` | int | Timeout ms (1000–140000). Scrape job timeout on ScrapingBee. The CLI sets the HTTP client (aiohttp) timeout to this value in seconds plus 30 s (for send/receive) so the client does not give up before the API responds. |
| `--custom-google` / `--transparent-status-code` | — | Google (15 credits), target status. |
| `--custom-google` / `--transparent-status-code` | — | Google (20 credits), target status. |
| `--tag` | string | Optional label included in API response headers. |
| `--mode` | auto | Auto-Mode: API picks the cheapest config that succeeds; charged only for the winning config. GET only. See [Auto-Mode](#auto-mode). |
| `--max-cost` | int | Cap credits a request may cost (≥ 1). Requires `--mode auto`; omit = uncapped. |
Expand Down
1 change: 1 addition & 0 deletions .kiro/skills/scrapingbee-cli/reference/amazon/product.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ scrapingbee amazon-product --output-file product.json B0DPDRNSXV --domain com
| `--language` | string | e.g. en_US, es_US, fr_FR. |
| `--currency` | string | USD, EUR, GBP, etc. |
| `--add-html` | true/false | Include full HTML. |
| `--autoselect-variant` | true/false | Auto-select the default/most-popular variant (undocumented API param, verified accepted). |
| `--light-request` | true/false | Light request. |
| `--screenshot` | true/false | Take screenshot. |
| `--tag` | string | Optional label included in API response headers. |
Expand Down
1 change: 1 addition & 0 deletions .kiro/skills/scrapingbee-cli/reference/google/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ scrapingbee google --output-file serp.json "pizza new york" --country-code us
| `--device` | string | `desktop` or `mobile`. |
| `--page` | int | Page number (default 1). |
| `--pages` | int | Consecutive pages to fetch starting at `--page` (default 1, max 10; 3 or fewer recommended). Combined into one response; cost is per fetched page. |
| `--nb-results` | int | Requested results per page (undocumented API param, verified accepted; Google may return more or fewer). |
| `--language` | string | Language code (e.g. en, fr, de). |
| `--date-range` | string | `past-hour`, `past-day`, `past-week`, `past-month`, `past-year`. Restrict results by recency. |
| `--nfpr` | true/false | Disable autocorrection. |
Expand Down
2 changes: 1 addition & 1 deletion .kiro/skills/scrapingbee-cli/reference/scrape/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Blocked? See [reference/proxy/strategies.md](reference/proxy/strategies.md).
|-----------|------|-------------|
| `--device` | desktop \| mobile | Device type (CLI validates). |
| `--timeout` | int | Timeout ms (1000–140000). Scrape job timeout on ScrapingBee. The CLI sets the HTTP client (aiohttp) timeout to this value in seconds plus 30 s (for send/receive) so the client does not give up before the API responds. |
| `--custom-google` / `--transparent-status-code` | — | Google (15 credits), target status. |
| `--custom-google` / `--transparent-status-code` | — | Google (20 credits), target status. |
| `--tag` | string | Optional label included in API response headers. |
| `--mode` | auto | Auto-Mode: API picks the cheapest config that succeeds; charged only for the winning config. GET only. See [Auto-Mode](#auto-mode). |
| `--max-cost` | int | Cap credits a request may cost (≥ 1). Requires `--mode auto`; omit = uncapped. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ scrapingbee amazon-product --output-file product.json B0DPDRNSXV --domain com
| `--language` | string | e.g. en_US, es_US, fr_FR. |
| `--currency` | string | USD, EUR, GBP, etc. |
| `--add-html` | true/false | Include full HTML. |
| `--autoselect-variant` | true/false | Auto-select the default/most-popular variant (undocumented API param, verified accepted). |
| `--light-request` | true/false | Light request. |
| `--screenshot` | true/false | Take screenshot. |
| `--tag` | string | Optional label included in API response headers. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ scrapingbee google --output-file serp.json "pizza new york" --country-code us
| `--device` | string | `desktop` or `mobile`. |
| `--page` | int | Page number (default 1). |
| `--pages` | int | Consecutive pages to fetch starting at `--page` (default 1, max 10; 3 or fewer recommended). Combined into one response; cost is per fetched page. |
| `--nb-results` | int | Requested results per page (undocumented API param, verified accepted; Google may return more or fewer). |
| `--language` | string | Language code (e.g. en, fr, de). |
| `--date-range` | string | `past-hour`, `past-day`, `past-week`, `past-month`, `past-year`. Restrict results by recency. |
| `--nfpr` | true/false | Disable autocorrection. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Blocked? See [reference/proxy/strategies.md](reference/proxy/strategies.md).
|-----------|------|-------------|
| `--device` | desktop \| mobile | Device type (CLI validates). |
| `--timeout` | int | Timeout ms (1000–140000). Scrape job timeout on ScrapingBee. The CLI sets the HTTP client (aiohttp) timeout to this value in seconds plus 30 s (for send/receive) so the client does not give up before the API responds. |
| `--custom-google` / `--transparent-status-code` | — | Google (15 credits), target status. |
| `--custom-google` / `--transparent-status-code` | — | Google (20 credits), target status. |
| `--tag` | string | Optional label included in API response headers. |
| `--mode` | auto | Auto-Mode: API picks the cheapest config that succeeds; charged only for the winning config. GET only. See [Auto-Mode](#auto-mode). |
| `--max-cost` | int | Cap credits a request may cost (≥ 1). Requires `--mode auto`; omit = uncapped. |
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All notable changes to this project are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.6.0] - TBD
## [1.6.0] - 2026-08-24

### Added

Expand All @@ -15,6 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **`youtube-subtitles` command** — fetch video captions/transcripts from the YouTube Subtitles API (5 credits per request). Accepts a video ID or full YouTube URL, `--language` (ISO code) and `--subtitle-origin` (`auto-generated` / `uploader-provided`), and supports batch via `--input-file` like the other YouTube commands.
- **`--pages` on `google`** — fetch up to 10 consecutive result pages starting at `--page` in a single combined response (3 or fewer recommended; cost is per fetched page).
- **`--search-type ads` on `google`** — classic-result structure optimized for paid-ad visibility.
- **`--nb-results` on `google`** — requested number of results per page. Undocumented API parameter, verified accepted by the API (Google may return more or fewer results than requested).
- **`--autoselect-variant` on `amazon-product`** — auto-select the default/most-popular product variant, matching the existing `amazon-search` flag. Undocumented API parameter, verified accepted by the API.

### Changed

- **Header-based authorization** — all API requests now authenticate via the `Authorization: Bearer` header instead of the deprecated `api_key` query parameter, so the key no longer appears in request URLs (or anything that logs them). `crawl` is the one exception: its Scrapy middleware (`scrapy-scrapingbee`) still builds `api_key` URLs and will migrate separately.

## [1.5.1] - 2026-07-20

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ scrapingbee amazon-product --output-file product.json B0DPDRNSXV --domain com
| `--language` | string | e.g. en_US, es_US, fr_FR. |
| `--currency` | string | USD, EUR, GBP, etc. |
| `--add-html` | true/false | Include full HTML. |
| `--autoselect-variant` | true/false | Auto-select the default/most-popular variant (undocumented API param, verified accepted). |
| `--light-request` | true/false | Light request. |
| `--screenshot` | true/false | Take screenshot. |
| `--tag` | string | Optional label included in API response headers. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ scrapingbee google --output-file serp.json "pizza new york" --country-code us
| `--device` | string | `desktop` or `mobile`. |
| `--page` | int | Page number (default 1). |
| `--pages` | int | Consecutive pages to fetch starting at `--page` (default 1, max 10; 3 or fewer recommended). Combined into one response; cost is per fetched page. |
| `--nb-results` | int | Requested results per page (undocumented API param, verified accepted; Google may return more or fewer). |
| `--language` | string | Language code (e.g. en, fr, de). |
| `--date-range` | string | `past-hour`, `past-day`, `past-week`, `past-month`, `past-year`. Restrict results by recency. |
| `--nfpr` | true/false | Disable autocorrection. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Blocked? See [reference/proxy/strategies.md](reference/proxy/strategies.md).
|-----------|------|-------------|
| `--device` | desktop \| mobile | Device type (CLI validates). |
| `--timeout` | int | Timeout ms (1000–140000). Scrape job timeout on ScrapingBee. The CLI sets the HTTP client (aiohttp) timeout to this value in seconds plus 30 s (for send/receive) so the client does not give up before the API responds. |
| `--custom-google` / `--transparent-status-code` | — | Google (15 credits), target status. |
| `--custom-google` / `--transparent-status-code` | — | Google (20 credits), target status. |
| `--tag` | string | Optional label included in API response headers. |
| `--mode` | auto | Auto-Mode: API picks the cheapest config that succeeds; charged only for the winning config. GET only. See [Auto-Mode](#auto-mode). |
| `--max-cost` | int | Cap credits a request may cost (≥ 1). Requires `--mode auto`; omit = uncapped. |
Expand Down
14 changes: 9 additions & 5 deletions src/scrapingbee_cli/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ async def __aenter__(self) -> Client:
else aiohttp.TCPConnector(ssl=ssl_context)
)
timeout = aiohttp.ClientTimeout(total=self.timeout)
# Header-based auth: the api_key query parameter is deprecated for
# new integrations, so authenticate every request via the session.
session_headers = user_agent_headers() | {"Authorization": f"Bearer {self.api_key}"}
self._session = aiohttp.ClientSession(
connector=connector,
timeout=timeout,
headers=user_agent_headers(),
headers=session_headers,
)
return self

Expand All @@ -67,7 +70,6 @@ async def _get(
headers: dict[str, str] | None = None,
) -> tuple[bytes, dict, int]:
params = _clean_params(params)
params.setdefault("api_key", self.api_key)
url = f"{self.base_url}{path}" if path else self.base_url
session = self._ensure_session()
req_kwargs: dict[str, Any] = {"params": params}
Expand Down Expand Up @@ -114,7 +116,6 @@ async def _request(
headers: dict[str, str] | None = None,
) -> tuple[bytes, dict, int]:
params = _clean_params(params)
params.setdefault("api_key", self.api_key)
url = f"{self.base_url}{path}" if path else self.base_url
session = self._ensure_session()
req_kwargs: dict[str, Any] = {"params": params}
Expand Down Expand Up @@ -243,7 +244,6 @@ async def scrape(
body_out, out_headers, status = await self._get("", params, headers=req_headers)
else:
params_clean = _clean_params(params)
params_clean["api_key"] = self.api_key
# ScrapingBee API expects POST to it as application/x-www-form-urlencoded
content_type = "application/x-www-form-urlencoded; charset=utf-8"
# Don't send user's Content-Type to ScrapingBee; forward via params if needed
Expand Down Expand Up @@ -279,7 +279,7 @@ async def usage(
) -> tuple[bytes, dict, int]:
return await self._get_with_retry(
"/usage",
{"api_key": self.api_key},
{},
retries=retries,
backoff=backoff,
)
Expand All @@ -292,6 +292,7 @@ async def google_search(
device: str | None = None,
page: int | None = None,
pages: int | None = None,
nb_results: int | None = None,
language: str | None = None,
nfpr: bool | None = None,
extra_params: str | None = None,
Expand All @@ -315,6 +316,7 @@ async def google_search(
"device": device,
"page": page if page is not None else None,
"pages": pages if pages is not None else None,
"nb_results": nb_results if nb_results is not None else None,
"language": language,
"nfpr": self._bool(nfpr),
"extra_params": extra_params,
Expand Down Expand Up @@ -369,6 +371,7 @@ async def amazon_product(
zip_code: str | None = None,
language: str | None = None,
currency: str | None = None,
autoselect_variant: bool | None = None,
add_html: bool | None = None,
light_request: bool | None = None,
screenshot: bool | None = None,
Expand All @@ -384,6 +387,7 @@ async def amazon_product(
"zip_code": zip_code,
"language": language,
"currency": currency,
"autoselect_variant": self._bool(autoselect_variant),
"add_html": self._bool(add_html),
"light_request": self._bool(light_request),
"screenshot": self._bool(screenshot),
Expand Down
12 changes: 12 additions & 0 deletions src/scrapingbee_cli/commands/amazon.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@
)
@optgroup.option("--currency", type=str, default=None, help="Currency code (e.g. USD, EUR, GBP).")
@optgroup.group("Output", help="Response format options")
@optgroup.option(
"--autoselect-variant",
type=BOOL_STR,
default=None,
help=(
"Auto-select the default/most-popular product variant (true/false). "
"Undocumented API parameter — verified accepted by the API."
),
)
@optgroup.option(
"--add-html", type=BOOL_STR, default=None, help="Include full HTML in response (true/false)."
)
Expand All @@ -86,6 +95,7 @@ def amazon_product_cmd(
zip_code: str | None,
language: str | None,
currency: str | None,
autoselect_variant: str | None,
add_html: str | None,
light_request: str | None,
screenshot: str | None,
Expand Down Expand Up @@ -135,6 +145,7 @@ async def api_call(client, a):
zip_code=zip_code,
language=language,
currency=currency,
autoselect_variant=parse_bool(autoselect_variant),
add_html=parse_bool(add_html),
light_request=parse_bool(light_request),
screenshot=parse_bool(screenshot),
Expand Down Expand Up @@ -178,6 +189,7 @@ async def _single() -> None:
zip_code=zip_code,
language=language,
currency=currency,
autoselect_variant=parse_bool(autoselect_variant),
add_html=parse_bool(add_html),
light_request=parse_bool(light_request),
screenshot=parse_bool(screenshot),
Expand Down
13 changes: 13 additions & 0 deletions src/scrapingbee_cli/commands/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ def _warn_empty_organic(data: bytes, search_type: str | None) -> None:
"3 or fewer recommended). Results are combined into one response."
),
)
@optgroup.option(
"--nb-results",
type=int,
default=None,
help=(
"Requested number of results per page (undocumented API parameter — "
"verified accepted by the API; Google may return more or fewer)."
),
)
@optgroup.option(
"--language",
type=str,
Expand Down Expand Up @@ -178,6 +187,7 @@ def google_cmd(
device: str | None,
page: int | None,
pages: int | None,
nb_results: int | None,
language: str | None,
nfpr: str | None,
extra_params: str | None,
Expand Down Expand Up @@ -206,6 +216,7 @@ def google_cmd(
raise SystemExit(1)
_validate_page(page)
_validate_pages(pages)
_validate_page(nb_results, name="nb-results")
_validate_price_range(min_price, max_price)
_validate_geolocation(latitude, longitude, radius)

Expand Down Expand Up @@ -239,6 +250,7 @@ async def api_call(client, q):
device=device,
page=page,
pages=pages,
nb_results=nb_results,
language=language,
nfpr=parse_bool(nfpr),
extra_params=extra_params,
Expand Down Expand Up @@ -290,6 +302,7 @@ async def _single() -> None:
device=device,
page=page,
pages=pages,
nb_results=nb_results,
language=language,
nfpr=parse_bool(nfpr),
extra_params=extra_params,
Expand Down
Loading