@scrapa/sdk 0.4.0 → 0.5.0

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.
@@ -4,7 +4,7 @@
4
4
  // One method per capability, grouped the way the docs group them, returning the
5
5
  // DTO the operation declares. `Scrapa` in ../client.ts supplies request().
6
6
  /** The version this client reports in `x-scrapa-client`. */
7
- export const SDK_VERSION = "0.4.0";
7
+ export const SDK_VERSION = "0.5.0";
8
8
  /** The hosted API. */
9
9
  export const DEFAULT_BASE_URL = "https://api.scrapa.app/v1";
10
10
  export class GeneratedOperations {
@@ -17,14 +17,18 @@ export class GeneratedOperations {
17
17
  * turns out to be a JavaScript shell, so you pay for a browser only when the page needed one.
18
18
  * To send a search form or a JSON query, use `method: "POST"` with a `body`; to download a
19
19
  * file exactly as the site sent it, ask for `formats: ["raw"]`. A link to a PDF or a Word file
20
- * is read into text too, headings and paragraphs included. Every request leaves through a
21
- * residential proxy, or through your own with `proxy: { pool: "custom", server }`. The answer
22
- * says which engine replied, where the page finally was and what it cost.
20
+ * is read into text too, headings and paragraphs included. To click a cookie banner, type into
21
+ * a search box or run a script before the page is read, send `browser.actions`. Every request
22
+ * leaves through a residential proxy, or through your own with `proxy: { pool: "custom",
23
+ * server }`. The answer says which engine replied, where the page finally was and what it
24
+ * cost.
23
25
  *
24
26
  * Credits: 1 credit with the fetch engine, 5 with the browser (a screenshot or a PDF is
25
27
  * included, never a surcharge), 5 more when you ask for `extract`, plus managed-proxy
26
- * bandwidth past the first megabyte. A page the site blocked, a URL our policy refused and
27
- * anything we broke all cost nothing.
28
+ * bandwidth past the first megabyte. A page the site blocked and a URL our policy refused cost
29
+ * nothing, unless your own `browser.actions` script ran in the page first. Anything we broke
30
+ * costs nothing, and neither does a page served from a copy you read earlier (`maxAge`),
31
+ * though `extract` on it is still charged.
28
32
  *
29
33
  * `POST /v1/scrape`
30
34
  */
@@ -42,7 +46,8 @@ export class GeneratedOperations {
42
46
  * What the same request would cost, without making it. Free, and refused by the same guards a
43
47
  * real call meets, so a quote is never a price for a call that would be denied. `maxCost` is
44
48
  * the ceiling: for `auto` it is the browser's price, which is only charged if the page turns
45
- * out to need one.
49
+ * out to need one. With `maxAge`, the quote is the price of reading the page now; if a copy is
50
+ * there, the page costs nothing and only `extract` is charged.
46
51
  *
47
52
  * Credits: 0 credits. Pricing a call is free.
48
53
  *
@@ -68,7 +73,8 @@ export class GeneratedOperations {
68
73
  *
69
74
  * Credits: 2 credits, plus managed-proxy bandwidth past the first megabyte, every file the map
70
75
  * read counted together. A site that lists nothing is charged, because it answered. A site
71
- * that refused every file, and anything we broke, cost nothing.
76
+ * that refused every file, and anything we broke, cost nothing. When our side fails partway,
77
+ * you still get the URLs found so far, with `truncated: true`.
72
78
  *
73
79
  * `POST /v1/map`
74
80
  */
@@ -106,9 +112,9 @@ export class GeneratedOperations {
106
112
  * holds. They are read live off a real search front through a residential exit, never a
107
113
  * reseller's cache. `country` picks both the exit and the market, so `br` returns what
108
114
  * somebody in Brazil would see. Narrow to your own list of hosts with `includeDomains`, ask
109
- * for `topic: "news"` when you want dated journalism, and add `answer: true` when you want a
110
- * paragraph written over the results instead of writing it yourself. To read a result, pass
111
- * its URL to `scrape`.
115
+ * for `topic: "news"` when you want dated journalism or `topic: "images"` when you want
116
+ * pictures, and add `answer: true` when you want a paragraph written over the results instead
117
+ * of writing it yourself. To read a result, pass its URL to `scrape`.
112
118
  *
113
119
  * Credits: 4 credits per 10 results, so a `limit` above 10 costs two rows, plus 1 for `answer:
114
120
  * true`. A search every front refused, and anything we broke, cost nothing; a search that ran
@@ -131,15 +137,17 @@ export class GeneratedOperations {
131
137
  *
132
138
  * Hand us a list of URLs and stop holding a connection open. Every one is read with the
133
139
  * options you pass here. It uses the same engines, the same exit and the same meter as a
134
- * single `scrape`, and a page the site blocked costs nothing here too. Nothing is charged
135
- * when you submit: a batch spends as it goes, so use `quote` for the ceiling. Poll `get`
136
- * for progress, or pass a `webhook` and we will call you instead. Results are readable for
137
- * 24 hours.
140
+ * single `scrape`, and a page the site blocked costs nothing here too, unless your own
141
+ * `browser.actions` script ran in the page first. Nothing is charged when you submit: a
142
+ * batch spends as it goes, so use `quote` for the ceiling. Poll `get` for progress, or
143
+ * pass a `webhook` and we will call you instead. Results are readable for 24 hours from
144
+ * when you submit. A batch still running then stops, and the URLs it has not read are
145
+ * `skipped`, free.
138
146
  *
139
147
  * Credits: Creating a batch is free, and nothing is held: each URL then costs exactly what
140
148
  * the same call would have cost on its own, and the pages the web refused cost nothing
141
- * here too. What the batch has spent so far is on the batch itself, and it grows while it
142
- * runs.
149
+ * here too, unless your own `browser.actions` script ran in them first. What the batch has
150
+ * spent so far is on the batch itself, and it grows while it runs.
143
151
  *
144
152
  * `POST /v1/batches`
145
153
  */
@@ -153,9 +161,11 @@ export class GeneratedOperations {
153
161
  * Price a batch
154
162
  *
155
163
  * What that submission would cost at most, without submitting it. `maxCost` prices every
156
- * URL at the ceiling one page could reach, so the real bill comes in lower by whatever the
157
- * web refuses for free and by every page that never needed a browser. Bandwidth is on top
158
- * and cannot be quoted, because it depends on what the pages weigh.
164
+ * URL at the ceiling one page could reach. The real bill comes in lower by every page that
165
+ * never needed a browser and by every outcome that costs nothing: a page the site blocked
166
+ * or our policy refused (unless your own `browser.actions` script ran in it first) and
167
+ * anything we broke. Bandwidth is on top and cannot be quoted, because it depends on what
168
+ * the pages weigh.
159
169
  *
160
170
  * Credits: 0 credits. Pricing a batch is free.
161
171
  *
@@ -1 +1 @@
1
- {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/generated/operations.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,0DAA0D;AAC1D,EAAE;AACF,gFAAgF;AAChF,2EAA2E;AAmC3E,4DAA4D;AAC5D,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC;AAEnC,sBAAsB;AACtB,MAAM,CAAC,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AAE5D,MAAM,OAAgB,mBAAmB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;;;;;;;;;;WAWG;QACH,KAAK,EAAE,CACH,MAA0B,EAC1B,IAA6C,EAC1B,EAAE,CACrB,IAAI,CAAC,OAAO,CACR,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAE,EAC7D,MAAM,EACN,IAAI,CACP;KACR,CAAC;IAEO,KAAK,GAAG;QACb;;;;;;;;;;WAUG;QACH,GAAG,EAAE,CAAC,IAA6C,EAAqB,EAAE,CACtE,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC;KACvE,CAAC;CACL"}
1
+ {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/generated/operations.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,0DAA0D;AAC1D,EAAE;AACF,gFAAgF;AAChF,2EAA2E;AAmC3E,4DAA4D;AAC5D,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC;AAEnC,sBAAsB;AACtB,MAAM,CAAC,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AAE5D,MAAM,OAAgB,mBAAmB;IAOrC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CACF,MAAoB,EACpB,IAA6C;QAE7C,OAAO,IAAI,CAAC,OAAO,CACf;YACI,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,KAAK;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC;SACxD,EACD,MAAM,EACN,IAAI,CACP,CAAC;IACN,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CACD,MAAyB,EACzB,IAA6C;QAE7C,OAAO,IAAI,CAAC,OAAO,CACf;YACI,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,eAAe;YACrB,UAAU,EAAE,IAAI;YAChB,K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