@isdk/web-searcher 0.1.4 → 0.1.5

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.
Files changed (36) hide show
  1. package/README.cn.md +156 -7
  2. package/README.md +156 -7
  3. package/dist/index.d.mts +220 -11
  4. package/dist/index.d.ts +220 -11
  5. package/dist/index.js +1 -1
  6. package/dist/index.mjs +1 -1
  7. package/docs/README.md +156 -7
  8. package/docs/classes/GoogleSearcher.md +171 -44
  9. package/docs/classes/WebSearcher.md +158 -45
  10. package/docs/functions/extractDate.md +42 -0
  11. package/docs/functions/extractMetadataFrom.md +40 -0
  12. package/docs/functions/fetchHeaders.md +34 -0
  13. package/docs/functions/fetchPartial.md +41 -0
  14. package/docs/functions/normalizeDate.md +29 -0
  15. package/docs/functions/parseHeaders.md +28 -0
  16. package/docs/functions/parseHtml.md +31 -0
  17. package/docs/functions/testUrlsByLatency.md +38 -0
  18. package/docs/globals.md +18 -0
  19. package/docs/interfaces/CustomTimeRange.md +3 -3
  20. package/docs/interfaces/ExtractOptions.md +54 -0
  21. package/docs/interfaces/FetchExtractorOptions.md +35 -0
  22. package/docs/interfaces/FetcherOptions.md +424 -0
  23. package/docs/interfaces/HtmlData.md +53 -0
  24. package/docs/interfaces/MetadataResult.md +27 -0
  25. package/docs/interfaces/PaginationConfig.md +9 -9
  26. package/docs/interfaces/SearchContext.md +30 -4
  27. package/docs/interfaces/SearchOptions.md +77 -11
  28. package/docs/interfaces/StandardSearchResult.md +10 -10
  29. package/docs/interfaces/VerifiedUrl.md +25 -0
  30. package/docs/type-aliases/MetadataType.md +13 -0
  31. package/docs/type-aliases/SafeSearchLevel.md +1 -1
  32. package/docs/type-aliases/SearchCategory.md +2 -2
  33. package/docs/type-aliases/SearchTimeRange.md +1 -1
  34. package/docs/type-aliases/SearchTimeRangePreset.md +1 -1
  35. package/docs/type-aliases/SearcherConstructor.md +2 -2
  36. package/package.json +3 -2
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: GoogleSearcher
8
8
 
9
- Defined in: [web-searcher/src/engines/google.ts:24](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/engines/google.ts#L24)
9
+ Defined in: [web-searcher/src/engines/google.ts:24](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/engines/google.ts#L24)
10
10
 
11
11
  A sample implementation of a Google Search scraper.
12
12
 
@@ -37,7 +37,7 @@ Use this class to understand:
37
37
 
38
38
  > **new GoogleSearcher**(`options?`): `GoogleSearcher`
39
39
 
40
- Defined in: web-fetcher/dist/index.d.ts:2287
40
+ Defined in: web-fetcher/dist/index.d.ts:1171
41
41
 
42
42
  Creates a new FetchSession.
43
43
 
@@ -45,7 +45,7 @@ Creates a new FetchSession.
45
45
 
46
46
  ##### options?
47
47
 
48
- `FetcherOptions`
48
+ [`FetcherOptions`](../interfaces/FetcherOptions.md)
49
49
 
50
50
  Configuration options for the fetcher.
51
51
 
@@ -63,7 +63,7 @@ Configuration options for the fetcher.
63
63
 
64
64
  > `protected` **closed**: `boolean`
65
65
 
66
- Defined in: web-fetcher/dist/index.d.ts:2281
66
+ Defined in: web-fetcher/dist/index.d.ts:1165
67
67
 
68
68
  #### Inherited from
69
69
 
@@ -75,7 +75,7 @@ Defined in: web-fetcher/dist/index.d.ts:2281
75
75
 
76
76
  > `readonly` **context**: `FetchContext`
77
77
 
78
- Defined in: web-fetcher/dist/index.d.ts:2280
78
+ Defined in: web-fetcher/dist/index.d.ts:1164
79
79
 
80
80
  The execution context for this session, containing configurations, event bus, and shared state.
81
81
 
@@ -89,7 +89,7 @@ The execution context for this session, containing configurations, event bus, an
89
89
 
90
90
  > `readonly` **id**: `string`
91
91
 
92
- Defined in: web-fetcher/dist/index.d.ts:2276
92
+ Defined in: web-fetcher/dist/index.d.ts:1160
93
93
 
94
94
  Unique identifier for the session.
95
95
 
@@ -101,9 +101,9 @@ Unique identifier for the session.
101
101
 
102
102
  ### options
103
103
 
104
- > `protected` **options**: `FetcherOptions`
104
+ > `protected` **options**: [`FetcherOptions`](../interfaces/FetcherOptions.md)
105
105
 
106
- Defined in: web-fetcher/dist/index.d.ts:2272
106
+ Defined in: web-fetcher/dist/index.d.ts:1156
107
107
 
108
108
  #### Inherited from
109
109
 
@@ -115,7 +115,7 @@ Defined in: web-fetcher/dist/index.d.ts:2272
115
115
 
116
116
  > `static` **\_isFactory**: `boolean` = `false`
117
117
 
118
- Defined in: [web-searcher/src/searcher.ts:33](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/searcher.ts#L33)
118
+ Defined in: [web-searcher/src/searcher.ts:34](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/searcher.ts#L34)
119
119
 
120
120
  #### Inherited from
121
121
 
@@ -127,7 +127,7 @@ Defined in: [web-searcher/src/searcher.ts:33](https://github.com/isdk/web-search
127
127
 
128
128
  > `static` **alias**: `string`[]
129
129
 
130
- Defined in: [web-searcher/src/engines/google.ts:25](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/engines/google.ts#L25)
130
+ Defined in: [web-searcher/src/engines/google.ts:25](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/engines/google.ts#L25)
131
131
 
132
132
  Engine alias(es). Can be a single string or an array of strings.
133
133
  Useful for registering shorthand names (e.g., 'g' for 'Google').
@@ -142,7 +142,7 @@ Useful for registering shorthand names (e.g., 'g' for 'Google').
142
142
 
143
143
  > `static` **createObject**: (`name`, ...`args`) => [`WebSearcher`](WebSearcher.md)
144
144
 
145
- Defined in: [web-searcher/src/searcher.ts:78](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/searcher.ts#L78)
145
+ Defined in: [web-searcher/src/searcher.ts:85](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/searcher.ts#L85)
146
146
 
147
147
  Creates an instance of the registered search engine.
148
148
 
@@ -172,11 +172,39 @@ An instance of the search engine.
172
172
 
173
173
  ***
174
174
 
175
+ ### currentInstanceIndex?
176
+
177
+ > `static` `optional` **currentInstanceIndex**: `number`
178
+
179
+ Defined in: [web-searcher/src/searcher.ts:52](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/searcher.ts#L52)
180
+
181
+ Globally shared index for tracking the currently active instance (node) across sessions.
182
+
183
+ #### Inherited from
184
+
185
+ [`WebSearcher`](WebSearcher.md).[`currentInstanceIndex`](WebSearcher.md#currentinstanceindex)
186
+
187
+ ***
188
+
189
+ ### defaultBaseUrls?
190
+
191
+ > `static` `optional` **defaultBaseUrls**: `string`[]
192
+
193
+ Defined in: [web-searcher/src/searcher.ts:49](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/searcher.ts#L49)
194
+
195
+ Default base URLs for engines that support multiple instances.
196
+
197
+ #### Inherited from
198
+
199
+ [`WebSearcher`](WebSearcher.md).[`defaultBaseUrls`](WebSearcher.md#defaultbaseurls)
200
+
201
+ ***
202
+
175
203
  ### forEach()
176
204
 
177
205
  > `static` **forEach**: (`cb`) => `void`
178
206
 
179
- Defined in: [web-searcher/src/searcher.ts:85](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/searcher.ts#L85)
207
+ Defined in: [web-searcher/src/searcher.ts:92](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/searcher.ts#L92)
180
208
 
181
209
  Iterates over all registered engines.
182
210
 
@@ -202,7 +230,7 @@ Callback function to invoke for each registered engine.
202
230
 
203
231
  > `static` **get**: (`name`) => *typeof* [`WebSearcher`](WebSearcher.md)
204
232
 
205
- Defined in: [web-searcher/src/searcher.ts:69](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/searcher.ts#L69)
233
+ Defined in: [web-searcher/src/searcher.ts:76](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/searcher.ts#L76)
206
234
 
207
235
  Retrieves a registered search engine class by name.
208
236
 
@@ -230,7 +258,7 @@ The search engine class constructor.
230
258
 
231
259
  > `static` `optional` **name**: `string`
232
260
 
233
- Defined in: [web-searcher/src/searcher.ts:40](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/searcher.ts#L40)
261
+ Defined in: [web-searcher/src/searcher.ts:41](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/searcher.ts#L41)
234
262
 
235
263
  Custom engine name. If not provided, it is derived from the class name.
236
264
  For example, `GoogleSearcher` becomes `Google`.
@@ -245,7 +273,7 @@ For example, `GoogleSearcher` becomes `Google`.
245
273
 
246
274
  > `static` **register**: (`ctor`, `options?`) => `boolean`
247
275
 
248
- Defined in: [web-searcher/src/searcher.ts:54](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/searcher.ts#L54)
276
+ Defined in: [web-searcher/src/searcher.ts:61](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/searcher.ts#L61)
249
277
 
250
278
  Registers a search engine class.
251
279
 
@@ -279,7 +307,7 @@ Registration options. If a string is provided, it is used as the registered name
279
307
 
280
308
  > `static` **setAliases**: (`ctor`, ...`aliases`) => `void`
281
309
 
282
- Defined in: [web-searcher/src/searcher.ts:93](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/searcher.ts#L93)
310
+ Defined in: [web-searcher/src/searcher.ts:100](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/searcher.ts#L100)
283
311
 
284
312
  Sets aliases for a registered engine.
285
313
 
@@ -311,7 +339,7 @@ Aliases to add.
311
339
 
312
340
  > `static` **unregister**: (`name?`) => `void`
313
341
 
314
- Defined in: [web-searcher/src/searcher.ts:61](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/searcher.ts#L61)
342
+ Defined in: [web-searcher/src/searcher.ts:68](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/searcher.ts#L68)
315
343
 
316
344
  Unregisters a search engine.
317
345
 
@@ -339,7 +367,7 @@ The name or class to unregister.
339
367
 
340
368
  > **get** **pagination**(): [`PaginationConfig`](../interfaces/PaginationConfig.md)
341
369
 
342
- Defined in: [web-searcher/src/engines/google.ts:61](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/engines/google.ts#L61)
370
+ Defined in: [web-searcher/src/engines/google.ts:61](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/engines/google.ts#L61)
343
371
 
344
372
  Configures pagination for Google Search results.
345
373
  Uses the 'start' URL parameter, incrementing by 10 for each page.
@@ -358,15 +386,15 @@ Uses the 'start' URL parameter, incrementing by 10 for each page.
358
386
 
359
387
  #### Get Signature
360
388
 
361
- > **get** **template**(): `FetcherOptions`
389
+ > **get** **template**(): [`FetcherOptions`](../interfaces/FetcherOptions.md)
362
390
 
363
- Defined in: [web-searcher/src/engines/google.ts:32](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/engines/google.ts#L32)
391
+ Defined in: [web-searcher/src/engines/google.ts:32](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/engines/google.ts#L32)
364
392
 
365
393
  Defines the fetch template for Google Search.
366
394
 
367
395
  ##### Returns
368
396
 
369
- `FetcherOptions`
397
+ [`FetcherOptions`](../interfaces/FetcherOptions.md)
370
398
 
371
399
  The fetcher configuration including the URL pattern and extraction rules.
372
400
 
@@ -376,17 +404,43 @@ The fetcher configuration including the URL pattern and extraction rules.
376
404
 
377
405
  ## Methods
378
406
 
407
+ ### \_logDebug()
408
+
409
+ > `protected` **\_logDebug**(`category`, ...`args`): `void`
410
+
411
+ Defined in: web-fetcher/dist/index.d.ts:1172
412
+
413
+ #### Parameters
414
+
415
+ ##### category
416
+
417
+ `string`
418
+
419
+ ##### args
420
+
421
+ ...`any`[]
422
+
423
+ #### Returns
424
+
425
+ `void`
426
+
427
+ #### Inherited from
428
+
429
+ [`WebSearcher`](WebSearcher.md).[`_logDebug`](WebSearcher.md#_logdebug)
430
+
431
+ ***
432
+
379
433
  ### createContext()
380
434
 
381
435
  > `protected` **createContext**(`options`): `FetchContext`
382
436
 
383
- Defined in: [web-searcher/src/searcher.ts:155](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/searcher.ts#L155)
437
+ Defined in: [web-searcher/src/searcher.ts:216](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/searcher.ts#L216)
384
438
 
385
439
  #### Parameters
386
440
 
387
441
  ##### options
388
442
 
389
- `FetcherOptions` = `...`
443
+ [`FetcherOptions`](../interfaces/FetcherOptions.md) = `...`
390
444
 
391
445
  #### Returns
392
446
 
@@ -402,7 +456,7 @@ Defined in: [web-searcher/src/searcher.ts:155](https://github.com/isdk/web-searc
402
456
 
403
457
  > **dispose**(): `Promise`\<`void`\>
404
458
 
405
- Defined in: web-fetcher/dist/index.d.ts:2346
459
+ Defined in: web-fetcher/dist/index.d.ts:1231
406
460
 
407
461
  Disposes of the session and its associated engine.
408
462
 
@@ -425,7 +479,7 @@ This method should be called when the session is no longer needed to free up res
425
479
 
426
480
  > **execute**\<`R`\>(`actionOptions`, `context?`): `Promise`\<`FetchActionResult`\<`R`\>\>
427
481
 
428
- Defined in: web-fetcher/dist/index.d.ts:2301
482
+ Defined in: web-fetcher/dist/index.d.ts:1186
429
483
 
430
484
  Executes a single action within the session.
431
485
 
@@ -473,7 +527,7 @@ await session.execute({ name: 'goto', params: { url: 'https://example.com' } });
473
527
 
474
528
  > **executeAll**(`actions`, `options?`): `Promise`\<\{ `outputs`: `Record`\<`string`, `any`\>; `result`: `FetchResponse` \| `undefined`; \}\>
475
529
 
476
- Defined in: web-fetcher/dist/index.d.ts:2318
530
+ Defined in: web-fetcher/dist/index.d.ts:1203
477
531
 
478
532
  Executes a sequence of actions.
479
533
 
@@ -481,13 +535,13 @@ Executes a sequence of actions.
481
535
 
482
536
  ##### actions
483
537
 
484
- `_RequireAtLeastOne`\<`FetchActionProperties`, `"id"` \| `"name"` \| `"action"`\>[]
538
+ `_RequireAtLeastOne`\<`FetchActionProperties`, `"name"` \| `"id"` \| `"action"`\>[]
485
539
 
486
540
  An array of action options to be executed in order.
487
541
 
488
542
  ##### options?
489
543
 
490
- `Partial`\<`FetcherOptions`\> & `object`
544
+ `Partial`\<[`FetcherOptions`](../interfaces/FetcherOptions.md)\> & `object`
491
545
 
492
546
  Optional temporary configuration overrides (e.g., timeoutMs, headers) for this batch of actions.
493
547
  These overrides do not affect the main session context.
@@ -517,7 +571,7 @@ const { result, outputs } = await session.executeAll([
517
571
 
518
572
  > `protected` **formatOptions**(`options`): `Record`\<`string`, `any`\>
519
573
 
520
- Defined in: [web-searcher/src/engines/google.ts:82](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/engines/google.ts#L82)
574
+ Defined in: [web-searcher/src/engines/google.ts:82](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/engines/google.ts#L82)
521
575
 
522
576
  Maps standard `SearchOptions` to Google's specific URL parameters.
523
577
 
@@ -551,7 +605,7 @@ A map of variables to inject into the URL template.
551
605
 
552
606
  > **getOutputs**(): `Record`\<`string`, `any`\>
553
607
 
554
- Defined in: web-fetcher/dist/index.d.ts:2329
608
+ Defined in: web-fetcher/dist/index.d.ts:1214
555
609
 
556
610
  Retrieves all outputs accumulated during the session.
557
611
 
@@ -571,7 +625,7 @@ A record of stored output data.
571
625
 
572
626
  > **getState**(): `Promise`\<\{ `cookies`: `Cookie`[]; `sessionState?`: `any`; \} \| `undefined`\>
573
627
 
574
- Defined in: web-fetcher/dist/index.d.ts:2335
628
+ Defined in: web-fetcher/dist/index.d.ts:1220
575
629
 
576
630
  Gets the current state of the session, including cookies and engine-specific state.
577
631
 
@@ -587,16 +641,53 @@ A promise resolving to the session state, or undefined if no engine is initializ
587
641
 
588
642
  ***
589
643
 
644
+ ### getTemplate()
645
+
646
+ > `protected` **getTemplate**(`variables`, `options`): [`FetcherOptions`](../interfaces/FetcherOptions.md)
647
+
648
+ Defined in: [web-searcher/src/searcher.ts:212](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/searcher.ts#L212)
649
+
650
+ Dynamically retrieves the fetch template based on current variables and search options.
651
+
652
+ Subclasses can override this method to return different extraction rules (actions)
653
+ or URL patterns based on the search category, region, or other parameters.
654
+
655
+ #### Parameters
656
+
657
+ ##### variables
658
+
659
+ `Record`\<`string`, `any`\>
660
+
661
+ The calculated variables (from formatOptions, pagination, etc.).
662
+
663
+ ##### options
664
+
665
+ [`SearchOptions`](../interfaces/SearchOptions.md)
666
+
667
+ The original search options provided by the user.
668
+
669
+ #### Returns
670
+
671
+ [`FetcherOptions`](../interfaces/FetcherOptions.md)
672
+
673
+ The fetcher configuration to be used for the current request.
674
+
675
+ #### Inherited from
676
+
677
+ [`WebSearcher`](WebSearcher.md).[`getTemplate`](WebSearcher.md#gettemplate)
678
+
679
+ ***
680
+
590
681
  ### search()
591
682
 
592
683
  > **search**(`query`, `options`): `Promise`\<[`StandardSearchResult`](../interfaces/StandardSearchResult.md)[]\>
593
684
 
594
- Defined in: [web-searcher/src/searcher.ts:182](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/searcher.ts#L182)
685
+ Defined in: [web-searcher/src/searcher.ts:246](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/searcher.ts#L246)
595
686
 
596
687
  Executes a search query.
597
688
 
598
- This method handles the pagination loop, variable injection, fetching,
599
- and result transformation.
689
+ This method handles the pagination loop, multi-instance failover, variable injection,
690
+ fetching, and result transformation.
600
691
 
601
692
  #### Parameters
602
693
 
@@ -628,7 +719,7 @@ A promise resolving to an array of standardized search results.
628
719
 
629
720
  > `protected` **transform**(`outputs`): `Promise`\<`any`[]\>
630
721
 
631
- Defined in: [web-searcher/src/engines/google.ts:145](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/engines/google.ts#L145)
722
+ Defined in: [web-searcher/src/engines/google.ts:145](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/engines/google.ts#L145)
632
723
 
633
724
  Cleans and normalizes the extracted results.
634
725
  Specifically, it unwraps Google's redirect URLs (starting with `/url?q=`).
@@ -653,24 +744,60 @@ An array of cleaned search results.
653
744
 
654
745
  ***
655
746
 
747
+ ### validateFetchResult()
748
+
749
+ > `protected` **validateFetchResult**(`results`, `context`): `Promise`\<`boolean`\>
750
+
751
+ Defined in: [web-searcher/src/searcher.ts:421](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/searcher.ts#L421)
752
+
753
+ Hook for subclasses to validate fetched results before they are accepted.
754
+ If this returns false, the instance manager will consider the fetch a failure
755
+ and automatically switch to the next available baseUrl (if any).
756
+
757
+ #### Parameters
758
+
759
+ ##### results
760
+
761
+ [`StandardSearchResult`](../interfaces/StandardSearchResult.md)[]
762
+
763
+ The extracted results.
764
+
765
+ ##### context
766
+
767
+ [`SearchContext`](../interfaces/SearchContext.md)
768
+
769
+ Context including the current baseUrl and page.
770
+
771
+ #### Returns
772
+
773
+ `Promise`\<`boolean`\>
774
+
775
+ A promise resolving to true if valid, false otherwise.
776
+
777
+ #### Inherited from
778
+
779
+ [`WebSearcher`](WebSearcher.md).[`validateFetchResult`](WebSearcher.md#validatefetchresult)
780
+
781
+ ***
782
+
656
783
  ### search()
657
784
 
658
- > `static` **search**(`engineName`, `query`, `options`): `Promise`\<[`StandardSearchResult`](../interfaces/StandardSearchResult.md)[]\>
785
+ > `static` **search**(`engineNames`, `query`, `options`): `Promise`\<[`StandardSearchResult`](../interfaces/StandardSearchResult.md)[]\>
659
786
 
660
- Defined in: [web-searcher/src/searcher.ts:106](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/searcher.ts#L106)
787
+ Defined in: [web-searcher/src/searcher.ts:113](https://github.com/isdk/web-searcher.js/blob/955bc509edda39926bd12c6c2b8c28da7eb13ff5/src/searcher.ts#L113)
661
788
 
662
- Static helper to execute a one-off search.
789
+ Static helper to execute a one-off search or a fallback chain.
663
790
 
664
- It creates an instance of the specified engine, executes the search, and then
665
- automatically disposes of the session.
791
+ It creates an instance of the specified engine(s), executes the search, and automatically
792
+ falls back to the next engine in the list if the current one fails or is exhausted.
666
793
 
667
794
  #### Parameters
668
795
 
669
- ##### engineName
796
+ ##### engineNames
670
797
 
671
- `string`
798
+ The name(s) of the engine(s) to use (e.g., 'Google' or ['SearXNG', 'Google']).
672
799
 
673
- The name of the engine to use (e.g., 'Google').
800
+ `string` | `string`[]
674
801
 
675
802
  ##### query
676
803
 
@@ -680,7 +807,7 @@ The search query string.
680
807
 
681
808
  ##### options
682
809
 
683
- [`SearchOptions`](../interfaces/SearchOptions.md) & `FetcherOptions` = `{}`
810
+ [`SearchOptions`](../interfaces/SearchOptions.md) & [`FetcherOptions`](../interfaces/FetcherOptions.md) = `{}`
684
811
 
685
812
  Combined search options and fetcher options.
686
813