scrapebadger 0.76.1 → 0.76.2

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.
package/README.md CHANGED
@@ -126,7 +126,7 @@ Etsy and AliExpress category navigation is separate from search: their search me
126
126
  | **ChatGPT** | Prompt the real chatgpt.com anonymously — structured answer with citations anchored to character offsets, the full retrieved search trail, and AEO/GEO brand-visibility analysis | [ChatGPT Guide](docs/chatgpt.md) |
127
127
  | **Gemini** | Prompt the real gemini.google.com anonymously — structured answer with cited web sources, the full retrieved search trail, and AEO/GEO brand-visibility analysis | [Gemini Docs](https://docs.scrapebadger.com/gemini/overview) |
128
128
 
129
- ## Quotes, feedback and free re-reads
129
+ ## Quotes, feedback and async polling
130
130
 
131
131
  These calls are free and never billed.
132
132
 
@@ -139,12 +139,6 @@ const client = new ScrapeBadger({ apiKey: "your-api-key" });
139
139
  const quote = await client.agent.quote("GET", "/v1/google/search", { params: { q: "coffee" } });
140
140
  console.log(quote.valid, quote.errors, quote.credits.max, quote.usd, quote.latency);
141
141
 
142
- // Re-read a billed result for ~15 minutes, reshaped. The ID is the call's
143
- // X-Result-ID header (raw HTTP, the CLI) or AsyncRequest.resultId.
144
- const titles = await client.results.get<string[]>(resultId, { jq: "[.organic_results[].title]" });
145
- const outline = await client.results.get(resultId, { summary: true });
146
- const first5 = await client.results.get(resultId, { fields: ["title", "link"], maxItems: 5 });
147
-
148
142
  // Poll a call made with `Prefer: respond-async` (202 + request_id).
149
143
  const state = await client.requests.get(requestId);
150
144
  if (!state.running) console.log(state.status, state.creditsUsed, state.data);
@@ -158,7 +152,7 @@ const info = await client.account.getAccountInfo();
158
152
  const trial = info.agent_trial as AgentTrial | undefined;
159
153
  ```
160
154
 
161
- `results.get` returns the stored body as-is (any JSON value) and throws `NotFoundError` once it has expired. `requests.get` returns `running: true` while the call is in progress — wait `retryAfterSeconds` and poll again; never re-submit the call. Once finished it returns the original body, or throws the original call's error. The SDK's own methods never send `Prefer: respond-async`; `requests.get` polls a request ID obtained elsewhere (raw HTTP, the CLI or MCP server).
155
+ ScrapeBadger does not cache or store responses: every call is fetched fresh and billed, and `results.get` (the old free re-read) is deprecated because `GET /v1/results/{id}` was removed on 2026-11-09. To reshape a result, re-run the call with the `jq`, `fields` or `max_items` view parameters. `requests.get` returns `running: true` while the call is in progress — wait `retryAfterSeconds` and poll again; never re-submit the call. Once finished it returns the original body, or throws the original call's error. The SDK's own methods never send `Prefer: respond-async`; `requests.get` polls a request ID obtained elsewhere (raw HTTP, the CLI or MCP server).
162
156
 
163
157
  ## Error Handling
164
158
 
package/dist/index.cjs CHANGED
@@ -9,7 +9,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
9
  var WebSocket__default = /*#__PURE__*/_interopDefault(WebSocket);
10
10
 
11
11
  // src/internal/version.ts
12
- var SDK_VERSION = "0.76.1";
12
+ var SDK_VERSION = "0.76.2";
13
13
 
14
14
  // src/internal/exceptions.ts
15
15
  var ScrapeBadgerError = class _ScrapeBadgerError extends Error {
@@ -5066,19 +5066,32 @@ var AgentClient = class {
5066
5066
  return this.feedback(summary, { ...options, type: "bug" });
5067
5067
  }
5068
5068
  };
5069
+ var resultsGetWarned = false;
5069
5070
  var ResultsClient = class {
5070
5071
  constructor(client) {
5071
5072
  this.client = client;
5072
5073
  }
5073
5074
  /**
5074
- * Replay a recent result, optionally trimmed. Free.
5075
+ * Deprecated: the API no longer stores results, so there is nothing to re-read.
5075
5076
  *
5076
- * @param resultId - `X-Result-ID` of the original call.
5077
+ * `GET /v1/results/{id}` was removed from the API on 2026-11-09 and answers
5078
+ * 410 Gone, which this method throws as `ScrapeBadgerError`. Re-run the
5079
+ * original call with the `jq`, `fields` or `max_items` view parameters instead
5080
+ * (billed as a normal call). Kept only so existing code fails with a clear
5081
+ * error; it will be removed in a future release.
5082
+ *
5083
+ * @deprecated The API no longer stores results; re-run the call with view params.
5084
+ * @param resultId - ID of a stored result (no longer issued by the API).
5077
5085
  * @param options - `jq`, `fields`, `maxItems`, `summary` view params.
5078
- * @returns The original response body, reshaped — any JSON value.
5079
- * @throws NotFoundError - Unknown result, or it expired (~15 minutes).
5086
+ * @throws ScrapeBadgerError - Always (410 Gone `results_removed`) against the current API.
5080
5087
  */
5081
5088
  async get(resultId, options = {}) {
5089
+ if (!resultsGetWarned) {
5090
+ resultsGetWarned = true;
5091
+ console.warn(
5092
+ "[scrapebadger] results.get() is deprecated: ScrapeBadger stopped storing results on 2026-11-09 and GET /v1/results/{id} answers 410 Gone. Re-run the call with jq/fields/max_items view parameters instead."
5093
+ );
5094
+ }
5082
5095
  const { jq, fields, maxItems, summary } = options;
5083
5096
  return this.client.request(`/v1/results/${encodeURIComponent(resultId)}`, {
5084
5097
  params: {
@@ -5114,7 +5127,8 @@ var RequestsClient = class {
5114
5127
  running,
5115
5128
  status: status ?? 200,
5116
5129
  retryAfterSeconds: retryAfter ?? null,
5117
- resultId: headers?.get("X-Result-ID") ?? null,
5130
+ resultId: null,
5131
+ // deprecated: the API no longer sends X-Result-ID
5118
5132
  creditsUsed: credits && /^\d+$/.test(credits) ? Number(credits) : null,
5119
5133
  data
5120
5134
  };
@@ -10712,7 +10726,10 @@ var ScrapeBadger = class {
10712
10726
  account;
10713
10727
  /** Quote a call before making it, and report bugs or send feedback. Free. */
10714
10728
  agent;
10715
- /** Re-read a recent result (`X-Result-ID`) for free, optionally trimmed. */
10729
+ /**
10730
+ * @deprecated The API no longer stores results (`GET /v1/results/{id}` answers
10731
+ * 410 Gone since 2026-11-09); see `ResultsClient.get`.
10732
+ */
10716
10733
  results;
10717
10734
  /** Poll a call made with `Prefer: respond-async`. Free. */
10718
10735
  requests;