@decodo/sdk-ts 2.0.0 → 2.0.1
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 +415 -17
- package/package.json +1 -1
- package/build/cjs/api/web-scraping-api.d.ts +0 -13
- package/build/cjs/api/web-scraping-api.js +0 -41
- package/build/cjs/client.d.ts +0 -11
- package/build/cjs/client.js +0 -34
- package/build/cjs/errors.d.ts +0 -18
- package/build/cjs/errors.js +0 -44
- package/build/cjs/generated/parameters.d.ts +0 -11
- package/build/cjs/generated/parameters.js +0 -85
- package/build/cjs/generated/request-schemas.d.ts +0 -2123
- package/build/cjs/generated/request-schemas.js +0 -2431
- package/build/cjs/generated/targets.d.ts +0 -735
- package/build/cjs/generated/targets.js +0 -343
- package/build/cjs/http.d.ts +0 -22
- package/build/cjs/http.js +0 -94
- package/build/cjs/index.d.ts +0 -9
- package/build/cjs/index.js +0 -19
- package/build/cjs/types/requests.d.ts +0 -1
- package/build/cjs/types/requests.js +0 -2
- package/build/cjs/types/responses.d.ts +0 -62
- package/build/cjs/types/responses.js +0 -2
- package/build/esm/api/web-scraping-api.d.ts +0 -13
- package/build/esm/api/web-scraping-api.js +0 -37
- package/build/esm/client.d.ts +0 -11
- package/build/esm/client.js +0 -30
- package/build/esm/errors.d.ts +0 -18
- package/build/esm/errors.js +0 -36
- package/build/esm/generated/parameters.d.ts +0 -11
- package/build/esm/generated/parameters.js +0 -82
- package/build/esm/generated/request-schemas.d.ts +0 -2123
- package/build/esm/generated/request-schemas.js +0 -2395
- package/build/esm/generated/targets.d.ts +0 -735
- package/build/esm/generated/targets.js +0 -340
- package/build/esm/http.d.ts +0 -22
- package/build/esm/http.js +0 -90
- package/build/esm/index.d.ts +0 -9
- package/build/esm/index.js +0 -5
- package/build/esm/types/requests.d.ts +0 -1
- package/build/esm/types/requests.js +0 -1
- package/build/esm/types/responses.d.ts +0 -62
- package/build/esm/types/responses.js +0 -1
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Auto-generated by src/codegen/web-scraping-api/generate-targets.ts — do not edit
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.targetMeta = exports.targets = exports.Target = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* Scrape target discriminator (wire string values).
|
|
7
|
-
*/
|
|
8
|
-
var Target;
|
|
9
|
-
(function (Target) {
|
|
10
|
-
Target["UniversalEcommerce"] = "universal_ecommerce";
|
|
11
|
-
Target["GoogleSearch"] = "google_search";
|
|
12
|
-
Target["GoogleTravelHotels"] = "google_travel_hotels";
|
|
13
|
-
Target["GoogleTrendsExplore"] = "google_trends_explore";
|
|
14
|
-
Target["GoogleShoppingSearch"] = "google_shopping_search";
|
|
15
|
-
Target["GoogleShoppingProduct"] = "google_shopping_product";
|
|
16
|
-
Target["Google"] = "google";
|
|
17
|
-
Target["GoogleSuggest"] = "google_suggest";
|
|
18
|
-
Target["GoogleMaps"] = "google_maps";
|
|
19
|
-
Target["GoogleAiMode"] = "google_ai_mode";
|
|
20
|
-
Target["GoogleAds"] = "google_ads";
|
|
21
|
-
Target["GoogleLens"] = "google_lens";
|
|
22
|
-
Target["BingSearch"] = "bing_search";
|
|
23
|
-
Target["Bing"] = "bing";
|
|
24
|
-
Target["YoutubeTranscript"] = "youtube_transcript";
|
|
25
|
-
Target["AmazonProduct"] = "amazon_product";
|
|
26
|
-
Target["AmazonPricing"] = "amazon_pricing";
|
|
27
|
-
Target["AmazonSearch"] = "amazon_search";
|
|
28
|
-
Target["AmazonSellers"] = "amazon_sellers";
|
|
29
|
-
Target["AmazonBestsellers"] = "amazon_bestsellers";
|
|
30
|
-
Target["Amazon"] = "amazon";
|
|
31
|
-
Target["Ecommerce"] = "ecommerce";
|
|
32
|
-
Target["EcommerceCore"] = "ecommerce_core";
|
|
33
|
-
Target["WalmartProduct"] = "walmart_product";
|
|
34
|
-
Target["WalmartSearch"] = "walmart_search";
|
|
35
|
-
Target["Walmart"] = "walmart";
|
|
36
|
-
Target["TargetProduct"] = "target_product";
|
|
37
|
-
Target["TargetSearch"] = "target_search";
|
|
38
|
-
Target["Target"] = "target";
|
|
39
|
-
Target["LowesSearch"] = "lowes_search";
|
|
40
|
-
Target["Universal"] = "universal";
|
|
41
|
-
Target["UniversalCore"] = "universal_core";
|
|
42
|
-
Target["Chatgpt"] = "chatgpt";
|
|
43
|
-
Target["Perplexity"] = "perplexity";
|
|
44
|
-
Target["Bbb"] = "bbb";
|
|
45
|
-
Target["Autotrader"] = "autotrader";
|
|
46
|
-
Target["Mobile"] = "mobile";
|
|
47
|
-
Target["Airbnb"] = "airbnb";
|
|
48
|
-
Target["AppleAppStore"] = "apple_app_store";
|
|
49
|
-
Target["InstagramGraphqlProfile"] = "instagram_graphql_profile";
|
|
50
|
-
Target["TiktokPost"] = "tiktok_post";
|
|
51
|
-
Target["TiktokShopSearch"] = "tiktok_shop_search";
|
|
52
|
-
Target["TiktokShopProduct"] = "tiktok_shop_product";
|
|
53
|
-
Target["Tiktok"] = "tiktok";
|
|
54
|
-
Target["RedditPost"] = "reddit_post";
|
|
55
|
-
Target["RedditSubreddit"] = "reddit_subreddit";
|
|
56
|
-
Target["RedditUser"] = "reddit_user";
|
|
57
|
-
Target["YoutubeVideo"] = "youtube_video";
|
|
58
|
-
Target["YoutubeMetadata"] = "youtube_metadata";
|
|
59
|
-
Target["YoutubeSearch"] = "youtube_search";
|
|
60
|
-
Target["YoutubeSearchMax"] = "youtube_search_max";
|
|
61
|
-
Target["YoutubeSubtitles"] = "youtube_subtitles";
|
|
62
|
-
Target["YoutubeChannel"] = "youtube_channel";
|
|
63
|
-
Target["SiteUnblocker"] = "site_unblocker";
|
|
64
|
-
Target["SiteUnblockerReq"] = "site_unblocker_req";
|
|
65
|
-
})(Target || (exports.Target = Target = {}));
|
|
66
|
-
exports.targets = [Target.UniversalEcommerce, Target.GoogleSearch, Target.GoogleTravelHotels, Target.GoogleTrendsExplore, Target.GoogleShoppingSearch, Target.GoogleShoppingProduct, Target.Google, Target.GoogleSuggest, Target.GoogleMaps, Target.GoogleAiMode, Target.GoogleAds, Target.GoogleLens, Target.BingSearch, Target.Bing, Target.YoutubeTranscript, Target.AmazonProduct, Target.AmazonPricing, Target.AmazonSearch, Target.AmazonSellers, Target.AmazonBestsellers, Target.Amazon, Target.Ecommerce, Target.EcommerceCore, Target.WalmartProduct, Target.WalmartSearch, Target.Walmart, Target.TargetProduct, Target.TargetSearch, Target.Target, Target.LowesSearch, Target.Universal, Target.UniversalCore, Target.Chatgpt, Target.Perplexity, Target.Bbb, Target.Autotrader, Target.Mobile, Target.Airbnb, Target.AppleAppStore, Target.InstagramGraphqlProfile, Target.TiktokPost, Target.TiktokShopSearch, Target.TiktokShopProduct, Target.Tiktok, Target.RedditPost, Target.RedditSubreddit, Target.RedditUser, Target.YoutubeVideo, Target.YoutubeMetadata, Target.YoutubeSearch, Target.YoutubeSearchMax, Target.YoutubeSubtitles, Target.YoutubeChannel, Target.SiteUnblocker, Target.SiteUnblockerReq];
|
|
67
|
-
exports.targetMeta = {
|
|
68
|
-
[Target.UniversalEcommerce]: {
|
|
69
|
-
group: "None",
|
|
70
|
-
response_format: "html",
|
|
71
|
-
parameters: ["callback_url"],
|
|
72
|
-
},
|
|
73
|
-
[Target.GoogleSearch]: {
|
|
74
|
-
group: "Google",
|
|
75
|
-
response_format: "json",
|
|
76
|
-
parameters: ["query", "headless", "locale", "geo", "device_type", "page_from", "google_results_language", "google_tbm", "google_tbs", "parse", "google_nfpr", "google_safe_search", "session_id", "xhr", "markdown", "page_count", "callback_url"],
|
|
77
|
-
},
|
|
78
|
-
[Target.GoogleTravelHotels]: {
|
|
79
|
-
group: "Google",
|
|
80
|
-
response_format: "html",
|
|
81
|
-
parameters: ["query", "headless", "locale", "device_type", "page_from", "date_range", "stars", "adults", "children", "session_id", "markdown", "callback_url"],
|
|
82
|
-
},
|
|
83
|
-
[Target.GoogleTrendsExplore]: {
|
|
84
|
-
group: "Google",
|
|
85
|
-
response_format: "json",
|
|
86
|
-
parameters: ["query", "geo", "device_type", "search_type", "date_start", "date_end", "callback_url"],
|
|
87
|
-
},
|
|
88
|
-
[Target.GoogleShoppingSearch]: {
|
|
89
|
-
group: "Google",
|
|
90
|
-
response_format: "json",
|
|
91
|
-
parameters: ["query", "headless", "locale", "geo", "device_type", "page_from", "google_tbs", "parse", "session_id", "google_results_language", "markdown", "callback_url"],
|
|
92
|
-
},
|
|
93
|
-
[Target.GoogleShoppingProduct]: {
|
|
94
|
-
group: "Google",
|
|
95
|
-
response_format: "json",
|
|
96
|
-
parameters: ["query", "headless", "locale", "geo", "device_type", "page_from", "parse", "session_id", "google_results_language", "markdown", "xhr", "callback_url"],
|
|
97
|
-
},
|
|
98
|
-
[Target.Google]: {
|
|
99
|
-
group: "Google",
|
|
100
|
-
response_format: "json",
|
|
101
|
-
parameters: ["url", "headless", "locale", "device_type", "parse", "session_id", "markdown", "xhr", "page_count", "callback_url"],
|
|
102
|
-
},
|
|
103
|
-
[Target.GoogleSuggest]: {
|
|
104
|
-
group: "Google",
|
|
105
|
-
response_format: "json",
|
|
106
|
-
parameters: ["query", "device_type", "geo", "locale", "session_id", "callback_url"],
|
|
107
|
-
},
|
|
108
|
-
[Target.GoogleMaps]: {
|
|
109
|
-
group: "Google",
|
|
110
|
-
response_format: "html",
|
|
111
|
-
parameters: ["query", "headless", "geo", "locale", "page_from", "device_type", "session_id", "google_results_language", "google_nfpr", "hotel_occupancy", "date_range", "markdown", "callback_url"],
|
|
112
|
-
},
|
|
113
|
-
[Target.GoogleAiMode]: {
|
|
114
|
-
group: "AI Tools",
|
|
115
|
-
response_format: "json",
|
|
116
|
-
parameters: ["query", "geo", "parse", "device_type", "session_id", "markdown", "xhr", "callback_url"],
|
|
117
|
-
},
|
|
118
|
-
[Target.GoogleAds]: {
|
|
119
|
-
group: "Google",
|
|
120
|
-
response_format: "json",
|
|
121
|
-
parameters: ["query", "headless", "locale", "geo", "device_type", "page_from", "google_results_language", "google_tbm", "google_tbs", "parse", "google_nfpr", "session_id", "markdown", "xhr", "page_count", "callback_url"],
|
|
122
|
-
},
|
|
123
|
-
[Target.GoogleLens]: {
|
|
124
|
-
group: "Google",
|
|
125
|
-
response_format: "json",
|
|
126
|
-
parameters: ["query", "headless", "parse", "device_type", "markdown", "callback_url"],
|
|
127
|
-
},
|
|
128
|
-
[Target.BingSearch]: {
|
|
129
|
-
group: "Bing",
|
|
130
|
-
response_format: "json",
|
|
131
|
-
parameters: ["query", "headless", "locale", "geo", "domain", "device_type", "page_from", "parse", "page_count", "session_id", "markdown", "xhr", "callback_url"],
|
|
132
|
-
},
|
|
133
|
-
[Target.Bing]: {
|
|
134
|
-
group: "Bing",
|
|
135
|
-
response_format: "json",
|
|
136
|
-
parameters: ["url", "headless", "locale", "geo", "device_type", "page_from", "parse", "session_id", "markdown", "xhr", "callback_url"],
|
|
137
|
-
},
|
|
138
|
-
[Target.YoutubeTranscript]: {
|
|
139
|
-
group: "YouTube",
|
|
140
|
-
response_format: "json",
|
|
141
|
-
parameters: ["query", "language_code", "transcript_origin", "callback_url"],
|
|
142
|
-
},
|
|
143
|
-
[Target.AmazonProduct]: {
|
|
144
|
-
group: "Amazon",
|
|
145
|
-
response_format: "json",
|
|
146
|
-
parameters: ["query", "headless", "domain", "device_type", "parse", "autoselect_variant", "geo", "session_id", "currency", "markdown", "xhr", "callback_url"],
|
|
147
|
-
},
|
|
148
|
-
[Target.AmazonPricing]: {
|
|
149
|
-
group: "Amazon",
|
|
150
|
-
response_format: "json",
|
|
151
|
-
parameters: ["query", "headless", "domain", "device_type", "page_from", "parse", "geo", "session_id", "currency", "markdown", "xhr", "callback_url"],
|
|
152
|
-
},
|
|
153
|
-
[Target.AmazonSearch]: {
|
|
154
|
-
group: "Amazon",
|
|
155
|
-
response_format: "json",
|
|
156
|
-
parameters: ["query", "headless", "domain", "device_type", "page_from", "category", "merchant", "parse", "geo", "session_id", "sort_by", "currency", "markdown", "xhr", "callback_url"],
|
|
157
|
-
},
|
|
158
|
-
[Target.AmazonSellers]: {
|
|
159
|
-
group: "Amazon",
|
|
160
|
-
response_format: "json",
|
|
161
|
-
parameters: ["query", "headless", "locale", "domain", "device_type", "geo", "parse", "markdown", "xhr", "callback_url"],
|
|
162
|
-
},
|
|
163
|
-
[Target.AmazonBestsellers]: {
|
|
164
|
-
group: "Amazon",
|
|
165
|
-
response_format: "json",
|
|
166
|
-
parameters: ["query", "domain", "device_type", "geo", "page_from", "category", "parse", "session_id", "currency", "markdown", "xhr", "callback_url"],
|
|
167
|
-
},
|
|
168
|
-
[Target.Amazon]: {
|
|
169
|
-
group: "Amazon",
|
|
170
|
-
response_format: "json",
|
|
171
|
-
parameters: ["url", "headless", "device_type", "parse", "geo", "session_id", "markdown", "xhr", "callback_url"],
|
|
172
|
-
},
|
|
173
|
-
[Target.Ecommerce]: {
|
|
174
|
-
group: "Other eCommerce",
|
|
175
|
-
response_format: "json",
|
|
176
|
-
parameters: ["url", "headless", "locale", "geo", "device_type", "parse", "parser_type", "callback_url"],
|
|
177
|
-
},
|
|
178
|
-
[Target.EcommerceCore]: {
|
|
179
|
-
group: "None",
|
|
180
|
-
response_format: "html",
|
|
181
|
-
parameters: ["url", "payload", "geo", "http_method", "successful_status_codes", "callback_url"],
|
|
182
|
-
},
|
|
183
|
-
[Target.WalmartProduct]: {
|
|
184
|
-
group: "Walmart",
|
|
185
|
-
response_format: "html",
|
|
186
|
-
parameters: ["product_id", "headless", "parse", "xhr", "markdown", "fulfillment_type", "walmart_store_id", "delivery_zip", "callback_url"],
|
|
187
|
-
},
|
|
188
|
-
[Target.WalmartSearch]: {
|
|
189
|
-
group: "Walmart",
|
|
190
|
-
response_format: "json",
|
|
191
|
-
parameters: ["query", "headless", "parse", "markdown", "fulfillment_type", "walmart_store_id", "delivery_zip", "callback_url"],
|
|
192
|
-
},
|
|
193
|
-
[Target.Walmart]: {
|
|
194
|
-
group: "Walmart",
|
|
195
|
-
response_format: "html",
|
|
196
|
-
parameters: ["url", "headless", "locale", "geo", "device_type", "store_id", "markdown", "xhr", "callback_url"],
|
|
197
|
-
},
|
|
198
|
-
[Target.TargetProduct]: {
|
|
199
|
-
group: "Target",
|
|
200
|
-
response_format: "json",
|
|
201
|
-
parameters: ["product_id", "headless", "parse", "device_type", "markdown", "xhr", "delivery_type", "target_store_id", "delivery_zip", "callback_url"],
|
|
202
|
-
},
|
|
203
|
-
[Target.TargetSearch]: {
|
|
204
|
-
group: "Target",
|
|
205
|
-
response_format: "json",
|
|
206
|
-
parameters: ["query", "headless", "parse", "device_type", "delivery_type", "target_store_id", "delivery_zip", "xhr", "markdown", "callback_url"],
|
|
207
|
-
},
|
|
208
|
-
[Target.Target]: {
|
|
209
|
-
group: "Target",
|
|
210
|
-
response_format: "html",
|
|
211
|
-
parameters: ["url", "headless", "device_type", "xhr", "delivery_zip", "target_store_id", "callback_url"],
|
|
212
|
-
},
|
|
213
|
-
[Target.LowesSearch]: {
|
|
214
|
-
group: "Lowe's",
|
|
215
|
-
response_format: "json",
|
|
216
|
-
parameters: ["query", "lowes_store_id", "headless", "delivery_zip", "user_agent_type", "free_delivery", "pickup_today", "delivery_today_tomorrow", "callback_url"],
|
|
217
|
-
},
|
|
218
|
-
[Target.Universal]: {
|
|
219
|
-
group: "Universal",
|
|
220
|
-
response_format: "html",
|
|
221
|
-
parameters: ["url", "payload", "proxy_pool", "http_method", "headless", "geo", "locale", "device_type", "session_id", "successful_status_codes", "headers", "cookies", "force_headers", "force_cookies", "xhr", "markdown", "callback_url"],
|
|
222
|
-
},
|
|
223
|
-
[Target.UniversalCore]: {
|
|
224
|
-
group: "None",
|
|
225
|
-
response_format: "html",
|
|
226
|
-
parameters: ["url", "payload", "geo", "http_method", "successful_status_codes", "callback_url"],
|
|
227
|
-
},
|
|
228
|
-
[Target.Chatgpt]: {
|
|
229
|
-
group: "AI Tools",
|
|
230
|
-
response_format: "json",
|
|
231
|
-
parameters: ["prompt", "search", "parse", "geo", "device_type", "markdown", "xhr", "callback_url"],
|
|
232
|
-
},
|
|
233
|
-
[Target.Perplexity]: {
|
|
234
|
-
group: "AI Tools",
|
|
235
|
-
response_format: "json",
|
|
236
|
-
parameters: ["prompt", "parse", "geo", "device_type", "markdown", "xhr", "callback_url"],
|
|
237
|
-
},
|
|
238
|
-
[Target.Bbb]: {
|
|
239
|
-
group: "Business Reviews",
|
|
240
|
-
response_format: "html",
|
|
241
|
-
parameters: ["url", "headless", "geo", "device_type", "markdown", "xhr", "callback_url"],
|
|
242
|
-
},
|
|
243
|
-
[Target.Autotrader]: {
|
|
244
|
-
group: "Marketplace",
|
|
245
|
-
response_format: "html",
|
|
246
|
-
parameters: ["url", "headless", "geo", "device_type", "markdown", "xhr", "callback_url"],
|
|
247
|
-
},
|
|
248
|
-
[Target.Mobile]: {
|
|
249
|
-
group: "Marketplace",
|
|
250
|
-
response_format: "html",
|
|
251
|
-
parameters: ["url", "headless", "geo", "device_type", "markdown", "xhr", "callback_url"],
|
|
252
|
-
},
|
|
253
|
-
[Target.Airbnb]: {
|
|
254
|
-
group: "Travel",
|
|
255
|
-
response_format: "html",
|
|
256
|
-
parameters: ["url", "headless", "geo", "device_type", "markdown", "xhr", "callback_url"],
|
|
257
|
-
},
|
|
258
|
-
[Target.AppleAppStore]: {
|
|
259
|
-
group: "Marketplace",
|
|
260
|
-
response_format: "html",
|
|
261
|
-
parameters: ["url", "headless", "geo", "device_type", "markdown", "xhr", "callback_url"],
|
|
262
|
-
},
|
|
263
|
-
[Target.InstagramGraphqlProfile]: {
|
|
264
|
-
group: "Instagram",
|
|
265
|
-
response_format: "json",
|
|
266
|
-
parameters: ["query", "callback_url"],
|
|
267
|
-
},
|
|
268
|
-
[Target.TiktokPost]: {
|
|
269
|
-
group: "TikTok",
|
|
270
|
-
response_format: "html",
|
|
271
|
-
parameters: ["url", "xhr", "callback_url"],
|
|
272
|
-
},
|
|
273
|
-
[Target.TiktokShopSearch]: {
|
|
274
|
-
group: "TikTok",
|
|
275
|
-
response_format: "html",
|
|
276
|
-
parameters: ["query", "headless", "device_type", "markdown", "country", "callback_url"],
|
|
277
|
-
},
|
|
278
|
-
[Target.TiktokShopProduct]: {
|
|
279
|
-
group: "TikTok",
|
|
280
|
-
response_format: "html",
|
|
281
|
-
parameters: ["product_id", "headless", "device_type", "xhr", "markdown", "country", "callback_url"],
|
|
282
|
-
},
|
|
283
|
-
[Target.Tiktok]: {
|
|
284
|
-
group: "TikTok",
|
|
285
|
-
response_format: "html",
|
|
286
|
-
parameters: ["url", "headless", "user_agent_type", "callback_url"],
|
|
287
|
-
},
|
|
288
|
-
[Target.RedditPost]: {
|
|
289
|
-
group: "Reddit",
|
|
290
|
-
response_format: "json",
|
|
291
|
-
parameters: ["url", "locale", "geo", "callback_url"],
|
|
292
|
-
},
|
|
293
|
-
[Target.RedditSubreddit]: {
|
|
294
|
-
group: "Reddit",
|
|
295
|
-
response_format: "json",
|
|
296
|
-
parameters: ["url", "locale", "geo", "callback_url"],
|
|
297
|
-
},
|
|
298
|
-
[Target.RedditUser]: {
|
|
299
|
-
group: "Reddit",
|
|
300
|
-
response_format: "json",
|
|
301
|
-
parameters: ["url", "locale", "geo", "sort", "callback_url"],
|
|
302
|
-
},
|
|
303
|
-
[Target.YoutubeVideo]: {
|
|
304
|
-
group: "None",
|
|
305
|
-
response_format: "json",
|
|
306
|
-
parameters: ["query", "geo", "callback_url"],
|
|
307
|
-
},
|
|
308
|
-
[Target.YoutubeMetadata]: {
|
|
309
|
-
group: "YouTube",
|
|
310
|
-
response_format: "json",
|
|
311
|
-
parameters: ["query", "callback_url"],
|
|
312
|
-
},
|
|
313
|
-
[Target.YoutubeSearch]: {
|
|
314
|
-
group: "YouTube",
|
|
315
|
-
response_format: "json",
|
|
316
|
-
parameters: ["360", "query", "upload_date", "type", "duration", "video_sort_by", "3d", "4k", "creative_commons", "hd", "hdr", "vr180", "live", "location", "purchased", "subtitles", "callback_url"],
|
|
317
|
-
},
|
|
318
|
-
[Target.YoutubeSearchMax]: {
|
|
319
|
-
group: "YouTube",
|
|
320
|
-
response_format: "json",
|
|
321
|
-
parameters: ["360", "query", "upload_date", "type", "duration", "video_sort_by", "3d", "4k", "creative_commons", "hd", "hdr", "vr180", "live", "location", "purchased", "subtitles", "markdown", "callback_url"],
|
|
322
|
-
},
|
|
323
|
-
[Target.YoutubeSubtitles]: {
|
|
324
|
-
group: "YouTube",
|
|
325
|
-
response_format: "json",
|
|
326
|
-
parameters: ["query", "language_code", "subtitle_origin", "callback_url"],
|
|
327
|
-
},
|
|
328
|
-
[Target.YoutubeChannel]: {
|
|
329
|
-
group: "YouTube",
|
|
330
|
-
response_format: "json",
|
|
331
|
-
parameters: ["query", "parse", "limit", "markdown", "callback_url"],
|
|
332
|
-
},
|
|
333
|
-
[Target.SiteUnblocker]: {
|
|
334
|
-
group: "None",
|
|
335
|
-
response_format: "html",
|
|
336
|
-
parameters: ["url", "geo", "locale", "session_id", "http_method", "customStatusCode", "requestBody", "headless", "headers", "force_headers", "force_cookies", "customCookies", "markdown", "callback_url"],
|
|
337
|
-
},
|
|
338
|
-
[Target.SiteUnblockerReq]: {
|
|
339
|
-
group: "None",
|
|
340
|
-
response_format: "html",
|
|
341
|
-
parameters: ["url", "geo", "locale", "session_id", "http_method", "customStatusCode", "requestBody", "headless", "headers", "force_headers", "force_cookies", "customCookies", "markdown", "callback_url"],
|
|
342
|
-
},
|
|
343
|
-
};
|
package/build/cjs/http.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export type BasicAuth = {
|
|
2
|
-
type: 'basic';
|
|
3
|
-
token: string;
|
|
4
|
-
};
|
|
5
|
-
export type ApiKeyAuth = {
|
|
6
|
-
type: 'apiKey';
|
|
7
|
-
apiKey: string;
|
|
8
|
-
};
|
|
9
|
-
export type HttpClientConfig = {
|
|
10
|
-
baseUrl: string;
|
|
11
|
-
auth: BasicAuth | ApiKeyAuth;
|
|
12
|
-
timeoutMs: number;
|
|
13
|
-
};
|
|
14
|
-
export declare class HttpClient {
|
|
15
|
-
private readonly baseUrl;
|
|
16
|
-
private readonly authHeader;
|
|
17
|
-
private readonly timeoutMs;
|
|
18
|
-
constructor(config: HttpClientConfig);
|
|
19
|
-
request<T>(method: string, path: string, body?: unknown): Promise<T>;
|
|
20
|
-
post<T>(path: string, body: unknown): Promise<T>;
|
|
21
|
-
get<T>(path: string, query?: Record<string, string>): Promise<T>;
|
|
22
|
-
}
|
package/build/cjs/http.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpClient = void 0;
|
|
4
|
-
const errors_js_1 = require("./errors.js");
|
|
5
|
-
class HttpClient {
|
|
6
|
-
baseUrl;
|
|
7
|
-
authHeader;
|
|
8
|
-
timeoutMs;
|
|
9
|
-
constructor(config) {
|
|
10
|
-
this.baseUrl = config.baseUrl.replace(/\/+$/, '');
|
|
11
|
-
this.timeoutMs = config.timeoutMs;
|
|
12
|
-
if (config.auth.type === 'basic') {
|
|
13
|
-
this.authHeader = `Basic ${config.auth.token}`;
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
this.authHeader = config.auth.apiKey;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
async request(method, path, body) {
|
|
20
|
-
const url = `${this.baseUrl}${path}`;
|
|
21
|
-
const controller = new AbortController();
|
|
22
|
-
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
23
|
-
try {
|
|
24
|
-
const init = {
|
|
25
|
-
method,
|
|
26
|
-
headers: {
|
|
27
|
-
Authorization: this.authHeader,
|
|
28
|
-
'Content-Type': 'application/json',
|
|
29
|
-
Accept: 'application/json',
|
|
30
|
-
},
|
|
31
|
-
signal: controller.signal,
|
|
32
|
-
};
|
|
33
|
-
if (body !== undefined) {
|
|
34
|
-
init.body = JSON.stringify(body);
|
|
35
|
-
}
|
|
36
|
-
const res = await fetch(url, init);
|
|
37
|
-
if (res.ok) {
|
|
38
|
-
if (res.status === 204) {
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
return (await res.json());
|
|
42
|
-
}
|
|
43
|
-
let errorBody;
|
|
44
|
-
try {
|
|
45
|
-
errorBody = (await res.json());
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
// response body wasn't JSON
|
|
49
|
-
}
|
|
50
|
-
const message = errorBody?.message ?? `HTTP ${res.status}`;
|
|
51
|
-
if (res.status === 401 || res.status === 403) {
|
|
52
|
-
throw new errors_js_1.AuthenticationError(message);
|
|
53
|
-
}
|
|
54
|
-
if (res.status === 429) {
|
|
55
|
-
throw new errors_js_1.RateLimitError(message);
|
|
56
|
-
}
|
|
57
|
-
if (res.status === 422 || (res.status === 400 && errorBody?.errors)) {
|
|
58
|
-
throw new errors_js_1.ValidationError(message, errorBody?.errors);
|
|
59
|
-
}
|
|
60
|
-
throw new errors_js_1.DecodoError(message, res.status, errorBody?.status);
|
|
61
|
-
}
|
|
62
|
-
catch (err) {
|
|
63
|
-
if (err instanceof errors_js_1.DecodoError) {
|
|
64
|
-
throw err;
|
|
65
|
-
}
|
|
66
|
-
if (err instanceof TypeError &&
|
|
67
|
-
err.cause?.code ===
|
|
68
|
-
'ABORT_ERR') {
|
|
69
|
-
throw new errors_js_1.TimeoutError(`Request to ${path} timed out after ${this.timeoutMs}ms`);
|
|
70
|
-
}
|
|
71
|
-
if (err instanceof DOMException && err.name === 'AbortError') {
|
|
72
|
-
throw new errors_js_1.TimeoutError(`Request to ${path} timed out after ${this.timeoutMs}ms`);
|
|
73
|
-
}
|
|
74
|
-
throw err;
|
|
75
|
-
}
|
|
76
|
-
finally {
|
|
77
|
-
clearTimeout(timer);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
post(path, body) {
|
|
81
|
-
return this.request('POST', path, body);
|
|
82
|
-
}
|
|
83
|
-
get(path, query) {
|
|
84
|
-
if (query) {
|
|
85
|
-
const params = new URLSearchParams(query);
|
|
86
|
-
const qs = params.toString();
|
|
87
|
-
if (qs) {
|
|
88
|
-
return this.request('GET', `${path}?${qs}`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return this.request('GET', path);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
exports.HttpClient = HttpClient;
|
package/build/cjs/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { DecodoClient } from './client.js';
|
|
2
|
-
export type { DecodoConfig } from './client.js';
|
|
3
|
-
export { WebScrapingApi } from './api/web-scraping-api.js';
|
|
4
|
-
export type { TargetString, TargetParamsMap, TargetMeta, ScrapeRequest, BatchRequest, } from './generated/targets.js';
|
|
5
|
-
export { targets, targetMeta, Target, } from './generated/targets.js';
|
|
6
|
-
export { parameterMeta } from './generated/parameters.js';
|
|
7
|
-
export type { ParameterMeta } from './generated/parameters.js';
|
|
8
|
-
export type { SyncResponse, AsyncTaskResponse, BatchResponse, TaskMetadata, TaskResultsResponse, TaskStatus, ResultEntry, } from './types/responses.js';
|
|
9
|
-
export { DecodoError, AuthenticationError, RateLimitError, ValidationError, TimeoutError, } from './errors.js';
|
package/build/cjs/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TimeoutError = exports.ValidationError = exports.RateLimitError = exports.AuthenticationError = exports.DecodoError = exports.parameterMeta = exports.Target = exports.targetMeta = exports.targets = exports.WebScrapingApi = exports.DecodoClient = void 0;
|
|
4
|
-
var client_js_1 = require("./client.js");
|
|
5
|
-
Object.defineProperty(exports, "DecodoClient", { enumerable: true, get: function () { return client_js_1.DecodoClient; } });
|
|
6
|
-
var web_scraping_api_js_1 = require("./api/web-scraping-api.js");
|
|
7
|
-
Object.defineProperty(exports, "WebScrapingApi", { enumerable: true, get: function () { return web_scraping_api_js_1.WebScrapingApi; } });
|
|
8
|
-
var targets_js_1 = require("./generated/targets.js");
|
|
9
|
-
Object.defineProperty(exports, "targets", { enumerable: true, get: function () { return targets_js_1.targets; } });
|
|
10
|
-
Object.defineProperty(exports, "targetMeta", { enumerable: true, get: function () { return targets_js_1.targetMeta; } });
|
|
11
|
-
Object.defineProperty(exports, "Target", { enumerable: true, get: function () { return targets_js_1.Target; } });
|
|
12
|
-
var parameters_js_1 = require("./generated/parameters.js");
|
|
13
|
-
Object.defineProperty(exports, "parameterMeta", { enumerable: true, get: function () { return parameters_js_1.parameterMeta; } });
|
|
14
|
-
var errors_js_1 = require("./errors.js");
|
|
15
|
-
Object.defineProperty(exports, "DecodoError", { enumerable: true, get: function () { return errors_js_1.DecodoError; } });
|
|
16
|
-
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return errors_js_1.AuthenticationError; } });
|
|
17
|
-
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return errors_js_1.RateLimitError; } });
|
|
18
|
-
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return errors_js_1.ValidationError; } });
|
|
19
|
-
Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return errors_js_1.TimeoutError; } });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { ScrapeRequest, BatchRequest } from '../generated/targets.js';
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
export type ResultEntry = {
|
|
2
|
-
content: unknown;
|
|
3
|
-
status_code: number;
|
|
4
|
-
url?: string;
|
|
5
|
-
task_id: string;
|
|
6
|
-
headers?: Record<string, string>;
|
|
7
|
-
cookies?: Record<string, string>[];
|
|
8
|
-
created_at: string;
|
|
9
|
-
updated_at: string;
|
|
10
|
-
help?: string;
|
|
11
|
-
browser_actions_warnings?: Record<string, string>[];
|
|
12
|
-
browser_actions_error?: Record<string, string>[];
|
|
13
|
-
delivery_zip?: string;
|
|
14
|
-
};
|
|
15
|
-
export type SyncResponse = {
|
|
16
|
-
results: ResultEntry[];
|
|
17
|
-
};
|
|
18
|
-
export type AsyncTaskResponse = {
|
|
19
|
-
id: string;
|
|
20
|
-
target?: string;
|
|
21
|
-
url?: string;
|
|
22
|
-
query?: string;
|
|
23
|
-
status: string;
|
|
24
|
-
created_at?: string;
|
|
25
|
-
updated_at?: string;
|
|
26
|
-
page_from?: number;
|
|
27
|
-
limit?: number;
|
|
28
|
-
geo?: string | null;
|
|
29
|
-
device_type?: string;
|
|
30
|
-
headless?: string | null;
|
|
31
|
-
parse?: boolean;
|
|
32
|
-
locale?: string | null;
|
|
33
|
-
domain?: string;
|
|
34
|
-
output_schema?: string | null;
|
|
35
|
-
content_encoding?: string;
|
|
36
|
-
page_count?: number;
|
|
37
|
-
adults?: number;
|
|
38
|
-
children?: number;
|
|
39
|
-
callback_url?: string;
|
|
40
|
-
browser_actions_error?: Record<string, string>[];
|
|
41
|
-
browser_actions_warnings?: Record<string, string>[];
|
|
42
|
-
};
|
|
43
|
-
export type BatchResponse = {
|
|
44
|
-
id?: string;
|
|
45
|
-
queries?: AsyncTaskResponse[];
|
|
46
|
-
errors?: Array<{
|
|
47
|
-
message: string;
|
|
48
|
-
}>;
|
|
49
|
-
};
|
|
50
|
-
export type TaskStatus = 'pending' | 'faulted' | 'done';
|
|
51
|
-
export type TaskMetadata = {
|
|
52
|
-
status: TaskStatus;
|
|
53
|
-
[key: string]: unknown;
|
|
54
|
-
};
|
|
55
|
-
export type TaskResultsResponse = {
|
|
56
|
-
results: ResultEntry[];
|
|
57
|
-
};
|
|
58
|
-
export type ErrorResponse = {
|
|
59
|
-
status: string;
|
|
60
|
-
message: string;
|
|
61
|
-
errors?: unknown[];
|
|
62
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { HttpClient } from '../http.js';
|
|
2
|
-
import type { ScrapeRequest, BatchRequest } from '../generated/targets.js';
|
|
3
|
-
import type { SyncResponse, AsyncTaskResponse, BatchResponse, TaskMetadata, TaskResultsResponse } from '../types/responses.js';
|
|
4
|
-
export declare class WebScrapingApi {
|
|
5
|
-
private readonly http;
|
|
6
|
-
constructor(http: HttpClient);
|
|
7
|
-
private validate;
|
|
8
|
-
scrape(params: ScrapeRequest): Promise<SyncResponse>;
|
|
9
|
-
scrapeAsync(params: ScrapeRequest): Promise<AsyncTaskResponse>;
|
|
10
|
-
scrapeBatch(params: BatchRequest): Promise<BatchResponse>;
|
|
11
|
-
getStatus(taskId: string): Promise<TaskMetadata>;
|
|
12
|
-
getResults(taskId: string): Promise<TaskResultsResponse | null>;
|
|
13
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { prettifyError } from 'zod';
|
|
2
|
-
import { ValidationError } from '../errors.js';
|
|
3
|
-
import { requestSchemas } from '../generated/request-schemas.js';
|
|
4
|
-
export class WebScrapingApi {
|
|
5
|
-
http;
|
|
6
|
-
constructor(http) {
|
|
7
|
-
this.http = http;
|
|
8
|
-
}
|
|
9
|
-
validate(params) {
|
|
10
|
-
const schema = requestSchemas[params.target];
|
|
11
|
-
if (!schema) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const parsed = schema.safeParse(params);
|
|
15
|
-
if (!parsed.success) {
|
|
16
|
-
throw new ValidationError(prettifyError(parsed.error));
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
async scrape(params) {
|
|
20
|
-
this.validate(params);
|
|
21
|
-
return this.http.post('/v2/scrape', params);
|
|
22
|
-
}
|
|
23
|
-
async scrapeAsync(params) {
|
|
24
|
-
this.validate(params);
|
|
25
|
-
return this.http.post('/v3/task', params);
|
|
26
|
-
}
|
|
27
|
-
async scrapeBatch(params) {
|
|
28
|
-
return this.http.post('/v3/task/batch', params);
|
|
29
|
-
}
|
|
30
|
-
async getStatus(taskId) {
|
|
31
|
-
return this.http.get(`/v3/task/${taskId}`);
|
|
32
|
-
}
|
|
33
|
-
async getResults(taskId) {
|
|
34
|
-
const res = await this.http.get(`/v3/task/${taskId}/results`);
|
|
35
|
-
return res ?? null;
|
|
36
|
-
}
|
|
37
|
-
}
|
package/build/esm/client.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { WebScrapingApi } from './api/web-scraping-api.js';
|
|
2
|
-
export type DecodoConfig = {
|
|
3
|
-
webScrapingApi?: {
|
|
4
|
-
token: string;
|
|
5
|
-
};
|
|
6
|
-
timeoutMs?: number;
|
|
7
|
-
};
|
|
8
|
-
export declare class DecodoClient {
|
|
9
|
-
readonly webScrapingApi: WebScrapingApi;
|
|
10
|
-
constructor(config: DecodoConfig);
|
|
11
|
-
}
|
package/build/esm/client.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { HttpClient } from './http.js';
|
|
2
|
-
import { WebScrapingApi } from './api/web-scraping-api.js';
|
|
3
|
-
const WEB_API_BASE_URL = 'https://scraper-api.decodo.com';
|
|
4
|
-
const DEFAULT_TIMEOUT_MS = 180_000;
|
|
5
|
-
const notConfigured = (namespace, hint) => {
|
|
6
|
-
throw new Error(`${namespace} is not configured. ${hint}`);
|
|
7
|
-
};
|
|
8
|
-
export class DecodoClient {
|
|
9
|
-
webScrapingApi;
|
|
10
|
-
constructor(config) {
|
|
11
|
-
const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
12
|
-
if (config.webScrapingApi) {
|
|
13
|
-
this.webScrapingApi = new WebScrapingApi(new HttpClient({
|
|
14
|
-
baseUrl: WEB_API_BASE_URL,
|
|
15
|
-
auth: {
|
|
16
|
-
type: 'basic',
|
|
17
|
-
token: config.webScrapingApi.token,
|
|
18
|
-
},
|
|
19
|
-
timeoutMs,
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
this.webScrapingApi = new Proxy({}, {
|
|
24
|
-
get() {
|
|
25
|
-
notConfigured('webScrapingApi', 'Provide webScrapingApi.token in DecodoConfig.');
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|