@crawlee/utils 4.0.0-beta.256 → 4.0.0-beta.257
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/sitemap.js +7 -17
- package/package.json +4 -4
package/internals/sitemap.js
CHANGED
|
@@ -24,23 +24,13 @@ class SitemapTxtParser extends Transform {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
#processBuffer(input, finalize) {
|
|
27
|
-
this.#buffer
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
for (const url of parts) {
|
|
35
|
-
this.push({ type: 'url', loc: url });
|
|
36
|
-
}
|
|
37
|
-
this.#buffer = '';
|
|
38
|
-
}
|
|
39
|
-
else if (parts.length > 0) {
|
|
40
|
-
for (const url of parts.slice(0, -1)) {
|
|
41
|
-
this.push({ type: 'url', loc: url });
|
|
42
|
-
}
|
|
43
|
-
this.#buffer = parts.at(-1);
|
|
27
|
+
const lines = (this.#buffer + input).split('\n');
|
|
28
|
+
// The text after the last line break may be a partial line, so it waits for the next chunk.
|
|
29
|
+
this.#buffer = finalize ? '' : lines.pop();
|
|
30
|
+
for (const line of lines) {
|
|
31
|
+
const url = line.trim();
|
|
32
|
+
if (url.length > 0) {
|
|
33
|
+
this.push({ type: 'url', loc: url });
|
|
44
34
|
}
|
|
45
35
|
}
|
|
46
36
|
}
|
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.257",
|
|
4
4
|
"description": "A set of shared utilities that can be used by crawlers",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.13.0"
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@apify/validations": "^1.1.2",
|
|
46
|
-
"@crawlee/http-client": "4.0.0-beta.
|
|
47
|
-
"@crawlee/types": "4.0.0-beta.
|
|
46
|
+
"@crawlee/http-client": "4.0.0-beta.257",
|
|
47
|
+
"@crawlee/types": "4.0.0-beta.257",
|
|
48
48
|
"@types/sax": "^1.2.7",
|
|
49
49
|
"cheerio": "^1.2.0",
|
|
50
50
|
"domhandler": "^6.0.1",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "d8f0dc1eb055b27aa07827a505c8f5a0aaaa5abd"
|
|
67
67
|
}
|