@isdk/web-searcher 0.1.1

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.
@@ -0,0 +1,86 @@
1
+ [**@isdk/web-searcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-searcher](../globals.md) / PaginationConfig
6
+
7
+ # Interface: PaginationConfig
8
+
9
+ Defined in: [web-searcher/src/types.ts:26](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L26)
10
+
11
+ Configuration for pagination strategies.
12
+ Defines how the searcher should navigate to the next page of results.
13
+
14
+ ## Properties
15
+
16
+ ### increment?
17
+
18
+ > `optional` **increment**: `number`
19
+
20
+ Defined in: [web-searcher/src/types.ts:53](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L53)
21
+
22
+ The increment step for each page.
23
+ - If the parameter represents an item offset (like Google's 'start'), this might be 10.
24
+ - If the parameter represents a page number, this is usually 1.
25
+
26
+ #### Default
27
+
28
+ ```ts
29
+ 1
30
+ ```
31
+
32
+ ***
33
+
34
+ ### nextButtonSelector?
35
+
36
+ > `optional` **nextButtonSelector**: `string`
37
+
38
+ Defined in: [web-searcher/src/types.ts:59](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L59)
39
+
40
+ The CSS selector for the "Next" page button.
41
+ Required if type is 'click-next'.
42
+
43
+ ***
44
+
45
+ ### paramName?
46
+
47
+ > `optional` **paramName**: `string`
48
+
49
+ Defined in: [web-searcher/src/types.ts:39](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L39)
50
+
51
+ The name of the URL parameter used for pagination.
52
+ Required if type is 'url-param'.
53
+
54
+ #### Example
55
+
56
+ ```ts
57
+ 'start' for Google, 'page' or 'p' for others.
58
+ ```
59
+
60
+ ***
61
+
62
+ ### startValue?
63
+
64
+ > `optional` **startValue**: `number`
65
+
66
+ Defined in: [web-searcher/src/types.ts:45](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L45)
67
+
68
+ The starting value for the pagination parameter.
69
+
70
+ #### Default
71
+
72
+ ```ts
73
+ 0
74
+ ```
75
+
76
+ ***
77
+
78
+ ### type
79
+
80
+ > **type**: `"url-param"` \| `"click-next"`
81
+
82
+ Defined in: [web-searcher/src/types.ts:32](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L32)
83
+
84
+ The type of pagination mechanism:
85
+ - 'url-param': Pagination is handled by modifying URL parameters (e.g., `?page=2` or `?start=10`).
86
+ - 'click-next': Pagination is handled by clicking a "Next" button on the page (only works in 'browser' mode).
@@ -0,0 +1,41 @@
1
+ [**@isdk/web-searcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-searcher](../globals.md) / SearchContext
6
+
7
+ # Interface: SearchContext
8
+
9
+ Defined in: [web-searcher/src/types.ts:65](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L65)
10
+
11
+ Context object passed to the transform function.
12
+
13
+ ## Properties
14
+
15
+ ### limit?
16
+
17
+ > `optional` **limit**: `number`
18
+
19
+ Defined in: [web-searcher/src/types.ts:73](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L73)
20
+
21
+ The requested limit of results.
22
+
23
+ ***
24
+
25
+ ### page
26
+
27
+ > **page**: `number`
28
+
29
+ Defined in: [web-searcher/src/types.ts:70](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L70)
30
+
31
+ The current page index (0-based).
32
+
33
+ ***
34
+
35
+ ### query
36
+
37
+ > **query**: `string`
38
+
39
+ Defined in: [web-searcher/src/types.ts:67](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L67)
40
+
41
+ The original search query.
@@ -0,0 +1,105 @@
1
+ [**@isdk/web-searcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-searcher](../globals.md) / SearchOptions
6
+
7
+ # Interface: SearchOptions
8
+
9
+ Defined in: [web-searcher/src/types.ts:94](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L94)
10
+
11
+ Options provided when executing a search.
12
+
13
+ ## Indexable
14
+
15
+ \[`key`: `string`\]: `any`
16
+
17
+ Any other custom variables to be injected into the template.
18
+
19
+ ## Properties
20
+
21
+ ### category?
22
+
23
+ > `optional` **category**: [`SearchCategory`](../type-aliases/SearchCategory.md)
24
+
25
+ Defined in: [web-searcher/src/types.ts:108](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L108)
26
+
27
+ The category of results to return.
28
+ Default: 'all' (web search)
29
+
30
+ ***
31
+
32
+ ### language?
33
+
34
+ > `optional` **language**: `string`
35
+
36
+ Defined in: [web-searcher/src/types.ts:118](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L118)
37
+
38
+ Language code (ISO 639-1) for the interface or results (e.g., 'en', 'zh-CN').
39
+
40
+ ***
41
+
42
+ ### limit?
43
+
44
+ > `optional` **limit**: `number`
45
+
46
+ Defined in: [web-searcher/src/types.ts:96](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L96)
47
+
48
+ The maximum number of results to retrieve.
49
+
50
+ ***
51
+
52
+ ### region?
53
+
54
+ > `optional` **region**: `string`
55
+
56
+ Defined in: [web-searcher/src/types.ts:113](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L113)
57
+
58
+ Region code (ISO 3166-1 alpha-2) to bias results (e.g., 'US', 'CN', 'JP').
59
+
60
+ ***
61
+
62
+ ### safeSearch?
63
+
64
+ > `optional` **safeSearch**: [`SafeSearchLevel`](../type-aliases/SafeSearchLevel.md)
65
+
66
+ Defined in: [web-searcher/src/types.ts:124](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L124)
67
+
68
+ Safe search filtering level.
69
+ Default: engine dependent (usually 'moderate' or 'strict' by default).
70
+
71
+ ***
72
+
73
+ ### timeRange?
74
+
75
+ > `optional` **timeRange**: [`SearchTimeRange`](../type-aliases/SearchTimeRange.md)
76
+
77
+ Defined in: [web-searcher/src/types.ts:102](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L102)
78
+
79
+ Date range for the search results.
80
+ Default: 'all'
81
+
82
+ ***
83
+
84
+ ### transform()?
85
+
86
+ > `optional` **transform**: (`results`, `context`) => [`StandardSearchResult`](StandardSearchResult.md)[] \| `Promise`\<[`StandardSearchResult`](StandardSearchResult.md)[]\>
87
+
88
+ Defined in: [web-searcher/src/types.ts:130](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L130)
89
+
90
+ A custom transform function to filter or modify results at runtime.
91
+ This runs AFTER the engine-level transform.
92
+
93
+ #### Parameters
94
+
95
+ ##### results
96
+
97
+ [`StandardSearchResult`](StandardSearchResult.md)[]
98
+
99
+ ##### context
100
+
101
+ [`SearchContext`](SearchContext.md)
102
+
103
+ #### Returns
104
+
105
+ [`StandardSearchResult`](StandardSearchResult.md)[] \| `Promise`\<[`StandardSearchResult`](StandardSearchResult.md)[]\>
@@ -0,0 +1,58 @@
1
+ [**@isdk/web-searcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-searcher](../globals.md) / StandardSearchResult
6
+
7
+ # Interface: StandardSearchResult
8
+
9
+ Defined in: [web-searcher/src/types.ts:5](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L5)
10
+
11
+ Interface representing a standardized search result item.
12
+ This ensures consistency across different search engines.
13
+
14
+ ## Indexable
15
+
16
+ \[`key`: `string`\]: `any`
17
+
18
+ Allows for engine-specific extra fields (e.g., rank, author, date).
19
+
20
+ ## Properties
21
+
22
+ ### image?
23
+
24
+ > `optional` **image**: `string`
25
+
26
+ Defined in: [web-searcher/src/types.ts:16](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L16)
27
+
28
+ An optional image URL associated with the result.
29
+
30
+ ***
31
+
32
+ ### snippet?
33
+
34
+ > `optional` **snippet**: `string`
35
+
36
+ Defined in: [web-searcher/src/types.ts:13](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L13)
37
+
38
+ A brief snippet or description of the result.
39
+
40
+ ***
41
+
42
+ ### title
43
+
44
+ > **title**: `string`
45
+
46
+ Defined in: [web-searcher/src/types.ts:7](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L7)
47
+
48
+ The title of the search result.
49
+
50
+ ***
51
+
52
+ ### url
53
+
54
+ > **url**: `string`
55
+
56
+ Defined in: [web-searcher/src/types.ts:10](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L10)
57
+
58
+ The URL of the search result.
@@ -0,0 +1,11 @@
1
+ [**@isdk/web-searcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-searcher](../globals.md) / SafeSearchLevel
6
+
7
+ # Type Alias: SafeSearchLevel
8
+
9
+ > **SafeSearchLevel** = `"off"` \| `"moderate"` \| `"strict"`
10
+
11
+ Defined in: [web-searcher/src/types.ts:89](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L89)
@@ -0,0 +1,11 @@
1
+ [**@isdk/web-searcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-searcher](../globals.md) / SearchCategory
6
+
7
+ # Type Alias: SearchCategory
8
+
9
+ > **SearchCategory** = `"all"` \| `"images"` \| `"videos"` \| `"news"`
10
+
11
+ Defined in: [web-searcher/src/types.ts:87](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L87)
@@ -0,0 +1,11 @@
1
+ [**@isdk/web-searcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-searcher](../globals.md) / SearchTimeRange
6
+
7
+ # Type Alias: SearchTimeRange
8
+
9
+ > **SearchTimeRange** = [`SearchTimeRangePreset`](SearchTimeRangePreset.md) \| [`CustomTimeRange`](../interfaces/CustomTimeRange.md)
10
+
11
+ Defined in: [web-searcher/src/types.ts:85](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L85)
@@ -0,0 +1,11 @@
1
+ [**@isdk/web-searcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-searcher](../globals.md) / SearchTimeRangePreset
6
+
7
+ # Type Alias: SearchTimeRangePreset
8
+
9
+ > **SearchTimeRangePreset** = `"all"` \| `"day"` \| `"week"` \| `"month"` \| `"year"`
10
+
11
+ Defined in: [web-searcher/src/types.ts:76](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/types.ts#L76)
@@ -0,0 +1,23 @@
1
+ [**@isdk/web-searcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-searcher](../globals.md) / SearcherConstructor
6
+
7
+ # Type Alias: SearcherConstructor()
8
+
9
+ > **SearcherConstructor** = (`options?`) => [`WebSearcher`](../classes/WebSearcher.md)
10
+
11
+ Defined in: [web-searcher/src/searcher.ts:10](https://github.com/isdk/web-searcher.js/blob/e9a6e5ec9526780489427743389b927a5c16db5c/src/searcher.ts#L10)
12
+
13
+ Constructor definition for Searcher subclasses.
14
+
15
+ ## Parameters
16
+
17
+ ### options?
18
+
19
+ `FetcherOptions`
20
+
21
+ ## Returns
22
+
23
+ [`WebSearcher`](../classes/WebSearcher.md)
package/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "@isdk/web-searcher",
3
+ "version": "0.1.1",
4
+ "description": "A high-level framework for building search engine scrapers, supporting multi-page navigation, session persistence, and result standardization.",
5
+ "license": "MIT",
6
+ "author": "Riceball LEE <snowyu.lee@gmail.com>",
7
+ "homepage": "https://github.com/isdk/web-searcher.js",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git://github.com/isdk/web-searcher.js.git"
11
+ },
12
+ "main": "./dist/index.js",
13
+ "module": "./dist/index.mjs",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "require": "./dist/index.js",
18
+ "import": "./dist/index.mjs"
19
+ }
20
+ },
21
+ "dependencies": {
22
+ "custom-factory": "^3.0.0",
23
+ "lodash-es": "^4.17.22",
24
+ "@isdk/web-fetcher": "^0.2.12"
25
+ },
26
+ "devDependencies": {
27
+ "@antfu/eslint-config": "^7.0.1",
28
+ "@fastify/cookie": "^11.0.2",
29
+ "@fastify/formbody": "^8.0.2",
30
+ "@types/jest": "^30.0.0",
31
+ "@types/jsdom": "^27.0.0",
32
+ "@types/lodash-es": "^4.17.12",
33
+ "@typescript-eslint/eslint-plugin": "~8.53.0",
34
+ "eslint": "^9.39.2",
35
+ "eslint-config-prettier": "^10.1.8",
36
+ "eslint-plugin-tsdoc": "^0.5.0",
37
+ "fastify": "^5.7.1",
38
+ "prettier": "^3.8.0",
39
+ "terser": "^5.46.0",
40
+ "tsup": "^8.5.1",
41
+ "tsx": "^4.21.0",
42
+ "type-fest": "^5.4.1",
43
+ "typedoc": "^0.28.16",
44
+ "typedoc-plugin-markdown": "^4.9.0",
45
+ "typescript": "~5.7.3",
46
+ "vite": "^7.3.1",
47
+ "vite-tsconfig-paths": "^6.0.4",
48
+ "vitest": "^4.0.17",
49
+ "vitest-fetch-mock": "^0.4.5"
50
+ },
51
+ "files": [
52
+ "docs",
53
+ "dist"
54
+ ],
55
+ "keywords": [
56
+ "web",
57
+ "fetch",
58
+ "crawler",
59
+ "spider",
60
+ "structure",
61
+ "data"
62
+ ],
63
+ "maintainers": [
64
+ "Riceball LEE <snowyu.lee@gmail.com>"
65
+ ],
66
+ "engines": {
67
+ "node": ">=20.11.1"
68
+ },
69
+ "types": "./dist/index.d.ts",
70
+ "scripts": {
71
+ "build-fast": "tsup",
72
+ "build": "pnpm run build-fast --dts-resolve --dts && pnpm run doc:md",
73
+ "clean": "rm -fr web docs dist",
74
+ "doc": "typedoc --plugin none --out web",
75
+ "doc:md": "typedoc --plugin typedoc-plugin-markdown --out docs",
76
+ "style": "pnpm run format:base -c && pnpm run lint",
77
+ "style:fix": "pnpm run format:fix && npm run lint:fix",
78
+ "format": "pnpm run format:base -c",
79
+ "format:base": "prettier \"src/**/*.{ts,tsx,js,jsx,css,scss,sass,less,md}\"",
80
+ "format:fix": "pnpm run format:base --write",
81
+ "lint": "eslint .",
82
+ "lint:fix": "pnpm run lint --fix",
83
+ "test": "vitest run",
84
+ "release": "pnpm run clean && pnpm run build && git add -f docs && git ci -m 'docs: update API docs' && pnpm dlx commit-and-tag-version -s",
85
+ "release.alpha": "pnpm run release -- --prerelease alpha"
86
+ }
87
+ }