scrapebadger-cli 0.31.0__tar.gz → 0.34.1__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.
Files changed (87) hide show
  1. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/.gitignore +18 -0
  2. scrapebadger_cli-0.34.1/CHANGELOG.md +38 -0
  3. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/PKG-INFO +29 -10
  4. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/README.md +28 -9
  5. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/pyproject.toml +1 -1
  6. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/agent.py +2 -30
  7. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/amazon.py +10 -0
  8. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/facebook.py +8 -0
  9. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/google.py +83 -9
  10. scrapebadger_cli-0.34.1/src/scrapebadger_cli/commands/grok.py +67 -0
  11. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/linkedin.py +12 -0
  12. scrapebadger_cli-0.34.1/src/scrapebadger_cli/commands/meta_ai.py +35 -0
  13. scrapebadger_cli-0.34.1/src/scrapebadger_cli/commands/rufus.py +30 -0
  14. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/stream.py +0 -12
  15. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/main.py +6 -1
  16. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/results.py +0 -2
  17. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/tests/test_agent_features.py +2 -2
  18. scrapebadger_cli-0.34.1/tests/test_google_resolve.py +94 -0
  19. scrapebadger_cli-0.34.1/tests/test_grok_commands.py +59 -0
  20. scrapebadger_cli-0.34.1/tests/test_marketplace_monitor.py +58 -0
  21. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/uv.lock +1 -1
  22. scrapebadger_cli-0.31.0/CHANGELOG.md +0 -12
  23. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/__init__.py +0 -0
  24. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/availability.py +0 -0
  25. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/client.py +0 -0
  26. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/__init__.py +0 -0
  27. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/airbnb.py +0 -0
  28. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/aliexpress.py +0 -0
  29. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/apartments.py +0 -0
  30. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/app_store.py +0 -0
  31. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/asos.py +0 -0
  32. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/auth.py +0 -0
  33. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/autoscout24.py +0 -0
  34. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/baidu.py +0 -0
  35. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/bestbuy.py +0 -0
  36. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/bing.py +0 -0
  37. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/booking.py +0 -0
  38. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/brave.py +0 -0
  39. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/chatgpt.py +0 -0
  40. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/copilot.py +0 -0
  41. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/depop.py +0 -0
  42. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/duckduckgo.py +0 -0
  43. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/ebay.py +0 -0
  44. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/etsy.py +0 -0
  45. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/gemini.py +0 -0
  46. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/github.py +0 -0
  47. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/google_play.py +0 -0
  48. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/gumtree.py +0 -0
  49. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/idealista.py +0 -0
  50. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/immobiliare.py +0 -0
  51. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/init.py +0 -0
  52. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/instagram.py +0 -0
  53. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/leboncoin.py +0 -0
  54. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/loopnet.py +0 -0
  55. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/naver.py +0 -0
  56. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/onboarding.py +0 -0
  57. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/perplexity.py +0 -0
  58. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/realtor.py +0 -0
  59. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/reddit.py +0 -0
  60. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/redfin.py +0 -0
  61. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/target.py +0 -0
  62. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/tiktok.py +0 -0
  63. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/twitter.py +0 -0
  64. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/vinted.py +0 -0
  65. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/wallapop.py +0 -0
  66. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/walmart.py +0 -0
  67. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/web.py +0 -0
  68. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/yahoo.py +0 -0
  69. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/yandex.py +0 -0
  70. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/yelp.py +0 -0
  71. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/youtube.py +0 -0
  72. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/commands/zillow.py +0 -0
  73. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/config.py +0 -0
  74. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/output.py +0 -0
  75. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/src/scrapebadger_cli/views.py +0 -0
  76. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/tests/conftest.py +0 -0
  77. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/tests/test_autoscout24_commands.py +0 -0
  78. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/tests/test_brave.py +0 -0
  79. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/tests/test_cli_availability.py +0 -0
  80. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/tests/test_copilot_commands.py +0 -0
  81. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/tests/test_github.py +0 -0
  82. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/tests/test_google_light_search.py +0 -0
  83. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/tests/test_naver.py +0 -0
  84. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/tests/test_perplexity_strict_country.py +0 -0
  85. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/tests/test_tiktok_pagination.py +0 -0
  86. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/tests/test_vinted_image_search.py +0 -0
  87. {scrapebadger_cli-0.31.0 → scrapebadger_cli-0.34.1}/tests/test_yelp_commands.py +0 -0
@@ -194,3 +194,21 @@ apps/portal/public/uploads/support/*
194
194
 
195
195
  # Instagram account pool seed (purchased credentials — never commit)
196
196
  scrapers/instagram/.secrets/
197
+
198
+ # Account and proxy credential files (SCR-710): never commit them. accountd imports vendor files
199
+ # (POST /v1/files, sb-accounts import) and keeps them sealed; local copies stay untracked.
200
+ # Templates (*.example) and synthetic test fixtures (testdata/) stay tracked; the commit gate
201
+ # (tools/agent/secretscan --staged, account rules) checks those for real-looking values.
202
+ accounts*.txt
203
+ *accounts*.csv
204
+ *accounts*.xlsx
205
+ proxies.txt
206
+ *-vendor-accounts-*
207
+ !*.example
208
+ !**/testdata/**
209
+
210
+ # Agent kit (tools/agent): per-machine settings, launcher-written Kimi MCP file, local investigations
211
+ tools/agent/local.json
212
+ .kimi-code/
213
+ .investigations/
214
+ tools/agent/evals/out/
@@ -0,0 +1,38 @@
1
+ # Changelog
2
+
3
+ ## 0.34.1 — 2026-11-25
4
+
5
+ - `scrapebadger google maps-photos`: the help text says what the API returns. Photos
6
+ are one page, usually the first 8 that Google exposes, and `pagination.total_results`
7
+ is the place's total photo count on Google. `--next-page-token` is accepted but has
8
+ no effect (SCR-711).
9
+
10
+ ## 0.34.0 — 2026-11-23
11
+
12
+ - Add `scrapebadger google resolve`: get the real URLs of search results whose `link`
13
+ is a `google.com/goto` redirect (`POST /v1/google/resolve`, 0 credits). Pass
14
+ `link_token` values, or `--file` with a saved search or resolve response.
15
+
16
+ ## 0.33.0 — 2026-11-09
17
+
18
+ - Remove `scrapebadger stream delivery-logs`: ScrapeBadger no longer stores delivered
19
+ tweets (SCR-396), so `GET /v1/twitter/stream/logs` answers 410. Keep your own log
20
+ where your webhook or WebSocket receives the tweets.
21
+
22
+ ## 0.32.0 — 2026-11-09
23
+
24
+ - Remove `scrapebadger results get`: the API no longer keeps results after a call
25
+ (SCR-396), so `GET /v1/results/{id}` is gone. Local saves (`scrapebadger view`)
26
+ are unchanged; the saved line no longer prints a `result_id`.
27
+ - Google `--no-cache` is accepted and ignored: responses are never cached.
28
+
29
+ ## 0.30.0 — 2026-11-07
30
+
31
+ - Expose Google Search and Light targeting, advanced filters, and `--no-cache`.
32
+ - Add `--response-format html` for raw search pages, including Google verticals.
33
+
34
+
35
+ ## 0.29.0 — 2026-11-07
36
+
37
+ - Add AutoScout24 listing details and GitHub repository operations.
38
+ - 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.31.0
3
+ Version: 0.34.1
4
4
  Summary: ScrapeBadger CLI — Twitter, Vinted, Google, and Web Scraping from the command line
5
5
  Author: ScrapeBadger Team
6
6
  License: MIT
@@ -30,7 +30,7 @@ scrapebadger google light-search "vinted api" --gl us --hl en
30
30
  ```
31
31
 
32
32
  Light returns organic results and related searches for 10 credits per successful
33
- uncached request. Regular `scrapebadger google search` costs 20 credits and
33
+ request. Regular `scrapebadger google search` costs 20 credits and
34
34
  returns the full SERP. Cache hits and failed requests are free.
35
35
 
36
36
  Command-line access to ScrapeBadger APIs, including Etsy, AliExpress, Target, ASOS, Best Buy, search engines, social media and general web scraping.
@@ -80,14 +80,14 @@ to your human. A trial key works only from the IP that created it, on read APIs,
80
80
  at 10 requests/min, and not through the hosted MCP server. It refuses to replace an
81
81
  account key unless you pass `--force`.
82
82
 
83
- ## Saved results and free re-reads
83
+ ## Saved results
84
84
 
85
85
  Every API command also writes its full JSON response to
86
86
  `~/.cache/scrapebadger/results/<api>-<command>-<UTC timestamp>.json` (honours
87
87
  `XDG_CACHE_HOME`; the newest 200 are kept) and prints one line to stderr:
88
88
 
89
89
  ```
90
- saved: ~/.cache/scrapebadger/results/google-search-20261023T101500123456Z.json · credits: 20 · result_id: 6f1c...
90
+ saved: ~/.cache/scrapebadger/results/google-search-20261023T101500123456Z.json · credits: 20
91
91
  ```
92
92
 
93
93
  stdout is unchanged. Disable with `scrapebadger --no-save ...` or `SCRAPEBADGER_SAVE=0`.
@@ -104,11 +104,9 @@ scrapebadger view path/to/result.json --jq '.organic_results[].link' # needs j
104
104
  top-level array, else the largest top-level list); truncation adds
105
105
  `"_truncated": {"path", "kept", "total"}`.
106
106
 
107
- Re-read a result from the server within ~15 minutes, free, sliced server-side:
108
-
109
- ```bash
110
- scrapebadger results get <result_id> --max-items 3 --fields id,text
111
- ```
107
+ ScrapeBadger keeps no copy of a result after the call, so this local file is
108
+ the only one: re-slicing it is free, while running the command again is a new,
109
+ billed request.
112
110
 
113
111
  ## Quotes, bug reports and feedback (all free)
114
112
 
@@ -132,6 +130,27 @@ upgrade or claim link when you are out of credits.
132
130
  | `SCRAPEBADGER_MCP_URL` | `https://mcp.scrapebadger.com/mcp` | MCP server `init` registers |
133
131
  | `SCRAPEBADGER_SAVE` | `1` | `0` disables saving results |
134
132
 
133
+ ## Google result links (0.34.0+)
134
+
135
+ Google hides a result's URL behind a redirect (`https://www.google.com/goto?url=...`)
136
+ and paces how fast a result page's links can be followed. `google search` and
137
+ `google light-search` give every organic result whose `link` is still such a redirect
138
+ a `link_token` and `retry_after_seconds` (0 means it can be resolved right away).
139
+ `google resolve` returns the real URLs. It costs 0 credits.
140
+
141
+ ```bash
142
+ scrapebadger google search "vinted api" # prints "saved: <file>" on stderr
143
+ scrapebadger google resolve --file <file> # sends the rows that carry a link_token
144
+ scrapebadger google resolve <link_token> <link_token>
145
+ ```
146
+
147
+ Each row comes back resolved (`link` is the result's own URL, no `link_token`), not
148
+ ready (`link_token` and `retry_after_seconds`) or failed (`link_token` and `error`;
149
+ do not send it again). The top-level `retry_after_seconds` is the smallest wait among
150
+ the rows that are not ready. Wait that long, then run `google resolve --file` on the
151
+ saved resolve response: only the rows that are not ready are sent, with their latest
152
+ `link_token`. `--file -` reads the JSON from stdin. At most 25 results per call.
153
+
135
154
  ## Vinted mobile data (0.14.0+)
136
155
 
137
156
  ```sh
@@ -180,7 +199,7 @@ public default branch and accepts no pagination, market or ref options.
180
199
  scrapebadger github repository cli cli
181
200
  ```
182
201
 
183
- A successful uncached detail response costs 10 credits. Errors are unbilled;
202
+ A successful detail response costs 10 credits. Errors are unbilled;
184
203
  cache hits can be free. The raw JSON retains README, root files, latest commit,
185
204
  metadata and additive fields. Reference: https://docs.scrapebadger.com/github/repositories.
186
205
 
@@ -7,7 +7,7 @@ scrapebadger google light-search "vinted api" --gl us --hl en
7
7
  ```
8
8
 
9
9
  Light returns organic results and related searches for 10 credits per successful
10
- uncached request. Regular `scrapebadger google search` costs 20 credits and
10
+ request. Regular `scrapebadger google search` costs 20 credits and
11
11
  returns the full SERP. Cache hits and failed requests are free.
12
12
 
13
13
  Command-line access to ScrapeBadger APIs, including Etsy, AliExpress, Target, ASOS, Best Buy, search engines, social media and general web scraping.
@@ -57,14 +57,14 @@ to your human. A trial key works only from the IP that created it, on read APIs,
57
57
  at 10 requests/min, and not through the hosted MCP server. It refuses to replace an
58
58
  account key unless you pass `--force`.
59
59
 
60
- ## Saved results and free re-reads
60
+ ## Saved results
61
61
 
62
62
  Every API command also writes its full JSON response to
63
63
  `~/.cache/scrapebadger/results/<api>-<command>-<UTC timestamp>.json` (honours
64
64
  `XDG_CACHE_HOME`; the newest 200 are kept) and prints one line to stderr:
65
65
 
66
66
  ```
67
- saved: ~/.cache/scrapebadger/results/google-search-20261023T101500123456Z.json · credits: 20 · result_id: 6f1c...
67
+ saved: ~/.cache/scrapebadger/results/google-search-20261023T101500123456Z.json · credits: 20
68
68
  ```
69
69
 
70
70
  stdout is unchanged. Disable with `scrapebadger --no-save ...` or `SCRAPEBADGER_SAVE=0`.
@@ -81,11 +81,9 @@ scrapebadger view path/to/result.json --jq '.organic_results[].link' # needs j
81
81
  top-level array, else the largest top-level list); truncation adds
82
82
  `"_truncated": {"path", "kept", "total"}`.
83
83
 
84
- Re-read a result from the server within ~15 minutes, free, sliced server-side:
85
-
86
- ```bash
87
- scrapebadger results get <result_id> --max-items 3 --fields id,text
88
- ```
84
+ ScrapeBadger keeps no copy of a result after the call, so this local file is
85
+ the only one: re-slicing it is free, while running the command again is a new,
86
+ billed request.
89
87
 
90
88
  ## Quotes, bug reports and feedback (all free)
91
89
 
@@ -109,6 +107,27 @@ upgrade or claim link when you are out of credits.
109
107
  | `SCRAPEBADGER_MCP_URL` | `https://mcp.scrapebadger.com/mcp` | MCP server `init` registers |
110
108
  | `SCRAPEBADGER_SAVE` | `1` | `0` disables saving results |
111
109
 
110
+ ## Google result links (0.34.0+)
111
+
112
+ Google hides a result's URL behind a redirect (`https://www.google.com/goto?url=...`)
113
+ and paces how fast a result page's links can be followed. `google search` and
114
+ `google light-search` give every organic result whose `link` is still such a redirect
115
+ a `link_token` and `retry_after_seconds` (0 means it can be resolved right away).
116
+ `google resolve` returns the real URLs. It costs 0 credits.
117
+
118
+ ```bash
119
+ scrapebadger google search "vinted api" # prints "saved: <file>" on stderr
120
+ scrapebadger google resolve --file <file> # sends the rows that carry a link_token
121
+ scrapebadger google resolve <link_token> <link_token>
122
+ ```
123
+
124
+ Each row comes back resolved (`link` is the result's own URL, no `link_token`), not
125
+ ready (`link_token` and `retry_after_seconds`) or failed (`link_token` and `error`;
126
+ do not send it again). The top-level `retry_after_seconds` is the smallest wait among
127
+ the rows that are not ready. Wait that long, then run `google resolve --file` on the
128
+ saved resolve response: only the rows that are not ready are sent, with their latest
129
+ `link_token`. `--file -` reads the JSON from stdin. At most 25 results per call.
130
+
112
131
  ## Vinted mobile data (0.14.0+)
113
132
 
114
133
  ```sh
@@ -157,7 +176,7 @@ public default branch and accepts no pagination, market or ref options.
157
176
  scrapebadger github repository cli cli
158
177
  ```
159
178
 
160
- A successful uncached detail response costs 10 credits. Errors are unbilled;
179
+ A successful detail response costs 10 credits. Errors are unbilled;
161
180
  cache hits can be free. The raw JSON retains README, root files, latest commit,
162
181
  metadata and additive fields. Reference: https://docs.scrapebadger.com/github/repositories.
163
182
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "scrapebadger-cli"
3
- version = "0.31.0"
3
+ version = "0.34.1"
4
4
  description = "ScrapeBadger CLI — Twitter, Vinted, Google, and Web Scraping from the command line"
5
5
  requires-python = ">=3.10"
6
6
  license = {text = "MIT"}
@@ -1,4 +1,4 @@
1
- """Agent helpers: view saved results, re-read results, quote, feedback."""
1
+ """Agent helpers: view saved results, quote, feedback."""
2
2
 
3
3
  import json
4
4
  import shutil
@@ -10,12 +10,10 @@ from typing import Any
10
10
  import typer
11
11
 
12
12
  from scrapebadger_cli import results as saved
13
- from scrapebadger_cli.client import api_get, api_post
13
+ from scrapebadger_cli.client import api_post
14
14
  from scrapebadger_cli.output import console, render
15
15
  from scrapebadger_cli.views import apply_view, summary
16
16
 
17
- results_app = typer.Typer(no_args_is_help=True)
18
-
19
17
  FMT = typer.Option("json", "--output", "-o", help="Output format: json, csv, table, markdown")
20
18
  JQ = typer.Option(None, "--jq", help="jq expression to run on the result")
21
19
  FIELDS = typer.Option(None, "--fields", help="Comma-separated (dotted) fields of each item to keep")
@@ -103,32 +101,6 @@ def view(
103
101
  render(data, fmt)
104
102
 
105
103
 
106
- @results_app.command("get")
107
- def results_get(
108
- result_id: str = typer.Argument(..., help="X-Result-ID of an earlier call (kept ~15 min)"),
109
- jq: str | None = JQ,
110
- fields: str | None = FIELDS,
111
- max_items: int | None = MAX_ITEMS,
112
- show_summary: bool = SUMMARY,
113
- fmt: str = FMT,
114
- ) -> None:
115
- """Re-read an earlier result from the server, free, optionally sliced server-side."""
116
- data = api_get(
117
- f"/v1/results/{result_id}",
118
- {
119
- "jq": jq,
120
- "fields": fields,
121
- "max_items": max_items,
122
- "summary": "true" if show_summary else None,
123
- },
124
- save=False,
125
- )
126
- if fmt == "json":
127
- _print_json(data)
128
- else:
129
- render(data, fmt)
130
-
131
-
132
104
  def _parse_params(pairs: list[str]) -> dict[str, str]:
133
105
  params = {}
134
106
  for pair in pairs:
@@ -93,6 +93,12 @@ def reviews(
93
93
  star: str | None = typer.Option(None, "--star", help="e.g. five_star, critical"),
94
94
  verified_only: bool = typer.Option(False, "--verified-only"),
95
95
  media_only: bool = typer.Option(False, "--media-only"),
96
+ mode: str = typer.Option("public", "--mode", help="public with pool fallback, or full"),
97
+ max_pages: int = typer.Option(10, "--max-pages", help="Authenticated pages per star sweep"),
98
+ per_star: bool = typer.Option(
99
+ False, "--per-star", help="Sweep every star filter and deduplicate"
100
+ ),
101
+ limit: int | None = typer.Option(None, "--limit", help="Stop after this many distinct reviews"),
96
102
  fmt: str = FMT,
97
103
  fields: str | None = FIELDS,
98
104
  ) -> None:
@@ -106,6 +112,10 @@ def reviews(
106
112
  "star": star,
107
113
  "verified_only": verified_only,
108
114
  "media_only": media_only,
115
+ "mode": mode,
116
+ "max_pages": max_pages,
117
+ "per_star": per_star,
118
+ "limit": limit,
109
119
  },
110
120
  )
111
121
  render(data, fmt, fields)
@@ -39,6 +39,12 @@ def marketplace_search(
39
39
  radius: int | None = typer.Option(
40
40
  None, "--radius", help="Search radius around the location (km, or miles in the US)"
41
41
  ),
42
+ strict_filters: bool = typer.Option(
43
+ False, "--strict-filters", help="Enforce radius (km) and age; partial public coverage"
44
+ ),
45
+ include_details: bool = typer.Option(
46
+ False, "--include-details", help="Include descriptions and all public photos"
47
+ ),
42
48
  after: str | None = AFTER,
43
49
  fmt: str = FMT,
44
50
  fields: str | None = FIELDS,
@@ -57,6 +63,8 @@ def marketplace_search(
57
63
  "delivery_method": delivery_method,
58
64
  "radius": radius,
59
65
  "after": after,
66
+ "strict_filters": strict_filters,
67
+ "include_details": include_details,
60
68
  },
61
69
  )
62
70
  render(data, fmt, fields)
@@ -13,9 +13,13 @@ Typical workflow:
13
13
  scrapebadger google product-detail 7768723536481519578 --q "laptop" --include-offers
14
14
  """
15
15
 
16
+ import json
17
+ import sys
18
+ from pathlib import Path
19
+
16
20
  import typer
17
21
 
18
- from scrapebadger_cli.client import api_get, api_get_raw
22
+ from scrapebadger_cli.client import api_get, api_get_raw, api_post
19
23
  from scrapebadger_cli.output import render
20
24
 
21
25
  app = typer.Typer(no_args_is_help=True)
@@ -83,9 +87,7 @@ def search(
83
87
  "--udm",
84
88
  help="Google result filter: 14 web, 18 forums. Other verticals require output=html.",
85
89
  ),
86
- no_cache: bool = typer.Option(
87
- False, "--no-cache", help="Bypass result caches and request a fresh Google fetch."
88
- ),
90
+ no_cache: bool = typer.Option(False, "--no-cache", help="Ignored: responses are never cached."),
89
91
  as_dt: str | None = typer.Option(
90
92
  None, "--as-dt", help="Site restriction mode: i includes, e excludes as_sitesearch."
91
93
  ),
@@ -240,9 +242,7 @@ def light_search(
240
242
  "--udm",
241
243
  help="Google result filter: 14 web, 18 forums. Other verticals require output=html.",
242
244
  ),
243
- no_cache: bool = typer.Option(
244
- False, "--no-cache", help="Bypass result caches and request a fresh Google fetch."
245
- ),
245
+ no_cache: bool = typer.Option(False, "--no-cache", help="Ignored: responses are never cached."),
246
246
  as_dt: str | None = typer.Option(
247
247
  None, "--as-dt", help="Site restriction mode: i includes, e excludes as_sitesearch."
248
248
  ),
@@ -341,6 +341,75 @@ def light_search(
341
341
  render(data, fmt, fields)
342
342
 
343
343
 
344
+ # ---------------------------------------------------------------------------
345
+ # Resolve (result links that are still google.com/goto redirects)
346
+ # ---------------------------------------------------------------------------
347
+
348
+ RESOLVE_MAX_RESULTS = 25
349
+
350
+
351
+ def _rows_to_resolve(data: object) -> list[dict]:
352
+ """The rows of a search or resolve response (or a plain list) that still wait for a URL."""
353
+ if isinstance(data, dict):
354
+ data = data.get("organic_results", data.get("results"))
355
+ if not isinstance(data, list):
356
+ raise typer.BadParameter(
357
+ "expected a search response, a resolve response or a list of results",
358
+ param_hint="--file",
359
+ )
360
+ return [
361
+ row
362
+ for row in data
363
+ if isinstance(row, dict)
364
+ and isinstance(row.get("link_token"), str)
365
+ and row["link_token"]
366
+ and not row.get("error")
367
+ ]
368
+
369
+
370
+ @app.command()
371
+ def resolve(
372
+ link_tokens: list[str] | None = typer.Argument(
373
+ None, help="link_token values of organic results from search or light-search"
374
+ ),
375
+ file: str | None = typer.Option(
376
+ None,
377
+ "--file",
378
+ help="JSON file with a saved search or resolve response, or a list of results; - reads stdin",
379
+ ),
380
+ fmt: str = FMT,
381
+ fields: str | None = FIELDS,
382
+ ) -> None:
383
+ """Get the real URLs behind google.com/goto result links. Costs 0 credits.
384
+
385
+ Pass link_token values, or --file with a saved search or resolve response.
386
+ From a file, the rows that still carry a link_token are sent.
387
+ A row comes back resolved (link is the URL), not ready or failed (error).
388
+ Not ready: wait retry_after_seconds, then send the row's new link_token.
389
+ At most 25 results per call.
390
+ """
391
+ if bool(link_tokens) == bool(file):
392
+ raise typer.BadParameter("Pass link_token values or --file, one of the two")
393
+ if file:
394
+ try:
395
+ text = sys.stdin.read() if file == "-" else Path(file).expanduser().read_text()
396
+ rows = _rows_to_resolve(json.loads(text))
397
+ except (OSError, ValueError) as exc:
398
+ raise typer.BadParameter(f"cannot read {file}: {exc}", param_hint="--file") from exc
399
+ else:
400
+ rows = [{"link_token": token} for token in link_tokens or []]
401
+ if not rows:
402
+ typer.echo("Nothing to resolve: no result carries a link_token.", err=True)
403
+ raise typer.Exit(0)
404
+ if len(rows) > RESOLVE_MAX_RESULTS:
405
+ raise typer.BadParameter(
406
+ f"{len(rows)} results to resolve; at most {RESOLVE_MAX_RESULTS} per call"
407
+ )
408
+ data = api_post("/v1/google/resolve", {"results": rows})
409
+ # The envelope carries the top-level retry_after_seconds: keep it in the JSON output.
410
+ render(data, fmt, fields, preserve_envelope=True)
411
+
412
+
344
413
  # ---------------------------------------------------------------------------
345
414
  # Maps (5 endpoints)
346
415
  # ---------------------------------------------------------------------------
@@ -417,11 +486,16 @@ def maps_reviews(
417
486
  def maps_photos(
418
487
  data_id: str = typer.Argument(..., help="Google Maps data ID"),
419
488
  hl: str | None = typer.Option(None, "--hl", help="Language code"),
420
- next_page_token: str | None = typer.Option(None, "--next-page-token", help="Pagination token"),
489
+ next_page_token: str | None = typer.Option(
490
+ None, "--next-page-token", help="Accepted for compatibility; photos are a single page"
491
+ ),
421
492
  fmt: str = FMT,
422
493
  fields: str | None = FIELDS,
423
494
  ) -> None:
424
- """Maps photos for a place."""
495
+ """Maps photos for a place: one page, usually the first 8 that Google exposes.
496
+
497
+ pagination.total_results is the place's total photo count on Google.
498
+ """
425
499
  data = api_get(
426
500
  "/v1/google/maps/photos",
427
501
  {"data_id": data_id, "hl": hl, "next_page_token": next_page_token},
@@ -0,0 +1,67 @@
1
+ import typer
2
+
3
+ from scrapebadger_cli.client import api_get
4
+ from scrapebadger_cli.output import render
5
+
6
+ app = typer.Typer(no_args_is_help=True)
7
+
8
+ FMT = typer.Option("json", "--output", "-o", help="Output format: json, csv, table, markdown")
9
+ FIELDS = typer.Option(None, "--fields", "-f", help="Comma-separated fields to include")
10
+ MODE = typer.Option("auto", "--mode", "-m", help="Assistant mode: auto, fast, expert")
11
+ WEB_SEARCH = typer.Option("auto", "--web-search", "-w", help="Web and X search: auto, force, off")
12
+
13
+
14
+ @app.command()
15
+ def ask(
16
+ prompt: str = typer.Argument(..., help="Prompt to send to Grok (max 4000 chars)"),
17
+ conversation_id: str | None = typer.Option(None, "--conversation-id", "-c"),
18
+ mode: str = MODE,
19
+ web_search: str = WEB_SEARCH,
20
+ fmt: str = FMT,
21
+ fields: str | None = FIELDS,
22
+ ) -> None:
23
+ """Ask the real Grok assistant and get the answer, web sources, and X posts."""
24
+ params = {"prompt": prompt, "mode": mode, "web_search": web_search}
25
+ if conversation_id:
26
+ params["conversation_id"] = conversation_id
27
+ render(api_get("/v1/grok/ask", params), fmt, fields)
28
+
29
+
30
+ @app.command()
31
+ def models(fmt: str = FMT, fields: str | None = FIELDS) -> None:
32
+ """List Grok assistant modes."""
33
+ render(api_get("/v1/grok/models", {}), fmt, fields)
34
+
35
+
36
+ @app.command()
37
+ def conversation(
38
+ conversation_id: str = typer.Argument(...),
39
+ fmt: str = FMT,
40
+ fields: str | None = FIELDS,
41
+ ) -> None:
42
+ """Get messages in a Grok conversation."""
43
+ render(api_get(f"/v1/grok/conversations/{conversation_id}", {}), fmt, fields)
44
+
45
+
46
+ @app.command("brand-visibility")
47
+ def brand_visibility(
48
+ prompt: str = typer.Argument(...),
49
+ brand: str = typer.Option(..., "--brand", "-b"),
50
+ competitors: list[str] = typer.Option([], "--competitor", "-c"),
51
+ brand_domain: str | None = typer.Option(None, "--brand-domain", "-d"),
52
+ mode: str = MODE,
53
+ web_search: str = typer.Option("force", "--web-search", "-w"),
54
+ fmt: str = FMT,
55
+ fields: str | None = FIELDS,
56
+ ) -> None:
57
+ """Measure brand mentions and citations in a real Grok answer."""
58
+ params = {
59
+ "prompt": prompt,
60
+ "brand": brand,
61
+ "competitors": competitors,
62
+ "mode": mode,
63
+ "web_search": web_search,
64
+ }
65
+ if brand_domain:
66
+ params["brand_domain"] = brand_domain
67
+ render(api_get("/v1/grok/brand-visibility", params), fmt, fields)
@@ -122,6 +122,18 @@ def profile(
122
122
  render(data, fmt, fields)
123
123
 
124
124
 
125
+ @app.command("full-profile")
126
+ def full_profile(
127
+ public_id: str = typer.Argument(..., help="Profile public id (e.g. williamhgates)"),
128
+ country: str = COUNTRY,
129
+ fmt: str = FMT,
130
+ fields: str | None = FIELDS,
131
+ ) -> None:
132
+ """Get a full profile through the server-owned authenticated projection."""
133
+ data = api_get(f"/v1/linkedin/profiles/{public_id}/full", {"country": country})
134
+ render(data, fmt, fields)
135
+
136
+
125
137
  @app.command()
126
138
  def post(
127
139
  post_slug: str = typer.Argument(..., help="LinkedIn post slug"),
@@ -0,0 +1,35 @@
1
+ """Meta AI LLM scraping commands."""
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
+
10
+ FMT = typer.Option("json", "--output", "-o", help="Output format: json, csv, table, markdown")
11
+ FIELDS = typer.Option(None, "--fields", "-f", help="Comma-separated fields to include")
12
+ COUNTRY = typer.Option("US", "--country", "-c", help="ISO-3166 alpha-2 egress country")
13
+
14
+
15
+ @app.command()
16
+ def ask(
17
+ prompt: str = typer.Argument(..., help="Prompt to send to Meta AI (max 4000 chars)"),
18
+ country: str = COUNTRY,
19
+ fmt: str = FMT,
20
+ fields: str | None = FIELDS,
21
+ ) -> None:
22
+ """Ask the real meta.ai (Meta AI assistant) and get the answer (slow, tens of seconds)."""
23
+ data = api_get("/v1/meta-ai/ask", {"prompt": prompt, "country": country})
24
+ render(data, fmt, fields)
25
+
26
+
27
+ @app.command()
28
+ def models(
29
+ country: str = COUNTRY,
30
+ fmt: str = FMT,
31
+ fields: str | None = FIELDS,
32
+ ) -> None:
33
+ """List the assistant modes meta.ai exposes to anonymous users."""
34
+ data = api_get("/v1/meta-ai/models", {"country": country})
35
+ render(data, fmt, fields)
@@ -0,0 +1,30 @@
1
+ """Amazon Rufus LLM scraping commands."""
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
+
10
+ FMT = typer.Option("json", "--output", "-o", help="Output format: json, csv, table, markdown")
11
+ FIELDS = typer.Option(None, "--fields", "-f", help="Comma-separated fields to include")
12
+
13
+
14
+ @app.command()
15
+ def ask(
16
+ prompt: str = typer.Argument(..., help="Shopping question for Rufus (max 4000 chars)"),
17
+ asin: str | None = typer.Option(None, "--asin", "-a", help="Optional product ASIN context"),
18
+ fmt: str = FMT,
19
+ fields: str | None = FIELDS,
20
+ ) -> None:
21
+ """Ask Amazon Rufus (Alexa for Shopping) and get the answer and product cards."""
22
+ data = api_get("/v1/rufus/ask", {"prompt": prompt, **({"asin": asin} if asin else {})})
23
+ render(data, fmt, fields)
24
+
25
+
26
+ @app.command()
27
+ def models(fmt: str = FMT, fields: str | None = FIELDS) -> None:
28
+ """List the Amazon shopping assistant models exposed by the API."""
29
+ data = api_get("/v1/rufus/models")
30
+ render(data, fmt, fields)
@@ -256,15 +256,3 @@ def delete_rule(
256
256
  console.print("[green]Filter rule deleted.[/green]")
257
257
  else:
258
258
  console.print(f"[red]Error ({resp.status_code}): {resp.text}[/red]")
259
-
260
-
261
- @app.command(name="delivery-logs")
262
- def delivery_logs(
263
- page: int = typer.Option(1, "--page"),
264
- page_size: int = typer.Option(20, "--page-size"),
265
- fmt: str = FMT,
266
- fields: str | None = FIELDS,
267
- ) -> None:
268
- """List recent tweet delivery logs."""
269
- data = api_get("/v1/twitter/stream/logs", {"page": page, "page_size": page_size})
270
- render(data, fmt, fields)
@@ -30,6 +30,7 @@ from scrapebadger_cli.commands import (
30
30
  github,
31
31
  google,
32
32
  google_play,
33
+ grok,
33
34
  gumtree,
34
35
  idealista,
35
36
  immobiliare,
@@ -38,12 +39,14 @@ from scrapebadger_cli.commands import (
38
39
  leboncoin,
39
40
  linkedin,
40
41
  loopnet,
42
+ meta_ai,
41
43
  naver,
42
44
  onboarding,
43
45
  perplexity,
44
46
  realtor,
45
47
  reddit,
46
48
  redfin,
49
+ rufus,
47
50
  stream,
48
51
  target,
49
52
  tiktok,
@@ -127,6 +130,9 @@ app.add_typer(perplexity.app, name="perplexity", help="Perplexity AI answer-engi
127
130
  app.add_typer(autoscout24.app, name="autoscout24", help="AutoScout24 vehicle search and listings")
128
131
  app.add_typer(copilot.app, name="copilot", help="Microsoft Copilot answer-engine commands")
129
132
  app.add_typer(gemini.app, name="gemini", help="Google Gemini LLM commands")
133
+ app.add_typer(meta_ai.app, name="meta-ai", help="Meta AI LLM commands")
134
+ app.add_typer(grok.app, name="grok", help="Grok answer-engine commands")
135
+ app.add_typer(rufus.app, name="rufus", help="Amazon Rufus LLM commands")
130
136
  app.add_typer(
131
137
  facebook.app,
132
138
  name="facebook",
@@ -140,7 +146,6 @@ app.command()(onboarding.trial)
140
146
  app.command()(onboarding.connect)
141
147
  app.command()(init.init)
142
148
  app.command()(agent.view)
143
- app.add_typer(agent.results_app, name="results", help="Re-read earlier results (free)")
144
149
  app.command()(agent.quote)
145
150
  app.command(name="report-bug")(agent.report_bug)
146
151
  app.command()(agent.feedback)
@@ -70,7 +70,5 @@ def save(resp: httpx.Response, data: Any, path: str) -> Path | None:
70
70
  parts = [f"saved: {target}"]
71
71
  if credits := resp.headers.get("x-credits-used"):
72
72
  parts.append(f"credits: {credits}")
73
- if result_id := resp.headers.get("x-result-id"):
74
- parts.append(f"result_id: {result_id}")
75
73
  typer.echo(" · ".join(parts), err=True)
76
74
  return target
@@ -50,7 +50,7 @@ def invoke(*args):
50
50
 
51
51
  def test_result_saved_and_stdout_unchanged(monkeypatch):
52
52
  monkeypatch.setenv("SCRAPEBADGER_API_KEY", "sb_test")
53
- headers = {"X-Credits-Used": "5", "X-Result-ID": "r-1"}
53
+ headers = {"X-Credits-Used": "5"}
54
54
  mock_api(monkeypatch, lambda req: httpx.Response(200, json=PROPERTY, headers=headers))
55
55
 
56
56
  result = invoke("zillow", "property", "1")
@@ -60,7 +60,7 @@ def test_result_saved_and_stdout_unchanged(monkeypatch):
60
60
  [saved] = results.saved_files()
61
61
  assert saved.name.startswith("zillow-property-") and saved.parent == results.results_dir()
62
62
  assert json.loads(saved.read_text()) == PROPERTY
63
- assert result.stderr.strip() == f"saved: {saved} · credits: 5 · result_id: r-1"
63
+ assert result.stderr.strip() == f"saved: {saved} · credits: 5"
64
64
 
65
65
 
66
66
  @pytest.mark.parametrize("disable", [("--no-save",), ()])
@@ -0,0 +1,94 @@
1
+ """`scrapebadger google resolve`: POST /v1/google/resolve from tokens or a saved response (SCR-667)."""
2
+
3
+ import json
4
+ from unittest.mock import Mock
5
+
6
+ import pytest
7
+
8
+ CliRunner = pytest.importorskip("typer.testing").CliRunner
9
+ google = pytest.importorskip(
10
+ "scrapebadger_cli.commands.google", reason="CLI is tested with its own installed package"
11
+ )
12
+
13
+ ANSWER = {
14
+ "results": [
15
+ {"position": 4, "link": "https://example.com/a"},
16
+ {"position": 5, "link_token": "sbl1.next.sig", "retry_after_seconds": 8},
17
+ ],
18
+ "retry_after_seconds": 8,
19
+ }
20
+
21
+
22
+ @pytest.fixture
23
+ def post(monkeypatch):
24
+ call = Mock(return_value=ANSWER)
25
+ monkeypatch.setattr(google, "api_post", call)
26
+ return call
27
+
28
+
29
+ def test_tokens_are_sent_as_rows_and_the_envelope_is_printed(post):
30
+ result = CliRunner().invoke(google.app, ["resolve", "sbl1.a.sig", "sbl1.b.sig"])
31
+ assert result.exit_code == 0, result.output
32
+ post.assert_called_once_with(
33
+ "/v1/google/resolve",
34
+ {"results": [{"link_token": "sbl1.a.sig"}, {"link_token": "sbl1.b.sig"}]},
35
+ )
36
+ # Two rows and the top-level wait: the list alone would lose retry_after_seconds.
37
+ assert json.loads(result.stdout) == ANSWER
38
+
39
+
40
+ def test_a_saved_search_sends_the_rows_that_carry_a_token(post, tmp_path):
41
+ search = {
42
+ "search_information": {"query_displayed": "vinted api"},
43
+ "organic_results": [
44
+ {"position": 1, "link": "https://example.com/", "link_token": None},
45
+ {
46
+ "position": 4,
47
+ "link": "https://www.google.com/goto?url=x",
48
+ "link_token": "sbl1.a.sig",
49
+ },
50
+ ],
51
+ }
52
+ saved = tmp_path / "google-search.json"
53
+ saved.write_text(json.dumps(search))
54
+ result = CliRunner().invoke(google.app, ["resolve", "--file", str(saved)])
55
+ assert result.exit_code == 0, result.output
56
+ assert post.call_args.args[1] == {"results": [search["organic_results"][1]]}
57
+
58
+
59
+ def test_a_saved_resolve_answer_sends_only_the_rows_not_ready(post):
60
+ earlier = {
61
+ "results": [
62
+ {"position": 4, "link": "https://example.com/a"},
63
+ {"position": 5, "link_token": "sbl1.next.sig", "retry_after_seconds": 8},
64
+ {"position": 6, "link_token": "sbl1.gone.sig", "error": "Run the search again."},
65
+ ],
66
+ "retry_after_seconds": 8,
67
+ }
68
+ result = CliRunner().invoke(google.app, ["resolve", "--file", "-"], input=json.dumps(earlier))
69
+ assert result.exit_code == 0, result.output
70
+ assert post.call_args.args[1] == {"results": [earlier["results"][1]]}
71
+
72
+
73
+ def test_nothing_to_resolve_makes_no_call(post):
74
+ done = {"results": [{"position": 4, "link": "https://example.com/a"}]}
75
+ result = CliRunner().invoke(google.app, ["resolve", "--file", "-"], input=json.dumps(done))
76
+ assert result.exit_code == 0
77
+ assert "Nothing to resolve" in result.output
78
+ post.assert_not_called()
79
+
80
+
81
+ @pytest.mark.parametrize(
82
+ ("args", "stdin"),
83
+ [
84
+ (["resolve"], None), # neither tokens nor a file
85
+ (["resolve", "sbl1.a.sig", "--file", "-"], "[]"), # both
86
+ (["resolve", "--file", "-"], "not json"),
87
+ (["resolve", "--file", "-"], '{"query": "no rows here"}'),
88
+ (["resolve", *[f"sbl1.{n}.sig" for n in range(26)]], None), # the API takes 25
89
+ ],
90
+ )
91
+ def test_bad_input_is_refused_before_any_call(post, args, stdin):
92
+ result = CliRunner().invoke(google.app, args, input=stdin)
93
+ assert result.exit_code == 2, result.output
94
+ post.assert_not_called()
@@ -0,0 +1,59 @@
1
+ from unittest.mock import Mock
2
+
3
+ import pytest
4
+
5
+ CliRunner = pytest.importorskip("typer.testing").CliRunner
6
+ grok = pytest.importorskip("scrapebadger_cli.commands.grok")
7
+
8
+
9
+ def _invoke(monkeypatch, args):
10
+ call = Mock(return_value={})
11
+ monkeypatch.setattr(grok, "api_get", call)
12
+ monkeypatch.setattr(grok, "render", Mock())
13
+ result = CliRunner().invoke(grok.app, args)
14
+ assert result.exit_code == 0, result.output
15
+ return call.call_args.args
16
+
17
+
18
+ def test_ask_defaults(monkeypatch):
19
+ path, params = _invoke(monkeypatch, ["ask", "capital of Lithuania?"])
20
+ assert path == "/v1/grok/ask"
21
+ assert params == {"prompt": "capital of Lithuania?", "mode": "auto", "web_search": "auto"}
22
+
23
+
24
+ def test_ask_conversation_and_modes(monkeypatch):
25
+ _, params = _invoke(
26
+ monkeypatch,
27
+ ["ask", "tell me more", "-c", "42:123", "-m", "expert", "-w", "off"],
28
+ )
29
+ assert params["conversation_id"] == "42:123"
30
+ assert params["mode"] == "expert"
31
+ assert params["web_search"] == "off"
32
+
33
+
34
+ def test_models_and_conversation(monkeypatch):
35
+ path, _ = _invoke(monkeypatch, ["models"])
36
+ assert path == "/v1/grok/models"
37
+ path, _ = _invoke(monkeypatch, ["conversation", "42:123"])
38
+ assert path == "/v1/grok/conversations/42:123"
39
+
40
+
41
+ def test_brand_visibility(monkeypatch):
42
+ path, params = _invoke(
43
+ monkeypatch,
44
+ [
45
+ "brand-visibility",
46
+ "best APIs",
47
+ "-b",
48
+ "ScrapeBadger",
49
+ "-c",
50
+ "Apify",
51
+ "-d",
52
+ "scrapebadger.com",
53
+ ],
54
+ )
55
+ assert path == "/v1/grok/brand-visibility"
56
+ assert params["brand"] == "ScrapeBadger"
57
+ assert params["competitors"] == ["Apify"]
58
+ assert params["brand_domain"] == "scrapebadger.com"
59
+ assert params["web_search"] == "force"
@@ -0,0 +1,58 @@
1
+ """Monitoring must survive empty filtered pages and never lose undelivered IDs."""
2
+
3
+ import importlib.util
4
+ import json
5
+ import sqlite3
6
+ from pathlib import Path
7
+
8
+ import pytest
9
+
10
+ _spec = importlib.util.spec_from_file_location(
11
+ "marketplace_monitor", Path(__file__).parents[3] / "examples/facebook_marketplace_monitor.py"
12
+ )
13
+ assert _spec and _spec.loader
14
+ monitor = importlib.util.module_from_spec(_spec)
15
+ _spec.loader.exec_module(monitor)
16
+
17
+
18
+ def test_empty_filtered_page_does_not_stop_and_locations_are_deduplicated(monkeypatch):
19
+ calls = []
20
+
21
+ def fetch(params, key):
22
+ calls.append(params)
23
+ if params["location"] == "london" and params["after"] is None:
24
+ return {
25
+ "listings": [],
26
+ "search_info": {},
27
+ "has_next_page": True,
28
+ "end_cursor": "sbmp1_next",
29
+ }
30
+ return {
31
+ "listings": [
32
+ {"id": "same", "creation_time_utc": 2},
33
+ {"id": "old", "creation_time_utc": 1},
34
+ ],
35
+ "search_info": {},
36
+ "has_next_page": False,
37
+ }
38
+
39
+ monkeypatch.setattr(monitor, "fetch_page", fetch)
40
+ rows, _ = monitor.collect("bike", ["london", "newcastleupontyne"], 20, 3, "test")
41
+ assert len(calls) == 3
42
+ assert calls[1]["after"] == "sbmp1_next"
43
+ assert all(call["strict_filters"] and call["days_since_listed"] == 2 for call in calls)
44
+ assert [row["id"] for row in rows] == ["same", "old"]
45
+
46
+
47
+ def test_seen_ids_commit_after_durable_output_and_failed_write_can_retry(tmp_path):
48
+ rows = [{"id": "new", "creation_time_utc": 2}]
49
+ with sqlite3.connect(tmp_path / "state.sqlite3") as db:
50
+ bad = tmp_path / "not-a-folder"
51
+ bad.write_text("file")
52
+ with pytest.raises(OSError):
53
+ monitor.save_new(db, "query", rows, [], bad / "result.json")
54
+ good = tmp_path / "first.json"
55
+ assert monitor.save_new(db, "query", rows, [], good) == 1
56
+ assert json.loads(good.read_text())["new_listings"] == rows
57
+ assert monitor.save_new(db, "query", rows, [], tmp_path / "second.json") == 0
58
+ assert monitor.save_new(db, "different-query", rows, [], tmp_path / "third.json") == 1
@@ -228,7 +228,7 @@ wheels = [
228
228
 
229
229
  [[package]]
230
230
  name = "scrapebadger-cli"
231
- version = "0.31.0"
231
+ version = "0.34.1"
232
232
  source = { editable = "." }
233
233
  dependencies = [
234
234
  { name = "click" },
@@ -1,12 +0,0 @@
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.