@crawlee/cheerio 3.0.3-beta.11 → 3.0.3-beta.14
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 +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/index.mjs +2 -0
- package/internals/cheerio-crawler.d.ts +17 -323
- package/internals/cheerio-crawler.d.ts.map +1 -1
- package/internals/cheerio-crawler.js +25 -504
- package/internals/cheerio-crawler.js.map +1 -1
- package/package.json +4 -9
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -2,34 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createCheerioRouter = exports.cheerioCrawlerEnqueueLinks = exports.CheerioCrawler = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const utilities_1 = require("@apify/utilities");
|
|
7
|
-
const basic_1 = require("@crawlee/basic");
|
|
8
|
-
const core_1 = require("@crawlee/core");
|
|
9
|
-
const utils_1 = require("@crawlee/utils");
|
|
5
|
+
const http_1 = require("@crawlee/http");
|
|
10
6
|
const cheerio = tslib_1.__importStar(require("cheerio"));
|
|
11
|
-
const content_type_1 = tslib_1.__importDefault(require("content-type"));
|
|
12
|
-
const got_scraping_1 = require("got-scraping");
|
|
13
7
|
const htmlparser2_1 = require("htmlparser2");
|
|
14
8
|
const WritableStream_1 = require("htmlparser2/lib/WritableStream");
|
|
15
|
-
const iconv_lite_1 = tslib_1.__importDefault(require("iconv-lite"));
|
|
16
|
-
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
17
|
-
const util_1 = tslib_1.__importDefault(require("util"));
|
|
18
|
-
/**
|
|
19
|
-
* Default mime types, which CheerioScraper supports.
|
|
20
|
-
*/
|
|
21
|
-
const HTML_AND_XML_MIME_TYPES = ['text/html', 'text/xml', 'application/xhtml+xml', 'application/xml'];
|
|
22
|
-
const APPLICATION_JSON_MIME_TYPE = 'application/json';
|
|
23
|
-
const CHEERIO_OPTIMIZED_AUTOSCALED_POOL_OPTIONS = {
|
|
24
|
-
desiredConcurrency: 10,
|
|
25
|
-
snapshotterOptions: {
|
|
26
|
-
eventLoopSnapshotIntervalSecs: 2,
|
|
27
|
-
maxBlockedMillis: 100,
|
|
28
|
-
},
|
|
29
|
-
systemStatusOptions: {
|
|
30
|
-
maxEventLoopOverloadedRatio: 0.7,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
9
|
/**
|
|
34
10
|
* Provides a framework for the parallel crawling of web pages using plain HTTP requests and
|
|
35
11
|
* [cheerio](https://www.npmjs.com/package/cheerio) HTML parser.
|
|
@@ -71,7 +47,7 @@ const CHEERIO_OPTIMIZED_AUTOSCALED_POOL_OPTIONS = {
|
|
|
71
47
|
* and skips pages with other content types. If you want the crawler to process other content types,
|
|
72
48
|
* use the {@apilink CheerioCrawlerOptions.additionalMimeTypes} constructor option.
|
|
73
49
|
* Beware that the parsing behavior differs for HTML, XML, JSON and other types of content.
|
|
74
|
-
* For details, see {@apilink CheerioCrawlerOptions.requestHandler}.
|
|
50
|
+
* For more details, see {@apilink CheerioCrawlerOptions.requestHandler}.
|
|
75
51
|
*
|
|
76
52
|
* New requests are only dispatched when there is enough free CPU and memory available,
|
|
77
53
|
* using the functionality provided by the {@apilink AutoscaledPool} class.
|
|
@@ -107,209 +83,30 @@ const CHEERIO_OPTIMIZED_AUTOSCALED_POOL_OPTIONS = {
|
|
|
107
83
|
* ```
|
|
108
84
|
* @category Crawlers
|
|
109
85
|
*/
|
|
110
|
-
class CheerioCrawler extends
|
|
86
|
+
class CheerioCrawler extends http_1.HttpCrawler {
|
|
111
87
|
/**
|
|
112
88
|
* All `CheerioCrawler` parameters are passed via an options object.
|
|
113
89
|
*/
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
// but not too much so that we would stall the crawler.
|
|
127
|
-
requestHandlerTimeoutSecs: navigationTimeoutSecs + requestHandlerTimeoutSecs + basic_1.BASIC_CRAWLER_TIMEOUT_BUFFER_SECS,
|
|
128
|
-
}, config);
|
|
129
|
-
Object.defineProperty(this, "config", {
|
|
130
|
-
enumerable: true,
|
|
131
|
-
configurable: true,
|
|
132
|
-
writable: true,
|
|
133
|
-
value: config
|
|
134
|
-
});
|
|
135
|
-
/**
|
|
136
|
-
* A reference to the underlying {@apilink ProxyConfiguration} class that manages the crawler's proxies.
|
|
137
|
-
* Only available if used by the crawler.
|
|
138
|
-
*/
|
|
139
|
-
Object.defineProperty(this, "proxyConfiguration", {
|
|
140
|
-
enumerable: true,
|
|
141
|
-
configurable: true,
|
|
142
|
-
writable: true,
|
|
143
|
-
value: void 0
|
|
144
|
-
});
|
|
145
|
-
Object.defineProperty(this, "userRequestHandlerTimeoutMillis", {
|
|
146
|
-
enumerable: true,
|
|
147
|
-
configurable: true,
|
|
148
|
-
writable: true,
|
|
149
|
-
value: void 0
|
|
150
|
-
});
|
|
151
|
-
Object.defineProperty(this, "preNavigationHooks", {
|
|
152
|
-
enumerable: true,
|
|
153
|
-
configurable: true,
|
|
154
|
-
writable: true,
|
|
155
|
-
value: void 0
|
|
156
|
-
});
|
|
157
|
-
Object.defineProperty(this, "postNavigationHooks", {
|
|
158
|
-
enumerable: true,
|
|
159
|
-
configurable: true,
|
|
160
|
-
writable: true,
|
|
161
|
-
value: void 0
|
|
162
|
-
});
|
|
163
|
-
Object.defineProperty(this, "persistCookiesPerSession", {
|
|
164
|
-
enumerable: true,
|
|
165
|
-
configurable: true,
|
|
166
|
-
writable: true,
|
|
167
|
-
value: void 0
|
|
168
|
-
});
|
|
169
|
-
Object.defineProperty(this, "navigationTimeoutMillis", {
|
|
170
|
-
enumerable: true,
|
|
171
|
-
configurable: true,
|
|
172
|
-
writable: true,
|
|
173
|
-
value: void 0
|
|
174
|
-
});
|
|
175
|
-
Object.defineProperty(this, "ignoreSslErrors", {
|
|
176
|
-
enumerable: true,
|
|
177
|
-
configurable: true,
|
|
178
|
-
writable: true,
|
|
179
|
-
value: void 0
|
|
180
|
-
});
|
|
181
|
-
Object.defineProperty(this, "suggestResponseEncoding", {
|
|
182
|
-
enumerable: true,
|
|
183
|
-
configurable: true,
|
|
184
|
-
writable: true,
|
|
185
|
-
value: void 0
|
|
186
|
-
});
|
|
187
|
-
Object.defineProperty(this, "forceResponseEncoding", {
|
|
188
|
-
enumerable: true,
|
|
189
|
-
configurable: true,
|
|
190
|
-
writable: true,
|
|
191
|
-
value: void 0
|
|
192
|
-
});
|
|
193
|
-
Object.defineProperty(this, "supportedMimeTypes", {
|
|
194
|
-
enumerable: true,
|
|
195
|
-
configurable: true,
|
|
196
|
-
writable: true,
|
|
197
|
-
value: void 0
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
91
|
+
constructor(options, config) {
|
|
92
|
+
super(options, config);
|
|
93
|
+
}
|
|
94
|
+
async _parseHTML(response, isXml, crawlingContext) {
|
|
95
|
+
const dom = await this._parseHtmlToDom(response);
|
|
96
|
+
const $ = cheerio.load(dom, {
|
|
97
|
+
xmlMode: isXml,
|
|
98
|
+
// Recent versions of cheerio use parse5 as the HTML parser/serializer. It's more strict than htmlparser2
|
|
99
|
+
// and not good for scraping. It also does not have a great streaming interface.
|
|
100
|
+
// Here we tell cheerio to use htmlparser2 for serialization, otherwise the conflict produces weird errors.
|
|
101
|
+
_useHtmlParser2: true,
|
|
198
102
|
});
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
value: (options) => {
|
|
207
|
-
return new Promise((resolve, reject) => {
|
|
208
|
-
const stream = (0, got_scraping_1.gotScraping)(options);
|
|
209
|
-
stream.on('error', reject);
|
|
210
|
-
stream.on('response', () => {
|
|
211
|
-
resolve(addResponsePropertiesToStream(stream));
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
this._handlePropertyNameChange({
|
|
217
|
-
newName: 'requestHandler',
|
|
218
|
-
oldName: 'handlePageFunction',
|
|
219
|
-
propertyKey: 'requestHandler',
|
|
220
|
-
newProperty: requestHandler,
|
|
221
|
-
oldProperty: handlePageFunction,
|
|
222
|
-
allowUndefined: true,
|
|
223
|
-
});
|
|
224
|
-
if (!this.requestHandler) {
|
|
225
|
-
this.requestHandler = this.router;
|
|
226
|
-
}
|
|
227
|
-
// Cookies should be persisted per session only if session pool is used
|
|
228
|
-
if (!this.useSessionPool && persistCookiesPerSession) {
|
|
229
|
-
throw new Error('You cannot use "persistCookiesPerSession" without "useSessionPool" set to true.');
|
|
230
|
-
}
|
|
231
|
-
this.supportedMimeTypes = new Set([...HTML_AND_XML_MIME_TYPES, APPLICATION_JSON_MIME_TYPE]);
|
|
232
|
-
if (additionalMimeTypes.length)
|
|
233
|
-
this._extendSupportedMimeTypes(additionalMimeTypes);
|
|
234
|
-
if (suggestResponseEncoding && forceResponseEncoding) {
|
|
235
|
-
this.log.warning('Both forceResponseEncoding and suggestResponseEncoding options are set. Using forceResponseEncoding.');
|
|
236
|
-
}
|
|
237
|
-
this.userRequestHandlerTimeoutMillis = requestHandlerTimeoutSecs * 1000;
|
|
238
|
-
this.navigationTimeoutMillis = navigationTimeoutSecs * 1000;
|
|
239
|
-
this.ignoreSslErrors = ignoreSslErrors;
|
|
240
|
-
this.suggestResponseEncoding = suggestResponseEncoding;
|
|
241
|
-
this.forceResponseEncoding = forceResponseEncoding;
|
|
242
|
-
this.proxyConfiguration = proxyConfiguration;
|
|
243
|
-
this.preNavigationHooks = preNavigationHooks;
|
|
244
|
-
this.postNavigationHooks = [
|
|
245
|
-
({ request, response }) => this._abortDownloadOfBody(request, response),
|
|
246
|
-
...postNavigationHooks,
|
|
247
|
-
];
|
|
248
|
-
if (this.useSessionPool) {
|
|
249
|
-
this.persistCookiesPerSession = persistCookiesPerSession ?? true;
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
this.persistCookiesPerSession = false;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* **EXPERIMENTAL**
|
|
257
|
-
* Function for attaching CrawlerExtensions such as the Unblockers.
|
|
258
|
-
* @param extension Crawler extension that overrides the crawler configuration.
|
|
259
|
-
*/
|
|
260
|
-
use(extension) {
|
|
261
|
-
(0, ow_1.default)(extension, ow_1.default.object.instanceOf(core_1.CrawlerExtension));
|
|
262
|
-
const extensionOptions = extension.getCrawlerOptions();
|
|
263
|
-
for (const [key, value] of (0, utils_1.entries)(extensionOptions)) {
|
|
264
|
-
const isConfigurable = this.hasOwnProperty(key);
|
|
265
|
-
const originalType = typeof this[key];
|
|
266
|
-
const extensionType = typeof value; // What if we want to null something? It is really needed?
|
|
267
|
-
const isSameType = originalType === extensionType || value == null; // fast track for deleting keys
|
|
268
|
-
const exists = this[key] != null;
|
|
269
|
-
if (!isConfigurable) { // Test if the property can be configured on the crawler
|
|
270
|
-
throw new Error(`${extension.name} tries to set property "${key}" that is not configurable on CheerioCrawler instance.`);
|
|
271
|
-
}
|
|
272
|
-
if (!isSameType && exists) { // Assuming that extensions will only add up configuration
|
|
273
|
-
throw new Error(`${extension.name} tries to set property of different type "${extensionType}". "CheerioCrawler.${key}: ${originalType}".`);
|
|
274
|
-
}
|
|
275
|
-
this.log.warning(`${extension.name} is overriding "CheerioCrawler.${key}: ${originalType}" with ${value}.`);
|
|
276
|
-
this[key] = value;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Wrapper around requestHandler that opens and closes pages etc.
|
|
281
|
-
*/
|
|
282
|
-
async _runRequestHandler(crawlingContext) {
|
|
283
|
-
const { request, session } = crawlingContext;
|
|
284
|
-
if (this.proxyConfiguration) {
|
|
285
|
-
const sessionId = session ? session.id : undefined;
|
|
286
|
-
crawlingContext.proxyInfo = await this.proxyConfiguration.newProxyInfo(sessionId);
|
|
287
|
-
}
|
|
288
|
-
if (!request.skipNavigation) {
|
|
289
|
-
await this._handleNavigation(crawlingContext);
|
|
290
|
-
(0, timeout_1.tryCancel)();
|
|
291
|
-
const { dom, isXml, body, contentType, response } = await this._parseResponse(request, crawlingContext.response);
|
|
292
|
-
(0, timeout_1.tryCancel)();
|
|
293
|
-
if (this.useSessionPool) {
|
|
294
|
-
this._throwOnBlockedRequest(session, response.statusCode);
|
|
295
|
-
}
|
|
296
|
-
if (this.persistCookiesPerSession) {
|
|
297
|
-
session.setCookiesFromResponse(response);
|
|
298
|
-
}
|
|
299
|
-
request.loadedUrl = response.url;
|
|
300
|
-
const $ = dom
|
|
301
|
-
? cheerio.load(dom, {
|
|
302
|
-
xmlMode: isXml,
|
|
303
|
-
// Recent versions of cheerio use parse5 as the HTML parser/serializer. It's more strict than htmlparser2
|
|
304
|
-
// and not good for scraping. It also does not have a great streaming interface.
|
|
305
|
-
// Here we tell cheerio to use htmlparser2 for serialization, otherwise the conflict produces weird errors.
|
|
306
|
-
_useHtmlParser2: true,
|
|
307
|
-
})
|
|
308
|
-
: null;
|
|
309
|
-
crawlingContext.$ = $;
|
|
310
|
-
crawlingContext.contentType = contentType;
|
|
311
|
-
crawlingContext.response = response;
|
|
312
|
-
crawlingContext.enqueueLinks = async (enqueueOptions) => {
|
|
103
|
+
return {
|
|
104
|
+
dom,
|
|
105
|
+
$,
|
|
106
|
+
get body() {
|
|
107
|
+
return isXml ? $.xml() : $.html({ decodeEntities: false });
|
|
108
|
+
},
|
|
109
|
+
enqueueLinks: async (enqueueOptions) => {
|
|
313
110
|
return cheerioCrawlerEnqueueLinks({
|
|
314
111
|
options: enqueueOptions,
|
|
315
112
|
$,
|
|
@@ -317,200 +114,8 @@ class CheerioCrawler extends basic_1.BasicCrawler {
|
|
|
317
114
|
originalRequestUrl: crawlingContext.request.url,
|
|
318
115
|
finalRequestUrl: crawlingContext.request.loadedUrl,
|
|
319
116
|
});
|
|
320
|
-
};
|
|
321
|
-
Object.defineProperty(crawlingContext, 'json', {
|
|
322
|
-
get() {
|
|
323
|
-
if (contentType.type !== APPLICATION_JSON_MIME_TYPE)
|
|
324
|
-
return null;
|
|
325
|
-
const jsonString = body.toString(contentType.encoding);
|
|
326
|
-
return JSON.parse(jsonString);
|
|
327
|
-
},
|
|
328
|
-
});
|
|
329
|
-
Object.defineProperty(crawlingContext, 'body', {
|
|
330
|
-
get() {
|
|
331
|
-
// NOTE: For XML/HTML documents, we don't store the original body and only reconstruct it from Cheerio's DOM.
|
|
332
|
-
// This is to save memory for high-concurrency crawls. The downside is that changes
|
|
333
|
-
// made to DOM are reflected in the HTML, but we can live with that...
|
|
334
|
-
if (dom) {
|
|
335
|
-
return isXml ? $.xml() : $.html({ decodeEntities: false });
|
|
336
|
-
}
|
|
337
|
-
return body;
|
|
338
|
-
},
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
return (0, timeout_1.addTimeoutToPromise)(() => Promise.resolve(this.requestHandler(crawlingContext)), this.userRequestHandlerTimeoutMillis, `requestHandler timed out after ${this.userRequestHandlerTimeoutMillis / 1000} seconds.`);
|
|
342
|
-
}
|
|
343
|
-
async _handleNavigation(crawlingContext) {
|
|
344
|
-
const gotOptions = {};
|
|
345
|
-
const { request, session } = crawlingContext;
|
|
346
|
-
const preNavigationHooksCookies = this._getCookieHeaderFromRequest(request);
|
|
347
|
-
// Execute pre navigation hooks before applying session pool cookies,
|
|
348
|
-
// as they may also set cookies in the session
|
|
349
|
-
await this._executeHooks(this.preNavigationHooks, crawlingContext, gotOptions);
|
|
350
|
-
(0, timeout_1.tryCancel)();
|
|
351
|
-
const postNavigationHooksCookies = this._getCookieHeaderFromRequest(request);
|
|
352
|
-
this._applyCookies(crawlingContext, gotOptions, preNavigationHooksCookies, postNavigationHooksCookies);
|
|
353
|
-
const proxyUrl = crawlingContext.proxyInfo?.url;
|
|
354
|
-
crawlingContext.response = await (0, timeout_1.addTimeoutToPromise)(() => this._requestFunction({ request, session, proxyUrl, gotOptions }), this.navigationTimeoutMillis, `request timed out after ${this.navigationTimeoutMillis / 1000} seconds.`);
|
|
355
|
-
(0, timeout_1.tryCancel)();
|
|
356
|
-
await this._executeHooks(this.postNavigationHooks, crawlingContext, gotOptions);
|
|
357
|
-
(0, timeout_1.tryCancel)();
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Sets the cookie header to `gotOptions` based on the provided request and session headers, as well as any changes that occurred due to hooks.
|
|
361
|
-
*/
|
|
362
|
-
_applyCookies({ session, request }, gotOptions, preHookCookies, postHookCookies) {
|
|
363
|
-
const sessionCookie = session?.getCookieString(request.url) ?? '';
|
|
364
|
-
let alteredGotOptionsCookies = (gotOptions.headers?.Cookie || gotOptions.headers?.cookie || '');
|
|
365
|
-
if (gotOptions.headers?.Cookie && gotOptions.headers?.cookie) {
|
|
366
|
-
const { Cookie: upperCaseHeader, cookie: lowerCaseHeader, } = gotOptions.headers;
|
|
367
|
-
// eslint-disable-next-line max-len
|
|
368
|
-
this.log.warning(`Encountered mixed casing for the cookie headers in the got options for request ${request.url} (${request.id}). Their values will be merged`);
|
|
369
|
-
const sourceCookies = [];
|
|
370
|
-
if (Array.isArray(lowerCaseHeader)) {
|
|
371
|
-
sourceCookies.push(...lowerCaseHeader);
|
|
372
|
-
}
|
|
373
|
-
else {
|
|
374
|
-
sourceCookies.push(lowerCaseHeader);
|
|
375
|
-
}
|
|
376
|
-
if (Array.isArray(upperCaseHeader)) {
|
|
377
|
-
sourceCookies.push(...upperCaseHeader);
|
|
378
|
-
}
|
|
379
|
-
else {
|
|
380
|
-
sourceCookies.push(upperCaseHeader);
|
|
381
|
-
}
|
|
382
|
-
alteredGotOptionsCookies = (0, core_1.mergeCookies)(request.url, sourceCookies);
|
|
383
|
-
}
|
|
384
|
-
const sourceCookies = [
|
|
385
|
-
sessionCookie,
|
|
386
|
-
preHookCookies,
|
|
387
|
-
];
|
|
388
|
-
if (Array.isArray(alteredGotOptionsCookies)) {
|
|
389
|
-
sourceCookies.push(...alteredGotOptionsCookies);
|
|
390
|
-
}
|
|
391
|
-
else {
|
|
392
|
-
sourceCookies.push(alteredGotOptionsCookies);
|
|
393
|
-
}
|
|
394
|
-
sourceCookies.push(postHookCookies);
|
|
395
|
-
const mergedCookie = (0, core_1.mergeCookies)(request.url, sourceCookies);
|
|
396
|
-
gotOptions.headers ?? (gotOptions.headers = {});
|
|
397
|
-
Reflect.deleteProperty(gotOptions.headers, 'Cookie');
|
|
398
|
-
Reflect.deleteProperty(gotOptions.headers, 'cookie');
|
|
399
|
-
gotOptions.headers.Cookie = mergedCookie;
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* Function to make the HTTP request. It performs optimizations
|
|
403
|
-
* on the request such as only downloading the request body if the
|
|
404
|
-
* received content type matches text/html, application/xml, application/xhtml+xml.
|
|
405
|
-
*/
|
|
406
|
-
async _requestFunction({ request, session, proxyUrl, gotOptions }) {
|
|
407
|
-
const opts = this._getRequestOptions(request, session, proxyUrl, gotOptions);
|
|
408
|
-
try {
|
|
409
|
-
return await this._requestAsBrowser(opts);
|
|
410
|
-
}
|
|
411
|
-
catch (e) {
|
|
412
|
-
if (e instanceof got_scraping_1.TimeoutError) {
|
|
413
|
-
this._handleRequestTimeout(session);
|
|
414
|
-
return undefined;
|
|
415
|
-
}
|
|
416
|
-
throw e;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* Encodes and parses response according to the provided content type
|
|
421
|
-
*/
|
|
422
|
-
async _parseResponse(request, responseStream) {
|
|
423
|
-
const { statusCode } = responseStream;
|
|
424
|
-
const { type, charset } = (0, utils_1.parseContentTypeFromResponse)(responseStream);
|
|
425
|
-
const { response, encoding } = this._encodeResponse(request, responseStream, charset);
|
|
426
|
-
const contentType = { type, encoding };
|
|
427
|
-
if (statusCode >= 500) {
|
|
428
|
-
const body = await (0, utilities_1.readStreamToString)(response, encoding);
|
|
429
|
-
// Errors are often sent as JSON, so attempt to parse them,
|
|
430
|
-
// despite Accept header being set to text/html.
|
|
431
|
-
if (type === APPLICATION_JSON_MIME_TYPE) {
|
|
432
|
-
const errorResponse = JSON.parse(body);
|
|
433
|
-
let { message } = errorResponse;
|
|
434
|
-
if (!message)
|
|
435
|
-
message = util_1.default.inspect(errorResponse, { depth: 1, maxArrayLength: 10 });
|
|
436
|
-
throw new Error(`${statusCode} - ${message}`);
|
|
437
|
-
}
|
|
438
|
-
// It's not a JSON, so it's probably some text. Get the first 100 chars of it.
|
|
439
|
-
throw new Error(`${statusCode} - Internal Server Error: ${body.substr(0, 100)}`);
|
|
440
|
-
}
|
|
441
|
-
else if (HTML_AND_XML_MIME_TYPES.includes(type)) {
|
|
442
|
-
const dom = await this._parseHtmlToDom(response);
|
|
443
|
-
return ({ dom, isXml: type.includes('xml'), response, contentType });
|
|
444
|
-
}
|
|
445
|
-
else {
|
|
446
|
-
const body = await (0, utilities_1.concatStreamToBuffer)(response);
|
|
447
|
-
return { body, response, contentType };
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* Combines the provided `requestOptions` with mandatory (non-overridable) values.
|
|
452
|
-
*/
|
|
453
|
-
_getRequestOptions(request, session, proxyUrl, gotOptions) {
|
|
454
|
-
const requestOptions = {
|
|
455
|
-
url: request.url,
|
|
456
|
-
method: request.method,
|
|
457
|
-
proxyUrl,
|
|
458
|
-
timeout: { request: this.navigationTimeoutMillis },
|
|
459
|
-
sessionToken: session,
|
|
460
|
-
...gotOptions,
|
|
461
|
-
headers: { ...request.headers, ...gotOptions?.headers },
|
|
462
|
-
https: {
|
|
463
|
-
...gotOptions?.https,
|
|
464
|
-
rejectUnauthorized: !this.ignoreSslErrors,
|
|
465
117
|
},
|
|
466
|
-
isStream: true,
|
|
467
118
|
};
|
|
468
|
-
// Delete any possible lowercased header for cookie as they are merged in _applyCookies under the uppercase Cookie header
|
|
469
|
-
Reflect.deleteProperty(requestOptions.headers, 'cookie');
|
|
470
|
-
// TODO this is incorrect, the check for man in the middle needs to be done
|
|
471
|
-
// on individual proxy level, not on the `proxyConfiguration` level,
|
|
472
|
-
// because users can use normal + MITM proxies in a single configuration.
|
|
473
|
-
// Disable SSL verification for MITM proxies
|
|
474
|
-
if (this.proxyConfiguration && this.proxyConfiguration.isManInTheMiddle) {
|
|
475
|
-
requestOptions.https = {
|
|
476
|
-
...requestOptions.https,
|
|
477
|
-
rejectUnauthorized: false,
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
if (/PATCH|POST|PUT/.test(request.method))
|
|
481
|
-
requestOptions.body = request.payload;
|
|
482
|
-
return requestOptions;
|
|
483
|
-
}
|
|
484
|
-
_encodeResponse(request, response, encoding) {
|
|
485
|
-
if (this.forceResponseEncoding) {
|
|
486
|
-
encoding = this.forceResponseEncoding;
|
|
487
|
-
}
|
|
488
|
-
else if (!encoding && this.suggestResponseEncoding) {
|
|
489
|
-
encoding = this.suggestResponseEncoding;
|
|
490
|
-
}
|
|
491
|
-
// Fall back to utf-8 if we still don't have encoding.
|
|
492
|
-
const utf8 = 'utf8';
|
|
493
|
-
if (!encoding)
|
|
494
|
-
return { response, encoding: utf8 };
|
|
495
|
-
// This means that the encoding is one of Node.js supported
|
|
496
|
-
// encodings and we don't need to re-encode it.
|
|
497
|
-
if (Buffer.isEncoding(encoding))
|
|
498
|
-
return { response, encoding };
|
|
499
|
-
// Try to re-encode a variety of unsupported encodings to utf-8
|
|
500
|
-
if (iconv_lite_1.default.encodingExists(encoding)) {
|
|
501
|
-
const encodeStream = iconv_lite_1.default.encodeStream(utf8);
|
|
502
|
-
const decodeStream = iconv_lite_1.default.decodeStream(encoding).on('error', (err) => encodeStream.emit('error', err));
|
|
503
|
-
response.on('error', (err) => decodeStream.emit('error', err));
|
|
504
|
-
const encodedResponse = response.pipe(decodeStream).pipe(encodeStream);
|
|
505
|
-
encodedResponse.statusCode = response.statusCode;
|
|
506
|
-
encodedResponse.headers = response.headers;
|
|
507
|
-
encodedResponse.url = response.url;
|
|
508
|
-
return {
|
|
509
|
-
response: encodedResponse,
|
|
510
|
-
encoding: utf8,
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
throw new Error(`Resource ${request.url} served with unsupported charset/encoding: ${encoding}`);
|
|
514
119
|
}
|
|
515
120
|
async _parseHtmlToDom(response) {
|
|
516
121
|
return new Promise((resolve, reject) => {
|
|
@@ -527,73 +132,21 @@ class CheerioCrawler extends basic_1.BasicCrawler {
|
|
|
527
132
|
.pipe(parser);
|
|
528
133
|
});
|
|
529
134
|
}
|
|
530
|
-
/**
|
|
531
|
-
* Checks and extends supported mime types
|
|
532
|
-
*/
|
|
533
|
-
_extendSupportedMimeTypes(additionalMimeTypes) {
|
|
534
|
-
additionalMimeTypes.forEach((mimeType) => {
|
|
535
|
-
try {
|
|
536
|
-
const parsedType = content_type_1.default.parse(mimeType);
|
|
537
|
-
this.supportedMimeTypes.add(parsedType.type);
|
|
538
|
-
}
|
|
539
|
-
catch (err) {
|
|
540
|
-
throw new Error(`Can not parse mime type ${mimeType} from "options.additionalMimeTypes".`);
|
|
541
|
-
}
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
/**
|
|
545
|
-
* Handles timeout request
|
|
546
|
-
*/
|
|
547
|
-
_handleRequestTimeout(session) {
|
|
548
|
-
session?.markBad();
|
|
549
|
-
throw new Error(`request timed out after ${this.requestHandlerTimeoutMillis / 1000} seconds.`);
|
|
550
|
-
}
|
|
551
|
-
_abortDownloadOfBody(request, response) {
|
|
552
|
-
const { statusCode } = response;
|
|
553
|
-
const { type } = (0, utils_1.parseContentTypeFromResponse)(response);
|
|
554
|
-
if (statusCode === 406) {
|
|
555
|
-
request.noRetry = true;
|
|
556
|
-
throw new Error(`Resource ${request.url} is not available in the format requested by the Accept header. Skipping resource.`);
|
|
557
|
-
}
|
|
558
|
-
if (!this.supportedMimeTypes.has(type) && statusCode < 500) {
|
|
559
|
-
request.noRetry = true;
|
|
560
|
-
throw new Error(`Resource ${request.url} served Content-Type ${type}, `
|
|
561
|
-
+ `but only ${Array.from(this.supportedMimeTypes).join(', ')} are allowed. Skipping resource.`);
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
135
|
}
|
|
565
136
|
exports.CheerioCrawler = CheerioCrawler;
|
|
566
|
-
Object.defineProperty(CheerioCrawler, "optionsShape", {
|
|
567
|
-
enumerable: true,
|
|
568
|
-
configurable: true,
|
|
569
|
-
writable: true,
|
|
570
|
-
value: {
|
|
571
|
-
...basic_1.BasicCrawler.optionsShape,
|
|
572
|
-
handlePageFunction: ow_1.default.optional.function,
|
|
573
|
-
navigationTimeoutSecs: ow_1.default.optional.number,
|
|
574
|
-
ignoreSslErrors: ow_1.default.optional.boolean,
|
|
575
|
-
additionalMimeTypes: ow_1.default.optional.array.ofType(ow_1.default.string),
|
|
576
|
-
suggestResponseEncoding: ow_1.default.optional.string,
|
|
577
|
-
forceResponseEncoding: ow_1.default.optional.string,
|
|
578
|
-
proxyConfiguration: ow_1.default.optional.object.validate(core_1.validators.proxyConfiguration),
|
|
579
|
-
persistCookiesPerSession: ow_1.default.optional.boolean,
|
|
580
|
-
preNavigationHooks: ow_1.default.optional.array,
|
|
581
|
-
postNavigationHooks: ow_1.default.optional.array,
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
137
|
/** @internal */
|
|
585
138
|
async function cheerioCrawlerEnqueueLinks({ options, $, requestQueue, originalRequestUrl, finalRequestUrl }) {
|
|
586
139
|
if (!$) {
|
|
587
140
|
throw new Error('Cannot enqueue links because the DOM is not available.');
|
|
588
141
|
}
|
|
589
|
-
const baseUrl = (0,
|
|
142
|
+
const baseUrl = (0, http_1.resolveBaseUrlForEnqueueLinksFiltering)({
|
|
590
143
|
enqueueStrategy: options?.strategy,
|
|
591
144
|
finalRequestUrl,
|
|
592
145
|
originalRequestUrl,
|
|
593
146
|
userProvidedBaseUrl: options?.baseUrl,
|
|
594
147
|
});
|
|
595
148
|
const urls = extractUrlsFromCheerio($, options?.selector ?? 'a', options?.baseUrl ?? finalRequestUrl ?? originalRequestUrl);
|
|
596
|
-
return (0,
|
|
149
|
+
return (0, http_1.enqueueLinks)({
|
|
597
150
|
requestQueue,
|
|
598
151
|
urls,
|
|
599
152
|
baseUrl,
|
|
@@ -631,38 +184,6 @@ function extractUrlsFromCheerio($, selector, baseUrl) {
|
|
|
631
184
|
})
|
|
632
185
|
.filter((href) => !!href);
|
|
633
186
|
}
|
|
634
|
-
/**
|
|
635
|
-
* The stream object returned from got does not have the below properties.
|
|
636
|
-
* At the same time, you can't read data directly from the response stream,
|
|
637
|
-
* because they won't get emitted unless you also read from the primary
|
|
638
|
-
* got stream. To be able to work with only one stream, we move the expected props
|
|
639
|
-
* from the response stream to the got stream.
|
|
640
|
-
* @internal
|
|
641
|
-
*/
|
|
642
|
-
function addResponsePropertiesToStream(stream) {
|
|
643
|
-
const properties = [
|
|
644
|
-
'statusCode', 'statusMessage', 'headers',
|
|
645
|
-
'complete', 'httpVersion', 'rawHeaders',
|
|
646
|
-
'rawTrailers', 'trailers', 'url',
|
|
647
|
-
'request',
|
|
648
|
-
];
|
|
649
|
-
const response = stream.response;
|
|
650
|
-
response.on('end', () => {
|
|
651
|
-
// @ts-expect-error
|
|
652
|
-
Object.assign(stream.rawTrailers, response.rawTrailers);
|
|
653
|
-
// @ts-expect-error
|
|
654
|
-
Object.assign(stream.trailers, response.trailers);
|
|
655
|
-
// @ts-expect-error
|
|
656
|
-
stream.complete = response.complete;
|
|
657
|
-
});
|
|
658
|
-
for (const prop of properties) {
|
|
659
|
-
if (!(prop in stream)) {
|
|
660
|
-
// @ts-expect-error
|
|
661
|
-
stream[prop] = response[prop];
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
return stream;
|
|
665
|
-
}
|
|
666
187
|
/**
|
|
667
188
|
* Creates new {@apilink Router} instance that works based on request labels.
|
|
668
189
|
* This instance can then serve as a `requestHandler` of your {@apilink CheerioCrawler}.
|
|
@@ -688,7 +209,7 @@ function addResponsePropertiesToStream(stream) {
|
|
|
688
209
|
* ```
|
|
689
210
|
*/
|
|
690
211
|
function createCheerioRouter() {
|
|
691
|
-
return
|
|
212
|
+
return http_1.Router.create();
|
|
692
213
|
}
|
|
693
214
|
exports.createCheerioRouter = createCheerioRouter;
|
|
694
215
|
//# sourceMappingURL=cheerio-crawler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cheerio-crawler.js","sourceRoot":"","sources":["../../src/internals/cheerio-crawler.ts"],"names":[],"mappings":";;;;AAAA,4CAAgE;AAChE,gDAA4E;AAE5E,0CAAiF;AAEjF,wCAAwJ;AAGxJ,0CAAuE;AAEvE,yDAAmC;AAEnC,wEAA6C;AAE7C,+CAAyD;AACzD,6CAAyC;AACzC,mEAAgE;AAEhE,oEAA+B;AAC/B,oDAAoB;AACpB,wDAAwB;AAExB;;GAEG;AACH,MAAM,uBAAuB,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,uBAAuB,EAAE,iBAAiB,CAAC,CAAC;AACtG,MAAM,0BAA0B,GAAG,kBAAkB,CAAC;AACtD,MAAM,yCAAyC,GAA0B;IACrE,kBAAkB,EAAE,EAAE;IACtB,kBAAkB,EAAE;QAChB,6BAA6B,EAAE,CAAC;QAChC,gBAAgB,EAAE,GAAG;KACxB;IACD,mBAAmB,EAAE;QACjB,2BAA2B,EAAE,GAAG;KACnC;CACJ,CAAC;AA4PF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,MAAa,cAAe,SAAQ,oBAAoC;IAiCpE;;OAEG;IACH,YAAY,UAAiC,EAAE,EAAoB,SAAS,oBAAa,CAAC,eAAe,EAAE;QACvG,IAAA,YAAE,EAAC,OAAO,EAAE,uBAAuB,EAAE,YAAE,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,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
|
"name": "@crawlee/cheerio",
|
|
3
|
-
"version": "3.0.3-beta.
|
|
3
|
+
"version": "3.0.3-beta.14",
|
|
4
4
|
"description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.0.0"
|
|
@@ -53,14 +53,9 @@
|
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@crawlee/basic": "^3.0.3-beta.11",
|
|
59
|
-
"@types/content-type": "^1.1.5",
|
|
56
|
+
"@crawlee/http": "^3.0.3-beta.14",
|
|
57
|
+
"@crawlee/types": "^3.0.3-beta.14",
|
|
60
58
|
"cheerio": "1.0.0-rc.12",
|
|
61
|
-
"
|
|
62
|
-
"htmlparser2": "^8.0.1",
|
|
63
|
-
"iconv-lite": "^0.6.3",
|
|
64
|
-
"ow": "^0.28.1"
|
|
59
|
+
"htmlparser2": "^8.0.1"
|
|
65
60
|
}
|
|
66
61
|
}
|