@apiverve/webimagescraper 1.1.7

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 ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 APIVerve, and Evlar LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,400 @@
1
+ Website Images Scraper API
2
+ ============
3
+
4
+ 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
+
6
+ ![Build Status](https://img.shields.io/badge/build-passing-green)
7
+ ![Code Climate](https://img.shields.io/badge/maintainability-B-purple)
8
+ ![Prod Ready](https://img.shields.io/badge/production-ready-blue)
9
+
10
+ This is a Javascript Wrapper for the [Website Images Scraper API](https://apiverve.com/marketplace/api/webimagescraper)
11
+
12
+ ---
13
+
14
+ ## Installation
15
+ npm install @apiverve/webimagescraper --save
16
+
17
+ ---
18
+
19
+ ## Configuration
20
+
21
+ Before using the webimagescraper API client, you have to setup your account and obtain your API Key.
22
+ You can get it by signing up at [https://apiverve.com](https://apiverve.com)
23
+
24
+ ---
25
+
26
+ ## Usage
27
+
28
+ The Website Images Scraper API documentation is found here: [https://docs.apiverve.com/api/webimagescraper](https://docs.apiverve.com/api/webimagescraper).
29
+ You can find parameters, example responses, and status codes documented here.
30
+
31
+ ### Setup
32
+
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)
38
+ });
39
+ ```
40
+
41
+ ---
42
+
43
+
44
+ ### Perform Request
45
+ Using the API client, you can perform requests to the API.
46
+
47
+ ###### Define Query
48
+
49
+ ```
50
+ var query = {
51
+ "url": "https://en.wikipedia.org/wiki/Solar_System"
52
+ };
53
+ ```
54
+
55
+ ###### Simple Request (using Callback)
56
+
57
+ ```
58
+ api.execute(query, function (error, data) {
59
+ if (error) {
60
+ return console.error(error);
61
+ } else {
62
+ console.log(data);
63
+ }
64
+ });
65
+ ```
66
+
67
+ ###### Example Response
68
+
69
+ ```
70
+ {
71
+ "status": "ok",
72
+ "error": null,
73
+ "data": {
74
+ "url": "http://en.wikipedia.org/wiki/Solar_System",
75
+ "imageCount": 72,
76
+ "images": [
77
+ {
78
+ "src": "http://en.wikipedia.org/wiki/Solar_System/static/images/icons/wikipedia.png",
79
+ "external": false
80
+ },
81
+ {
82
+ "src": "http://en.wikipedia.org/wiki/Solar_System/static/images/mobile/copyright/wikipedia-wordmark-en.svg",
83
+ "external": false
84
+ },
85
+ {
86
+ "src": "http://en.wikipedia.org/wiki/Solar_System/static/images/mobile/copyright/wikipedia-tagline-en.svg",
87
+ "external": false
88
+ },
89
+ {
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
+ "external": false
92
+ },
93
+ {
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
+ "external": false
96
+ },
97
+ {
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
+ "external": false
100
+ },
101
+ {
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
+ "external": false
104
+ },
105
+ {
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
+ "external": false
108
+ },
109
+ {
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
+ "external": false
112
+ },
113
+ {
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
+ "external": false
116
+ },
117
+ {
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
+ "external": false
120
+ },
121
+ {
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
+ "external": false
124
+ },
125
+ {
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
+ "external": false
128
+ },
129
+ {
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
+ "external": false
132
+ },
133
+ {
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
+ "external": false
136
+ },
137
+ {
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
+ "external": false
140
+ },
141
+ {
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
+ "external": false
144
+ },
145
+ {
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
+ "external": false
148
+ },
149
+ {
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
+ "external": false
152
+ },
153
+ {
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
+ "external": false
156
+ },
157
+ {
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
+ "external": false
160
+ },
161
+ {
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
+ "external": false
164
+ },
165
+ {
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
+ "external": false
168
+ },
169
+ {
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
+ "external": false
172
+ },
173
+ {
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
+ "external": false
176
+ },
177
+ {
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
+ "external": false
180
+ },
181
+ {
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
+ "external": false
184
+ },
185
+ {
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
+ "external": false
188
+ },
189
+ {
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
+ "external": false
192
+ },
193
+ {
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
+ "external": false
196
+ },
197
+ {
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
+ "external": false
200
+ },
201
+ {
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
+ "external": false
204
+ },
205
+ {
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
+ "external": false
208
+ },
209
+ {
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
+ "external": false
212
+ },
213
+ {
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
+ "external": false
216
+ },
217
+ {
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
+ "external": false
220
+ },
221
+ {
222
+ "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/45e5789e5d9c8f7c79744f43ecaaf8ba42a8553a",
223
+ "external": true
224
+ },
225
+ {
226
+ "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/0355a973ffa402dc57f8f4371f702db85b17e989",
227
+ "external": true
228
+ },
229
+ {
230
+ "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/876ecaef49f096f44b57f0258336275f8ba3a373",
231
+ "external": true
232
+ },
233
+ {
234
+ "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/db73983682cbebba39553ac1760903b39e050466",
235
+ "external": true
236
+ },
237
+ {
238
+ "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/ea2097c0262c82b8e921dfcc2cc9873e238bc31c",
239
+ "external": true
240
+ },
241
+ {
242
+ "src": "https://wikimedia.org/api/rest_v1/media/math/render/svg/5a386d5764fd35c853376fd570d4c46300b19867",
243
+ "external": true
244
+ },
245
+ {
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
+ "external": false
248
+ },
249
+ {
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
+ "external": false
252
+ },
253
+ {
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
+ "external": false
256
+ },
257
+ {
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
+ "external": false
260
+ },
261
+ {
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
+ "external": false
264
+ },
265
+ {
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
+ "external": false
268
+ },
269
+ {
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
+ "external": false
272
+ },
273
+ {
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
+ "external": false
276
+ },
277
+ {
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
+ "external": false
280
+ },
281
+ {
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
+ "external": false
284
+ },
285
+ {
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
+ "external": false
288
+ },
289
+ {
290
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/4/43/Solar_System_Template_2.png",
291
+ "external": false
292
+ },
293
+ {
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
+ "external": false
296
+ },
297
+ {
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
+ "external": false
300
+ },
301
+ {
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
+ "external": false
304
+ },
305
+ {
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
+ "external": false
308
+ },
309
+ {
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
+ "external": false
312
+ },
313
+ {
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
+ "external": false
316
+ },
317
+ {
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
+ "external": false
320
+ },
321
+ {
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
+ "external": false
324
+ },
325
+ {
326
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/5f/He1523a.jpg/14px-He1523a.jpg",
327
+ "external": false
328
+ },
329
+ {
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
+ "external": false
332
+ },
333
+ {
334
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/8/83/Solar_system.jpg/15px-Solar_system.jpg",
335
+ "external": false
336
+ },
337
+ {
338
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/0/00/Crab_Nebula.jpg/19px-Crab_Nebula.jpg",
339
+ "external": false
340
+ },
341
+ {
342
+ "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",
343
+ "external": false
344
+ },
345
+ {
346
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/5/5f/He1523a.jpg/16px-He1523a.jpg",
347
+ "external": false
348
+ },
349
+ {
350
+ "src": "http://en.wikipedia.org/wiki/Solar_System//upload.wikimedia.org/wikipedia/commons/thumb/d/d6/RocketSunIcon.svg/19px-RocketSunIcon.svg.png",
351
+ "external": false
352
+ },
353
+ {
354
+ "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",
355
+ "external": false
356
+ },
357
+ {
358
+ "src": "http://en.wikipedia.org/wiki/Solar_System/static/images/footer/wikimedia-button.svg",
359
+ "external": false
360
+ },
361
+ {
362
+ "src": "http://en.wikipedia.org/wiki/Solar_System/w/resources/assets/poweredby_mediawiki.svg",
363
+ "external": false
364
+ }
365
+ ],
366
+ "maxLinksReached": false
367
+ },
368
+ "code": 200
369
+ }
370
+ ```
371
+
372
+ ---
373
+
374
+ ## Customer Support
375
+
376
+ Need any assistance? [Get in touch with Customer Support](https://apiverve.com/contact).
377
+
378
+ ---
379
+
380
+ ## Updates
381
+ Stay up to date by following [@apiverveHQ](https://twitter.com/apiverveHQ) on Twitter.
382
+
383
+ ---
384
+
385
+ ## Legal
386
+
387
+ All usage of the APIVerve website, API, and services is subject to the [APIVerve Terms of Service](https://apiverve.com/terms) and all legal documents and agreements.
388
+
389
+ ---
390
+
391
+ ## License
392
+ Licensed under the The MIT License (MIT)
393
+
394
+ Copyright (©) 2024 APIVerve, and Evlar LLC
395
+
396
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
397
+
398
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
399
+
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.
package/index.js ADDED
@@ -0,0 +1,90 @@
1
+ const axios = require('axios');
2
+
3
+ class webimagescraperWrapper {
4
+
5
+ constructor(options) {
6
+ if (!options || typeof options !== 'object') {
7
+ throw new Error('Options object must be provided.');
8
+ }
9
+
10
+ const { api_key, secure = true } = options;
11
+
12
+ if (!api_key || typeof api_key !== 'string') {
13
+ throw new Error('API key must be provided as a non-empty string.');
14
+ }
15
+ if (typeof secure !== 'boolean') {
16
+ throw new Error('Secure parameter must be a boolean value.');
17
+ }
18
+
19
+ this.APIKey = api_key;
20
+ this.IsSecure = secure;
21
+
22
+ // secure is deprecated, all requests must be made over HTTPS
23
+ this.baseURL = 'https://api.apiverve.com/v1/webimagescraper';
24
+ }
25
+
26
+ async execute(query, callback) {
27
+ if(arguments.length > 1) {
28
+ if (!query || typeof query !== 'object') {
29
+ throw new Error('Query parameters must be provided as an object.');
30
+ }
31
+ } else {
32
+ callback = query;
33
+ query = {};
34
+ }
35
+
36
+ var requiredParams = ["url"];
37
+ if (requiredParams.length > 0) {
38
+ for (var i = 0; i < requiredParams.length; i++) {
39
+ if (!query[requiredParams[i]]) {
40
+ throw new Error(`Required parameter [${requiredParams[i]}] is missing.`);
41
+ }
42
+ }
43
+ }
44
+
45
+ const method = 'POST';
46
+ const url = method === 'POST' ? this.baseURL : this.constructURL(query);
47
+
48
+ try {
49
+ const response = await axios({
50
+ method,
51
+ url,
52
+ headers: {
53
+ 'Content-Type': 'application/json',
54
+ 'x-api-key': this.APIKey,
55
+ 'auth-mode': 'npm-package'
56
+ },
57
+ data: method === 'POST' ? query : undefined
58
+ });
59
+
60
+ const data = response.data;
61
+ callback(null, data);
62
+ return data;
63
+ } catch (error) {
64
+ if (error.response.data) {
65
+ callback(error.response.data, null);
66
+ throw error.response.data;
67
+ } else {
68
+ callback(error, null);
69
+ throw error;
70
+ }
71
+ }
72
+ }
73
+
74
+ constructURL(query) {
75
+ let url = this.baseURL;
76
+
77
+ if(query && typeof query === 'object')
78
+ {
79
+ if (Object.keys(query).length > 0) {
80
+ const queryString = Object.keys(query)
81
+ .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(query[key])}`)
82
+ .join('&');
83
+ url += `?${queryString}`;
84
+ }
85
+ }
86
+ return url;
87
+ }
88
+ }
89
+
90
+ module.exports = webimagescraperWrapper;
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@apiverve/webimagescraper",
3
+ "version": "1.1.7",
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
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "mocha"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/apiverve/webimagescraper-API.git"
12
+ },
13
+ "keywords": [
14
+ "web image scraper","web image scraping","web image scrape","web image api","web image tool"
15
+ ],
16
+ "author": "APIVerve <hello@apiverve.com> (http://apiverve.com/)",
17
+ "license": "MIT",
18
+ "bugs": {
19
+ "url": "https://github.com/apiverve/webimagescraper-API/issues"
20
+ },
21
+ "homepage": "https://apiverve.com/marketplace/api/webimagescraper?utm_source=npm",
22
+ "devDependencies": {
23
+ "mocha": "^11.0.1",
24
+ "chai": "^5.1.2",
25
+ "dotenv": "^16.4.7"
26
+ },
27
+ "dependencies": {
28
+ "node-fetch": "^3.3.2",
29
+ "promise": "^8.3.0",
30
+ "axios": "1.7.9"
31
+ }
32
+ }
package/tmp/build.dat ADDED
@@ -0,0 +1 @@
1
+ #