@decodo/sdk-ts 2.0.0 → 2.1.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.
Files changed (70) hide show
  1. package/README.md +415 -17
  2. package/build/cjs/api/web-scraping-api.d.ts +3 -1
  3. package/build/cjs/api/web-scraping-api.js +5 -3
  4. package/build/cjs/client.d.ts +2 -0
  5. package/build/cjs/client.js +3 -1
  6. package/build/cjs/generated/parameters.js +3 -6
  7. package/build/cjs/generated/request-schemas.d.ts +0 -172
  8. package/build/cjs/generated/request-schemas.js +0 -190
  9. package/build/cjs/generated/targets.d.ts +2 -62
  10. package/build/cjs/generated/targets.js +1 -25
  11. package/build/cjs/http.js +1 -0
  12. package/build/cjs/index.d.ts +3 -0
  13. package/build/cjs/index.js +5 -1
  14. package/build/cjs/schema/build-request-schemas.d.ts +4 -0
  15. package/build/cjs/schema/build-request-schemas.js +56 -0
  16. package/build/cjs/schema/build-target-meta.d.ts +3 -0
  17. package/build/cjs/schema/build-target-meta.js +19 -0
  18. package/build/cjs/schema/bundled-provider.d.ts +2 -0
  19. package/build/cjs/schema/bundled-provider.js +9 -0
  20. package/build/cjs/schema/bundled-schema.d.ts +10 -0
  21. package/build/cjs/schema/bundled-schema.js +24 -0
  22. package/build/cjs/schema/constants.d.ts +5 -0
  23. package/build/cjs/schema/constants.js +8 -0
  24. package/build/cjs/schema/expand-path.d.ts +1 -0
  25. package/build/cjs/schema/expand-path.js +15 -0
  26. package/build/cjs/schema/remote-provider.d.ts +8 -0
  27. package/build/cjs/schema/remote-provider.js +120 -0
  28. package/build/cjs/schema/remote-schema.d.ts +19 -0
  29. package/build/cjs/schema/remote-schema.js +149 -0
  30. package/build/cjs/schema/resolve-latest-ir.d.ts +2 -0
  31. package/build/cjs/schema/resolve-latest-ir.js +55 -0
  32. package/build/cjs/schema/resolve-provider.d.ts +3 -0
  33. package/build/cjs/schema/resolve-provider.js +27 -0
  34. package/build/cjs/schema/types.d.ts +44 -0
  35. package/build/cjs/schema/types.js +2 -0
  36. package/build/esm/api/web-scraping-api.d.ts +3 -1
  37. package/build/esm/api/web-scraping-api.js +5 -3
  38. package/build/esm/client.d.ts +2 -0
  39. package/build/esm/client.js +3 -1
  40. package/build/esm/generated/parameters.js +3 -6
  41. package/build/esm/generated/request-schemas.d.ts +0 -172
  42. package/build/esm/generated/request-schemas.js +0 -190
  43. package/build/esm/generated/targets.d.ts +2 -62
  44. package/build/esm/generated/targets.js +1 -25
  45. package/build/esm/http.js +1 -0
  46. package/build/esm/index.d.ts +3 -0
  47. package/build/esm/index.js +2 -0
  48. package/build/esm/schema/build-request-schemas.d.ts +4 -0
  49. package/build/esm/schema/build-request-schemas.js +18 -0
  50. package/build/esm/schema/build-target-meta.d.ts +3 -0
  51. package/build/esm/schema/build-target-meta.js +15 -0
  52. package/build/esm/schema/bundled-provider.d.ts +2 -0
  53. package/build/esm/schema/bundled-provider.js +6 -0
  54. package/build/esm/schema/bundled-schema.d.ts +10 -0
  55. package/build/esm/schema/bundled-schema.js +20 -0
  56. package/build/esm/schema/constants.d.ts +5 -0
  57. package/build/esm/schema/constants.js +5 -0
  58. package/build/esm/schema/expand-path.d.ts +1 -0
  59. package/build/esm/schema/expand-path.js +11 -0
  60. package/build/esm/schema/remote-provider.d.ts +8 -0
  61. package/build/esm/schema/remote-provider.js +83 -0
  62. package/build/esm/schema/remote-schema.d.ts +19 -0
  63. package/build/esm/schema/remote-schema.js +112 -0
  64. package/build/esm/schema/resolve-latest-ir.d.ts +2 -0
  65. package/build/esm/schema/resolve-latest-ir.js +51 -0
  66. package/build/esm/schema/resolve-provider.d.ts +3 -0
  67. package/build/esm/schema/resolve-provider.js +22 -0
  68. package/build/esm/schema/types.d.ts +44 -0
  69. package/build/esm/schema/types.js +1 -0
  70. package/package.json +6 -3
package/README.md CHANGED
@@ -1,23 +1,77 @@
1
- # @decodo/sdk-ts
1
+ # Decodo TypeScript SDK
2
2
 
3
- Official TypeScript SDK for the Decodo Web Scraping API.
3
+ ![Node.js](https://img.shields.io/badge/node-%3E%3D18-green)
4
+ ![License](https://img.shields.io/badge/license-MIT-blue)
4
5
 
5
- Features:
6
+ [![](https://dcbadge.limes.pink/api/server/https://discord.gg/Ja8dqKgvbZ)](https://discord.gg/Ja8dqKgvbZ)
6
7
 
7
- - Strongly typed per-target parameters with full IDE autocomplete
8
- - Sync, async, and batch scraping
9
- - Zero runtime dependencies (uses native `fetch`, Node 18+)
10
- - Typed error hierarchy
8
+ <p align="center">
9
+ <a href="https://dashboard.decodo.com/integrations?utm_source=github&utm_medium=social&utm_campaign=mcp_server"> <img src="https://github.com/user-attachments/assets/a1e52a9e-3da1-4081-b3c6-053aafb8f196"/></a>
10
+
11
+ The official TypeScript SDK for the Decodo Web Scraping API.
12
+
13
+ Build strongly typed scraping workflows for search engines, eCommerce platforms, social media, AI tools, and more using the Decodo Web Scraping API.
14
+
15
+ - Fully typed targets and parameters with IDE autocomplete
16
+ - Sync, async, and batch scraping methods
17
+ - Native `fetch` support, Node.js 18+
18
+ - Typed error hierarchy for safer integrations
19
+ - Built for TypeScript and modern JavaScript runtimes
20
+
21
+ # What is Decodo TypeScript SDK?
22
+
23
+ Decodo TypeScript SDK is the official TypeScript SDK for the Decodo Web Scraping API. It provides a typed interface for interacting with Decodo targets like Google, Amazon, TikTok, Reddit, YouTube, ChatGPT, Perplexity, and more.
24
+
25
+ Instead of manually constructing HTTP requests and validating payloads, you can work with fully typed methods and target-specific parameters directly in your editor.
26
+
27
+ # Why use the SDK?
28
+
29
+ - **Strong typing and autocomplete**. Target parameters are fully typed for better DX and fewer mistakes.
30
+ - **Unified scraping interface**. Work with search engines, eCommerce platforms, social media, and AI tools through one SDK.
31
+ - **Async and batch workflows**. Create scraping tasks, poll statuses, and process batches at scale.
32
+ - **Typed errors**. Handle authentication, validation, timeout, and rate-limit failures safely.
33
+ - **Minimal setup**. Uses native `fetch`, no additional HTTP client required.
34
+
35
+ ## Requirements
36
+
37
+ - Node.js 18+ (for native `fetch`)
38
+ - TypeScript 5.0+ (recommended for best type inference)
11
39
 
12
40
  ## Installation
13
41
 
14
42
  ```bash
15
- npm install @decodo/sdk-ts
43
+ npm install --save @decodo/sdk-ts
16
44
  ```
17
45
 
18
46
  ## Quick start
19
47
 
48
+ Create a new project:
49
+
50
+ ```sh
51
+ mkdir scrape-with-decodo
52
+ cd scrape-with-decodo
53
+
54
+ npm init -y
55
+ npm install --save @decodo/sdk-ts
56
+
57
+ touch main.js
58
+ ```
59
+
60
+ <details>
61
+ <summary>Optional: prevent module type warning</summary>
62
+ Run the following script to switch to ESM modules:
63
+ <br />
64
+
65
+ ```sh
66
+ node -e "let p=require('./package.json'); p.type='module'; require('fs').writeFileSync('./package.json', JSON.stringify(p, null, 2))"
67
+ ```
68
+
69
+ </details>
70
+
71
+ Get a Web Scraping API basic authentication token from the [Decodo dashboard](https://dashboard.decodo.com/welcome) and use it in the following example:
72
+
20
73
  ```typescript
74
+ // main.js
21
75
  import { DecodoClient, Target } from '@decodo/sdk-ts';
22
76
 
23
77
  const client = new DecodoClient({
@@ -32,9 +86,273 @@ const result = await client.webScrapingApi.scrape({
32
86
  geo: 'United States',
33
87
  parse: true,
34
88
  });
35
- console.log(result.results[0].content);
89
+ console.log(JSON.stringify(result, null, 2));
36
90
  ```
37
91
 
92
+ Run the script:
93
+
94
+ ```
95
+ node main.js
96
+ ```
97
+
98
+ <details>
99
+ <summary>Example response</summary>
100
+
101
+ ```json
102
+ {
103
+ "results": [
104
+ {
105
+ "content": {
106
+ "results": {
107
+ "last_visible_page": 10,
108
+ "page": 1,
109
+ "parse_status_code": 12000,
110
+ "results": {
111
+ "local_pack": [
112
+ {
113
+ "items": [
114
+ {
115
+ "address": "Rochester, NY",
116
+ "paid": false,
117
+ "pos": 1,
118
+ "rating": 4.9,
119
+ "rating_count": 1700,
120
+ "subtitle": "Coffee shop",
121
+ "title": "Albunn Coffee House"
122
+ },
123
+ {
124
+ "address": "Rochester, NY",
125
+ "paid": false,
126
+ "pos": 2,
127
+ "rating": 4.8,
128
+ "rating_count": 937,
129
+ "subtitle": "Coffee shop",
130
+ "title": "Layali Coffee House"
131
+ },
132
+ {
133
+ "address": "Ocean Township, NJ",
134
+ "paid": false,
135
+ "pos": 3,
136
+ "rating": 4.9,
137
+ "rating_count": 124,
138
+ "subtitle": "Coffee shop",
139
+ "title": "Ocean Brew Co."
140
+ }
141
+ ],
142
+ "pos_overall": 1
143
+ }
144
+ ],
145
+ "navigation": [
146
+ {
147
+ "pos": 1,
148
+ "title": "AI Mode",
149
+ "url": "/search?q=coffee+shops&sca_esv=525e608177515078&hl=en&gl=us&udm=50&fbs=ADc_l-aN0CWEZBOHjofHoaMMDiKp9lEhFAN_4ain3HSNQWw-mOdEry7qMdvK9DVYTQhhmGPzdLibceP-axzNRyypn83aa9v77RK3nAyJbS7Ww3c5hEZ41MHuBwA1cj9fLdcvZl39JyX99GA6dTRuy8597fUa5gVhW6ji9TQaHsuXH4CUtx2nUSCgjR6EycjMi9JpkD60fmHj94qqvvZFpMtWVwcBzf9XLw&aep=1&ntc=1&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQ2J8OegQIEhAD"
150
+ },
151
+ {
152
+ "pos": 2,
153
+ "title": "All"
154
+ },
155
+ {
156
+ "pos": 3,
157
+ "title": "Shopping",
158
+ "url": "/search?sca_esv=525e608177515078&hl=en&gl=us&udm=28&fbs=ADc_l-aN0CWEZBOHjofHoaMMDiKp9lEhFAN_4ain3HSNQWw-mOdEry7qMdvK9DVYTQhhmGPzdLibceP-axzNRyypn83aa9v77RK3nAyJbS7Ww3c5hEZ41MHuBwA1cj9fLdcvZl39JyX99GA6dTRuy8597fUa5gVhW6ji9TQaHsuXH4CUtx2nUSCgjR6EycjMi9JpkD60fmHj94qqvvZFpMtWVwcBzf9XLw&q=coffee+shops&ved=1t:220175&ictx=111"
159
+ },
160
+ {
161
+ "pos": 4,
162
+ "title": "Maps",
163
+ "url": "https://maps.google.com/maps?sca_esv=525e608177515078&hl=en&gl=us&output=search&q=coffee+shops&source=lnms&fbs=ADc_l-aN0CWEZBOHjofHoaMMDiKp9lEhFAN_4ain3HSNQWw-mOdEry7qMdvK9DVYTQhhmGPzdLibceP-axzNRyypn83aa9v77RK3nAyJbS7Ww3c5hEZ41MHuBwA1cj9fLdcvZl39JyX99GA6dTRuy8597fUa5gVhW6ji9TQaHsuXH4CUtx2nUSCgjR6EycjMi9JpkD60fmHj94qqvvZFpMtWVwcBzf9XLw&entry=mc&ved=1t:200715&ictx=111"
164
+ },
165
+ {
166
+ "pos": 5,
167
+ "title": "Images",
168
+ "url": "/search?sca_esv=525e608177515078&hl=en&gl=us&udm=2&fbs=ADc_l-aN0CWEZBOHjofHoaMMDiKp9lEhFAN_4ain3HSNQWw-mOdEry7qMdvK9DVYTQhhmGPzdLibceP-axzNRyypn83aa9v77RK3nAyJbS7Ww3c5hEZ41MHuBwA1cj9fLdcvZl39JyX99GA6dTRuy8597fUa5gVhW6ji9TQaHsuXH4CUtx2nUSCgjR6EycjMi9JpkD60fmHj94qqvvZFpMtWVwcBzf9XLw&q=coffee+shops&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQtKgLegQIFhAB"
169
+ },
170
+ {
171
+ "pos": 6,
172
+ "title": "Short videos",
173
+ "url": "/search?sca_esv=525e608177515078&hl=en&gl=us&udm=39&fbs=ADc_l-aN0CWEZBOHjofHoaMMDiKp9lEhFAN_4ain3HSNQWw-mOdEry7qMdvK9DVYTQhhmGPzdLibceP-axzNRyypn83aa9v77RK3nAyJbS7Ww3c5hEZ41MHuBwA1cj9fLdcvZl39JyX99GA6dTRuy8597fUa5gVhW6ji9TQaHsuXH4CUtx2nUSCgjR6EycjMi9JpkD60fmHj94qqvvZFpMtWVwcBzf9XLw&q=coffee+shops&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQs6gLegQIFxAB"
174
+ },
175
+ {
176
+ "pos": 7,
177
+ "title": "Videos",
178
+ "url": "/search?sca_esv=525e608177515078&hl=en&gl=us&udm=7&fbs=ADc_l-aN0CWEZBOHjofHoaMMDiKp9lEhFAN_4ain3HSNQWw-mOdEry7qMdvK9DVYTQhhmGPzdLibceP-axzNRyypn83aa9v77RK3nAyJbS7Ww3c5hEZ41MHuBwA1cj9fLdcvZl39JyX99GA6dTRuy8597fUa5gVhW6ji9TQaHsuXH4CUtx2nUSCgjR6EycjMi9JpkD60fmHj94qqvvZFpMtWVwcBzf9XLw&q=coffee+shops&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQtKgLegQIGBAB"
179
+ },
180
+ {
181
+ "pos": 8,
182
+ "title": "Forums",
183
+ "url": "/search?sca_esv=525e608177515078&hl=en&gl=us&udm=18&fbs=ADc_l-aN0CWEZBOHjofHoaMMDiKp9lEhFAN_4ain3HSNQWw-mOdEry7qMdvK9DVYTQhhmGPzdLibceP-axzNRyypn83aa9v77RK3nAyJbS7Ww3c5hEZ41MHuBwA1cj9fLdcvZl39JyX99GA6dTRuy8597fUa5gVhW6ji9TQaHsuXH4CUtx2nUSCgjR6EycjMi9JpkD60fmHj94qqvvZFpMtWVwcBzf9XLw&q=coffee+shops&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQs6gLegUIuQEQAQ"
184
+ },
185
+ {
186
+ "pos": 9,
187
+ "title": "News",
188
+ "url": "/search?sca_esv=525e608177515078&hl=en&gl=us&q=coffee+shops&tbm=nws&source=lnms&fbs=ADc_l-aN0CWEZBOHjofHoaMMDiKp9lEhFAN_4ain3HSNQWw-mOdEry7qMdvK9DVYTQhhmGPzdLibceP-axzNRyypn83aa9v77RK3nAyJbS7Ww3c5hEZ41MHuBwA1cj9fLdcvZl39JyX99GA6dTRuy8597fUa5gVhW6ji9TQaHsuXH4CUtx2nUSCgjR6EycjMi9JpkD60fmHj94qqvvZFpMtWVwcBzf9XLw&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQ0pQJegUItwEQAQ"
189
+ },
190
+ {
191
+ "pos": 10,
192
+ "title": "Web",
193
+ "url": "/search?sca_esv=525e608177515078&hl=en&gl=us&udm=web&fbs=ADc_l-aN0CWEZBOHjofHoaMMDiKp9lEhFAN_4ain3HSNQWw-mOdEry7qMdvK9DVYTQhhmGPzdLibceP-axzNRyypn83aa9v77RK3nAyJbS7Ww3c5hEZ41MHuBwA1cj9fLdcvZl39JyX99GA6dTRuy8597fUa5gVhW6ji9TQaHsuXH4CUtx2nUSCgjR6EycjMi9JpkD60fmHj94qqvvZFpMtWVwcBzf9XLw&q=coffee+shops&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQs6gLegUIugEQAQ"
194
+ },
195
+ {
196
+ "pos": 11,
197
+ "title": "Books",
198
+ "url": "/search?sca_esv=525e608177515078&hl=en&gl=us&q=coffee+shops&udm=36&source=lnms&fbs=ADc_l-aN0CWEZBOHjofHoaMMDiKp9lEhFAN_4ain3HSNQWw-mOdEry7qMdvK9DVYTQhhmGPzdLibceP-axzNRyypn83aa9v77RK3nAyJbS7Ww3c5hEZ41MHuBwA1cj9fLdcvZl39JyX99GA6dTRuy8597fUa5gVhW6ji9TQaHsuXH4CUtx2nUSCgjR6EycjMi9JpkD60fmHj94qqvvZFpMtWVwcBzf9XLw&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQ0pQJegUIuAEQAQ"
199
+ }
200
+ ],
201
+ "organic": [
202
+ {
203
+ "desc": "For an alternate, local view, Eater has an interesting list of what it considers Philadelphia's 21 Essential Coffee Shops. Header image: Penn's Landing and ...Read more",
204
+ "favicon_text": "Brian's Coffee Spot",
205
+ "pos": 1,
206
+ "pos_overall": 2,
207
+ "title": "Philadelphia",
208
+ "url": "https://www.brian-coffee-spot.com/the-coffee-spot-guide-to/usa-canada/philadelphia/",
209
+ "url_shown": "https://www.brian-coffee-spot.com› usa-canada › phila..."
210
+ },
211
+ {
212
+ "desc": "Which Pittsburgh coffee shops are worth your time? Our ever-expanding guide gets to the bottom of that question.Read more",
213
+ "favicon_text": "Discover the Burgh",
214
+ "pos": 2,
215
+ "pos_overall": 3,
216
+ "title": "48 Pittsburgh Coffee Shops to Grab a Delicious Brew",
217
+ "url": "https://www.discovertheburgh.com/pittsburgh-coffee-shops/",
218
+ "url_shown": "https://www.discovertheburgh.com› ... › Coffee"
219
+ },
220
+ {
221
+ "desc": "Sep 29, 2016 — Best Coffee Shops in Atlanta · Octane · Dancing Goats Coffee Bar · Chrome Yellow Trading Co. · Revelator Coffee Company. Brash isn't the only ...Read more",
222
+ "favicon_text": "ATL Bucket List",
223
+ "pos": 3,
224
+ "pos_overall": 4,
225
+ "title": "Best Coffee Shops in Atlanta",
226
+ "url": "https://www.atlbucketlist.com/2016/09/29/best-coffee-shops-in-atlanta/",
227
+ "url_shown": "https://www.atlbucketlist.com› Food & Drink"
228
+ },
229
+ {
230
+ "desc": "Atticus Coffee & Gifts (222 N Howard St, Spokane, WA // 509.747.0336) There is a lot to love about downtown's Atticus. Firstly, it's one of the most ...Read more",
231
+ "favicon_text": "Spokane Eats",
232
+ "pos": 4,
233
+ "pos_overall": 6,
234
+ "title": "BEST COFFEE IN SPOKANE",
235
+ "url": "https://spokaneeats.net/best-coffee-in-spokane/",
236
+ "url_shown": "https://spokaneeats.net› Blog"
237
+ },
238
+ {
239
+ "desc": "Tucson has many excellent coffee shops including Exo Roast Co., Ren Coffeehouse, Presta Coffee Roasters and Ombre Coffee.",
240
+ "favicon_text": "Globalphile",
241
+ "pos": 5,
242
+ "pos_overall": 7,
243
+ "title": "The Best Coffee Shops in Tucson, AZ",
244
+ "url": "https://globalphile.com/the-best-coffee-shops-in-tucson-az/",
245
+ "url_shown": "https://globalphile.com› the-best-coffee-shops-in-tucson..."
246
+ },
247
+ {
248
+ "desc": "Oct 30, 2025 — The Best Coffee Shops in Orange County, California: A Local's Guide · Brot Coffee Co. · Daydream Surf Shop – Newport Beach · Hidden House Coffee ...Read more",
249
+ "favicon_text": "Lauren Belzer",
250
+ "pos": 6,
251
+ "pos_overall": 8,
252
+ "title": "The Best Coffee Shops in Orange County, California",
253
+ "url": "https://laurenbelz.com/best-coffee-orange-county/",
254
+ "url_shown": "https://laurenbelz.com› best-coffee-orange-county"
255
+ },
256
+ {
257
+ "desc": "Sep 11, 2024 — Writer Gene Kahane names his top five favorite local coffee shops around the island of Alameda, including LazyBird and The Local.",
258
+ "favicon_text": "Alameda Post",
259
+ "pos": 7,
260
+ "pos_overall": 9,
261
+ "title": "Five Favorite Coffee Shops",
262
+ "url": "https://alamedapost.com/features/alameda-life/five-favorite-coffee-shops/",
263
+ "url_shown": "https://alamedapost.com› Features › Alameda Life"
264
+ },
265
+ {
266
+ "desc": "Jun 24, 2025 — 1. Royal Flamingo Coffee -> I Like It Like That · 2. Roosevelt Coffeehouse -> Olentangy River Brewing Company · 3. Ravello's Coffee -> The Daily ...Read more",
267
+ "favicon_text": "Breakfast With Nick",
268
+ "pos": 8,
269
+ "pos_overall": 10,
270
+ "title": "Columbus' Best Coffee Shops in Bars",
271
+ "url": "https://breakfastwithnick.com/2025/06/24/the-best-coffee-shops-in-bars-columbus-ohio/",
272
+ "url_shown": "https://breakfastwithnick.com› 2025/06/24 › the-best-c..."
273
+ }
274
+ ],
275
+ "paid": [],
276
+ "related_searches": [
277
+ {
278
+ "pos_overall": 11,
279
+ "related_searches": [
280
+ "Best coffee shops",
281
+ "Coffee shops Pittsburgh",
282
+ "Coffee shops Strip District",
283
+ "Coffee shops Philadelphia",
284
+ "Coffee shops downtown Pittsburgh",
285
+ "Best coffee shops Pittsburgh",
286
+ "Best coffee shops in Philadelphia for working",
287
+ "Coffee Shops Sewickley"
288
+ ],
289
+ "related_searches_urls": [
290
+ "https://www.google.com/search?sca_esv=525e608177515078&hl=en&gl=us&q=Best+coffee+shops&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQ1QJ6BAg1EAE",
291
+ "https://www.google.com/search?sca_esv=525e608177515078&hl=en&gl=us&q=Coffee+shops+Pittsburgh&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQ1QJ6BAg8EAE",
292
+ "https://www.google.com/search?sca_esv=525e608177515078&hl=en&gl=us&q=Coffee+shops+Strip+District&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQ1QJ6BAg_EAE",
293
+ "https://www.google.com/search?sca_esv=525e608177515078&hl=en&gl=us&q=Coffee+shops+Philadelphia&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQ1QJ6BAhBEAE",
294
+ "https://www.google.com/search?sca_esv=525e608177515078&hl=en&gl=us&q=Coffee+shops+downtown+Pittsburgh&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQ1QJ6BAg-EAE",
295
+ "https://www.google.com/search?sca_esv=525e608177515078&hl=en&gl=us&q=Best+coffee+shops+Pittsburgh&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQ1QJ6BAg6EAE",
296
+ "https://www.google.com/search?sca_esv=525e608177515078&hl=en&gl=us&q=Best+coffee+shops+in+Philadelphia+for+working&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQ1QJ6BAg7EAE",
297
+ "https://www.google.com/search?sca_esv=525e608177515078&hl=en&gl=us&q=Coffee+Shops+Sewickley&sa=X&ved=2ahUKEwiq0P6Xv8yUAxUPNvsDHaaIEQsQ1QJ6BAg5EAE"
298
+ ]
299
+ }
300
+ ],
301
+ "search_information": {
302
+ "no_results_for_original_query_found": false,
303
+ "query": "coffee shops",
304
+ "showing_results_for": "coffee shops",
305
+ "time_taken_displayed": null,
306
+ "total_results_count": 403000000
307
+ },
308
+ "total_results_count": 403000000,
309
+ "what_people_are_saying": {
310
+ "items": [
311
+ {
312
+ "engagement_timeframe": "2 reactions, 3 days ago",
313
+ "pos": 1,
314
+ "source": "Facebook",
315
+ "title": "Will be working in Frederick every Monday for the foreseeable future (driving from Westminster)...what's your fave coffee shop in the area?",
316
+ "url": "https://www.facebook.com/groups/366748512662939/posts/968510169153434/"
317
+ },
318
+ {
319
+ "engagement_timeframe": "90+ comments, 18 hours ago",
320
+ "pos": 2,
321
+ "source": "Reddit",
322
+ "title": "Portland coffee roaster scoops up another empty Starbucks cafe",
323
+ "url": "https://www.reddit.com/r/Portland/comments/1tjmv4s/portland_coffee_roaster_scoops_up_another_empty/"
324
+ },
325
+ {
326
+ "engagement_timeframe": "1.5M+ views, 1 week ago",
327
+ "pos": 3,
328
+ "source": "Los Angeles",
329
+ "title": "Auntie Nid Coffee Shop 🇹🇭 aka ร้านป้านิดปากแดง กาแฟโบราณ (Pa Nid Pak Daeng Kafaeboran) #auntienidcoffeeshop #auntienid",
330
+ "url": "https://www.tiktok.com/@janiedevours/video/7640013933008440606"
331
+ }
332
+ ],
333
+ "pos_overall": 5
334
+ }
335
+ },
336
+ "url": "https://www.google.com/search?q=coffee+shops&hl=en&gl=us"
337
+ },
338
+ "errors": [],
339
+ "status_code": 12000,
340
+ "task_id": "7463508496927950850"
341
+ },
342
+ "headers": {},
343
+ "status_code": 200,
344
+ "url": "https://www.google.com/search?q=coffee+shops&hl=en&gl=us",
345
+ "query": "coffee shops",
346
+ "task_id": "7463508496927950850",
347
+ "created_at": "2026-05-22 08:38:10",
348
+ "updated_at": "2026-05-22 08:38:13"
349
+ }
350
+ ]
351
+ }
352
+ ```
353
+
354
+ </details>
355
+
38
356
  ## Configuration
39
357
 
40
358
  ```typescript
@@ -46,9 +364,14 @@ const client = new DecodoClient({
46
364
  });
47
365
  ```
48
366
 
367
+ | Parameter | Description |
368
+ | --- | --- |
369
+ | `token` | Web Scraping API basic authentication token |
370
+ | `timeoutMs` | Request timeout in milliseconds (default: 180000) |
371
+
49
372
  ## Web Scraping API
50
373
 
51
- Access via `client.webScrapingApi`.
374
+ Access the API via `client.webScrapingApi`.
52
375
 
53
376
  The snippets below assume you have already imported `Target` (and `DecodoClient` where a client is constructed), for example:
54
377
 
@@ -58,7 +381,7 @@ import { DecodoClient, Target } from '@decodo/sdk-ts';
58
381
 
59
382
  ### Sync scrape
60
383
 
61
- Blocks until the scraping result is ready:
384
+ Waits for the scraping result before returning:
62
385
 
63
386
  ```typescript
64
387
  const result = await client.webScrapingApi.scrape({
@@ -70,7 +393,7 @@ const result = await client.webScrapingApi.scrape({
70
393
 
71
394
  ### Async scrape
72
395
 
73
- Creates a task and returns immediately. Poll separately for results:
396
+ Creates a scraping task and returns immediately. Poll separately for task status and results:
74
397
 
75
398
  ```typescript
76
399
  const task = await client.webScrapingApi.scrapeAsync({
@@ -87,7 +410,7 @@ const results = await client.webScrapingApi.getResults(task.id);
87
410
 
88
411
  ### Batch scrape
89
412
 
90
- Send multiple URLs or queries in a single request:
413
+ Send multiple queries or URLs in a single request:
91
414
 
92
415
  ```typescript
93
416
  const batch = await client.webScrapingApi.scrapeBatch({
@@ -95,9 +418,71 @@ const batch = await client.webScrapingApi.scrapeBatch({
95
418
  query: ['coffee', 'tea', 'juice'],
96
419
  parse: true,
97
420
  });
98
- console.log(batch.id);
421
+
422
+ const coffeeTaskId = batch.queries[0].id;
423
+
424
+ await client.webScrapingApi.getResults(coffeeTaskId);
99
425
  ```
100
426
 
427
+ ## Supported targets
428
+
429
+ Each target accepts one primary input parameter (`url`, `query`, `product_id`, or `prompt`) together with optional configuration. The examples below show the minimum payload to call `client.webScrapingApi.scrape(...)`.
430
+
431
+ ### Search engines
432
+
433
+ | Target | Description | Example |
434
+ | --- | --- | --- |
435
+ | `Target.GoogleSearch` | Google Search results for a query | `{ target: Target.GoogleSearch, query: "coffee shops" }` |
436
+ | `Target.GoogleMaps` | Google Maps search results | `{ target: Target.GoogleMaps, query: "coffee shops brooklyn" }` |
437
+ | `Target.GoogleShoppingSearch` | Google Shopping search results | `{ target: Target.GoogleShoppingSearch, query: "laptop" }` |
438
+ | `Target.GoogleSuggest` | Google Autocomplete suggestions | `{ target: Target.GoogleSuggest, query: "coffee" }` |
439
+ | `Target.GoogleLens` | Google Lens reverse image search | `{ target: Target.GoogleLens, query: "https://example.com/cat.jpg" }` |
440
+ | `Target.BingSearch` | Bing Search results | `{ target: Target.BingSearch, query: "electric vehicles" }` |
441
+
442
+ ### eCommerce
443
+
444
+ | Target | Description | Example |
445
+ | --- | --- | --- |
446
+ | `Target.AmazonProduct` | Amazon product detail page by ASIN | `{ target: Target.AmazonProduct, query: "B09H74FXNW" }` |
447
+ | `Target.AmazonSearch` | Amazon search results | `{ target: Target.AmazonSearch, query: "laptop" }` |
448
+ | `Target.AmazonPricing` | Amazon pricing and offers | `{ target: Target.AmazonPricing, query: "B09H74FXNW" }` |
449
+ | `Target.WalmartProduct` | Walmart product page by product ID | `{ target: Target.WalmartProduct, product_id: "15296401808" }` |
450
+ | `Target.TargetProduct` | Target.com product page by product ID | `{ target: Target.TargetProduct, product_id: "92186007" }` |
451
+ | `Target.Ecommerce` | Generic eCommerce page with parser | `{ target: Target.Ecommerce, url: "https://example.com/product/123" }` |
452
+
453
+ ### Social media
454
+
455
+ | Target | Description | Example |
456
+ | --- | --- | --- |
457
+ | `Target.RedditPost` | Reddit post by URL | `{ target: Target.RedditPost, url: "https://reddit.com/r/nba/..." }` |
458
+ | `Target.RedditSubreddit` | Reddit subreddit by URL | `{ target: Target.RedditSubreddit, url: "https://reddit.com/r/nba/" }` |
459
+ | `Target.YoutubeVideo` | YouTube video by ID | `{ target: Target.YoutubeVideo, query: "dFu9aKJoqGg" }` |
460
+ | `Target.YoutubeSearch` | YouTube search results | `{ target: Target.YoutubeSearch, query: "ambient music" }` |
461
+ | `Target.TiktokPost` | TikTok post by URL | `{ target: Target.TiktokPost, url: "https://www.tiktok.com/@nba/video/..." }` |
462
+
463
+ ### AI tools
464
+
465
+ | Target | Description | Example |
466
+ | --- | --- | --- |
467
+ | `Target.Chatgpt` | ChatGPT response for a prompt | `{ target: Target.Chatgpt, prompt: "What are the top three dog breeds?" }` |
468
+ | `Target.Perplexity` | Perplexity response for a prompt | `{ target: Target.Perplexity, prompt: "What causes seasonal allergies?" }` |
469
+ | `Target.GoogleAiMode` | Google AI Mode response | `{ target: Target.GoogleAiMode, query: "What are the top three dog breeds?" }` |
470
+
471
+ ### Universal scraping
472
+
473
+ | Target | Description | Example |
474
+ | --- | --- | --- |
475
+ | `Target.Universal` | Any URL via the universal scraper | `{ target: Target.Universal, url: "https://example.com" }` |
476
+ | `Target.Google` | Raw Google URL scraping | `{ target: Target.Google, url: "https://google.com/search?q=laptop" }` |
477
+ | `Target.Amazon` | Raw Amazon URL scraping | `{ target: Target.Amazon, url: "https://amazon.com/dp/B09H74FXNW" }` |
478
+
479
+ > `Target.UniversalEcommerce` isn't listed above because it doesn't accept a primary input parameter like `url`, `query`, `product_id`, or `prompt`. It only accepts optional configuration fields such as `callback_url`.
480
+
481
+ For the full target list and parameter details, see the API documentation:
482
+
483
+ - [Target list](https://help.decodo.com/docs/web-scraping-api-targets)
484
+ - [Parameters](https://help.decodo.com/docs/web-scraping-api-parameters)
485
+
101
486
  ## Error handling
102
487
 
103
488
  The SDK throws typed errors that map to API error codes:
@@ -132,7 +517,20 @@ try {
132
517
  }
133
518
  ```
134
519
 
135
- ## Requirements
520
+ ## Related repositories
521
+
522
+ - [Web Scraping API](https://github.com/Decodo/Web-Scraping-API)
523
+ - [Decodo MCP Server](https://github.com/Decodo/mcp-server)
524
+ - [Decodo OpenClaw Skill](https://github.com/Decodo/decodo-openclaw-skill)
525
+
526
+ ## Get started
527
+
528
+ Build scraping workflows with the Decodo Web Scraping API:
529
+
530
+ - [Start free plan](https://dashboard.decodo.com/)
531
+ - [Documentation](https://help.decodo.com/docs/introduction)
532
+ - [Discord](https://discord.gg/Ja8dqKgvbZ)
533
+
534
+ ## License
136
535
 
137
- - Node.js >= 18 (for native `fetch`)
138
- - TypeScript >= 5.0 (recommended for best type inference)
536
+ Released under the [MIT License](https://github.com/Decodo/Decodo/blob/master/LICENSE).
@@ -1,9 +1,11 @@
1
1
  import { HttpClient } from '../http.js';
2
+ import type { DecodoSchema } from '../schema/types.js';
2
3
  import type { ScrapeRequest, BatchRequest } from '../generated/targets.js';
3
4
  import type { SyncResponse, AsyncTaskResponse, BatchResponse, TaskMetadata, TaskResultsResponse } from '../types/responses.js';
4
5
  export declare class WebScrapingApi {
5
6
  private readonly http;
6
- constructor(http: HttpClient);
7
+ private readonly schemas;
8
+ constructor(http: HttpClient, schemas?: DecodoSchema);
7
9
  private validate;
8
10
  scrape(params: ScrapeRequest): Promise<SyncResponse>;
9
11
  scrapeAsync(params: ScrapeRequest): Promise<AsyncTaskResponse>;
@@ -3,14 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WebScrapingApi = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const errors_js_1 = require("../errors.js");
6
- const request_schemas_js_1 = require("../generated/request-schemas.js");
6
+ const bundled_schema_js_1 = require("../schema/bundled-schema.js");
7
7
  class WebScrapingApi {
8
8
  http;
9
- constructor(http) {
9
+ schemas;
10
+ constructor(http, schemas = bundled_schema_js_1.BundledSchema.shared) {
10
11
  this.http = http;
12
+ this.schemas = schemas;
11
13
  }
12
14
  validate(params) {
13
- const schema = request_schemas_js_1.requestSchemas[params.target];
15
+ const schema = this.schemas.getRequestSchema(params.target);
14
16
  if (!schema) {
15
17
  return;
16
18
  }
@@ -1,9 +1,11 @@
1
1
  import { WebScrapingApi } from './api/web-scraping-api.js';
2
+ import type { DecodoSchema } from './schema/types.js';
2
3
  export type DecodoConfig = {
3
4
  webScrapingApi?: {
4
5
  token: string;
5
6
  };
6
7
  timeoutMs?: number;
8
+ schema?: DecodoSchema;
7
9
  };
8
10
  export declare class DecodoClient {
9
11
  readonly webScrapingApi: WebScrapingApi;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DecodoClient = void 0;
4
4
  const http_js_1 = require("./http.js");
5
5
  const web_scraping_api_js_1 = require("./api/web-scraping-api.js");
6
+ const bundled_schema_js_1 = require("./schema/bundled-schema.js");
6
7
  const WEB_API_BASE_URL = 'https://scraper-api.decodo.com';
7
8
  const DEFAULT_TIMEOUT_MS = 180_000;
8
9
  const notConfigured = (namespace, hint) => {
@@ -12,6 +13,7 @@ class DecodoClient {
12
13
  webScrapingApi;
13
14
  constructor(config) {
14
15
  const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
16
+ const schema = config.schema ?? bundled_schema_js_1.BundledSchema.shared;
15
17
  if (config.webScrapingApi) {
16
18
  this.webScrapingApi = new web_scraping_api_js_1.WebScrapingApi(new http_js_1.HttpClient({
17
19
  baseUrl: WEB_API_BASE_URL,
@@ -20,7 +22,7 @@ class DecodoClient {
20
22
  token: config.webScrapingApi.token,
21
23
  },
22
24
  timeoutMs,
23
- }));
25
+ }), schema);
24
26
  }
25
27
  else {
26
28
  this.webScrapingApi = new Proxy({}, {
@@ -39,9 +39,6 @@ exports.parameterMeta = {
39
39
  merchant: { type: "string" },
40
40
  sort_by: { type: "string" },
41
41
  parser_type: { type: "string" },
42
- payload: { type: "string" },
43
- http_method: { type: "string" },
44
- successful_status_codes: { type: "array", items: { type: "number" } },
45
42
  product_id: { type: "string" },
46
43
  fulfillment_type: { type: "string" },
47
44
  walmart_store_id: { type: "string" },
@@ -54,7 +51,10 @@ exports.parameterMeta = {
54
51
  free_delivery: { type: "boolean" },
55
52
  pickup_today: { type: "boolean" },
56
53
  delivery_today_tomorrow: { type: "boolean" },
54
+ payload: { type: "string" },
57
55
  proxy_pool: { type: "string", enum: ["standard", "premium"] },
56
+ http_method: { type: "string" },
57
+ successful_status_codes: { type: "array", items: { type: "number" } },
58
58
  headers: { type: "object" },
59
59
  cookies: { type: "object" },
60
60
  force_headers: { type: "boolean" },
@@ -79,7 +79,4 @@ exports.parameterMeta = {
79
79
  subtitles: { type: "boolean" },
80
80
  subtitle_origin: { type: "string" },
81
81
  limit: { type: "number", minimum: 0, maximum: 100 },
82
- customStatusCode: { type: "string" },
83
- requestBody: { type: "string" },
84
- customCookies: { type: "string" },
85
82
  };