@crawlee/utils 4.0.0-beta.87 → 4.0.0-beta.88
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/index.d.ts +0 -1
- package/index.js +0 -1
- package/internals/general.d.ts +0 -5
- package/internals/general.js +0 -13
- package/internals/robots.d.ts +0 -1
- package/internals/robots.js +0 -2
- package/internals/sitemap.js +2 -2
- package/package.json +4 -4
- package/internals/chunk.d.ts +0 -1
- package/internals/chunk.js +0 -39
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/internals/general.d.ts
CHANGED
|
@@ -30,11 +30,6 @@ export declare function weightedAvg(arrValues: number[], arrWeights: number[]):
|
|
|
30
30
|
* @param millis Period of time to sleep, in milliseconds. If not a positive number, the returned promise resolves immediately.
|
|
31
31
|
*/
|
|
32
32
|
export declare function sleep(millis?: number): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Converts SNAKE_CASE to camelCase.
|
|
35
|
-
* @ignore
|
|
36
|
-
*/
|
|
37
|
-
export declare function snakeCaseToCamelCase(snakeCaseStr: string): string;
|
|
38
33
|
/**
|
|
39
34
|
* Traverses DOM and expands shadow-root elements (created by custom components).
|
|
40
35
|
* @ignore
|
package/internals/general.js
CHANGED
|
@@ -42,19 +42,6 @@ export function weightedAvg(arrValues, arrWeights) {
|
|
|
42
42
|
export async function sleep(millis) {
|
|
43
43
|
return setTimeout(millis ?? undefined);
|
|
44
44
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Converts SNAKE_CASE to camelCase.
|
|
47
|
-
* @ignore
|
|
48
|
-
*/
|
|
49
|
-
export function snakeCaseToCamelCase(snakeCaseStr) {
|
|
50
|
-
return snakeCaseStr
|
|
51
|
-
.toLowerCase()
|
|
52
|
-
.split('_')
|
|
53
|
-
.map((part, index) => {
|
|
54
|
-
return index > 0 ? part.charAt(0).toUpperCase() + part.slice(1) : part;
|
|
55
|
-
})
|
|
56
|
-
.join('');
|
|
57
|
-
}
|
|
58
45
|
/**
|
|
59
46
|
* Traverses DOM and expands shadow-root elements (created by custom components).
|
|
60
47
|
* @ignore
|
package/internals/robots.d.ts
CHANGED
package/internals/robots.js
CHANGED
package/internals/sitemap.js
CHANGED
|
@@ -7,7 +7,7 @@ import { fileTypeStream } from 'file-type';
|
|
|
7
7
|
import sax from 'sax';
|
|
8
8
|
import MIMEType from 'whatwg-mimetype';
|
|
9
9
|
import { mergeAsyncIterables } from './iterables.js';
|
|
10
|
-
import {
|
|
10
|
+
import { RobotsTxtFile } from './robots.js';
|
|
11
11
|
class SitemapTxtParser extends Transform {
|
|
12
12
|
decoder = new StringDecoder('utf8');
|
|
13
13
|
buffer = '';
|
|
@@ -367,7 +367,7 @@ export async function* discoverValidSitemaps(urls, options = {}) {
|
|
|
367
367
|
return;
|
|
368
368
|
}
|
|
369
369
|
try {
|
|
370
|
-
const robotsFile = await
|
|
370
|
+
const robotsFile = await RobotsTxtFile.find(domainUrls[0], {
|
|
371
371
|
proxyUrl,
|
|
372
372
|
timeoutMillis: requestTimeoutMillis,
|
|
373
373
|
signal,
|
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.88",
|
|
4
4
|
"description": "A set of shared utilities that can be used by crawlers",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.0.0"
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@apify/ps-tree": "^1.2.0",
|
|
45
|
-
"@crawlee/http-client": "4.0.0-beta.
|
|
46
|
-
"@crawlee/types": "4.0.0-beta.
|
|
45
|
+
"@crawlee/http-client": "4.0.0-beta.88",
|
|
46
|
+
"@crawlee/types": "4.0.0-beta.88",
|
|
47
47
|
"@types/sax": "^1.2.7",
|
|
48
48
|
"cheerio": "^1.0.0",
|
|
49
49
|
"domhandler": "^5.0.3",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "4f7d17669d59250cf802591e73498793de28967d"
|
|
65
65
|
}
|
package/internals/chunk.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function chunk<T>(array: readonly T[], chunkSize: number): T[][];
|
package/internals/chunk.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
The MIT License (MIT)
|
|
3
|
-
|
|
4
|
-
Copyright © `2020` `The Sapphire Community and its contributors`
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person
|
|
7
|
-
obtaining a copy of this software and associated documentation
|
|
8
|
-
files (the “Software”), to deal in the Software without
|
|
9
|
-
restriction, including without limitation the rights to use,
|
|
10
|
-
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
copies of the Software, and to permit persons to whom the
|
|
12
|
-
Software is furnished to do so, subject to the following
|
|
13
|
-
conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice shall be
|
|
16
|
-
included in all copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
20
|
-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
22
|
-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
23
|
-
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
24
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
25
|
-
OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
-
*/
|
|
27
|
-
export function chunk(array, chunkSize) {
|
|
28
|
-
if (!Array.isArray(array))
|
|
29
|
-
throw new TypeError('entries must be an array.');
|
|
30
|
-
if (!Number.isInteger(chunkSize))
|
|
31
|
-
throw new TypeError('chunkSize must be an integer.');
|
|
32
|
-
if (chunkSize < 1)
|
|
33
|
-
throw new RangeError('chunkSize must be 1 or greater.');
|
|
34
|
-
const clone = array.slice();
|
|
35
|
-
const chunks = [];
|
|
36
|
-
while (clone.length)
|
|
37
|
-
chunks.push(clone.splice(0, chunkSize));
|
|
38
|
-
return chunks;
|
|
39
|
-
}
|