@spider-cloud/spider-client 0.1.82 → 0.1.85

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/client.d.ts CHANGED
@@ -66,6 +66,13 @@ export declare class Spider {
66
66
  * @returns {Promise<any>} The screenshot data.
67
67
  */
68
68
  screenshot(url: string, params?: GenericParams): Promise<any>;
69
+ /**
70
+ * Unblock a challenging url to get data.
71
+ * @param {string} url - The URL to get data from.
72
+ * @param {GenericParams} [params={}] - Configuration parameters for the screenshot.
73
+ * @returns {Promise<any>} The screenshot data.
74
+ */
75
+ unblocker(url: string, params?: GenericParams): Promise<any>;
69
76
  /**
70
77
  * Perform a search and gather a list of websites to start crawling and collect resources.
71
78
  * @param {string} search - The search query.
package/dist/client.js CHANGED
@@ -117,6 +117,15 @@ class Spider {
117
117
  async screenshot(url, params = {}) {
118
118
  return this._apiPost(config_1.APIRoutes.Screenshot, { url: url, ...params });
119
119
  }
120
+ /**
121
+ * Unblock a challenging url to get data.
122
+ * @param {string} url - The URL to get data from.
123
+ * @param {GenericParams} [params={}] - Configuration parameters for the screenshot.
124
+ * @returns {Promise<any>} The screenshot data.
125
+ */
126
+ async unblocker(url, params = {}) {
127
+ return this._apiPost(config_1.APIRoutes.Unblocker, { url: url, ...params });
128
+ }
120
129
  /**
121
130
  * Perform a search and gather a list of websites to start crawling and collect resources.
122
131
  * @param {string} search - The search query.
package/dist/config.d.ts CHANGED
@@ -152,9 +152,41 @@ export type ClickAll = {
152
152
  };
153
153
  export type ClickAllClickable = {};
154
154
  export type ClickPoint = {
155
+ /** Rust: ClickPoint { x: f64, y: f64 } */
155
156
  x: number;
156
157
  y: number;
157
158
  };
159
+ /** Rust: ClickHold { selector: String, hold_for_ms: u64 } */
160
+ export type ClickHold = {
161
+ selector: string;
162
+ /** Duration to hold in milliseconds */
163
+ hold_for_ms: number;
164
+ };
165
+ /** Rust: ClickHoldPoint { x: f64, y: f64, hold_for_ms: u64 } */
166
+ export type ClickHoldPoint = {
167
+ x: number;
168
+ y: number;
169
+ /** Duration to hold in milliseconds */
170
+ hold_for_ms: number;
171
+ };
172
+ /** Rust: ClickDrag { from: String, to: String, modifier: Option<i64> } */
173
+ export type ClickDrag = {
174
+ /** CSS selector for the drag start element */
175
+ from: string;
176
+ /** CSS selector for the drag destination element */
177
+ to: string;
178
+ /** Optional keyboard modifier (e.g. Shift=8), maps to Option<i64> */
179
+ modifier?: number | null;
180
+ };
181
+ /** Rust: ClickDragPoint { from_x, from_y, to_x, to_y, modifier: Option<i64> } */
182
+ export type ClickDragPoint = {
183
+ from_x: number;
184
+ from_y: number;
185
+ to_x: number;
186
+ to_y: number;
187
+ /** Optional keyboard modifier (e.g. Shift=8), maps to Option<i64> */
188
+ modifier?: number | null;
189
+ };
158
190
  export type Wait = {
159
191
  /** Rust: u64 (milliseconds) */
160
192
  ms: number;
@@ -204,7 +236,7 @@ export type Screenshot = {
204
236
  output: string;
205
237
  };
206
238
  export type ValidateChain = {};
207
- export type WebAutomation = Evaluate | Click | ClickAll | ClickAllClickable | ClickPoint | Wait | WaitForNavigation | WaitForDom | WaitFor | WaitForWithTimeout | WaitForAndClick | ScrollX | ScrollY | Fill | Type | InfiniteScroll | Screenshot | ValidateChain;
239
+ export type WebAutomation = Evaluate | Click | ClickAll | ClickAllClickable | ClickPoint | ClickHold | ClickHoldPoint | ClickDrag | ClickDragPoint | Wait | WaitForNavigation | WaitForDom | WaitFor | WaitForWithTimeout | WaitForAndClick | ScrollX | ScrollY | Fill | Type | InfiniteScroll | Screenshot | ValidateChain;
208
240
  export type ReturnFormat = "markdown" | "commonmark" | "raw" | "screenshot" | "text" | "html2text" | "bytes" | "xml" | "empty";
209
241
  export type WebAutomationMap = Record<string, WebAutomation[]>;
210
242
  export type ExecutionScriptsMap = Record<string, string>;
@@ -420,6 +452,11 @@ export interface SpiderParams {
420
452
  * The wait for events on the page. You need to make your `request` `chrome` or `smart`.
421
453
  */
422
454
  wait_for?: WaitForConfiguration;
455
+ /**
456
+ * Disables service-provided hints that add request optimizations to improve crawl outcomes,
457
+ * such as network blacklists, request-type selection, geo handling, and more.
458
+ */
459
+ disable_hints?: boolean;
423
460
  /**
424
461
  * 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.
425
462
  */
@@ -554,6 +591,8 @@ export declare enum ApiVersion {
554
591
  }
555
592
  export declare enum APIRoutes {
556
593
  Crawl = "crawl",
594
+ Scrape = "scrape",
595
+ Unblocker = "unblocker",
557
596
  Links = "links",
558
597
  Screenshot = "screenshot",
559
598
  Search = "search",
package/dist/config.js CHANGED
@@ -32,6 +32,10 @@ var APIRoutes;
32
32
  (function (APIRoutes) {
33
33
  // Crawl a website to collect the contents. Can be one page or many.
34
34
  APIRoutes["Crawl"] = "crawl";
35
+ // Scrape a website to collect the contents. Can be one page or many.
36
+ APIRoutes["Scrape"] = "scrape";
37
+ // Unblock a website to collect the contents. Can be one page or many.
38
+ APIRoutes["Unblocker"] = "unblocker";
35
39
  // Crawl a website to collect the links. Can be one page or many.
36
40
  APIRoutes["Links"] = "links";
37
41
  // Crawl a website to collect screenshots. Can be one page or many.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spider-cloud/spider-client",
3
- "version": "0.1.82",
3
+ "version": "0.1.85",
4
4
  "description": "Isomorphic Javascript SDK for Spider Cloud services",
5
5
  "scripts": {
6
6
  "test": "node --import tsx --test __tests__/*test.ts",