@isdk/web-searcher 0.1.5 → 0.1.6
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/README.cn.md +40 -0
- package/README.md +40 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/README.md +40 -0
- package/docs/classes/GoogleSearcher.md +150 -48
- package/docs/classes/WebSearcher.md +138 -48
- package/docs/functions/extractDate.md +1 -1
- package/docs/functions/extractMetadataFrom.md +1 -1
- package/docs/functions/fetchHeaders.md +1 -1
- package/docs/functions/fetchPartial.md +1 -1
- package/docs/functions/normalizeDate.md +1 -1
- package/docs/functions/parseHeaders.md +1 -1
- package/docs/functions/parseHtml.md +1 -1
- package/docs/functions/testUrlsByLatency.md +5 -1
- package/docs/interfaces/CustomTimeRange.md +3 -3
- package/docs/interfaces/ExtractOptions.md +4 -4
- package/docs/interfaces/FetchExtractorOptions.md +3 -3
- package/docs/interfaces/FetcherOptions.md +41 -29
- package/docs/interfaces/HtmlData.md +4 -4
- package/docs/interfaces/MetadataResult.md +2 -2
- package/docs/interfaces/PaginationConfig.md +7 -7
- package/docs/interfaces/SearchContext.md +6 -6
- package/docs/interfaces/SearchOptions.md +13 -13
- package/docs/interfaces/StandardSearchResult.md +10 -10
- package/docs/interfaces/VerifiedUrl.md +3 -3
- package/docs/type-aliases/MetadataType.md +1 -1
- package/docs/type-aliases/SafeSearchLevel.md +1 -1
- package/docs/type-aliases/SearchCategory.md +1 -1
- package/docs/type-aliases/SearchTimeRange.md +1 -1
- package/docs/type-aliases/SearchTimeRangePreset.md +1 -1
- package/docs/type-aliases/SearcherConstructor.md +1 -1
- package/package.json +2 -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/
|
|
9
|
+
Defined in: [web-searcher/src/engines/google.ts:24](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/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:
|
|
40
|
+
Defined in: web-fetcher/dist/index.d.ts:1172
|
|
41
41
|
|
|
42
42
|
Creates a new FetchSession.
|
|
43
43
|
|
|
@@ -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:
|
|
66
|
+
Defined in: web-fetcher/dist/index.d.ts:1166
|
|
67
67
|
|
|
68
68
|
#### Inherited from
|
|
69
69
|
|
|
@@ -75,7 +75,7 @@ Defined in: web-fetcher/dist/index.d.ts:1165
|
|
|
75
75
|
|
|
76
76
|
> `readonly` **context**: `FetchContext`
|
|
77
77
|
|
|
78
|
-
Defined in: web-fetcher/dist/index.d.ts:
|
|
78
|
+
Defined in: web-fetcher/dist/index.d.ts:1165
|
|
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:
|
|
92
|
+
Defined in: web-fetcher/dist/index.d.ts:1161
|
|
93
93
|
|
|
94
94
|
Unique identifier for the session.
|
|
95
95
|
|
|
@@ -103,7 +103,7 @@ Unique identifier for the session.
|
|
|
103
103
|
|
|
104
104
|
> `protected` **options**: [`FetcherOptions`](../interfaces/FetcherOptions.md)
|
|
105
105
|
|
|
106
|
-
Defined in: web-fetcher/dist/index.d.ts:
|
|
106
|
+
Defined in: web-fetcher/dist/index.d.ts:1157
|
|
107
107
|
|
|
108
108
|
#### Inherited from
|
|
109
109
|
|
|
@@ -111,11 +111,25 @@ Defined in: web-fetcher/dist/index.d.ts:1156
|
|
|
111
111
|
|
|
112
112
|
***
|
|
113
113
|
|
|
114
|
+
### \_defaultOptions?
|
|
115
|
+
|
|
116
|
+
> `static` `optional` **\_defaultOptions**: [`SearchOptions`](../interfaces/SearchOptions.md)
|
|
117
|
+
|
|
118
|
+
Defined in: [web-searcher/src/searcher.ts:55](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L55)
|
|
119
|
+
|
|
120
|
+
**`Internal`**
|
|
121
|
+
|
|
122
|
+
#### Inherited from
|
|
123
|
+
|
|
124
|
+
[`WebSearcher`](WebSearcher.md).[`_defaultOptions`](WebSearcher.md#_defaultoptions)
|
|
125
|
+
|
|
126
|
+
***
|
|
127
|
+
|
|
114
128
|
### \_isFactory
|
|
115
129
|
|
|
116
130
|
> `static` **\_isFactory**: `boolean` = `false`
|
|
117
131
|
|
|
118
|
-
Defined in: [web-searcher/src/searcher.ts:34](https://github.com/isdk/web-searcher.js/blob/
|
|
132
|
+
Defined in: [web-searcher/src/searcher.ts:34](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L34)
|
|
119
133
|
|
|
120
134
|
#### Inherited from
|
|
121
135
|
|
|
@@ -127,7 +141,7 @@ Defined in: [web-searcher/src/searcher.ts:34](https://github.com/isdk/web-search
|
|
|
127
141
|
|
|
128
142
|
> `static` **alias**: `string`[]
|
|
129
143
|
|
|
130
|
-
Defined in: [web-searcher/src/engines/google.ts:25](https://github.com/isdk/web-searcher.js/blob/
|
|
144
|
+
Defined in: [web-searcher/src/engines/google.ts:25](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/engines/google.ts#L25)
|
|
131
145
|
|
|
132
146
|
Engine alias(es). Can be a single string or an array of strings.
|
|
133
147
|
Useful for registering shorthand names (e.g., 'g' for 'Google').
|
|
@@ -142,7 +156,7 @@ Useful for registering shorthand names (e.g., 'g' for 'Google').
|
|
|
142
156
|
|
|
143
157
|
> `static` **createObject**: (`name`, ...`args`) => [`WebSearcher`](WebSearcher.md)
|
|
144
158
|
|
|
145
|
-
Defined in: [web-searcher/src/searcher.ts:
|
|
159
|
+
Defined in: [web-searcher/src/searcher.ts:122](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L122)
|
|
146
160
|
|
|
147
161
|
Creates an instance of the registered search engine.
|
|
148
162
|
|
|
@@ -176,7 +190,7 @@ An instance of the search engine.
|
|
|
176
190
|
|
|
177
191
|
> `static` `optional` **currentInstanceIndex**: `number`
|
|
178
192
|
|
|
179
|
-
Defined in: [web-searcher/src/searcher.ts:52](https://github.com/isdk/web-searcher.js/blob/
|
|
193
|
+
Defined in: [web-searcher/src/searcher.ts:52](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L52)
|
|
180
194
|
|
|
181
195
|
Globally shared index for tracking the currently active instance (node) across sessions.
|
|
182
196
|
|
|
@@ -190,7 +204,7 @@ Globally shared index for tracking the currently active instance (node) across s
|
|
|
190
204
|
|
|
191
205
|
> `static` `optional` **defaultBaseUrls**: `string`[]
|
|
192
206
|
|
|
193
|
-
Defined in: [web-searcher/src/searcher.ts:49](https://github.com/isdk/web-searcher.js/blob/
|
|
207
|
+
Defined in: [web-searcher/src/searcher.ts:49](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L49)
|
|
194
208
|
|
|
195
209
|
Default base URLs for engines that support multiple instances.
|
|
196
210
|
|
|
@@ -204,7 +218,7 @@ Default base URLs for engines that support multiple instances.
|
|
|
204
218
|
|
|
205
219
|
> `static` **forEach**: (`cb`) => `void`
|
|
206
220
|
|
|
207
|
-
Defined in: [web-searcher/src/searcher.ts:
|
|
221
|
+
Defined in: [web-searcher/src/searcher.ts:129](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L129)
|
|
208
222
|
|
|
209
223
|
Iterates over all registered engines.
|
|
210
224
|
|
|
@@ -230,7 +244,7 @@ Callback function to invoke for each registered engine.
|
|
|
230
244
|
|
|
231
245
|
> `static` **get**: (`name`) => *typeof* [`WebSearcher`](WebSearcher.md)
|
|
232
246
|
|
|
233
|
-
Defined in: [web-searcher/src/searcher.ts:
|
|
247
|
+
Defined in: [web-searcher/src/searcher.ts:113](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L113)
|
|
234
248
|
|
|
235
249
|
Retrieves a registered search engine class by name.
|
|
236
250
|
|
|
@@ -258,7 +272,7 @@ The search engine class constructor.
|
|
|
258
272
|
|
|
259
273
|
> `static` `optional` **name**: `string`
|
|
260
274
|
|
|
261
|
-
Defined in: [web-searcher/src/searcher.ts:41](https://github.com/isdk/web-searcher.js/blob/
|
|
275
|
+
Defined in: [web-searcher/src/searcher.ts:41](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L41)
|
|
262
276
|
|
|
263
277
|
Custom engine name. If not provided, it is derived from the class name.
|
|
264
278
|
For example, `GoogleSearcher` becomes `Google`.
|
|
@@ -273,7 +287,7 @@ For example, `GoogleSearcher` becomes `Google`.
|
|
|
273
287
|
|
|
274
288
|
> `static` **register**: (`ctor`, `options?`) => `boolean`
|
|
275
289
|
|
|
276
|
-
Defined in: [web-searcher/src/searcher.ts:
|
|
290
|
+
Defined in: [web-searcher/src/searcher.ts:98](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L98)
|
|
277
291
|
|
|
278
292
|
Registers a search engine class.
|
|
279
293
|
|
|
@@ -307,7 +321,7 @@ Registration options. If a string is provided, it is used as the registered name
|
|
|
307
321
|
|
|
308
322
|
> `static` **setAliases**: (`ctor`, ...`aliases`) => `void`
|
|
309
323
|
|
|
310
|
-
Defined in: [web-searcher/src/searcher.ts:
|
|
324
|
+
Defined in: [web-searcher/src/searcher.ts:137](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L137)
|
|
311
325
|
|
|
312
326
|
Sets aliases for a registered engine.
|
|
313
327
|
|
|
@@ -339,7 +353,7 @@ Aliases to add.
|
|
|
339
353
|
|
|
340
354
|
> `static` **unregister**: (`name?`) => `void`
|
|
341
355
|
|
|
342
|
-
Defined in: [web-searcher/src/searcher.ts:
|
|
356
|
+
Defined in: [web-searcher/src/searcher.ts:105](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L105)
|
|
343
357
|
|
|
344
358
|
Unregisters a search engine.
|
|
345
359
|
|
|
@@ -367,7 +381,7 @@ The name or class to unregister.
|
|
|
367
381
|
|
|
368
382
|
> **get** **pagination**(): [`PaginationConfig`](../interfaces/PaginationConfig.md)
|
|
369
383
|
|
|
370
|
-
Defined in: [web-searcher/src/engines/google.ts:61](https://github.com/isdk/web-searcher.js/blob/
|
|
384
|
+
Defined in: [web-searcher/src/engines/google.ts:61](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/engines/google.ts#L61)
|
|
371
385
|
|
|
372
386
|
Configures pagination for Google Search results.
|
|
373
387
|
Uses the 'start' URL parameter, incrementing by 10 for each page.
|
|
@@ -388,7 +402,7 @@ Uses the 'start' URL parameter, incrementing by 10 for each page.
|
|
|
388
402
|
|
|
389
403
|
> **get** **template**(): [`FetcherOptions`](../interfaces/FetcherOptions.md)
|
|
390
404
|
|
|
391
|
-
Defined in: [web-searcher/src/engines/google.ts:32](https://github.com/isdk/web-searcher.js/blob/
|
|
405
|
+
Defined in: [web-searcher/src/engines/google.ts:32](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/engines/google.ts#L32)
|
|
392
406
|
|
|
393
407
|
Defines the fetch template for Google Search.
|
|
394
408
|
|
|
@@ -402,13 +416,98 @@ The fetcher configuration including the URL pattern and extraction rules.
|
|
|
402
416
|
|
|
403
417
|
[`WebSearcher`](WebSearcher.md).[`template`](WebSearcher.md#template)
|
|
404
418
|
|
|
419
|
+
***
|
|
420
|
+
|
|
421
|
+
### defaultOptions
|
|
422
|
+
|
|
423
|
+
#### Get Signature
|
|
424
|
+
|
|
425
|
+
> **get** `static` **defaultOptions**(): [`SearchOptions`](../interfaces/SearchOptions.md)
|
|
426
|
+
|
|
427
|
+
Defined in: [web-searcher/src/searcher.ts:61](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L61)
|
|
428
|
+
|
|
429
|
+
Gets or sets the default search parameters for this specific engine class.
|
|
430
|
+
This does not include settings from parent classes.
|
|
431
|
+
|
|
432
|
+
##### Returns
|
|
433
|
+
|
|
434
|
+
[`SearchOptions`](../interfaces/SearchOptions.md)
|
|
435
|
+
|
|
436
|
+
#### Set Signature
|
|
437
|
+
|
|
438
|
+
> **set** `static` **defaultOptions**(`options`): `void`
|
|
439
|
+
|
|
440
|
+
Defined in: [web-searcher/src/searcher.ts:68](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L68)
|
|
441
|
+
|
|
442
|
+
##### Parameters
|
|
443
|
+
|
|
444
|
+
###### options
|
|
445
|
+
|
|
446
|
+
[`SearchOptions`](../interfaces/SearchOptions.md)
|
|
447
|
+
|
|
448
|
+
##### Returns
|
|
449
|
+
|
|
450
|
+
`void`
|
|
451
|
+
|
|
452
|
+
#### Inherited from
|
|
453
|
+
|
|
454
|
+
[`WebSearcher`](WebSearcher.md).[`defaultOptions`](WebSearcher.md#defaultoptions)
|
|
455
|
+
|
|
405
456
|
## Methods
|
|
406
457
|
|
|
458
|
+
### \_execute()
|
|
459
|
+
|
|
460
|
+
> `protected` **\_execute**\<`R`\>(`actionOptions`, `context?`): `Promise`\<`FetchActionResult`\<`R`\>\>
|
|
461
|
+
|
|
462
|
+
Defined in: web-fetcher/dist/index.d.ts:1187
|
|
463
|
+
|
|
464
|
+
Executes a single action within the session.
|
|
465
|
+
|
|
466
|
+
#### Type Parameters
|
|
467
|
+
|
|
468
|
+
##### R
|
|
469
|
+
|
|
470
|
+
`R` *extends* `FetchReturnType` = `"response"`
|
|
471
|
+
|
|
472
|
+
The expected return type of the action.
|
|
473
|
+
|
|
474
|
+
#### Parameters
|
|
475
|
+
|
|
476
|
+
##### actionOptions
|
|
477
|
+
|
|
478
|
+
`_RequireAtLeastOne`
|
|
479
|
+
|
|
480
|
+
Configuration for the action to be executed.
|
|
481
|
+
|
|
482
|
+
##### context?
|
|
483
|
+
|
|
484
|
+
`FetchContext`
|
|
485
|
+
|
|
486
|
+
Optional context override for this specific execution. Defaults to the session context.
|
|
487
|
+
|
|
488
|
+
#### Returns
|
|
489
|
+
|
|
490
|
+
`Promise`\<`FetchActionResult`\<`R`\>\>
|
|
491
|
+
|
|
492
|
+
A promise that resolves to the result of the action.
|
|
493
|
+
|
|
494
|
+
#### Example
|
|
495
|
+
|
|
496
|
+
```ts
|
|
497
|
+
await session.execute({ name: 'goto', params: { url: 'https://example.com' } });
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
#### Inherited from
|
|
501
|
+
|
|
502
|
+
[`WebSearcher`](WebSearcher.md).[`_execute`](WebSearcher.md#_execute)
|
|
503
|
+
|
|
504
|
+
***
|
|
505
|
+
|
|
407
506
|
### \_logDebug()
|
|
408
507
|
|
|
409
508
|
> `protected` **\_logDebug**(`category`, ...`args`): `void`
|
|
410
509
|
|
|
411
|
-
Defined in: web-fetcher/dist/index.d.ts:
|
|
510
|
+
Defined in: web-fetcher/dist/index.d.ts:1173
|
|
412
511
|
|
|
413
512
|
#### Parameters
|
|
414
513
|
|
|
@@ -434,7 +533,7 @@ Defined in: web-fetcher/dist/index.d.ts:1172
|
|
|
434
533
|
|
|
435
534
|
> `protected` **createContext**(`options`): `FetchContext`
|
|
436
535
|
|
|
437
|
-
Defined in: [web-searcher/src/searcher.ts:
|
|
536
|
+
Defined in: [web-searcher/src/searcher.ts:254](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L254)
|
|
438
537
|
|
|
439
538
|
#### Parameters
|
|
440
539
|
|
|
@@ -456,7 +555,7 @@ Defined in: [web-searcher/src/searcher.ts:216](https://github.com/isdk/web-searc
|
|
|
456
555
|
|
|
457
556
|
> **dispose**(): `Promise`\<`void`\>
|
|
458
557
|
|
|
459
|
-
Defined in: web-fetcher/dist/index.d.ts:
|
|
558
|
+
Defined in: web-fetcher/dist/index.d.ts:1233
|
|
460
559
|
|
|
461
560
|
Disposes of the session and its associated engine.
|
|
462
561
|
|
|
@@ -479,9 +578,7 @@ This method should be called when the session is no longer needed to free up res
|
|
|
479
578
|
|
|
480
579
|
> **execute**\<`R`\>(`actionOptions`, `context?`): `Promise`\<`FetchActionResult`\<`R`\>\>
|
|
481
580
|
|
|
482
|
-
Defined in: web-fetcher/dist/index.d.ts:
|
|
483
|
-
|
|
484
|
-
Executes a single action within the session.
|
|
581
|
+
Defined in: web-fetcher/dist/index.d.ts:1188
|
|
485
582
|
|
|
486
583
|
#### Type Parameters
|
|
487
584
|
|
|
@@ -489,34 +586,20 @@ Executes a single action within the session.
|
|
|
489
586
|
|
|
490
587
|
`R` *extends* `FetchReturnType` = `"response"`
|
|
491
588
|
|
|
492
|
-
The expected return type of the action.
|
|
493
|
-
|
|
494
589
|
#### Parameters
|
|
495
590
|
|
|
496
591
|
##### actionOptions
|
|
497
592
|
|
|
498
593
|
`_RequireAtLeastOne`
|
|
499
594
|
|
|
500
|
-
Configuration for the action to be executed.
|
|
501
|
-
|
|
502
595
|
##### context?
|
|
503
596
|
|
|
504
597
|
`FetchContext`
|
|
505
598
|
|
|
506
|
-
Optional context override for this specific execution. Defaults to the session context.
|
|
507
|
-
|
|
508
599
|
#### Returns
|
|
509
600
|
|
|
510
601
|
`Promise`\<`FetchActionResult`\<`R`\>\>
|
|
511
602
|
|
|
512
|
-
A promise that resolves to the result of the action.
|
|
513
|
-
|
|
514
|
-
#### Example
|
|
515
|
-
|
|
516
|
-
```ts
|
|
517
|
-
await session.execute({ name: 'goto', params: { url: 'https://example.com' } });
|
|
518
|
-
```
|
|
519
|
-
|
|
520
603
|
#### Inherited from
|
|
521
604
|
|
|
522
605
|
[`WebSearcher`](WebSearcher.md).[`execute`](WebSearcher.md#execute)
|
|
@@ -527,7 +610,7 @@ await session.execute({ name: 'goto', params: { url: 'https://example.com' } });
|
|
|
527
610
|
|
|
528
611
|
> **executeAll**(`actions`, `options?`): `Promise`\<\{ `outputs`: `Record`\<`string`, `any`\>; `result`: `FetchResponse` \| `undefined`; \}\>
|
|
529
612
|
|
|
530
|
-
Defined in: web-fetcher/dist/index.d.ts:
|
|
613
|
+
Defined in: web-fetcher/dist/index.d.ts:1205
|
|
531
614
|
|
|
532
615
|
Executes a sequence of actions.
|
|
533
616
|
|
|
@@ -571,7 +654,7 @@ const { result, outputs } = await session.executeAll([
|
|
|
571
654
|
|
|
572
655
|
> `protected` **formatOptions**(`options`): `Record`\<`string`, `any`\>
|
|
573
656
|
|
|
574
|
-
Defined in: [web-searcher/src/engines/google.ts:82](https://github.com/isdk/web-searcher.js/blob/
|
|
657
|
+
Defined in: [web-searcher/src/engines/google.ts:82](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/engines/google.ts#L82)
|
|
575
658
|
|
|
576
659
|
Maps standard `SearchOptions` to Google's specific URL parameters.
|
|
577
660
|
|
|
@@ -605,7 +688,7 @@ A map of variables to inject into the URL template.
|
|
|
605
688
|
|
|
606
689
|
> **getOutputs**(): `Record`\<`string`, `any`\>
|
|
607
690
|
|
|
608
|
-
Defined in: web-fetcher/dist/index.d.ts:
|
|
691
|
+
Defined in: web-fetcher/dist/index.d.ts:1216
|
|
609
692
|
|
|
610
693
|
Retrieves all outputs accumulated during the session.
|
|
611
694
|
|
|
@@ -625,7 +708,7 @@ A record of stored output data.
|
|
|
625
708
|
|
|
626
709
|
> **getState**(): `Promise`\<\{ `cookies`: `Cookie`[]; `sessionState?`: `any`; \} \| `undefined`\>
|
|
627
710
|
|
|
628
|
-
Defined in: web-fetcher/dist/index.d.ts:
|
|
711
|
+
Defined in: web-fetcher/dist/index.d.ts:1222
|
|
629
712
|
|
|
630
713
|
Gets the current state of the session, including cookies and engine-specific state.
|
|
631
714
|
|
|
@@ -645,7 +728,7 @@ A promise resolving to the session state, or undefined if no engine is initializ
|
|
|
645
728
|
|
|
646
729
|
> `protected` **getTemplate**(`variables`, `options`): [`FetcherOptions`](../interfaces/FetcherOptions.md)
|
|
647
730
|
|
|
648
|
-
Defined in: [web-searcher/src/searcher.ts:
|
|
731
|
+
Defined in: [web-searcher/src/searcher.ts:250](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L250)
|
|
649
732
|
|
|
650
733
|
Dynamically retrieves the fetch template based on current variables and search options.
|
|
651
734
|
|
|
@@ -682,7 +765,7 @@ The fetcher configuration to be used for the current request.
|
|
|
682
765
|
|
|
683
766
|
> **search**(`query`, `options`): `Promise`\<[`StandardSearchResult`](../interfaces/StandardSearchResult.md)[]\>
|
|
684
767
|
|
|
685
|
-
Defined in: [web-searcher/src/searcher.ts:
|
|
768
|
+
Defined in: [web-searcher/src/searcher.ts:284](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L284)
|
|
686
769
|
|
|
687
770
|
Executes a search query.
|
|
688
771
|
|
|
@@ -719,7 +802,7 @@ A promise resolving to an array of standardized search results.
|
|
|
719
802
|
|
|
720
803
|
> `protected` **transform**(`outputs`): `Promise`\<`any`[]\>
|
|
721
804
|
|
|
722
|
-
Defined in: [web-searcher/src/engines/google.ts:145](https://github.com/isdk/web-searcher.js/blob/
|
|
805
|
+
Defined in: [web-searcher/src/engines/google.ts:145](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/engines/google.ts#L145)
|
|
723
806
|
|
|
724
807
|
Cleans and normalizes the extracted results.
|
|
725
808
|
Specifically, it unwraps Google's redirect URLs (starting with `/url?q=`).
|
|
@@ -748,7 +831,7 @@ An array of cleaned search results.
|
|
|
748
831
|
|
|
749
832
|
> `protected` **validateFetchResult**(`results`, `context`): `Promise`\<`boolean`\>
|
|
750
833
|
|
|
751
|
-
Defined in: [web-searcher/src/searcher.ts:
|
|
834
|
+
Defined in: [web-searcher/src/searcher.ts:462](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L462)
|
|
752
835
|
|
|
753
836
|
Hook for subclasses to validate fetched results before they are accepted.
|
|
754
837
|
If this returns false, the instance manager will consider the fetch a failure
|
|
@@ -780,11 +863,30 @@ A promise resolving to true if valid, false otherwise.
|
|
|
780
863
|
|
|
781
864
|
***
|
|
782
865
|
|
|
866
|
+
### getDefaultOptions()
|
|
867
|
+
|
|
868
|
+
> `static` **getDefaultOptions**(): [`SearchOptions`](../interfaces/SearchOptions.md)
|
|
869
|
+
|
|
870
|
+
Defined in: [web-searcher/src/searcher.ts:76](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L76)
|
|
871
|
+
|
|
872
|
+
Retrieves the combined default search options by traversing the prototype chain.
|
|
873
|
+
Priority: Current class > Parent class > WebSearcher base class.
|
|
874
|
+
|
|
875
|
+
#### Returns
|
|
876
|
+
|
|
877
|
+
[`SearchOptions`](../interfaces/SearchOptions.md)
|
|
878
|
+
|
|
879
|
+
#### Inherited from
|
|
880
|
+
|
|
881
|
+
[`WebSearcher`](WebSearcher.md).[`getDefaultOptions`](WebSearcher.md#getdefaultoptions)
|
|
882
|
+
|
|
883
|
+
***
|
|
884
|
+
|
|
783
885
|
### search()
|
|
784
886
|
|
|
785
887
|
> `static` **search**(`engineNames`, `query`, `options`): `Promise`\<[`StandardSearchResult`](../interfaces/StandardSearchResult.md)[]\>
|
|
786
888
|
|
|
787
|
-
Defined in: [web-searcher/src/searcher.ts:
|
|
889
|
+
Defined in: [web-searcher/src/searcher.ts:150](https://github.com/isdk/web-searcher.js/blob/0c4757eb75b3b7c5af0231806f11e7b3c3166736/src/searcher.ts#L150)
|
|
788
890
|
|
|
789
891
|
Static helper to execute a one-off search or a fallback chain.
|
|
790
892
|
|