@spider-cloud/spider-client 0.0.63 → 0.0.66
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/config.d.ts +56 -0
- package/package.json +3 -3
package/dist/config.d.ts
CHANGED
|
@@ -95,6 +95,46 @@ export interface QueryRequest {
|
|
|
95
95
|
*/
|
|
96
96
|
pathname?: string;
|
|
97
97
|
}
|
|
98
|
+
type CSSSelector = {
|
|
99
|
+
name: string;
|
|
100
|
+
selectors: string[];
|
|
101
|
+
};
|
|
102
|
+
type CSSExtractionMap = {
|
|
103
|
+
[path: string]: CSSSelector[];
|
|
104
|
+
};
|
|
105
|
+
export type WebAutomation = {
|
|
106
|
+
type: "Evaluate";
|
|
107
|
+
code: string;
|
|
108
|
+
} | {
|
|
109
|
+
type: "Click";
|
|
110
|
+
selector: string;
|
|
111
|
+
} | {
|
|
112
|
+
type: "Wait";
|
|
113
|
+
duration: number;
|
|
114
|
+
} | {
|
|
115
|
+
type: "WaitForNavigation";
|
|
116
|
+
} | {
|
|
117
|
+
type: "WaitFor";
|
|
118
|
+
selector: string;
|
|
119
|
+
} | {
|
|
120
|
+
type: "WaitForAndClick";
|
|
121
|
+
selector: string;
|
|
122
|
+
} | {
|
|
123
|
+
type: "ScrollX";
|
|
124
|
+
pixels: number;
|
|
125
|
+
} | {
|
|
126
|
+
type: "ScrollY";
|
|
127
|
+
pixels: number;
|
|
128
|
+
} | {
|
|
129
|
+
type: "Fill";
|
|
130
|
+
selector: string;
|
|
131
|
+
value: string;
|
|
132
|
+
} | {
|
|
133
|
+
type: "InfiniteScroll";
|
|
134
|
+
times: number;
|
|
135
|
+
};
|
|
136
|
+
export type WebAutomationMap = Record<string, WebAutomation[]>;
|
|
137
|
+
export type ExecutionScriptsMap = Record<string, string>;
|
|
98
138
|
/**
|
|
99
139
|
* Represents the options available for making a spider request.
|
|
100
140
|
*/
|
|
@@ -163,6 +203,10 @@ export interface SpiderParams {
|
|
|
163
203
|
* Specifies whether to include metadata in the response.
|
|
164
204
|
*/
|
|
165
205
|
metadata?: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Use CSS query selectors to scrape contents from the web page. Set the paths and the CSS extraction object map to perform extractions per path or page.
|
|
208
|
+
*/
|
|
209
|
+
css_extraction_map?: CSSExtractionMap;
|
|
166
210
|
/**
|
|
167
211
|
* The dimensions of the viewport.
|
|
168
212
|
*/
|
|
@@ -235,6 +279,10 @@ export interface SpiderParams {
|
|
|
235
279
|
* Specifies whether to run the request in the background.
|
|
236
280
|
*/
|
|
237
281
|
run_in_background?: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Perform an infinite scroll on the page as new content arises. The request param also needs to be set to 'chrome' or 'smart'.
|
|
284
|
+
*/
|
|
285
|
+
scroll?: number;
|
|
238
286
|
/**
|
|
239
287
|
* Specifies whether to skip configuration checks.
|
|
240
288
|
*/
|
|
@@ -251,6 +299,14 @@ export interface SpiderParams {
|
|
|
251
299
|
* Disable request interception when running 'request' as 'chrome' or 'smart'. This can help when the page uses 3rd party or external scripts to load content.
|
|
252
300
|
*/
|
|
253
301
|
disable_intercept?: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Perform custom web automated tasks on a url or url path. You need to make your `request` `chrome` or `smart`.
|
|
304
|
+
*/
|
|
305
|
+
automation_scripts?: WebAutomationMap;
|
|
306
|
+
/**
|
|
307
|
+
* Perform custom Javascript tasks on a url or url path. You need to make your `request` `chrome` or `smart`.
|
|
308
|
+
*/
|
|
309
|
+
execution_scripts?: ExecutionScriptsMap;
|
|
254
310
|
}
|
|
255
311
|
export type SpiderCoreResponse = {
|
|
256
312
|
content?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spider-cloud/spider-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.66",
|
|
4
4
|
"description": "Isomorphic Javascript SDK for Spider Cloud services",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node --import tsx --test __tests__/*test.ts",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"author": "Jeff Mendez<jeff@a11ywatch.com>",
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@supabase/supabase-js": "^2.
|
|
26
|
+
"@supabase/supabase-js": "^2.45.0",
|
|
27
27
|
"@types/node": "20.14.2",
|
|
28
28
|
"dotenv": "^16.4.5",
|
|
29
|
-
"tsx": "^4.16.
|
|
29
|
+
"tsx": "^4.16.5",
|
|
30
30
|
"typescript": "5.4.5"
|
|
31
31
|
}
|
|
32
32
|
}
|