@crawlee/utils 4.0.0-beta.111 → 4.0.0-beta.112
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/internals/robots.d.ts +5 -0
- package/internals/robots.js +10 -0
- package/package.json +4 -4
package/internals/robots.d.ts
CHANGED
|
@@ -44,6 +44,11 @@ export declare class RobotsTxtFile {
|
|
|
44
44
|
*/
|
|
45
45
|
static from(url: string, content: string, proxyUrl?: string): RobotsTxtFile;
|
|
46
46
|
private static load;
|
|
47
|
+
/**
|
|
48
|
+
* Get crawl delay for a given user agent.
|
|
49
|
+
* @param [userAgent] relevant user agent, default to `*`
|
|
50
|
+
*/
|
|
51
|
+
getCrawlDelay(userAgent?: string): number | undefined;
|
|
47
52
|
/**
|
|
48
53
|
* Check if a URL should be crawled by robots.
|
|
49
54
|
* @param url the URL to check against the rules in robots.txt
|
package/internals/robots.js
CHANGED
|
@@ -70,11 +70,21 @@ export class RobotsTxtFile {
|
|
|
70
70
|
getSitemaps() {
|
|
71
71
|
return [];
|
|
72
72
|
},
|
|
73
|
+
getCrawlDelay() {
|
|
74
|
+
return undefined;
|
|
75
|
+
},
|
|
73
76
|
}, proxyUrl, logger);
|
|
74
77
|
}
|
|
75
78
|
// @ts-ignore
|
|
76
79
|
return new RobotsTxtFile(robotsParser(url.toString(), await response.text()), proxyUrl, logger);
|
|
77
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Get crawl delay for a given user agent.
|
|
83
|
+
* @param [userAgent] relevant user agent, default to `*`
|
|
84
|
+
*/
|
|
85
|
+
getCrawlDelay(userAgent = '*') {
|
|
86
|
+
return this.#robots.getCrawlDelay(userAgent);
|
|
87
|
+
}
|
|
78
88
|
/**
|
|
79
89
|
* Check if a URL should be crawled by robots.
|
|
80
90
|
* @param url the URL to check against the rules in robots.txt
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/utils",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.112",
|
|
4
4
|
"description": "A set of shared utilities that can be used by crawlers",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.0.0"
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@apify/ps-tree": "^1.2.0",
|
|
46
|
-
"@crawlee/http-client": "4.0.0-beta.
|
|
47
|
-
"@crawlee/types": "4.0.0-beta.
|
|
46
|
+
"@crawlee/http-client": "4.0.0-beta.112",
|
|
47
|
+
"@crawlee/types": "4.0.0-beta.112",
|
|
48
48
|
"@types/sax": "^1.2.7",
|
|
49
49
|
"cheerio": "^1.0.0",
|
|
50
50
|
"domhandler": "^5.0.3",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "5d1e107d4dc4ffd21f1c6cc5b1a1c10b59ca2b47"
|
|
66
66
|
}
|