@spider-cloud/spider-client 0.0.15 → 0.0.16
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/dist/spiderwebai.d.ts +8 -9
- package/dist/spiderwebai.js +2 -1
- package/package.json +1 -1
package/dist/spiderwebai.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
/**
|
|
3
2
|
* Configuration interface for Spider.
|
|
4
3
|
*/
|
|
@@ -36,7 +35,7 @@ export default class Spider {
|
|
|
36
35
|
* @param {object} [params={}] - Additional parameters for the scraping request.
|
|
37
36
|
* @returns {Promise<any>} The scraped data from the URL.
|
|
38
37
|
*/
|
|
39
|
-
scrapeUrl(url: string, params?: {}): Promise<
|
|
38
|
+
scrapeUrl(url: string, params?: {}): Promise<any>;
|
|
40
39
|
/**
|
|
41
40
|
* Initiates a crawling job starting from the specified URL.
|
|
42
41
|
* @param {string} url - The URL to start crawling.
|
|
@@ -44,47 +43,47 @@ export default class Spider {
|
|
|
44
43
|
* @param {boolean} [stream=false] - Whether to receive the response as a stream.
|
|
45
44
|
* @returns {Promise<any | Response>} The result of the crawl, either structured data or a Response object if streaming.
|
|
46
45
|
*/
|
|
47
|
-
crawlUrl(url: string, params?: {}, stream?: boolean): Promise<
|
|
46
|
+
crawlUrl(url: string, params?: {}, stream?: boolean): Promise<any>;
|
|
48
47
|
/**
|
|
49
48
|
* Retrieves all links from the specified URL.
|
|
50
49
|
* @param {string} url - The URL from which to gather links.
|
|
51
50
|
* @param {object} [params={}] - Additional parameters for the request.
|
|
52
51
|
* @returns {Promise<any>} A list of links extracted from the URL.
|
|
53
52
|
*/
|
|
54
|
-
links(url: string, params?: {}): Promise<
|
|
53
|
+
links(url: string, params?: {}): Promise<any>;
|
|
55
54
|
/**
|
|
56
55
|
* Takes a screenshot of the specified URL.
|
|
57
56
|
* @param {string} url - The URL to screenshot.
|
|
58
57
|
* @param {object} [params={}] - Configuration parameters for the screenshot.
|
|
59
58
|
* @returns {Promise<any>} The screenshot data.
|
|
60
59
|
*/
|
|
61
|
-
screenshot(url: string, params?: {}): Promise<
|
|
60
|
+
screenshot(url: string, params?: {}): Promise<any>;
|
|
62
61
|
/**
|
|
63
62
|
* Extracts contact information from the specified URL.
|
|
64
63
|
* @param {string} url - The URL from which to extract contacts.
|
|
65
64
|
* @param {object} [params={}] - Configuration parameters for the extraction.
|
|
66
65
|
* @returns {Promise<any>} The contact information extracted.
|
|
67
66
|
*/
|
|
68
|
-
extractContacts(url: string, params?: {}): Promise<
|
|
67
|
+
extractContacts(url: string, params?: {}): Promise<any>;
|
|
69
68
|
/**
|
|
70
69
|
* Applies labeling to data extracted from a specified URL.
|
|
71
70
|
* @param {string} url - The URL to label.
|
|
72
71
|
* @param {object} [params={}] - Configuration parameters for labeling.
|
|
73
72
|
* @returns {Promise<any>} The labeled data.
|
|
74
73
|
*/
|
|
75
|
-
label(url: string, params?: {}): Promise<
|
|
74
|
+
label(url: string, params?: {}): Promise<any>;
|
|
76
75
|
/**
|
|
77
76
|
* Check the crawl state of the website.
|
|
78
77
|
* @param {string} url - The URL to check.
|
|
79
78
|
* @param {object} [params={}] - Configuration parameters for crawl state. Can also pass in "domain" instead of the url to query.
|
|
80
79
|
* @returns {Promise<any>} The crawl state data.
|
|
81
80
|
*/
|
|
82
|
-
getCrawlState(url: string, params?: {}): Promise<
|
|
81
|
+
getCrawlState(url: string, params?: {}): Promise<any>;
|
|
83
82
|
/**
|
|
84
83
|
* Retrieves the number of credits available on the account.
|
|
85
84
|
* @returns {Promise<any>} The current credit balance.
|
|
86
85
|
*/
|
|
87
|
-
getCredits(): Promise<
|
|
86
|
+
getCredits(): Promise<any>;
|
|
88
87
|
/**
|
|
89
88
|
* Prepares common headers for each API request.
|
|
90
89
|
* @returns {HeadersInit} A headers object for fetch requests.
|
package/dist/spiderwebai.js
CHANGED
|
@@ -10,7 +10,8 @@ class Spider {
|
|
|
10
10
|
* @throws Will throw an error if the API key is not provided.
|
|
11
11
|
*/
|
|
12
12
|
constructor(props) {
|
|
13
|
-
|
|
13
|
+
var _a;
|
|
14
|
+
this.apiKey = (props === null || props === void 0 ? void 0 : props.apiKey) || ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.SPIDER_API_KEY);
|
|
14
15
|
if (!this.apiKey) {
|
|
15
16
|
throw new Error("No API key provided");
|
|
16
17
|
}
|