@crawlee/core 4.0.0-beta.187 → 4.0.0-beta.189
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/package.json +6 -6
- package/proxy_configuration.d.ts +7 -13
- package/proxy_configuration.js +6 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/core",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.189",
|
|
4
4
|
"description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.0.0"
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"@apify/log": "^3.0.1",
|
|
54
54
|
"@apify/timeout": "^1.0.1",
|
|
55
55
|
"@apify/utilities": "^3.0.1",
|
|
56
|
-
"@crawlee/fs-storage": "4.0.0-beta.
|
|
57
|
-
"@crawlee/http-client": "4.0.0-beta.
|
|
58
|
-
"@crawlee/types": "4.0.0-beta.
|
|
59
|
-
"@crawlee/utils": "4.0.0-beta.
|
|
56
|
+
"@crawlee/fs-storage": "4.0.0-beta.189",
|
|
57
|
+
"@crawlee/http-client": "4.0.0-beta.189",
|
|
58
|
+
"@crawlee/types": "4.0.0-beta.189",
|
|
59
|
+
"@crawlee/utils": "4.0.0-beta.189",
|
|
60
60
|
"@sapphire/async-queue": "^1.5.5",
|
|
61
61
|
"@standard-schema/spec": "^1.0.0",
|
|
62
62
|
"@vladfrangu/async_event_emitter": "^2.4.6",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "1dbb0f272b9da9c7a6bf3bdc1ae48f84eda3f21c"
|
|
80
80
|
}
|
package/proxy_configuration.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { ProxyInfo } from '@crawlee/types';
|
|
2
|
-
import type { Request } from './request.js';
|
|
3
2
|
export interface ProxyConfigurationFunction {
|
|
4
|
-
(
|
|
5
|
-
request?: Request;
|
|
6
|
-
}): string | null | Promise<string | null>;
|
|
3
|
+
(): string | null | Promise<string | null>;
|
|
7
4
|
}
|
|
8
5
|
type UrlList = (string | null)[];
|
|
9
6
|
export interface ProxyConfigurationOptions {
|
|
@@ -14,16 +11,13 @@ export interface ProxyConfigurationOptions {
|
|
|
14
11
|
*/
|
|
15
12
|
proxyUrls?: UrlList;
|
|
16
13
|
/**
|
|
17
|
-
* Custom function that allows you to generate the new proxy URL dynamically.
|
|
14
|
+
* Custom function that allows you to generate the new proxy URL dynamically.
|
|
18
15
|
* Can return either stringified proxy URL or `null` if the proxy should not be used. Can be asynchronous.
|
|
19
16
|
*
|
|
20
17
|
* This function is used to generate the URL when {@link ProxyConfiguration.newUrl} or {@link ProxyConfiguration.newProxyInfo} is called.
|
|
21
18
|
*/
|
|
22
19
|
newUrlFunction?: ProxyConfigurationFunction;
|
|
23
20
|
}
|
|
24
|
-
interface NewUrlOptions {
|
|
25
|
-
request?: Request;
|
|
26
|
-
}
|
|
27
21
|
/**
|
|
28
22
|
* Minimal contract that any object passed to a crawler as its `proxyConfiguration`
|
|
29
23
|
* option must satisfy.
|
|
@@ -36,10 +30,10 @@ interface NewUrlOptions {
|
|
|
36
30
|
*/
|
|
37
31
|
export interface IProxyConfiguration {
|
|
38
32
|
/**
|
|
39
|
-
* Creates a new {@link ProxyInfo} object describing the proxy to use
|
|
40
|
-
*
|
|
33
|
+
* Creates a new {@link ProxyInfo} object describing the proxy to use.
|
|
34
|
+
* Returns `undefined` when no proxy should be used.
|
|
41
35
|
*/
|
|
42
|
-
newProxyInfo(
|
|
36
|
+
newProxyInfo(): Promise<ProxyInfo | undefined>;
|
|
43
37
|
}
|
|
44
38
|
/**
|
|
45
39
|
* Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking
|
|
@@ -102,14 +96,14 @@ export declare class ProxyConfiguration implements IProxyConfiguration {
|
|
|
102
96
|
*
|
|
103
97
|
* @return Represents information about used proxy and its configuration.
|
|
104
98
|
*/
|
|
105
|
-
newProxyInfo(
|
|
99
|
+
newProxyInfo(): Promise<ProxyInfo | undefined>;
|
|
106
100
|
/**
|
|
107
101
|
* Returns a new proxy URL based on provided configuration options.
|
|
108
102
|
*
|
|
109
103
|
* @return A string with a proxy URL, including authentication credentials and port number.
|
|
110
104
|
* For example, `http://bob:password123@proxy.example.com:8000`
|
|
111
105
|
*/
|
|
112
|
-
newUrl(
|
|
106
|
+
newUrl(): Promise<string | undefined>;
|
|
113
107
|
private handleProxyUrlsList;
|
|
114
108
|
/**
|
|
115
109
|
* Calls the custom newUrlFunction and checks format of its return value
|
package/proxy_configuration.js
CHANGED
|
@@ -83,8 +83,8 @@ export class ProxyConfiguration {
|
|
|
83
83
|
*
|
|
84
84
|
* @return Represents information about used proxy and its configuration.
|
|
85
85
|
*/
|
|
86
|
-
async newProxyInfo(
|
|
87
|
-
const url = await this.newUrl(
|
|
86
|
+
async newProxyInfo() {
|
|
87
|
+
const url = await this.newUrl();
|
|
88
88
|
if (!url)
|
|
89
89
|
return undefined;
|
|
90
90
|
const { username, password, port, hostname } = new URL(url);
|
|
@@ -102,9 +102,9 @@ export class ProxyConfiguration {
|
|
|
102
102
|
* @return A string with a proxy URL, including authentication credentials and port number.
|
|
103
103
|
* For example, `http://bob:password123@proxy.example.com:8000`
|
|
104
104
|
*/
|
|
105
|
-
async newUrl(
|
|
105
|
+
async newUrl() {
|
|
106
106
|
if (this.#newUrlFunction) {
|
|
107
|
-
return (await this.callNewUrlFunction(
|
|
107
|
+
return (await this.callNewUrlFunction()) ?? undefined;
|
|
108
108
|
}
|
|
109
109
|
return this.handleProxyUrlsList() ?? undefined;
|
|
110
110
|
}
|
|
@@ -114,8 +114,8 @@ export class ProxyConfiguration {
|
|
|
114
114
|
/**
|
|
115
115
|
* Calls the custom newUrlFunction and checks format of its return value
|
|
116
116
|
*/
|
|
117
|
-
async callNewUrlFunction(
|
|
118
|
-
const proxyUrl = await this.#newUrlFunction(
|
|
117
|
+
async callNewUrlFunction() {
|
|
118
|
+
const proxyUrl = await this.#newUrlFunction();
|
|
119
119
|
try {
|
|
120
120
|
if (proxyUrl) {
|
|
121
121
|
new URL(proxyUrl); // eslint-disable-line no-new
|