@crawlee/utils 3.17.1-beta.32 → 3.17.1-beta.34
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/general.js +2 -2
- package/internals/sitemap.js +8 -3
- package/package.json +3 -3
package/internals/general.js
CHANGED
|
@@ -16,12 +16,12 @@ const promises_2 = require("node:timers/promises");
|
|
|
16
16
|
* Default regular expression to match URLs in a string that may be plain text, JSON, CSV or other. It supports common URL characters
|
|
17
17
|
* and does not support URLs containing commas or spaces. The URLs also may contain Unicode letters (not symbols).
|
|
18
18
|
*/
|
|
19
|
-
exports.URL_NO_COMMAS_REGEX = /https?:\/\/(www\.)?([\p{L}0-9]|[\p{L}0-9][-\p{L}0-9@:%._+~#=]{0,254}[\p{L}0-9])\.[a-z]{2,63}(:\d{1,5})?(\/[-\p{L}0-9@:%_+.~#?&/=()]*)?/giu;
|
|
19
|
+
exports.URL_NO_COMMAS_REGEX = /https?:\/\/(www\.)?([\p{L}0-9]|[\p{L}0-9][-\p{L}0-9@:%._+~#=]{0,254}[\p{L}0-9])\.[a-z]{2,63}(:\d{1,5})?(\/[-\p{L}0-9@:%_+.~#?&/=()'*]*)?/giu;
|
|
20
20
|
/**
|
|
21
21
|
* Regular expression that, in addition to the default regular expression `URL_NO_COMMAS_REGEX`, supports matching commas in URL path and query.
|
|
22
22
|
* Note, however, that this may prevent parsing URLs from comma delimited lists, or the URLs may become malformed.
|
|
23
23
|
*/
|
|
24
|
-
exports.URL_WITH_COMMAS_REGEX = /https?:\/\/(www\.)?([\p{L}0-9]|[\p{L}0-9][-\p{L}0-9@:%._+~#=]{0,254}[\p{L}0-9])\.[a-z]{2,63}(:\d{1,5})?(\/[-\p{L}0-9@:%_+,.~#?&/=()]*)?/giu;
|
|
24
|
+
exports.URL_WITH_COMMAS_REGEX = /https?:\/\/(www\.)?([\p{L}0-9]|[\p{L}0-9][-\p{L}0-9@:%._+~#=]{0,254}[\p{L}0-9])\.[a-z]{2,63}(:\d{1,5})?(\/[-\p{L}0-9@:%_+,.~#?&/=()'*]*)?/giu;
|
|
25
25
|
let isDockerPromiseCache;
|
|
26
26
|
async function createIsDockerPromise() {
|
|
27
27
|
const promise1 = promises_1.default
|
package/internals/sitemap.js
CHANGED
|
@@ -134,8 +134,10 @@ class SitemapXmlParser extends node_stream_1.Transform {
|
|
|
134
134
|
if (name === 'loc' || name === 'lastmod' || name === 'priority' || name === 'changefreq') {
|
|
135
135
|
this.currentTag = undefined;
|
|
136
136
|
}
|
|
137
|
-
if (name === 'url'
|
|
138
|
-
|
|
137
|
+
if (name === 'url') {
|
|
138
|
+
if (this.url.loc !== undefined) {
|
|
139
|
+
this.push({ type: 'url', ...this.url, loc: this.url.loc });
|
|
140
|
+
}
|
|
139
141
|
this.url = {};
|
|
140
142
|
}
|
|
141
143
|
}
|
|
@@ -151,7 +153,10 @@ class SitemapXmlParser extends node_stream_1.Transform {
|
|
|
151
153
|
}
|
|
152
154
|
text = text.trim();
|
|
153
155
|
if (this.currentTag === 'lastmod') {
|
|
154
|
-
|
|
156
|
+
const lastmod = new Date(text);
|
|
157
|
+
if (!Number.isNaN(lastmod.getTime())) {
|
|
158
|
+
this.url.lastmod = lastmod;
|
|
159
|
+
}
|
|
155
160
|
}
|
|
156
161
|
if (this.currentTag === 'priority') {
|
|
157
162
|
this.url.priority = Number(text);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/utils",
|
|
3
|
-
"version": "3.17.1-beta.
|
|
3
|
+
"version": "3.17.1-beta.34",
|
|
4
4
|
"description": "A set of shared utilities that can be used by crawlers",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.0.0"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@apify/log": "^2.4.0",
|
|
51
51
|
"@apify/ps-tree": "^1.2.0",
|
|
52
|
-
"@crawlee/types": "3.17.1-beta.
|
|
52
|
+
"@crawlee/types": "3.17.1-beta.34",
|
|
53
53
|
"@types/sax": "^1.2.7",
|
|
54
54
|
"cheerio": "1.0.0-rc.12",
|
|
55
55
|
"file-type": "^21.3.1",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "bac9190dce2ecb2ab994c749839c7a89d3c6ac3d"
|
|
74
74
|
}
|