scrapebadger-cli 0.28.1__tar.gz → 0.30.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scrapebadger_cli-0.30.0/CHANGELOG.md +12 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/PKG-INFO +34 -3
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/README.md +33 -2
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/pyproject.toml +1 -1
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/client.py +9 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/autoscout24.py +23 -1
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/github.py +15 -1
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/google.py +215 -5
- scrapebadger_cli-0.30.0/src/scrapebadger_cli/commands/yelp.py +50 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/main.py +4 -2
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/tests/test_autoscout24_commands.py +30 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/tests/test_github.py +27 -0
- scrapebadger_cli-0.30.0/tests/test_google_light_search.py +61 -0
- scrapebadger_cli-0.30.0/tests/test_yelp_commands.py +55 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/uv.lock +1 -1
- scrapebadger_cli-0.28.1/tests/test_google_light_search.py +0 -22
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/.gitignore +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/__init__.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/availability.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/__init__.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/agent.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/airbnb.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/aliexpress.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/amazon.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/apartments.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/app_store.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/asos.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/auth.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/baidu.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/bestbuy.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/bing.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/booking.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/brave.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/chatgpt.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/copilot.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/depop.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/duckduckgo.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/ebay.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/etsy.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/facebook.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/gemini.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/google_play.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/gumtree.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/idealista.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/immobiliare.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/init.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/instagram.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/leboncoin.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/linkedin.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/loopnet.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/naver.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/onboarding.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/perplexity.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/realtor.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/reddit.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/redfin.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/stream.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/target.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/tiktok.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/twitter.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/vinted.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/wallapop.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/walmart.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/web.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/yahoo.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/yandex.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/youtube.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/zillow.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/config.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/output.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/results.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/views.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/tests/conftest.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/tests/test_agent_features.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/tests/test_brave.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/tests/test_cli_availability.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/tests/test_copilot_commands.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/tests/test_naver.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/tests/test_perplexity_strict_country.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/tests/test_tiktok_pagination.py +0 -0
- {scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/tests/test_vinted_image_search.py +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.30.0 — 2026-11-07
|
|
4
|
+
|
|
5
|
+
- Expose Google Search and Light targeting, advanced filters, and `--no-cache`.
|
|
6
|
+
- Add `--response-format html` for raw search pages, including Google verticals.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## 0.29.0 — 2026-11-07
|
|
10
|
+
|
|
11
|
+
- Add AutoScout24 listing details and GitHub repository operations.
|
|
12
|
+
- Add Yelp business search and markets, preserving filters, pagination and response envelopes.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: scrapebadger-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.30.0
|
|
4
4
|
Summary: ScrapeBadger CLI — Twitter, Vinted, Google, and Web Scraping from the command line
|
|
5
5
|
Author: ScrapeBadger Team
|
|
6
6
|
License: MIT
|
|
@@ -171,6 +171,19 @@ Run `scrapebadger <api> --help` to list product, review, store, availability and
|
|
|
171
171
|
reference commands for that API. Each command supports `--help` for its exact
|
|
172
172
|
parameters. Requests use your API key's existing permissions and credit balance.
|
|
173
173
|
|
|
174
|
+
### GitHub repository detail
|
|
175
|
+
|
|
176
|
+
Use owner and repository name separately, not a URL. Repository detail uses the
|
|
177
|
+
public default branch and accepts no pagination, market or ref options.
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
scrapebadger github repository cli cli
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
A successful uncached detail response costs 10 credits. Errors are unbilled;
|
|
184
|
+
cache hits can be free. The raw JSON retains README, root files, latest commit,
|
|
185
|
+
metadata and additive fields. Reference: https://docs.scrapebadger.com/github/repositories.
|
|
186
|
+
|
|
174
187
|
### GitHub public profiles
|
|
175
188
|
|
|
176
189
|
Prepared for the GitHub API rollout. Use a login or @handle, not a URL.
|
|
@@ -185,13 +198,15 @@ scrapebadger github profile sindresorhus --tab stars --next-page-token OPAQUE_TO
|
|
|
185
198
|
|
|
186
199
|
These examples are representative; see https://docs.scrapebadger.com/github/profiles.
|
|
187
200
|
|
|
188
|
-
### AutoScout24 vehicle search
|
|
201
|
+
### AutoScout24 vehicle search and listing detail
|
|
189
202
|
|
|
190
|
-
Search vehicle cards across eight European marketplaces
|
|
203
|
+
Search vehicle cards across eight European marketplaces, then retrieve full specifications, equipment, photos and public seller contacts.
|
|
191
204
|
|
|
192
205
|
```bash
|
|
193
206
|
scrapebadger autoscout24 search --market de --make volkswagen --model golf --price-max 20000
|
|
194
207
|
scrapebadger autoscout24 search --market it --make volkswagen --model golf --sort-by price_asc --page 2
|
|
208
|
+
scrapebadger autoscout24 listing --url SEARCH_RESULT_URL
|
|
209
|
+
scrapebadger autoscout24 listing --listing-id UUID --market it
|
|
195
210
|
scrapebadger autoscout24 filters --market de --make volkswagen
|
|
196
211
|
scrapebadger autoscout24 markets
|
|
197
212
|
```
|
|
@@ -200,6 +215,9 @@ Ranges use `--price-min/--price-max` (EUR), `--mileage-min/--mileage-max` (km),
|
|
|
200
215
|
`--year-min/--year-max` (first registration) and `--power-min/--power-max` (kW).
|
|
201
216
|
Use `--help` for fuel, transmission, body, seller, condition and postcode/radius filters.
|
|
202
217
|
Follow the response's `next_page`; the source caps browsing at 200 pages per query.
|
|
218
|
+
Listing detail accepts exactly one URL or UUID and costs 10 credits. A URL infers its
|
|
219
|
+
market; a UUID defaults to Germany unless `--market` is supplied. Failed requests
|
|
220
|
+
and removed listings are free.
|
|
203
221
|
## Brave Search
|
|
204
222
|
|
|
205
223
|
```bash
|
|
@@ -215,3 +233,16 @@ Web/video `--page` is a 1-based native page ordinal; `--count` trims one source
|
|
|
215
233
|
page without changing its boundaries. Images/news return an initial batch.
|
|
216
234
|
JSON output preserves the complete response, including rich blocks and native
|
|
217
235
|
query alteration metadata. Use `brave locales` for country/UI-language codes.
|
|
236
|
+
|
|
237
|
+
## Yelp business search
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
scrapebadger yelp search "San Francisco, CA" -q pizza
|
|
241
|
+
scrapebadger yelp search "Chicago, IL" --category coffee --sort-by rating --price 1,2 --page 2
|
|
242
|
+
scrapebadger yelp search "Austin, TX" -q tacos --features delivery,takeout
|
|
243
|
+
scrapebadger yelp markets
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Results are ranked as on Yelp, ten businesses per page, pages 1–11; ads come back
|
|
247
|
+
separately under `ads`. JSON output keeps totals, filters and `next_page`.
|
|
248
|
+
Business detail and reviews are not included.
|
|
@@ -148,6 +148,19 @@ Run `scrapebadger <api> --help` to list product, review, store, availability and
|
|
|
148
148
|
reference commands for that API. Each command supports `--help` for its exact
|
|
149
149
|
parameters. Requests use your API key's existing permissions and credit balance.
|
|
150
150
|
|
|
151
|
+
### GitHub repository detail
|
|
152
|
+
|
|
153
|
+
Use owner and repository name separately, not a URL. Repository detail uses the
|
|
154
|
+
public default branch and accepts no pagination, market or ref options.
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
scrapebadger github repository cli cli
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
A successful uncached detail response costs 10 credits. Errors are unbilled;
|
|
161
|
+
cache hits can be free. The raw JSON retains README, root files, latest commit,
|
|
162
|
+
metadata and additive fields. Reference: https://docs.scrapebadger.com/github/repositories.
|
|
163
|
+
|
|
151
164
|
### GitHub public profiles
|
|
152
165
|
|
|
153
166
|
Prepared for the GitHub API rollout. Use a login or @handle, not a URL.
|
|
@@ -162,13 +175,15 @@ scrapebadger github profile sindresorhus --tab stars --next-page-token OPAQUE_TO
|
|
|
162
175
|
|
|
163
176
|
These examples are representative; see https://docs.scrapebadger.com/github/profiles.
|
|
164
177
|
|
|
165
|
-
### AutoScout24 vehicle search
|
|
178
|
+
### AutoScout24 vehicle search and listing detail
|
|
166
179
|
|
|
167
|
-
Search vehicle cards across eight European marketplaces
|
|
180
|
+
Search vehicle cards across eight European marketplaces, then retrieve full specifications, equipment, photos and public seller contacts.
|
|
168
181
|
|
|
169
182
|
```bash
|
|
170
183
|
scrapebadger autoscout24 search --market de --make volkswagen --model golf --price-max 20000
|
|
171
184
|
scrapebadger autoscout24 search --market it --make volkswagen --model golf --sort-by price_asc --page 2
|
|
185
|
+
scrapebadger autoscout24 listing --url SEARCH_RESULT_URL
|
|
186
|
+
scrapebadger autoscout24 listing --listing-id UUID --market it
|
|
172
187
|
scrapebadger autoscout24 filters --market de --make volkswagen
|
|
173
188
|
scrapebadger autoscout24 markets
|
|
174
189
|
```
|
|
@@ -177,6 +192,9 @@ Ranges use `--price-min/--price-max` (EUR), `--mileage-min/--mileage-max` (km),
|
|
|
177
192
|
`--year-min/--year-max` (first registration) and `--power-min/--power-max` (kW).
|
|
178
193
|
Use `--help` for fuel, transmission, body, seller, condition and postcode/radius filters.
|
|
179
194
|
Follow the response's `next_page`; the source caps browsing at 200 pages per query.
|
|
195
|
+
Listing detail accepts exactly one URL or UUID and costs 10 credits. A URL infers its
|
|
196
|
+
market; a UUID defaults to Germany unless `--market` is supplied. Failed requests
|
|
197
|
+
and removed listings are free.
|
|
180
198
|
## Brave Search
|
|
181
199
|
|
|
182
200
|
```bash
|
|
@@ -192,3 +210,16 @@ Web/video `--page` is a 1-based native page ordinal; `--count` trims one source
|
|
|
192
210
|
page without changing its boundaries. Images/news return an initial batch.
|
|
193
211
|
JSON output preserves the complete response, including rich blocks and native
|
|
194
212
|
query alteration metadata. Use `brave locales` for country/UI-language codes.
|
|
213
|
+
|
|
214
|
+
## Yelp business search
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
scrapebadger yelp search "San Francisco, CA" -q pizza
|
|
218
|
+
scrapebadger yelp search "Chicago, IL" --category coffee --sort-by rating --price 1,2 --page 2
|
|
219
|
+
scrapebadger yelp search "Austin, TX" -q tacos --features delivery,takeout
|
|
220
|
+
scrapebadger yelp markets
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Results are ranked as on Yelp, ten businesses per page, pages 1–11; ads come back
|
|
224
|
+
separately under `ads`. JSON output keeps totals, filters and `next_page`.
|
|
225
|
+
Business detail and reviews are not included.
|
|
@@ -45,6 +45,15 @@ def api_get(path: str, params: dict[str, Any] | None = None, *, save: bool = Tru
|
|
|
45
45
|
return _handle_response(resp, path if save else None)
|
|
46
46
|
|
|
47
47
|
|
|
48
|
+
def api_get_raw(path: str, params: dict[str, Any] | None = None) -> bytes:
|
|
49
|
+
"""GET a raw response, preserving the usual authentication and error handling."""
|
|
50
|
+
clean = {k: v for k, v in (params or {}).items() if v is not None}
|
|
51
|
+
resp = _get_client().get(path, params=clean or None)
|
|
52
|
+
if resp.status_code >= 400:
|
|
53
|
+
_handle_response(resp)
|
|
54
|
+
return resp.content
|
|
55
|
+
|
|
56
|
+
|
|
48
57
|
def api_post(
|
|
49
58
|
path: str, json_body: dict[str, Any] | None = None, *, save: bool = True
|
|
50
59
|
) -> dict | list:
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/autoscout24.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""AutoScout24 vehicle listing
|
|
1
|
+
"""AutoScout24 vehicle search, listing detail and reference commands."""
|
|
2
2
|
|
|
3
3
|
import typer
|
|
4
4
|
|
|
@@ -66,6 +66,28 @@ def search(
|
|
|
66
66
|
render(data, fmt, fields, preserve_envelope=True)
|
|
67
67
|
|
|
68
68
|
|
|
69
|
+
@app.command()
|
|
70
|
+
def listing(
|
|
71
|
+
url: str | None = typer.Option(None, "--url", help="Full HTTPS listing URL from search"),
|
|
72
|
+
listing_id: str | None = typer.Option(None, "--listing-id", help="Listing UUID from search"),
|
|
73
|
+
market: str | None = typer.Option(
|
|
74
|
+
None, "--market", help="Inferred from URL, otherwise de; must match URL if supplied"
|
|
75
|
+
),
|
|
76
|
+
fmt: str = FMT,
|
|
77
|
+
fields: str | None = FIELDS,
|
|
78
|
+
) -> None:
|
|
79
|
+
"""Full vehicle specs, equipment, photos and seller. URL or UUID required; 10 credits."""
|
|
80
|
+
render(
|
|
81
|
+
api_get(
|
|
82
|
+
"/v1/autoscout24/listing",
|
|
83
|
+
{"url": url, "listing_id": listing_id, "market": market},
|
|
84
|
+
),
|
|
85
|
+
fmt,
|
|
86
|
+
fields,
|
|
87
|
+
preserve_envelope=True,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
69
91
|
@app.command()
|
|
70
92
|
def filters(
|
|
71
93
|
market: str = typer.Option("de", "--market"),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""GitHub public profile commands."""
|
|
1
|
+
"""GitHub public profile and repository commands."""
|
|
2
2
|
|
|
3
3
|
from enum import Enum
|
|
4
4
|
from urllib.parse import quote
|
|
@@ -17,6 +17,20 @@ class ProfileTab(str, Enum):
|
|
|
17
17
|
stars = "stars"
|
|
18
18
|
|
|
19
19
|
|
|
20
|
+
@app.command()
|
|
21
|
+
def repository(
|
|
22
|
+
owner: str = typer.Argument(..., help="Public repository owner login, not a URL"),
|
|
23
|
+
repo: str = typer.Argument(..., help="Repository name, including dots or hyphens"),
|
|
24
|
+
fmt: str = typer.Option("json", "--output", "-o", help="json, csv, table, markdown"),
|
|
25
|
+
fields: str | None = typer.Option(None, "--fields", "-f", help="Comma-separated output fields"),
|
|
26
|
+
) -> None:
|
|
27
|
+
"""Get a public repository with native README, root files and latest commit."""
|
|
28
|
+
if owner in {".", ".."} or repo in {".", ".."}:
|
|
29
|
+
raise typer.BadParameter("owner and repo must not be dot path segments")
|
|
30
|
+
data = api_get(f"/v1/github/repositories/{quote(owner, safe='')}/{quote(repo, safe='')}")
|
|
31
|
+
render(data, fmt, fields, preserve_envelope=True)
|
|
32
|
+
|
|
33
|
+
|
|
20
34
|
@app.command()
|
|
21
35
|
def profile(
|
|
22
36
|
username: str = typer.Argument(..., help="GitHub login or @handle, not a profile URL"),
|
|
@@ -15,7 +15,7 @@ Typical workflow:
|
|
|
15
15
|
|
|
16
16
|
import typer
|
|
17
17
|
|
|
18
|
-
from scrapebadger_cli.client import api_get
|
|
18
|
+
from scrapebadger_cli.client import api_get, api_get_raw
|
|
19
19
|
from scrapebadger_cli.output import render
|
|
20
20
|
|
|
21
21
|
app = typer.Typer(no_args_is_help=True)
|
|
@@ -46,13 +46,116 @@ def search(
|
|
|
46
46
|
"--ai-overview",
|
|
47
47
|
help="Chase deferred AI Overview page_token when the SERP defers it",
|
|
48
48
|
),
|
|
49
|
+
uule: str | None = typer.Option(None, "--uule", help="Encoded Google location."),
|
|
50
|
+
lr: str | None = typer.Option(None, "--lr", help="Result language restrict."),
|
|
51
|
+
filter: int | None = typer.Option(None, "--filter", help="Omitted-results filter: 0 or 1."),
|
|
52
|
+
nfpr: int | None = typer.Option(None, "--nfpr", help="Disable spelling correction."),
|
|
53
|
+
user_agent: str | None = typer.Option(None, "--user-agent", help="Custom User-Agent."),
|
|
54
|
+
cr: str | None = typer.Option(None, "--cr", help="Country restrict."),
|
|
55
|
+
ludocid: str | None = typer.Option(None, "--ludocid", help="Place CID."),
|
|
56
|
+
lsig: str | None = typer.Option(None, "--lsig", help="Map view ID."),
|
|
57
|
+
kgmid: str | None = typer.Option(None, "--kgmid", help="Knowledge Graph entity ID."),
|
|
58
|
+
si: str | None = typer.Option(None, "--si", help="Cached Google parameters."),
|
|
59
|
+
ibp: str | None = typer.Option(None, "--ibp", help="Layout control."),
|
|
60
|
+
uds: str | None = typer.Option(None, "--uds", help="Google filter string."),
|
|
61
|
+
google_domain: str | None = typer.Option(
|
|
62
|
+
None,
|
|
63
|
+
"--google-domain",
|
|
64
|
+
help="Alias for domain; Google requests use google.com with country targeting.",
|
|
65
|
+
),
|
|
66
|
+
lat: float | None = typer.Option(
|
|
67
|
+
None, "--lat", help="Latitude; supply together with lon instead of location or uule."
|
|
68
|
+
),
|
|
69
|
+
lon: float | None = typer.Option(None, "--lon", help="Longitude; supply together with lat."),
|
|
70
|
+
radius: float | None = typer.Option(
|
|
71
|
+
None,
|
|
72
|
+
"--radius",
|
|
73
|
+
help="Location accuracy in meters; requires lat/lon or a named city with a known center.",
|
|
74
|
+
),
|
|
75
|
+
color_scheme: str | None = typer.Option(None, "--color-scheme", help="Google color scheme."),
|
|
76
|
+
tbm: str | None = typer.Option(
|
|
77
|
+
None,
|
|
78
|
+
"--tbm",
|
|
79
|
+
help="Google search type. Use output=html for verticals; dedicated APIs provide parsed vertical results.",
|
|
80
|
+
),
|
|
81
|
+
udm: str | None = typer.Option(
|
|
82
|
+
None,
|
|
83
|
+
"--udm",
|
|
84
|
+
help="Google result filter: 14 web, 18 forums. Other verticals require output=html.",
|
|
85
|
+
),
|
|
86
|
+
no_cache: bool = typer.Option(
|
|
87
|
+
False, "--no-cache", help="Bypass result caches and request a fresh Google fetch."
|
|
88
|
+
),
|
|
89
|
+
as_dt: str | None = typer.Option(
|
|
90
|
+
None, "--as-dt", help="Site restriction mode: i includes, e excludes as_sitesearch."
|
|
91
|
+
),
|
|
92
|
+
as_epq: str | None = typer.Option(None, "--as-epq", help="Exact phrase."),
|
|
93
|
+
as_eq: str | None = typer.Option(None, "--as-eq", help="Words to exclude."),
|
|
94
|
+
as_lq: str | None = typer.Option(
|
|
95
|
+
None, "--as-lq", help="Find pages linking to this URL; availability depends on Google."
|
|
96
|
+
),
|
|
97
|
+
as_nlo: str | None = typer.Option(None, "--as-nlo", help="Numeric range minimum."),
|
|
98
|
+
as_nhi: str | None = typer.Option(None, "--as-nhi", help="Numeric range maximum."),
|
|
99
|
+
as_oq: str | None = typer.Option(None, "--as-oq", help="Match any of these words."),
|
|
100
|
+
as_q: str | None = typer.Option(None, "--as-q", help="Additional query words."),
|
|
101
|
+
as_qdr: str | None = typer.Option(None, "--as-qdr", help="Time range, such as d, w, m or y1."),
|
|
102
|
+
as_rq: str | None = typer.Option(
|
|
103
|
+
None, "--as-rq", help="Related URL; availability depends on Google."
|
|
104
|
+
),
|
|
105
|
+
as_sitesearch: str | None = typer.Option(
|
|
106
|
+
None, "--as-sitesearch", help="Restrict results to a site."
|
|
107
|
+
),
|
|
108
|
+
expand_related_questions: str | None = typer.Option(
|
|
109
|
+
None,
|
|
110
|
+
"--expand-related-questions",
|
|
111
|
+
help="true or the number of People Also Ask answers to open.",
|
|
112
|
+
),
|
|
113
|
+
response_format: str = typer.Option(
|
|
114
|
+
"json", "--response-format", help="API format: json or html"
|
|
115
|
+
),
|
|
49
116
|
fmt: str = FMT,
|
|
50
117
|
fields: str | None = FIELDS,
|
|
51
118
|
) -> None:
|
|
52
119
|
"""Google web search (SERP)."""
|
|
53
|
-
|
|
120
|
+
if response_format not in ("json", "html"):
|
|
121
|
+
raise typer.BadParameter("--response-format must be json or html")
|
|
122
|
+
fetch = api_get_raw if response_format == "html" else api_get
|
|
123
|
+
data = fetch(
|
|
54
124
|
"/v1/google/search",
|
|
55
125
|
{
|
|
126
|
+
"uule": uule,
|
|
127
|
+
"lr": lr,
|
|
128
|
+
"filter": filter,
|
|
129
|
+
"nfpr": nfpr,
|
|
130
|
+
"user_agent": user_agent,
|
|
131
|
+
"cr": cr,
|
|
132
|
+
"ludocid": ludocid,
|
|
133
|
+
"lsig": lsig,
|
|
134
|
+
"kgmid": kgmid,
|
|
135
|
+
"si": si,
|
|
136
|
+
"ibp": ibp,
|
|
137
|
+
"uds": uds,
|
|
138
|
+
"google_domain": google_domain,
|
|
139
|
+
"lat": lat,
|
|
140
|
+
"lon": lon,
|
|
141
|
+
"radius": radius,
|
|
142
|
+
"color_scheme": color_scheme,
|
|
143
|
+
"tbm": tbm,
|
|
144
|
+
"udm": udm,
|
|
145
|
+
"no_cache": no_cache,
|
|
146
|
+
"as_dt": as_dt,
|
|
147
|
+
"as_epq": as_epq,
|
|
148
|
+
"as_eq": as_eq,
|
|
149
|
+
"as_lq": as_lq,
|
|
150
|
+
"as_nlo": as_nlo,
|
|
151
|
+
"as_nhi": as_nhi,
|
|
152
|
+
"as_oq": as_oq,
|
|
153
|
+
"as_q": as_q,
|
|
154
|
+
"as_qdr": as_qdr,
|
|
155
|
+
"as_rq": as_rq,
|
|
156
|
+
"as_sitesearch": as_sitesearch,
|
|
157
|
+
"expand_related_questions": expand_related_questions,
|
|
158
|
+
"output": response_format,
|
|
56
159
|
"q": q,
|
|
57
160
|
"gl": gl,
|
|
58
161
|
"hl": hl,
|
|
@@ -66,7 +169,10 @@ def search(
|
|
|
66
169
|
"ai_overview": ai_overview if ai_overview else None,
|
|
67
170
|
},
|
|
68
171
|
)
|
|
69
|
-
|
|
172
|
+
if isinstance(data, bytes):
|
|
173
|
+
typer.echo(data.decode("utf-8"))
|
|
174
|
+
else:
|
|
175
|
+
render(data, fmt, fields)
|
|
70
176
|
|
|
71
177
|
|
|
72
178
|
@app.command(name="light-search")
|
|
@@ -79,13 +185,114 @@ def light_search(
|
|
|
79
185
|
domain: str | None = typer.Option(None, "--domain", help="Google domain"),
|
|
80
186
|
location: str | None = typer.Option(None, "--location", help="City-level geo-targeting"),
|
|
81
187
|
safe: str | None = typer.Option(None, "--safe", help="off / active"),
|
|
188
|
+
uule: str | None = typer.Option(None, "--uule", help="Encoded Google location."),
|
|
189
|
+
lr: str | None = typer.Option(None, "--lr", help="Result language restrict."),
|
|
190
|
+
tbs: str | None = typer.Option(None, "--tbs", help="Google search filters."),
|
|
191
|
+
filter: int | None = typer.Option(None, "--filter", help="Omitted-results filter: 0 or 1."),
|
|
192
|
+
nfpr: int | None = typer.Option(None, "--nfpr", help="Disable spelling correction."),
|
|
193
|
+
device: str | None = typer.Option(None, "--device", help="Device target."),
|
|
194
|
+
user_agent: str | None = typer.Option(None, "--user-agent", help="Custom User-Agent."),
|
|
195
|
+
cr: str | None = typer.Option(None, "--cr", help="Country restrict."),
|
|
196
|
+
ludocid: str | None = typer.Option(None, "--ludocid", help="Place CID."),
|
|
197
|
+
lsig: str | None = typer.Option(None, "--lsig", help="Map view ID."),
|
|
198
|
+
kgmid: str | None = typer.Option(None, "--kgmid", help="Knowledge Graph entity ID."),
|
|
199
|
+
si: str | None = typer.Option(None, "--si", help="Cached Google parameters."),
|
|
200
|
+
ibp: str | None = typer.Option(None, "--ibp", help="Layout control."),
|
|
201
|
+
uds: str | None = typer.Option(None, "--uds", help="Google filter string."),
|
|
202
|
+
google_domain: str | None = typer.Option(
|
|
203
|
+
None,
|
|
204
|
+
"--google-domain",
|
|
205
|
+
help="Alias for domain; Google requests use google.com with country targeting.",
|
|
206
|
+
),
|
|
207
|
+
lat: float | None = typer.Option(
|
|
208
|
+
None, "--lat", help="Latitude; supply together with lon instead of location or uule."
|
|
209
|
+
),
|
|
210
|
+
lon: float | None = typer.Option(None, "--lon", help="Longitude; supply together with lat."),
|
|
211
|
+
radius: float | None = typer.Option(
|
|
212
|
+
None,
|
|
213
|
+
"--radius",
|
|
214
|
+
help="Location accuracy in meters; requires lat/lon or a named city with a known center.",
|
|
215
|
+
),
|
|
216
|
+
color_scheme: str | None = typer.Option(None, "--color-scheme", help="Google color scheme."),
|
|
217
|
+
tbm: str | None = typer.Option(
|
|
218
|
+
None,
|
|
219
|
+
"--tbm",
|
|
220
|
+
help="Google search type. Use output=html for verticals; dedicated APIs provide parsed vertical results.",
|
|
221
|
+
),
|
|
222
|
+
udm: str | None = typer.Option(
|
|
223
|
+
None,
|
|
224
|
+
"--udm",
|
|
225
|
+
help="Google result filter: 14 web, 18 forums. Other verticals require output=html.",
|
|
226
|
+
),
|
|
227
|
+
no_cache: bool = typer.Option(
|
|
228
|
+
False, "--no-cache", help="Bypass result caches and request a fresh Google fetch."
|
|
229
|
+
),
|
|
230
|
+
as_dt: str | None = typer.Option(
|
|
231
|
+
None, "--as-dt", help="Site restriction mode: i includes, e excludes as_sitesearch."
|
|
232
|
+
),
|
|
233
|
+
as_epq: str | None = typer.Option(None, "--as-epq", help="Exact phrase."),
|
|
234
|
+
as_eq: str | None = typer.Option(None, "--as-eq", help="Words to exclude."),
|
|
235
|
+
as_lq: str | None = typer.Option(
|
|
236
|
+
None, "--as-lq", help="Find pages linking to this URL; availability depends on Google."
|
|
237
|
+
),
|
|
238
|
+
as_nlo: str | None = typer.Option(None, "--as-nlo", help="Numeric range minimum."),
|
|
239
|
+
as_nhi: str | None = typer.Option(None, "--as-nhi", help="Numeric range maximum."),
|
|
240
|
+
as_oq: str | None = typer.Option(None, "--as-oq", help="Match any of these words."),
|
|
241
|
+
as_q: str | None = typer.Option(None, "--as-q", help="Additional query words."),
|
|
242
|
+
as_qdr: str | None = typer.Option(None, "--as-qdr", help="Time range, such as d, w, m or y1."),
|
|
243
|
+
as_rq: str | None = typer.Option(
|
|
244
|
+
None, "--as-rq", help="Related URL; availability depends on Google."
|
|
245
|
+
),
|
|
246
|
+
as_sitesearch: str | None = typer.Option(
|
|
247
|
+
None, "--as-sitesearch", help="Restrict results to a site."
|
|
248
|
+
),
|
|
249
|
+
response_format: str = typer.Option(
|
|
250
|
+
"json", "--response-format", help="API format: json or html"
|
|
251
|
+
),
|
|
82
252
|
fmt: str = FMT,
|
|
83
253
|
fields: str | None = FIELDS,
|
|
84
254
|
) -> None:
|
|
85
255
|
"""Google Light Search — organic + related searches, 10 credits (regular Search: 20)."""
|
|
86
|
-
|
|
256
|
+
if response_format not in ("json", "html"):
|
|
257
|
+
raise typer.BadParameter("--response-format must be json or html")
|
|
258
|
+
fetch = api_get_raw if response_format == "html" else api_get
|
|
259
|
+
data = fetch(
|
|
87
260
|
"/v1/google/light/search",
|
|
88
261
|
{
|
|
262
|
+
"uule": uule,
|
|
263
|
+
"lr": lr,
|
|
264
|
+
"tbs": tbs,
|
|
265
|
+
"filter": filter,
|
|
266
|
+
"nfpr": nfpr,
|
|
267
|
+
"device": device,
|
|
268
|
+
"user_agent": user_agent,
|
|
269
|
+
"cr": cr,
|
|
270
|
+
"ludocid": ludocid,
|
|
271
|
+
"lsig": lsig,
|
|
272
|
+
"kgmid": kgmid,
|
|
273
|
+
"si": si,
|
|
274
|
+
"ibp": ibp,
|
|
275
|
+
"uds": uds,
|
|
276
|
+
"google_domain": google_domain,
|
|
277
|
+
"lat": lat,
|
|
278
|
+
"lon": lon,
|
|
279
|
+
"radius": radius,
|
|
280
|
+
"color_scheme": color_scheme,
|
|
281
|
+
"tbm": tbm,
|
|
282
|
+
"udm": udm,
|
|
283
|
+
"no_cache": no_cache,
|
|
284
|
+
"as_dt": as_dt,
|
|
285
|
+
"as_epq": as_epq,
|
|
286
|
+
"as_eq": as_eq,
|
|
287
|
+
"as_lq": as_lq,
|
|
288
|
+
"as_nlo": as_nlo,
|
|
289
|
+
"as_nhi": as_nhi,
|
|
290
|
+
"as_oq": as_oq,
|
|
291
|
+
"as_q": as_q,
|
|
292
|
+
"as_qdr": as_qdr,
|
|
293
|
+
"as_rq": as_rq,
|
|
294
|
+
"as_sitesearch": as_sitesearch,
|
|
295
|
+
"output": response_format,
|
|
89
296
|
"q": q,
|
|
90
297
|
"gl": gl,
|
|
91
298
|
"hl": hl,
|
|
@@ -96,7 +303,10 @@ def light_search(
|
|
|
96
303
|
"safe": safe,
|
|
97
304
|
},
|
|
98
305
|
)
|
|
99
|
-
|
|
306
|
+
if isinstance(data, bytes):
|
|
307
|
+
typer.echo(data.decode("utf-8"))
|
|
308
|
+
else:
|
|
309
|
+
render(data, fmt, fields)
|
|
100
310
|
|
|
101
311
|
|
|
102
312
|
# ---------------------------------------------------------------------------
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Yelp business search commands. Business detail and reviews are not included."""
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
|
|
5
|
+
from scrapebadger_cli.client import api_get
|
|
6
|
+
from scrapebadger_cli.output import render
|
|
7
|
+
|
|
8
|
+
app = typer.Typer(no_args_is_help=True)
|
|
9
|
+
FMT = typer.Option("json", "--output", "-o", help="Output format: json, csv, table, markdown")
|
|
10
|
+
FIELDS = typer.Option(None, "--fields", "-f", help="Comma-separated response fields")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@app.command()
|
|
14
|
+
def search(
|
|
15
|
+
location: str = typer.Argument(..., help="Where: city, neighbourhood, address or postcode"),
|
|
16
|
+
query: str | None = typer.Option(None, "--query", "-q", help="What, e.g. pizza or plumbers"),
|
|
17
|
+
market: str = typer.Option("us", "--market", help="Yelp site; see `yelp markets`"),
|
|
18
|
+
category: str | None = typer.Option(None, "--category", help="Yelp category alias, e.g. pizza"),
|
|
19
|
+
sort_by: str = typer.Option(
|
|
20
|
+
"recommended", "--sort-by", help="recommended, rating, review_count"
|
|
21
|
+
),
|
|
22
|
+
price: str | None = typer.Option(None, "--price", help="Comma-separated levels 1-4, e.g. 1,2"),
|
|
23
|
+
features: str | None = typer.Option(
|
|
24
|
+
None, "--features", help="Comma-separated, e.g. delivery,takeout"
|
|
25
|
+
),
|
|
26
|
+
page: int = typer.Option(1, "--page", help="Page 1-11, ten businesses each"),
|
|
27
|
+
fmt: str = FMT,
|
|
28
|
+
fields: str | None = FIELDS,
|
|
29
|
+
) -> None:
|
|
30
|
+
"""Search ranked Yelp businesses; ads are separate. 15 credits; empty results free."""
|
|
31
|
+
data = api_get(
|
|
32
|
+
"/v1/yelp/search",
|
|
33
|
+
{
|
|
34
|
+
"location": location,
|
|
35
|
+
"query": query,
|
|
36
|
+
"market": market,
|
|
37
|
+
"category": category,
|
|
38
|
+
"sort_by": sort_by,
|
|
39
|
+
"price": price,
|
|
40
|
+
"features": features,
|
|
41
|
+
"page": page,
|
|
42
|
+
},
|
|
43
|
+
)
|
|
44
|
+
render(data, fmt, fields, preserve_envelope=True)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@app.command()
|
|
48
|
+
def markets(fmt: str = FMT, fields: str | None = FIELDS) -> None:
|
|
49
|
+
"""List the Yelp sites this API searches. Free."""
|
|
50
|
+
render(api_get("/v1/yelp/markets"), fmt, fields, preserve_envelope=True)
|
|
@@ -54,6 +54,7 @@ from scrapebadger_cli.commands import (
|
|
|
54
54
|
web,
|
|
55
55
|
yahoo,
|
|
56
56
|
yandex,
|
|
57
|
+
yelp,
|
|
57
58
|
youtube,
|
|
58
59
|
zillow,
|
|
59
60
|
)
|
|
@@ -79,7 +80,7 @@ def _main(
|
|
|
79
80
|
|
|
80
81
|
app.add_typer(twitter.app, name="twitter", help="Twitter/X data commands")
|
|
81
82
|
app.add_typer(reddit.app, name="reddit", help="Reddit data commands")
|
|
82
|
-
app.add_typer(github.app, name="github", help="GitHub public profile commands")
|
|
83
|
+
app.add_typer(github.app, name="github", help="GitHub public repository and profile commands")
|
|
83
84
|
app.add_typer(instagram.app, name="instagram", help="Instagram data commands")
|
|
84
85
|
app.add_typer(stream.app, name="stream", help="Real-time streaming commands")
|
|
85
86
|
app.add_typer(vinted.app, name="vinted", help="Vinted marketplace commands")
|
|
@@ -109,6 +110,7 @@ app.add_typer(baidu.app, name="baidu", help="Baidu search engine commands")
|
|
|
109
110
|
app.add_typer(naver.app, name="naver", help="Naver search, place & shopping commands")
|
|
110
111
|
app.add_typer(duckduckgo.app, name="duckduckgo", help="DuckDuckGo search commands")
|
|
111
112
|
app.add_typer(yandex.app, name="yandex", help="Yandex search commands")
|
|
113
|
+
app.add_typer(yelp.app, name="yelp", help="Yelp business search commands")
|
|
112
114
|
app.add_typer(realtor.app, name="realtor", help="Realtor real-estate commands")
|
|
113
115
|
app.add_typer(loopnet.app, name="loopnet", help="LoopNet commercial real estate commands")
|
|
114
116
|
app.add_typer(airbnb.app, name="airbnb", help="Airbnb stays, availability and experiences commands")
|
|
@@ -122,7 +124,7 @@ app.add_typer(apartments.app, name="apartments", help="Apartments.com rental com
|
|
|
122
124
|
app.add_typer(linkedin.app, name="linkedin", help="LinkedIn public data commands")
|
|
123
125
|
app.add_typer(chatgpt.app, name="chatgpt", help="ChatGPT LLM scraping commands")
|
|
124
126
|
app.add_typer(perplexity.app, name="perplexity", help="Perplexity AI answer-engine commands")
|
|
125
|
-
app.add_typer(autoscout24.app, name="autoscout24", help="AutoScout24 vehicle search
|
|
127
|
+
app.add_typer(autoscout24.app, name="autoscout24", help="AutoScout24 vehicle search and listings")
|
|
126
128
|
app.add_typer(copilot.app, name="copilot", help="Microsoft Copilot answer-engine commands")
|
|
127
129
|
app.add_typer(gemini.app, name="gemini", help="Google Gemini LLM commands")
|
|
128
130
|
app.add_typer(
|
|
@@ -58,6 +58,36 @@ def test_markets_remains_a_static_reference_call(monkeypatch):
|
|
|
58
58
|
call.assert_called_once_with("/v1/autoscout24/markets")
|
|
59
59
|
|
|
60
60
|
|
|
61
|
+
@pytest.mark.parametrize(
|
|
62
|
+
"arguments,params",
|
|
63
|
+
[
|
|
64
|
+
(
|
|
65
|
+
[
|
|
66
|
+
"--url",
|
|
67
|
+
"https://www.autoscout24.be/fr/offres/golf-3124825e-43e6-45d4-8987-775b827fb166",
|
|
68
|
+
],
|
|
69
|
+
{
|
|
70
|
+
"url": "https://www.autoscout24.be/fr/offres/golf-3124825e-43e6-45d4-8987-775b827fb166",
|
|
71
|
+
"listing_id": None,
|
|
72
|
+
"market": None,
|
|
73
|
+
},
|
|
74
|
+
),
|
|
75
|
+
(
|
|
76
|
+
["--listing-id", "3124825e-43e6-45d4-8987-775b827fb166", "--market", "be"],
|
|
77
|
+
{"url": None, "listing_id": "3124825e-43e6-45d4-8987-775b827fb166", "market": "be"},
|
|
78
|
+
),
|
|
79
|
+
],
|
|
80
|
+
)
|
|
81
|
+
def test_detail_url_and_id_handoffs_preserve_envelope(monkeypatch, arguments, params):
|
|
82
|
+
data = {"market": "be", "listing": {"id": "3124825e-43e6-45d4-8987-775b827fb166"}}
|
|
83
|
+
call = Mock(return_value=data)
|
|
84
|
+
monkeypatch.setattr(autoscout24, "api_get", call)
|
|
85
|
+
result = CliRunner().invoke(autoscout24.app, ["listing", *arguments])
|
|
86
|
+
assert result.exit_code == 0, result.output
|
|
87
|
+
call.assert_called_once_with("/v1/autoscout24/listing", params)
|
|
88
|
+
assert json.loads(result.stdout) == data
|
|
89
|
+
|
|
90
|
+
|
|
61
91
|
@pytest.mark.parametrize("count", [0, 1, 2])
|
|
62
92
|
def test_json_preserves_pagination_for_every_row_count(monkeypatch, count):
|
|
63
93
|
data = {
|
|
@@ -9,6 +9,33 @@ from scrapebadger_cli.main import app
|
|
|
9
9
|
from typer.testing import CliRunner
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
def test_repository_forwards_two_encoded_identifiers_and_preserves_envelope(monkeypatch):
|
|
13
|
+
payload = {
|
|
14
|
+
"repository": {"full_name": "example/project", "watchers": 0},
|
|
15
|
+
"readme": {"text": "Example", "html": "<p>Example</p>"},
|
|
16
|
+
"files": [],
|
|
17
|
+
"additional_source_field": {"available": False},
|
|
18
|
+
}
|
|
19
|
+
call = Mock(return_value=payload)
|
|
20
|
+
monkeypatch.setattr(github, "api_get", call)
|
|
21
|
+
result = CliRunner().invoke(app, ["github", "repository", "a/b?c", "project+?#雪"])
|
|
22
|
+
assert result.exit_code == 0, result.output
|
|
23
|
+
call.assert_called_once_with("/v1/github/repositories/a%2Fb%3Fc/project%2B%3F%23%E9%9B%AA")
|
|
24
|
+
assert json.loads(result.output) == payload
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@pytest.mark.parametrize(
|
|
28
|
+
"owner,repo", [(".", "project"), ("..", "project"), ("owner", "."), ("owner", "..")]
|
|
29
|
+
)
|
|
30
|
+
def test_repository_dot_segments_never_reach_http(monkeypatch, owner, repo):
|
|
31
|
+
call = Mock()
|
|
32
|
+
monkeypatch.setattr(github, "api_get", call)
|
|
33
|
+
result = CliRunner().invoke(app, ["github", "repository", owner, repo])
|
|
34
|
+
assert result.exit_code != 0
|
|
35
|
+
assert "dot path segments" in result.output
|
|
36
|
+
call.assert_not_called()
|
|
37
|
+
|
|
38
|
+
|
|
12
39
|
@pytest.mark.parametrize(
|
|
13
40
|
("options", "expected"),
|
|
14
41
|
[
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from unittest.mock import Mock
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
CliRunner = pytest.importorskip("typer.testing").CliRunner
|
|
6
|
+
google = pytest.importorskip(
|
|
7
|
+
"scrapebadger_cli.commands.google", reason="CLI is tested with its own installed package"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_light_search_uses_dedicated_route(monkeypatch):
|
|
12
|
+
call = Mock(return_value={"organic_results": []})
|
|
13
|
+
monkeypatch.setattr(google, "api_get", call)
|
|
14
|
+
monkeypatch.setattr(google, "render", Mock())
|
|
15
|
+
result = CliRunner().invoke(
|
|
16
|
+
google.app, ["light-search", "vinted api", "--gl", "us", "--start", "10"]
|
|
17
|
+
)
|
|
18
|
+
assert result.exit_code == 0, result.output
|
|
19
|
+
path, params = call.call_args.args
|
|
20
|
+
assert path == "/v1/google/light/search"
|
|
21
|
+
assert params["q"] == "vinted api" and params["start"] == 10
|
|
22
|
+
assert "mode" not in params
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@pytest.mark.parametrize("command", ["search", "light-search"])
|
|
26
|
+
def test_targeting_options_are_forwarded(monkeypatch, command):
|
|
27
|
+
call = Mock(return_value={"organic_results": []})
|
|
28
|
+
monkeypatch.setattr(google, "api_get", call)
|
|
29
|
+
monkeypatch.setattr(google, "render", Mock())
|
|
30
|
+
result = CliRunner().invoke(
|
|
31
|
+
google.app,
|
|
32
|
+
[
|
|
33
|
+
command,
|
|
34
|
+
"vinted api",
|
|
35
|
+
"--location",
|
|
36
|
+
"New York, USA",
|
|
37
|
+
"--no-cache",
|
|
38
|
+
"--as-sitesearch",
|
|
39
|
+
"github.com",
|
|
40
|
+
"--color-scheme",
|
|
41
|
+
"dark",
|
|
42
|
+
],
|
|
43
|
+
)
|
|
44
|
+
assert result.exit_code == 0, result.output
|
|
45
|
+
params = call.call_args.args[1]
|
|
46
|
+
assert params["location"] == "New York, USA"
|
|
47
|
+
assert params["no_cache"] is True
|
|
48
|
+
assert params["as_sitesearch"] == "github.com"
|
|
49
|
+
assert params["color_scheme"] == "dark"
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_raw_html_format_does_not_enter_json_renderer(monkeypatch):
|
|
53
|
+
call = Mock(return_value=b"<html>results</html>")
|
|
54
|
+
monkeypatch.setattr(google, "api_get_raw", call)
|
|
55
|
+
render = Mock(side_effect=AssertionError("HTML must not enter JSON renderer"))
|
|
56
|
+
monkeypatch.setattr(google, "render", render)
|
|
57
|
+
result = CliRunner().invoke(
|
|
58
|
+
google.app, ["search", "cats", "--tbm", "isch", "--response-format", "html"]
|
|
59
|
+
)
|
|
60
|
+
assert result.exit_code == 0, result.output
|
|
61
|
+
assert result.output.strip() == "<html>results</html>"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from unittest.mock import Mock
|
|
2
|
+
|
|
3
|
+
from scrapebadger_cli.commands import yelp
|
|
4
|
+
from typer.testing import CliRunner
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_search_filters_and_pagination_reach_gateway(monkeypatch):
|
|
8
|
+
call = Mock(return_value={"results": [], "ads": []})
|
|
9
|
+
render = Mock()
|
|
10
|
+
monkeypatch.setattr(yelp, "api_get", call)
|
|
11
|
+
monkeypatch.setattr(yelp, "render", render)
|
|
12
|
+
result = CliRunner().invoke(
|
|
13
|
+
yelp.app,
|
|
14
|
+
[
|
|
15
|
+
"search",
|
|
16
|
+
"San Francisco, CA",
|
|
17
|
+
"-q",
|
|
18
|
+
"pizza",
|
|
19
|
+
"--category",
|
|
20
|
+
"pizza",
|
|
21
|
+
"--sort-by",
|
|
22
|
+
"review_count",
|
|
23
|
+
"--price",
|
|
24
|
+
"1,2",
|
|
25
|
+
"--features",
|
|
26
|
+
"delivery,takeout",
|
|
27
|
+
"--page",
|
|
28
|
+
"3",
|
|
29
|
+
],
|
|
30
|
+
)
|
|
31
|
+
assert result.exit_code == 0, result.output
|
|
32
|
+
path, params = call.call_args.args
|
|
33
|
+
assert path == "/v1/yelp/search"
|
|
34
|
+
assert params == {
|
|
35
|
+
"location": "San Francisco, CA",
|
|
36
|
+
"query": "pizza",
|
|
37
|
+
"market": "us",
|
|
38
|
+
"category": "pizza",
|
|
39
|
+
"sort_by": "review_count",
|
|
40
|
+
"price": "1,2",
|
|
41
|
+
"features": "delivery,takeout",
|
|
42
|
+
"page": 3,
|
|
43
|
+
}
|
|
44
|
+
# Totals, ads and the next page survive any output format.
|
|
45
|
+
assert render.call_args.kwargs == {"preserve_envelope": True}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_location_is_required_and_markets_is_a_reference_call(monkeypatch):
|
|
49
|
+
call = Mock(return_value={"markets": []})
|
|
50
|
+
monkeypatch.setattr(yelp, "api_get", call)
|
|
51
|
+
monkeypatch.setattr(yelp, "render", Mock())
|
|
52
|
+
assert CliRunner().invoke(yelp.app, ["search"]).exit_code != 0
|
|
53
|
+
result = CliRunner().invoke(yelp.app, ["markets"])
|
|
54
|
+
assert result.exit_code == 0, result.output
|
|
55
|
+
call.assert_called_once_with("/v1/yelp/markets")
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
from unittest.mock import Mock
|
|
2
|
-
|
|
3
|
-
import pytest
|
|
4
|
-
|
|
5
|
-
CliRunner = pytest.importorskip("typer.testing").CliRunner
|
|
6
|
-
google = pytest.importorskip(
|
|
7
|
-
"scrapebadger_cli.commands.google", reason="CLI is tested with its own installed package"
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def test_light_search_uses_dedicated_route(monkeypatch):
|
|
12
|
-
call = Mock(return_value={"organic_results": []})
|
|
13
|
-
monkeypatch.setattr(google, "api_get", call)
|
|
14
|
-
monkeypatch.setattr(google, "render", Mock())
|
|
15
|
-
result = CliRunner().invoke(
|
|
16
|
-
google.app, ["light-search", "vinted api", "--gl", "us", "--start", "10"]
|
|
17
|
-
)
|
|
18
|
-
assert result.exit_code == 0, result.output
|
|
19
|
-
path, params = call.call_args.args
|
|
20
|
-
assert path == "/v1/google/light/search"
|
|
21
|
-
assert params["q"] == "vinted api" and params["start"] == 10
|
|
22
|
-
assert "mode" not in params
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/aliexpress.py
RENAMED
|
File without changes
|
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/apartments.py
RENAMED
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/app_store.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/bestbuy.py
RENAMED
|
File without changes
|
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/booking.py
RENAMED
|
File without changes
|
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/chatgpt.py
RENAMED
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/copilot.py
RENAMED
|
File without changes
|
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/duckduckgo.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/facebook.py
RENAMED
|
File without changes
|
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/google_play.py
RENAMED
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/gumtree.py
RENAMED
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/idealista.py
RENAMED
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/immobiliare.py
RENAMED
|
File without changes
|
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/instagram.py
RENAMED
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/leboncoin.py
RENAMED
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/linkedin.py
RENAMED
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/loopnet.py
RENAMED
|
File without changes
|
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/onboarding.py
RENAMED
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/perplexity.py
RENAMED
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/realtor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/twitter.py
RENAMED
|
File without changes
|
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/wallapop.py
RENAMED
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/walmart.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scrapebadger_cli-0.28.1 → scrapebadger_cli-0.30.0}/src/scrapebadger_cli/commands/youtube.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|