@xcrap/got-scraping-client 0.0.5 → 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.
- package/README.md +5 -5
- package/dist/index.d.ts +3 -2
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
There are no secrets to installing it, just use your favorite dependency manager. Here is an example using NPM:
|
|
8
8
|
|
|
9
9
|
```cmd
|
|
10
|
-
npm i @xcrap/got-scraping-client @xcrap/core @xcrap/
|
|
10
|
+
npm i @xcrap/got-scraping-client @xcrap/core @xcrap/extractor
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
> You need to install `@xcrap/
|
|
13
|
+
> You need to install `@xcrap/extractor` and `@xcrap/core` as well because I left them as `peerDependencies`, which means that the package needs `@xcrap/extractor` and `@xcrap/core` as dependencies, however, the ones that the user has installed in the project will be used.
|
|
14
14
|
|
|
15
15
|
## 🚀 Usage
|
|
16
16
|
|
|
@@ -18,14 +18,14 @@ Like any HTTP client, `GotScrapingClient` has two methods: `fetch()` to make a r
|
|
|
18
18
|
|
|
19
19
|
```ts
|
|
20
20
|
import { GotScrapingClient } from "@xcrap/got-scraping-client"
|
|
21
|
-
import { extract } from "@xcrap/
|
|
21
|
+
import { extract, css } from "@xcrap/extractor"
|
|
22
22
|
|
|
23
23
|
;(async() => {
|
|
24
24
|
const client = new GotScrapingClient()
|
|
25
25
|
const url = "https://example.com"
|
|
26
26
|
const response = await client.fetch({ url: url })
|
|
27
27
|
const parser = response.asHtmlParser()
|
|
28
|
-
const pageTitle = await parser.
|
|
28
|
+
const pageTitle = await parser.extractValue({ query: css("title"), extractor: extract("innerText") })
|
|
29
29
|
|
|
30
30
|
console.log("Page Title:", pageTitle)
|
|
31
31
|
})();
|
|
@@ -124,4 +124,4 @@ const client = new GotScrapingClient({ proxyUrl: randomProxyUrl })
|
|
|
124
124
|
|
|
125
125
|
## 📝 License
|
|
126
126
|
|
|
127
|
-
This project is licensed under the MIT License.
|
|
127
|
+
This project is licensed under the MIT License.
|
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,11 @@ import { ExtendedExtendOptions, GotScraping } from "got-scraping";
|
|
|
3
3
|
export type GotScrapingProxy = string;
|
|
4
4
|
export type GotScrapingRequestOptions = ClientRequestOptions & ExtendedExtendOptions;
|
|
5
5
|
export type GotScrapingFetchManyOptions = ClientFetchManyOptions<GotScrapingRequestOptions>;
|
|
6
|
-
export
|
|
6
|
+
export interface GotScrapingClientOptions extends BaseClientOptions<GotScrapingProxy>, Omit<ExtendedExtendOptions, "proxyUrl"> {
|
|
7
|
+
}
|
|
7
8
|
export declare class GotScrapingClient extends BaseClient<GotScrapingProxy> implements ClientInterface {
|
|
8
|
-
readonly options: GotScrapingClientOptions;
|
|
9
9
|
protected gotScrapingInstance: GotScraping | undefined;
|
|
10
|
+
protected readonly options: GotScrapingClientOptions;
|
|
10
11
|
constructor(options?: GotScrapingClientOptions);
|
|
11
12
|
protected initGotScraping(): Promise<void>;
|
|
12
13
|
protected ensureGotScraping(): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xcrap/got-scraping-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Xcrap Got Scraping Client is a package of the Xcrap framework that implements an HTTP client using the Got Scraping library.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"type": "commonjs",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@types/node": "^
|
|
27
|
-
"header-generator": "^2.1.
|
|
26
|
+
"@types/node": "^25.2.3",
|
|
27
|
+
"header-generator": "^2.1.80",
|
|
28
28
|
"ts-node": "^10.9.2",
|
|
29
|
-
"typescript": "^5.
|
|
29
|
+
"typescript": "^5.9.3"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"got-scraping": "^4.1.
|
|
33
|
-
"load-esm": "^1.0.
|
|
32
|
+
"got-scraping": "^4.1.3",
|
|
33
|
+
"load-esm": "^1.0.3"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@xcrap/core": "
|
|
37
|
-
"@xcrap/
|
|
36
|
+
"@xcrap/core": "^0.2.3",
|
|
37
|
+
"@xcrap/extractor": "^0.3.1"
|
|
38
38
|
},
|
|
39
39
|
"repository": {
|
|
40
40
|
"type": "git",
|