@apiverve/webimagescraper 1.1.9 → 1.1.12

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2024 APIVerve, and Evlar LLC
3
+ Copyright (c) 2025 APIVerve, and EvlarSoft LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,5 +1,4 @@
1
- Website Images Scraper API
2
- ============
1
+ # Website Images Scraper API
3
2
 
4
3
  Web Image Scraper is a simple tool for scraping images from a website. It returns the URLs of the images found on the website.
5
4
 
@@ -7,54 +6,62 @@ Web Image Scraper is a simple tool for scraping images from a website. It return
7
6
  ![Code Climate](https://img.shields.io/badge/maintainability-B-purple)
8
7
  ![Prod Ready](https://img.shields.io/badge/production-ready-blue)
9
8
 
10
- This is a Javascript Wrapper for the [Website Images Scraper API](https://apiverve.com/marketplace/api/webimagescraper)
9
+ This is a Javascript Wrapper for the [Website Images Scraper API](https://apiverve.com/marketplace/webimagescraper)
11
10
 
12
11
  ---
13
12
 
14
13
  ## Installation
15
- npm install @apiverve/webimagescraper --save
14
+
15
+ Using npm:
16
+ ```shell
17
+ npm install @apiverve/webimagescraper
18
+ ```
19
+
20
+ Using yarn:
21
+ ```shell
22
+ yarn add @apiverve/webimagescraper
23
+ ```
16
24
 
17
25
  ---
18
26
 
19
27
  ## Configuration
20
28
 
21
- Before using the webimagescraper API client, you have to setup your account and obtain your API Key.
29
+ Before using the Website Images Scraper API client, you have to setup your account and obtain your API Key.
22
30
  You can get it by signing up at [https://apiverve.com](https://apiverve.com)
23
31
 
24
32
  ---
25
33
 
26
- ## Usage
34
+ ## Quick Start
27
35
 
28
- The Website Images Scraper API documentation is found here: [https://docs.apiverve.com/api/webimagescraper](https://docs.apiverve.com/api/webimagescraper).
36
+ [Get started with the Quick Start Guide](https://docs.apiverve.com/quickstart)
37
+
38
+ The Website Images Scraper API documentation is found here: [https://docs.apiverve.com/ref/webimagescraper](https://docs.apiverve.com/ref/webimagescraper).
29
39
  You can find parameters, example responses, and status codes documented here.
30
40
 
31
41
  ### Setup
32
42
 
33
- ```
34
- var webimagescraperAPI = require('@apiverve/webimagescraper');
35
- var api = new webimagescraperAPI({
36
- api_key: [YOUR_API_KEY],
37
- secure: true //(Optional, defaults to true)
43
+ ```javascript
44
+ const webimagescraperAPI = require('@apiverve/webimagescraper');
45
+ const api = new webimagescraperAPI({
46
+ api_key: '[YOUR_API_KEY]'
38
47
  });
39
48
  ```
40
49
 
41
50
  ---
42
51
 
52
+ ## Usage
53
+
54
+ ---
43
55
 
44
56
  ### Perform Request
45
- Using the API client, you can perform requests to the API.
46
57
 
47
- ###### Define Query
58
+ Using the API is simple. All you have to do is make a request. The API will return a response with the data you requested.
48
59
 
49
- ```
60
+ ```javascript
50
61
  var query = {
51
62
  "url": "https://en.wikipedia.org/wiki/Solar_System"
52
63
  };
53
- ```
54
-
55
- ###### Simple Request (using Callback)
56
64
 
57
- ```
58
65
  api.execute(query, function (error, data) {
59
66
  if (error) {
60
67
  return console.error(error);
@@ -64,308 +71,350 @@ api.execute(query, function (error, data) {
64
71
  });
65
72
  ```
66
73
 
67
- ###### Example Response
74
+ ---
75
+
76
+ ### Using Promises
77
+
78
+ You can also use promises to make requests. The API returns a promise that you can use to handle the response.
79
+
80
+ ```javascript
81
+ var query = {
82
+ "url": "https://en.wikipedia.org/wiki/Solar_System"
83
+ };
84
+
85
+ api.execute(query)
86
+ .then(data => {
87
+ console.log(data);
88
+ })
89
+ .catch(error => {
90
+ console.error(error);
91
+ });
92
+ ```
93
+
94
+ ---
95
+
96
+ ### Using Async/Await
68
97
 
98
+ You can also use async/await to make requests. The API returns a promise that you can use to handle the response.
99
+
100
+ ```javascript
101
+ async function makeRequest() {
102
+ var query = {
103
+ "url": "https://en.wikipedia.org/wiki/Solar_System"
104
+ };
105
+
106
+ try {
107
+ const data = await api.execute(query);
108
+ console.log(data);
109
+ } catch (error) {
110
+ console.error(error);
111
+ }
112
+ }
69
113
  ```
70
- {
71
- "status": "ok",
72
- "error": null,
73
- "data": {
74
- "imageCount": 72,
75
- "images": [
76
- {
77
- "external": false,
78
- "src": "http://en.wikipedia.org/wiki/Solar_System/static/images/icons/wikipedia.png"
79
- },
80
- {
81
- "external": false,
82
- "src": "http://en.wikipedia.org/wiki/Solar_System/static/images/mobile/copyright/wikipedia-wordmark-en.svg"
83
- },
84
- {
85
- "external": false,
86
- "src": "http://en.wikipedia.org/wiki/Solar_System/static/images/mobile/copyright/wikipedia-tagline-en.svg"
87
- },
88
- {
89
- "external": false,
90
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/e/e7/Cscr-featured.svg/20px-Cscr-featured.svg.png"
91
- },
92
- {
93
- "external": false,
94
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/1/1b/Semi-protection-shackle.svg/20px-Semi-protection-shackle.svg.png"
95
- },
96
- {
97
- "external": false,
98
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/4/47/Sound-icon.svg/20px-Sound-icon.svg.png"
99
- },
100
- {
101
- "external": false,
102
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/1/19/Solar_System_true_color.jpg/290px-Solar_System_true_color.jpg"
103
- },
104
- {
105
- "external": false,
106
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Solar_System_true_color_%28title_and_caption%29.jpg/290px-Solar_System_true_color_%28title_and_caption%29.jpg"
107
- },
108
- {
109
- "external": false,
110
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/56/Soot-line1.jpg/300px-Soot-line1.jpg"
111
- },
112
- {
113
- "external": false,
114
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/7/7c/Sun_red_giant.svg/220px-Sun_red_giant.svg.png"
115
- },
116
- {
117
- "external": false,
118
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/c/cc/Solar_system_orrery_inner_planets.gif/220px-Solar_system_orrery_inner_planets.gif"
119
- },
120
- {
121
- "external": false,
122
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Solar_system_orrery_outer_planets.gif/220px-Solar_system_orrery_outer_planets.gif"
123
- },
124
- {
125
- "external": false,
126
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/d/df/Solar_System_distance_to_scale.svg/550px-Solar_System_distance_to_scale.svg.png"
127
- },
128
- {
129
- "external": false,
130
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/f/f7/PIA21424_-_The_TRAPPIST-1_Habitable_Zone.jpg/338px-PIA21424_-_The_TRAPPIST-1_Habitable_Zone.jpg"
131
- },
132
- {
133
- "external": false,
134
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/f/f0/Diagram_of_different_habitable_zone_regions_by_Chester_Harman.jpg/338px-Diagram_of_different_habitable_zone_regions_by_Chester_Harman.jpg"
135
- },
136
- {
137
- "external": false,
138
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/8/83/The_Sun_in_white_light.jpg/220px-The_Sun_in_white_light.jpg"
139
- },
140
- {
141
- "external": false,
142
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Terrestrial_planet_sizes_3.jpg/220px-Terrestrial_planet_sizes_3.jpg"
143
- },
144
- {
145
- "external": false,
146
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/1/11/Inner_solar_system_objects_top_view_for_wiki.png/220px-Inner_solar_system_objects_top_view_for_wiki.png"
147
- },
148
- {
149
- "external": false,
150
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/8/86/The_Four_Largest_Asteroids.jpg/220px-The_Four_Largest_Asteroids.jpg"
151
- },
152
- {
153
- "external": false,
154
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/6/67/Planet_collage_to_scale_%28captioned%29.jpg/220px-Planet_collage_to_scale_%28captioned%29.jpg"
155
- },
156
- {
157
- "external": false,
158
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/5b/Kuiper_belt_plot_objects_of_outer_solar_system.png/220px-Kuiper_belt_plot_objects_of_outer_solar_system.png"
159
- },
160
- {
161
- "external": false,
162
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/e/ed/TheKuiperBelt_classes-en.svg/220px-TheKuiperBelt_classes-en.svg.png"
163
- },
164
- {
165
- "external": false,
166
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/58/TheKuiperBelt_Projections_100AU_Classical_SDO.svg/220px-TheKuiperBelt_Projections_100AU_Classical_SDO.svg.png"
167
- },
168
- {
169
- "external": false,
170
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/56/Distant_object_orbits_%2B_Planet_Nine.png/290px-Distant_object_orbits_%2B_Planet_Nine.png"
171
- },
172
- {
173
- "external": false,
174
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/f/f0/Magnetosphere_Levels.jpg/220px-Magnetosphere_Levels.jpg"
175
- },
176
- {
177
- "external": false,
178
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/b/ba/Comet_Hale-Bopp_1995O1.jpg/220px-Comet_Hale-Bopp_1995O1.jpg"
179
- },
180
- {
181
- "external": false,
182
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Meteor_shower_in_the_Chilean_Desert_%28annotated_and_cropped%29.jpg/220px-Meteor_shower_in_the_Chilean_Desert_%28annotated_and_cropped%29.jpg"
183
- },
184
- {
185
- "external": false,
186
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/56/Kuiper_belt_-_Oort_cloud-en.svg/220px-Kuiper_belt_-_Oort_cloud-en.svg.png"
187
- },
188
- {
189
- "external": false,
190
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/1/1f/Interstellar_medium_annotated.jpg/550px-Interstellar_medium_annotated.jpg"
191
- },
192
- {
193
- "external": false,
194
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/7/7c/The_Local_Interstellar_Cloud_and_neighboring_G-cloud_complex.svg/220px-The_Local_Interstellar_Cloud_and_neighboring_G-cloud_complex.svg.png"
195
- },
196
- {
197
- "external": false,
198
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/1/19/Milky_Way_side_view.png/220px-Milky_Way_side_view.png"
199
- },
200
- {
201
- "external": false,
202
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/7/70/Apparent_retrograde_motion_of_Mars_in_2003.gif/220px-Apparent_retrograde_motion_of_Mars_in_2003.gif"
203
- },
204
- {
205
- "external": false,
206
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/4/4e/The_Solar_System%2C_with_the_orbits_of_5_remarkable_comets._LOC_2013593161_%28cropped%29.jpg/220px-The_Solar_System%2C_with_the_orbits_of_5_remarkable_comets._LOC_2013593161_%28cropped%29.jpg"
207
- },
208
- {
209
- "external": false,
210
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/8/83/Solar_system.jpg/22px-Solar_system.jpg"
211
- },
212
- {
213
- "external": false,
214
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Earth-moon.jpg/32px-Earth-moon.jpg"
215
- },
216
- {
217
- "external": false,
218
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/0/00/Crab_Nebula.jpg/28px-Crab_Nebula.jpg"
219
- },
220
- {
221
- "external": true,
222
- "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/45e5789e5d9c8f7c79744f43ecaaf8ba42a8553a"
223
- },
224
- {
225
- "external": true,
226
- "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/0355a973ffa402dc57f8f4371f702db85b17e989"
227
- },
228
- {
229
- "external": true,
230
- "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/876ecaef49f096f44b57f0258336275f8ba3a373"
231
- },
232
- {
233
- "external": true,
234
- "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/db73983682cbebba39553ac1760903b39e050466"
235
- },
236
- {
237
- "external": true,
238
- "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/ea2097c0262c82b8e921dfcc2cc9873e238bc31c"
239
- },
240
- {
241
- "external": true,
242
- "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/5a386d5764fd35c853376fd570d4c46300b19867"
243
- },
244
- {
245
- "external": false,
246
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/6/62/PD-icon.svg/12px-PD-icon.svg.png"
247
- },
248
- {
249
- "external": false,
250
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/6/62/PD-icon.svg/12px-PD-icon.svg.png"
251
- },
252
- {
253
- "external": false,
254
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/4/47/Sound-icon.svg/45px-Sound-icon.svg.png"
255
- },
256
- {
257
- "external": false,
258
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/0/06/Wiktionary-logo-v2.svg/19px-Wiktionary-logo-v2.svg.png"
259
- },
260
- {
261
- "external": false,
262
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/14px-Commons-logo.svg.png"
263
- },
264
- {
265
- "external": false,
266
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/2/24/Wikinews-logo.svg/21px-Wikinews-logo.svg.png"
267
- },
268
- {
269
- "external": false,
270
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Wikiquote-logo.svg/16px-Wikiquote-logo.svg.png"
271
- },
272
- {
273
- "external": false,
274
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Wikisource-logo.svg/18px-Wikisource-logo.svg.png"
275
- },
276
- {
277
- "external": false,
278
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Wikibooks-logo.svg/19px-Wikibooks-logo.svg.png"
279
- },
280
- {
281
- "external": false,
282
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Wikiversity_logo_2017.svg/21px-Wikiversity_logo_2017.svg.png"
283
- },
284
- {
285
- "external": false,
286
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Wikidata-logo.svg/21px-Wikidata-logo.svg.png"
287
- },
288
- {
289
- "external": false,
290
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/4/43/Solar_System_Template_2.png"
291
- },
292
- {
293
- "external": false,
294
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/8/83/Solar_system.jpg/22px-Solar_system.jpg"
295
- },
296
- {
297
- "external": false,
298
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/0/00/Crab_Nebula.jpg/28px-Crab_Nebula.jpg"
299
- },
300
- {
301
- "external": false,
302
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/4/43/The_Earth_seen_from_Apollo_17_with_transparent_background.png/28px-The_Earth_seen_from_Apollo_17_with_transparent_background.png"
303
- },
304
- {
305
- "external": false,
306
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/e/e2/Symbol_portal_class.svg/16px-Symbol_portal_class.svg.png"
307
- },
308
- {
309
- "external": false,
310
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/e/e2/Symbol_portal_class.svg/16px-Symbol_portal_class.svg.png"
311
- },
312
- {
313
- "external": false,
314
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png"
315
- },
316
- {
317
- "external": false,
318
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/12px-Commons-logo.svg.png"
319
- },
320
- {
321
- "external": false,
322
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png"
323
- },
324
- {
325
- "external": false,
326
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/5f/He1523a.jpg/14px-He1523a.jpg"
327
- },
328
- {
329
- "external": false,
330
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/e/e4/SaganWalk.0.Sun.jpg/70px-SaganWalk.0.Sun.jpg"
331
- },
332
- {
333
- "external": false,
334
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png"
335
- },
336
- {
337
- "external": false,
338
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/8/83/Solar_system.jpg/15px-Solar_system.jpg"
339
- },
340
- {
341
- "external": false,
342
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/0/00/Crab_Nebula.jpg/19px-Crab_Nebula.jpg"
343
- },
344
- {
345
- "external": false,
346
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/4/43/The_Earth_seen_from_Apollo_17_with_transparent_background.png/19px-The_Earth_seen_from_Apollo_17_with_transparent_background.png"
347
- },
348
- {
349
- "external": false,
350
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/5f/He1523a.jpg/16px-He1523a.jpg"
351
- },
352
- {
353
- "external": false,
354
- "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/d/d6/RocketSunIcon.svg/19px-RocketSunIcon.svg.png"
355
- },
356
- {
357
- "external": false,
358
- "src": "http://en.wikipedia.org/wiki/Solar_System/static/images/footer/wikimedia-button.svg"
359
- },
360
- {
361
- "external": false,
362
- "src": "http://en.wikipedia.org/wiki/Solar_System/w/resources/assets/mediawiki_compact.svg"
363
- }
364
- ],
365
- "maxLinksReached": false,
366
- "url": "http://en.wikipedia.org/wiki/Solar_System"
367
- },
368
- "code": 200
114
+
115
+ ---
116
+
117
+ ## Example Response
118
+
119
+ ```json
120
+ {
121
+ "status": "ok",
122
+ "error": null,
123
+ "data": {
124
+ "imageCount": 72,
125
+ "images": [
126
+ {
127
+ "external": false,
128
+ "src": "http://en.wikipedia.org/wiki/Solar_System/static/images/icons/wikipedia.png"
129
+ },
130
+ {
131
+ "external": false,
132
+ "src": "http://en.wikipedia.org/wiki/Solar_System/static/images/mobile/copyright/wikipedia-wordmark-en.svg"
133
+ },
134
+ {
135
+ "external": false,
136
+ "src": "http://en.wikipedia.org/wiki/Solar_System/static/images/mobile/copyright/wikipedia-tagline-en.svg"
137
+ },
138
+ {
139
+ "external": false,
140
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/e/e7/Cscr-featured.svg/20px-Cscr-featured.svg.png"
141
+ },
142
+ {
143
+ "external": false,
144
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/1/1b/Semi-protection-shackle.svg/20px-Semi-protection-shackle.svg.png"
145
+ },
146
+ {
147
+ "external": false,
148
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/4/47/Sound-icon.svg/20px-Sound-icon.svg.png"
149
+ },
150
+ {
151
+ "external": false,
152
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/1/19/Solar_System_true_color.jpg/290px-Solar_System_true_color.jpg"
153
+ },
154
+ {
155
+ "external": false,
156
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Solar_System_true_color_%28title_and_caption%29.jpg/290px-Solar_System_true_color_%28title_and_caption%29.jpg"
157
+ },
158
+ {
159
+ "external": false,
160
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/56/Soot-line1.jpg/300px-Soot-line1.jpg"
161
+ },
162
+ {
163
+ "external": false,
164
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/7/7c/Sun_red_giant.svg/220px-Sun_red_giant.svg.png"
165
+ },
166
+ {
167
+ "external": false,
168
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/c/cc/Solar_system_orrery_inner_planets.gif/220px-Solar_system_orrery_inner_planets.gif"
169
+ },
170
+ {
171
+ "external": false,
172
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Solar_system_orrery_outer_planets.gif/220px-Solar_system_orrery_outer_planets.gif"
173
+ },
174
+ {
175
+ "external": false,
176
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/d/df/Solar_System_distance_to_scale.svg/550px-Solar_System_distance_to_scale.svg.png"
177
+ },
178
+ {
179
+ "external": false,
180
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/f/f7/PIA21424_-_The_TRAPPIST-1_Habitable_Zone.jpg/338px-PIA21424_-_The_TRAPPIST-1_Habitable_Zone.jpg"
181
+ },
182
+ {
183
+ "external": false,
184
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/f/f0/Diagram_of_different_habitable_zone_regions_by_Chester_Harman.jpg/338px-Diagram_of_different_habitable_zone_regions_by_Chester_Harman.jpg"
185
+ },
186
+ {
187
+ "external": false,
188
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/8/83/The_Sun_in_white_light.jpg/220px-The_Sun_in_white_light.jpg"
189
+ },
190
+ {
191
+ "external": false,
192
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Terrestrial_planet_sizes_3.jpg/220px-Terrestrial_planet_sizes_3.jpg"
193
+ },
194
+ {
195
+ "external": false,
196
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/1/11/Inner_solar_system_objects_top_view_for_wiki.png/220px-Inner_solar_system_objects_top_view_for_wiki.png"
197
+ },
198
+ {
199
+ "external": false,
200
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/8/86/The_Four_Largest_Asteroids.jpg/220px-The_Four_Largest_Asteroids.jpg"
201
+ },
202
+ {
203
+ "external": false,
204
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/6/67/Planet_collage_to_scale_%28captioned%29.jpg/220px-Planet_collage_to_scale_%28captioned%29.jpg"
205
+ },
206
+ {
207
+ "external": false,
208
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/5b/Kuiper_belt_plot_objects_of_outer_solar_system.png/220px-Kuiper_belt_plot_objects_of_outer_solar_system.png"
209
+ },
210
+ {
211
+ "external": false,
212
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/e/ed/TheKuiperBelt_classes-en.svg/220px-TheKuiperBelt_classes-en.svg.png"
213
+ },
214
+ {
215
+ "external": false,
216
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/58/TheKuiperBelt_Projections_100AU_Classical_SDO.svg/220px-TheKuiperBelt_Projections_100AU_Classical_SDO.svg.png"
217
+ },
218
+ {
219
+ "external": false,
220
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/56/Distant_object_orbits_%2B_Planet_Nine.png/290px-Distant_object_orbits_%2B_Planet_Nine.png"
221
+ },
222
+ {
223
+ "external": false,
224
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/f/f0/Magnetosphere_Levels.jpg/220px-Magnetosphere_Levels.jpg"
225
+ },
226
+ {
227
+ "external": false,
228
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/b/ba/Comet_Hale-Bopp_1995O1.jpg/220px-Comet_Hale-Bopp_1995O1.jpg"
229
+ },
230
+ {
231
+ "external": false,
232
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Meteor_shower_in_the_Chilean_Desert_%28annotated_and_cropped%29.jpg/220px-Meteor_shower_in_the_Chilean_Desert_%28annotated_and_cropped%29.jpg"
233
+ },
234
+ {
235
+ "external": false,
236
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/56/Kuiper_belt_-_Oort_cloud-en.svg/220px-Kuiper_belt_-_Oort_cloud-en.svg.png"
237
+ },
238
+ {
239
+ "external": false,
240
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/1/1f/Interstellar_medium_annotated.jpg/550px-Interstellar_medium_annotated.jpg"
241
+ },
242
+ {
243
+ "external": false,
244
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/7/7c/The_Local_Interstellar_Cloud_and_neighboring_G-cloud_complex.svg/220px-The_Local_Interstellar_Cloud_and_neighboring_G-cloud_complex.svg.png"
245
+ },
246
+ {
247
+ "external": false,
248
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/1/19/Milky_Way_side_view.png/220px-Milky_Way_side_view.png"
249
+ },
250
+ {
251
+ "external": false,
252
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/7/70/Apparent_retrograde_motion_of_Mars_in_2003.gif/220px-Apparent_retrograde_motion_of_Mars_in_2003.gif"
253
+ },
254
+ {
255
+ "external": false,
256
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/4/4e/The_Solar_System%2C_with_the_orbits_of_5_remarkable_comets._LOC_2013593161_%28cropped%29.jpg/220px-The_Solar_System%2C_with_the_orbits_of_5_remarkable_comets._LOC_2013593161_%28cropped%29.jpg"
257
+ },
258
+ {
259
+ "external": false,
260
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/8/83/Solar_system.jpg/22px-Solar_system.jpg"
261
+ },
262
+ {
263
+ "external": false,
264
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Earth-moon.jpg/32px-Earth-moon.jpg"
265
+ },
266
+ {
267
+ "external": false,
268
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/0/00/Crab_Nebula.jpg/28px-Crab_Nebula.jpg"
269
+ },
270
+ {
271
+ "external": true,
272
+ "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/45e5789e5d9c8f7c79744f43ecaaf8ba42a8553a"
273
+ },
274
+ {
275
+ "external": true,
276
+ "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/0355a973ffa402dc57f8f4371f702db85b17e989"
277
+ },
278
+ {
279
+ "external": true,
280
+ "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/876ecaef49f096f44b57f0258336275f8ba3a373"
281
+ },
282
+ {
283
+ "external": true,
284
+ "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/db73983682cbebba39553ac1760903b39e050466"
285
+ },
286
+ {
287
+ "external": true,
288
+ "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/ea2097c0262c82b8e921dfcc2cc9873e238bc31c"
289
+ },
290
+ {
291
+ "external": true,
292
+ "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/5a386d5764fd35c853376fd570d4c46300b19867"
293
+ },
294
+ {
295
+ "external": false,
296
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/6/62/PD-icon.svg/12px-PD-icon.svg.png"
297
+ },
298
+ {
299
+ "external": false,
300
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/6/62/PD-icon.svg/12px-PD-icon.svg.png"
301
+ },
302
+ {
303
+ "external": false,
304
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/4/47/Sound-icon.svg/45px-Sound-icon.svg.png"
305
+ },
306
+ {
307
+ "external": false,
308
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/0/06/Wiktionary-logo-v2.svg/19px-Wiktionary-logo-v2.svg.png"
309
+ },
310
+ {
311
+ "external": false,
312
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/14px-Commons-logo.svg.png"
313
+ },
314
+ {
315
+ "external": false,
316
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/2/24/Wikinews-logo.svg/21px-Wikinews-logo.svg.png"
317
+ },
318
+ {
319
+ "external": false,
320
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Wikiquote-logo.svg/16px-Wikiquote-logo.svg.png"
321
+ },
322
+ {
323
+ "external": false,
324
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Wikisource-logo.svg/18px-Wikisource-logo.svg.png"
325
+ },
326
+ {
327
+ "external": false,
328
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Wikibooks-logo.svg/19px-Wikibooks-logo.svg.png"
329
+ },
330
+ {
331
+ "external": false,
332
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Wikiversity_logo_2017.svg/21px-Wikiversity_logo_2017.svg.png"
333
+ },
334
+ {
335
+ "external": false,
336
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Wikidata-logo.svg/21px-Wikidata-logo.svg.png"
337
+ },
338
+ {
339
+ "external": false,
340
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/4/43/Solar_System_Template_2.png"
341
+ },
342
+ {
343
+ "external": false,
344
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/8/83/Solar_system.jpg/22px-Solar_system.jpg"
345
+ },
346
+ {
347
+ "external": false,
348
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/0/00/Crab_Nebula.jpg/28px-Crab_Nebula.jpg"
349
+ },
350
+ {
351
+ "external": false,
352
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/4/43/The_Earth_seen_from_Apollo_17_with_transparent_background.png/28px-The_Earth_seen_from_Apollo_17_with_transparent_background.png"
353
+ },
354
+ {
355
+ "external": false,
356
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/e/e2/Symbol_portal_class.svg/16px-Symbol_portal_class.svg.png"
357
+ },
358
+ {
359
+ "external": false,
360
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/e/e2/Symbol_portal_class.svg/16px-Symbol_portal_class.svg.png"
361
+ },
362
+ {
363
+ "external": false,
364
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png"
365
+ },
366
+ {
367
+ "external": false,
368
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/12px-Commons-logo.svg.png"
369
+ },
370
+ {
371
+ "external": false,
372
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png"
373
+ },
374
+ {
375
+ "external": false,
376
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/5f/He1523a.jpg/14px-He1523a.jpg"
377
+ },
378
+ {
379
+ "external": false,
380
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/e/e4/SaganWalk.0.Sun.jpg/70px-SaganWalk.0.Sun.jpg"
381
+ },
382
+ {
383
+ "external": false,
384
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png"
385
+ },
386
+ {
387
+ "external": false,
388
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/8/83/Solar_system.jpg/15px-Solar_system.jpg"
389
+ },
390
+ {
391
+ "external": false,
392
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/0/00/Crab_Nebula.jpg/19px-Crab_Nebula.jpg"
393
+ },
394
+ {
395
+ "external": false,
396
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/4/43/The_Earth_seen_from_Apollo_17_with_transparent_background.png/19px-The_Earth_seen_from_Apollo_17_with_transparent_background.png"
397
+ },
398
+ {
399
+ "external": false,
400
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/5f/He1523a.jpg/16px-He1523a.jpg"
401
+ },
402
+ {
403
+ "external": false,
404
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/d/d6/RocketSunIcon.svg/19px-RocketSunIcon.svg.png"
405
+ },
406
+ {
407
+ "external": false,
408
+ "src": "http://en.wikipedia.org/wiki/Solar_System/static/images/footer/wikimedia-button.svg"
409
+ },
410
+ {
411
+ "external": false,
412
+ "src": "http://en.wikipedia.org/wiki/Solar_System/w/resources/assets/mediawiki_compact.svg"
413
+ }
414
+ ],
415
+ "maxLinksReached": false,
416
+ "url": "http://en.wikipedia.org/wiki/Solar_System"
417
+ }
369
418
  }
370
419
  ```
371
420
 
@@ -378,6 +427,7 @@ Need any assistance? [Get in touch with Customer Support](https://apiverve.com/c
378
427
  ---
379
428
 
380
429
  ## Updates
430
+
381
431
  Stay up to date by following [@apiverveHQ](https://twitter.com/apiverveHQ) on Twitter.
382
432
 
383
433
  ---
@@ -397,4 +447,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
397
447
 
398
448
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
399
449
 
400
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
450
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Basic Example - Website Images Scraper API
3
+ *
4
+ * This example demonstrates how to use the Website Images Scraper API.
5
+ * Make sure to set your API key in the .env file or replace '[YOUR_API_KEY]' below.
6
+ */
7
+
8
+ require('dotenv').config();
9
+ const webimagescraperAPI = require('../index.js');
10
+
11
+ // Initialize the API client
12
+ const api = new webimagescraperAPI({
13
+ api_key: process.env.API_KEY || '[YOUR_API_KEY]'
14
+ });
15
+
16
+ // Example query
17
+ var query = {
18
+ "url": "https://en.wikipedia.org/wiki/Solar_System"
19
+ };
20
+
21
+ // Make the API request using callback
22
+ console.log('Making request to Website Images Scraper API...\n');
23
+
24
+ api.execute(query, function (error, data) {
25
+ if (error) {
26
+ console.error('Error occurred:');
27
+ if (error.error) {
28
+ console.error('Message:', error.error);
29
+ console.error('Status:', error.status);
30
+ } else {
31
+ console.error(JSON.stringify(error, null, 2));
32
+ }
33
+ return;
34
+ }
35
+
36
+ console.log('Response:');
37
+ console.log(JSON.stringify(data, null, 2));
38
+ });
package/index.d.ts ADDED
@@ -0,0 +1,34 @@
1
+ declare module '@apiverve/webimagescraper' {
2
+ export interface webimagescraperOptions {
3
+ api_key: string;
4
+ secure?: boolean;
5
+ }
6
+
7
+ export interface webimagescraperResponse {
8
+ status: string;
9
+ error: string | null;
10
+ data: WebsiteImagesScraperData;
11
+ code?: number;
12
+ }
13
+
14
+
15
+ interface WebsiteImagesScraperData {
16
+ imageCount: number;
17
+ images: Image[];
18
+ maxLinksReached: boolean;
19
+ url: string;
20
+ }
21
+
22
+ interface Image {
23
+ external: boolean;
24
+ src: string;
25
+ }
26
+
27
+ export default class webimagescraperWrapper {
28
+ constructor(options: webimagescraperOptions);
29
+
30
+ execute(callback: (error: any, data: webimagescraperResponse | null) => void): Promise<webimagescraperResponse>;
31
+ execute(query: Record<string, any>, callback: (error: any, data: webimagescraperResponse | null) => void): Promise<webimagescraperResponse>;
32
+ execute(query?: Record<string, any>): Promise<webimagescraperResponse>;
33
+ }
34
+ }
package/index.js CHANGED
@@ -4,14 +4,27 @@ class webimagescraperWrapper {
4
4
 
5
5
  constructor(options) {
6
6
  if (!options || typeof options !== 'object') {
7
- throw new Error('Options object must be provided.');
7
+ throw new Error('Options object must be provided. See documentation: https://docs.apiverve.com/ref/webimagescraper');
8
8
  }
9
9
 
10
10
  const { api_key, secure = true } = options;
11
11
 
12
12
  if (!api_key || typeof api_key !== 'string') {
13
- throw new Error('API key must be provided as a non-empty string.');
13
+ throw new Error('API key must be provided as a non-empty string. Get your API key at: https://apiverve.com');
14
14
  }
15
+
16
+ // Validate API key format (GUID or alphanumeric with hyphens)
17
+ const apiKeyPattern = /^[a-zA-Z0-9-]+$/;
18
+ if (!apiKeyPattern.test(api_key)) {
19
+ throw new Error('Invalid API key format. API key must be alphanumeric and may contain hyphens. Get your API key at: https://apiverve.com');
20
+ }
21
+
22
+ // Check minimum length (GUIDs are typically 36 chars with hyphens, or 32 without)
23
+ const trimmedKey = api_key.replace(/-/g, '');
24
+ if (trimmedKey.length < 32) {
25
+ throw new Error('Invalid API key. API key appears to be too short. Get your API key at: https://apiverve.com');
26
+ }
27
+
15
28
  if (typeof secure !== 'boolean') {
16
29
  throw new Error('Secure parameter must be a boolean value.');
17
30
  }
@@ -24,20 +37,32 @@ class webimagescraperWrapper {
24
37
  }
25
38
 
26
39
  async execute(query, callback) {
27
- if(arguments.length > 1) {
40
+ // Handle different argument patterns
41
+ if(arguments.length === 0) {
42
+ // execute() - no args
43
+ query = {};
44
+ callback = null;
45
+ } else if(arguments.length === 1) {
46
+ if (typeof query === 'function') {
47
+ // execute(callback)
48
+ callback = query;
49
+ query = {};
50
+ } else {
51
+ // execute(query)
52
+ callback = null;
53
+ }
54
+ } else {
55
+ // execute(query, callback)
28
56
  if (!query || typeof query !== 'object') {
29
57
  throw new Error('Query parameters must be provided as an object.');
30
58
  }
31
- } else {
32
- callback = query;
33
- query = {};
34
59
  }
35
60
 
36
61
  var requiredParams = ["url"];
37
62
  if (requiredParams.length > 0) {
38
63
  for (var i = 0; i < requiredParams.length; i++) {
39
64
  if (!query[requiredParams[i]]) {
40
- throw new Error(`Required parameter [${requiredParams[i]}] is missing.`);
65
+ throw new Error(`Required parameter [${requiredParams[i]}] is missing. See documentation: https://docs.apiverve.com/ref/webimagescraper`);
41
66
  }
42
67
  }
43
68
  }
@@ -58,16 +83,25 @@ class webimagescraperWrapper {
58
83
  });
59
84
 
60
85
  const data = response.data;
61
- callback(null, data);
86
+ if (callback) callback(null, data);
62
87
  return data;
63
88
  } catch (error) {
64
- if (error.response.data) {
65
- callback(error.response.data, null);
66
- throw error.response.data;
89
+ let apiError;
90
+
91
+ if (error.response && error.response.data) {
92
+ apiError = error.response.data;
93
+ } else if (error.message) {
94
+ apiError = { error: error.message, status: 'error' };
67
95
  } else {
68
- callback(error, null);
69
- throw error;
70
- }
96
+ apiError = { error: 'An unknown error occurred', status: 'error' };
97
+ }
98
+
99
+ if (callback) {
100
+ callback(apiError, null);
101
+ return; // Don't throw if callback is provided
102
+ }
103
+
104
+ throw apiError;
71
105
  }
72
106
  }
73
107
 
package/package.json CHANGED
@@ -1,24 +1,27 @@
1
1
  {
2
2
  "name": "@apiverve/webimagescraper",
3
- "version": "1.1.9",
3
+ "version": "1.1.12",
4
4
  "description": "Web Image Scraper is a simple tool for scraping images from a website. It returns the URLs of the images found on the website.",
5
5
  "main": "index.js",
6
+ "types": "index.d.ts",
6
7
  "scripts": {
7
- "test": "mocha"
8
+ "test": "mocha",
9
+ "example": "node examples/basic.js"
8
10
  },
9
11
  "repository": {
10
12
  "type": "git",
11
- "url": "git+https://github.com/apiverve/webimagescraper-API.git"
13
+ "url": "git+https://github.com/apiverve/webimagescraper-api.git",
14
+ "directory": "npm"
12
15
  },
13
16
  "keywords": [
14
- "web image scraper","web image scraping","web image scrape","web image api","web image tool"
17
+ "web image scraper", "web image scraping", "web image scrape", "web image api", "web image tool"
15
18
  ],
16
19
  "author": "APIVerve <hello@apiverve.com> (http://apiverve.com/)",
17
20
  "license": "MIT",
18
21
  "bugs": {
19
- "url": "https://github.com/apiverve/webimagescraper-API/issues"
22
+ "url": "https://github.com/apiverve/webimagescraper-api/issues"
20
23
  },
21
- "homepage": "https://apiverve.com/marketplace/api/webimagescraper?utm_source=npm",
24
+ "homepage": "https://apiverve.com/marketplace/webimagescraper?utm_source=npm",
22
25
  "devDependencies": {
23
26
  "mocha": "^11.0.1",
24
27
  "chai": "^5.1.2",
@@ -27,6 +30,6 @@
27
30
  "dependencies": {
28
31
  "node-fetch": "^3.3.2",
29
32
  "promise": "^8.3.0",
30
- "axios": "1.7.9"
33
+ "axios": "1.13.2"
31
34
  }
32
35
  }