@crawlee/utils 3.17.1-beta.5 → 3.17.1-beta.51
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
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
|
|
@@ -258,32 +258,32 @@ const OPEN_GRAPH_PROPERTIES = [
|
|
|
258
258
|
outputName: 'articleInfo',
|
|
259
259
|
children: [
|
|
260
260
|
{
|
|
261
|
-
name: '
|
|
261
|
+
name: 'article:published_time',
|
|
262
262
|
outputName: 'publishedTime',
|
|
263
263
|
children: [],
|
|
264
264
|
},
|
|
265
265
|
{
|
|
266
|
-
name: '
|
|
266
|
+
name: 'article:modified_time',
|
|
267
267
|
outputName: 'modifiedTime',
|
|
268
268
|
children: [],
|
|
269
269
|
},
|
|
270
270
|
{
|
|
271
|
-
name: '
|
|
271
|
+
name: 'article:expiration_time',
|
|
272
272
|
outputName: 'expirationTime',
|
|
273
273
|
children: [],
|
|
274
274
|
},
|
|
275
275
|
{
|
|
276
|
-
name: '
|
|
276
|
+
name: 'article:author',
|
|
277
277
|
outputName: 'author',
|
|
278
278
|
children: [],
|
|
279
279
|
},
|
|
280
280
|
{
|
|
281
|
-
name: '
|
|
281
|
+
name: 'article:section',
|
|
282
282
|
outputName: 'section',
|
|
283
283
|
children: [],
|
|
284
284
|
},
|
|
285
285
|
{
|
|
286
|
-
name: '
|
|
286
|
+
name: 'article:tag',
|
|
287
287
|
outputName: 'tag',
|
|
288
288
|
children: [],
|
|
289
289
|
},
|
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.51",
|
|
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.51",
|
|
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": "5185ab2c00a7fce4eaecb7e16c172b6077779a64"
|
|
74
74
|
}
|