@isdk/web-searcher 0.1.2 → 0.1.4
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 +43 -14
- package/README.md +44 -15
- package/dist/index.d.mts +31 -2
- package/dist/index.d.ts +31 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/README.md +44 -15
- package/docs/classes/GoogleSearcher.md +27 -27
- package/docs/classes/WebSearcher.md +27 -27
- package/docs/interfaces/CustomTimeRange.md +3 -3
- package/docs/interfaces/PaginationConfig.md +26 -6
- package/docs/interfaces/SearchContext.md +4 -4
- package/docs/interfaces/SearchOptions.md +23 -8
- package/docs/interfaces/StandardSearchResult.md +56 -6
- 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 +2 -2
- package/docs/type-aliases/SearcherConstructor.md +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: SearchOptions
|
|
8
8
|
|
|
9
|
-
Defined in: [web-searcher/src/types.ts:
|
|
9
|
+
Defined in: [web-searcher/src/types.ts:120](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L120)
|
|
10
10
|
|
|
11
11
|
Options provided when executing a search.
|
|
12
12
|
|
|
@@ -22,7 +22,7 @@ Any other custom variables to be injected into the template.
|
|
|
22
22
|
|
|
23
23
|
> `optional` **category**: [`SearchCategory`](../type-aliases/SearchCategory.md)
|
|
24
24
|
|
|
25
|
-
Defined in: [web-searcher/src/types.ts:
|
|
25
|
+
Defined in: [web-searcher/src/types.ts:144](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L144)
|
|
26
26
|
|
|
27
27
|
The category of results to return.
|
|
28
28
|
Default: 'all' (web search)
|
|
@@ -33,7 +33,7 @@ Default: 'all' (web search)
|
|
|
33
33
|
|
|
34
34
|
> `optional` **language**: `string`
|
|
35
35
|
|
|
36
|
-
Defined in: [web-searcher/src/types.ts:
|
|
36
|
+
Defined in: [web-searcher/src/types.ts:154](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L154)
|
|
37
37
|
|
|
38
38
|
Language code (ISO 639-1) for the interface or results (e.g., 'en', 'zh-CN').
|
|
39
39
|
|
|
@@ -43,17 +43,32 @@ Language code (ISO 639-1) for the interface or results (e.g., 'en', 'zh-CN').
|
|
|
43
43
|
|
|
44
44
|
> `optional` **limit**: `number`
|
|
45
45
|
|
|
46
|
-
Defined in: [web-searcher/src/types.ts:
|
|
46
|
+
Defined in: [web-searcher/src/types.ts:122](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L122)
|
|
47
47
|
|
|
48
48
|
The maximum number of results to retrieve.
|
|
49
49
|
|
|
50
50
|
***
|
|
51
51
|
|
|
52
|
+
### maxPages?
|
|
53
|
+
|
|
54
|
+
> `optional` **maxPages**: `number`
|
|
55
|
+
|
|
56
|
+
Defined in: [web-searcher/src/types.ts:132](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L132)
|
|
57
|
+
|
|
58
|
+
The maximum number of pages (fetch cycles) allowed to reach the requested `limit`.
|
|
59
|
+
|
|
60
|
+
This is a safety guard. If the `limit` is high but each page has few results,
|
|
61
|
+
the searcher will stop once this page count is reached.
|
|
62
|
+
|
|
63
|
+
If not provided, it defaults to the value in `PaginationConfig` or 10.
|
|
64
|
+
|
|
65
|
+
***
|
|
66
|
+
|
|
52
67
|
### region?
|
|
53
68
|
|
|
54
69
|
> `optional` **region**: `string`
|
|
55
70
|
|
|
56
|
-
Defined in: [web-searcher/src/types.ts:
|
|
71
|
+
Defined in: [web-searcher/src/types.ts:149](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L149)
|
|
57
72
|
|
|
58
73
|
Region code (ISO 3166-1 alpha-2) to bias results (e.g., 'US', 'CN', 'JP').
|
|
59
74
|
|
|
@@ -63,7 +78,7 @@ Region code (ISO 3166-1 alpha-2) to bias results (e.g., 'US', 'CN', 'JP').
|
|
|
63
78
|
|
|
64
79
|
> `optional` **safeSearch**: [`SafeSearchLevel`](../type-aliases/SafeSearchLevel.md)
|
|
65
80
|
|
|
66
|
-
Defined in: [web-searcher/src/types.ts:
|
|
81
|
+
Defined in: [web-searcher/src/types.ts:160](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L160)
|
|
67
82
|
|
|
68
83
|
Safe search filtering level.
|
|
69
84
|
Default: engine dependent (usually 'moderate' or 'strict' by default).
|
|
@@ -74,7 +89,7 @@ Default: engine dependent (usually 'moderate' or 'strict' by default).
|
|
|
74
89
|
|
|
75
90
|
> `optional` **timeRange**: [`SearchTimeRange`](../type-aliases/SearchTimeRange.md)
|
|
76
91
|
|
|
77
|
-
Defined in: [web-searcher/src/types.ts:
|
|
92
|
+
Defined in: [web-searcher/src/types.ts:138](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L138)
|
|
78
93
|
|
|
79
94
|
Date range for the search results.
|
|
80
95
|
Default: 'all'
|
|
@@ -85,7 +100,7 @@ Default: 'all'
|
|
|
85
100
|
|
|
86
101
|
> `optional` **transform**: (`results`, `context`) => [`StandardSearchResult`](StandardSearchResult.md)[] \| `Promise`\<[`StandardSearchResult`](StandardSearchResult.md)[]\>
|
|
87
102
|
|
|
88
|
-
Defined in: [web-searcher/src/types.ts:
|
|
103
|
+
Defined in: [web-searcher/src/types.ts:166](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L166)
|
|
89
104
|
|
|
90
105
|
A custom transform function to filter or modify results at runtime.
|
|
91
106
|
This runs AFTER the engine-level transform.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: StandardSearchResult
|
|
8
8
|
|
|
9
|
-
Defined in: [web-searcher/src/types.ts:5](https://github.com/isdk/web-searcher.js/blob/
|
|
9
|
+
Defined in: [web-searcher/src/types.ts:5](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L5)
|
|
10
10
|
|
|
11
11
|
Interface representing a standardized search result item.
|
|
12
12
|
This ensures consistency across different search engines.
|
|
@@ -15,35 +15,85 @@ This ensures consistency across different search engines.
|
|
|
15
15
|
|
|
16
16
|
\[`key`: `string`\]: `any`
|
|
17
17
|
|
|
18
|
-
Allows for engine-specific extra fields (e.g.,
|
|
18
|
+
Allows for engine-specific extra fields (e.g., siteIcon, category).
|
|
19
19
|
|
|
20
20
|
## Properties
|
|
21
21
|
|
|
22
|
+
### author?
|
|
23
|
+
|
|
24
|
+
> `optional` **author**: `string`
|
|
25
|
+
|
|
26
|
+
Defined in: [web-searcher/src/types.ts:22](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L22)
|
|
27
|
+
|
|
28
|
+
The author or source name of the result.
|
|
29
|
+
|
|
30
|
+
***
|
|
31
|
+
|
|
32
|
+
### date?
|
|
33
|
+
|
|
34
|
+
> `optional` **date**: `string` \| `Date`
|
|
35
|
+
|
|
36
|
+
Defined in: [web-searcher/src/types.ts:19](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L19)
|
|
37
|
+
|
|
38
|
+
The date the result was published or last updated.
|
|
39
|
+
|
|
40
|
+
***
|
|
41
|
+
|
|
42
|
+
### favicon?
|
|
43
|
+
|
|
44
|
+
> `optional` **favicon**: `string`
|
|
45
|
+
|
|
46
|
+
Defined in: [web-searcher/src/types.ts:25](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L25)
|
|
47
|
+
|
|
48
|
+
The favicon URL of the source website.
|
|
49
|
+
|
|
50
|
+
***
|
|
51
|
+
|
|
22
52
|
### image?
|
|
23
53
|
|
|
24
54
|
> `optional` **image**: `string`
|
|
25
55
|
|
|
26
|
-
Defined in: [web-searcher/src/types.ts:16](https://github.com/isdk/web-searcher.js/blob/
|
|
56
|
+
Defined in: [web-searcher/src/types.ts:16](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L16)
|
|
27
57
|
|
|
28
58
|
An optional image URL associated with the result.
|
|
29
59
|
|
|
30
60
|
***
|
|
31
61
|
|
|
62
|
+
### rank?
|
|
63
|
+
|
|
64
|
+
> `optional` **rank**: `number`
|
|
65
|
+
|
|
66
|
+
Defined in: [web-searcher/src/types.ts:28](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L28)
|
|
67
|
+
|
|
68
|
+
The rank or position of the result (usually 1-indexed).
|
|
69
|
+
|
|
70
|
+
***
|
|
71
|
+
|
|
32
72
|
### snippet?
|
|
33
73
|
|
|
34
74
|
> `optional` **snippet**: `string`
|
|
35
75
|
|
|
36
|
-
Defined in: [web-searcher/src/types.ts:13](https://github.com/isdk/web-searcher.js/blob/
|
|
76
|
+
Defined in: [web-searcher/src/types.ts:13](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L13)
|
|
37
77
|
|
|
38
78
|
A brief snippet or description of the result.
|
|
39
79
|
|
|
40
80
|
***
|
|
41
81
|
|
|
82
|
+
### source?
|
|
83
|
+
|
|
84
|
+
> `optional` **source**: `string`
|
|
85
|
+
|
|
86
|
+
Defined in: [web-searcher/src/types.ts:31](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L31)
|
|
87
|
+
|
|
88
|
+
The source website name (e.g., 'GitHub', 'StackOverflow').
|
|
89
|
+
|
|
90
|
+
***
|
|
91
|
+
|
|
42
92
|
### title
|
|
43
93
|
|
|
44
94
|
> **title**: `string`
|
|
45
95
|
|
|
46
|
-
Defined in: [web-searcher/src/types.ts:7](https://github.com/isdk/web-searcher.js/blob/
|
|
96
|
+
Defined in: [web-searcher/src/types.ts:7](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L7)
|
|
47
97
|
|
|
48
98
|
The title of the search result.
|
|
49
99
|
|
|
@@ -53,6 +103,6 @@ The title of the search result.
|
|
|
53
103
|
|
|
54
104
|
> **url**: `string`
|
|
55
105
|
|
|
56
|
-
Defined in: [web-searcher/src/types.ts:10](https://github.com/isdk/web-searcher.js/blob/
|
|
106
|
+
Defined in: [web-searcher/src/types.ts:10](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L10)
|
|
57
107
|
|
|
58
108
|
The URL of the search result.
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
|
|
9
9
|
> **SafeSearchLevel** = `"off"` \| `"moderate"` \| `"strict"`
|
|
10
10
|
|
|
11
|
-
Defined in: [web-searcher/src/types.ts:
|
|
11
|
+
Defined in: [web-searcher/src/types.ts:115](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L115)
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
|
|
9
9
|
> **SearchCategory** = `"all"` \| `"images"` \| `"videos"` \| `"news"`
|
|
10
10
|
|
|
11
|
-
Defined in: [web-searcher/src/types.ts:
|
|
11
|
+
Defined in: [web-searcher/src/types.ts:113](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L113)
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
|
|
9
9
|
> **SearchTimeRange** = [`SearchTimeRangePreset`](SearchTimeRangePreset.md) \| [`CustomTimeRange`](../interfaces/CustomTimeRange.md)
|
|
10
10
|
|
|
11
|
-
Defined in: [web-searcher/src/types.ts:
|
|
11
|
+
Defined in: [web-searcher/src/types.ts:111](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L111)
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
# Type Alias: SearchTimeRangePreset
|
|
8
8
|
|
|
9
|
-
> **SearchTimeRangePreset** = `"all"` \| `"day"` \| `"week"` \| `"month"` \| `"year"`
|
|
9
|
+
> **SearchTimeRangePreset** = `"all"` \| `"hour"` \| `"day"` \| `"week"` \| `"month"` \| `"year"`
|
|
10
10
|
|
|
11
|
-
Defined in: [web-searcher/src/types.ts:
|
|
11
|
+
Defined in: [web-searcher/src/types.ts:102](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/types.ts#L102)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **SearcherConstructor** = (`options?`) => [`WebSearcher`](../classes/WebSearcher.md)
|
|
10
10
|
|
|
11
|
-
Defined in: [web-searcher/src/searcher.ts:10](https://github.com/isdk/web-searcher.js/blob/
|
|
11
|
+
Defined in: [web-searcher/src/searcher.ts:10](https://github.com/isdk/web-searcher.js/blob/7bcd8cca4a3a7fc201a5cf3e3b4283f267eadcea/src/searcher.ts#L10)
|
|
12
12
|
|
|
13
13
|
Constructor definition for Searcher subclasses.
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isdk/web-searcher",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "A high-level framework for building search engine scrapers, supporting multi-page navigation, session persistence, and result standardization.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Riceball LEE <snowyu.lee@gmail.com>",
|