@crawlee/basic 4.0.0-beta.114 → 4.0.0-beta.116
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { dirname } from 'node:path';
|
|
3
|
-
import { AutoscaledPool, bindMethodsToServiceLocator, BLOCKED_STATUS_CODES, ConcurrencySystem, ContextPipeline, ContextPipelineCleanupError, ContextPipelineInitializationError, ContextPipelineInterruptedError, createStorageTransaction, CriticalError, currentStorageTransaction, Dataset, enqueueLinks, EnqueueStrategy, getObjectType, KeyValueStore, log, LogLevel, mergeCookies, MissingSessionError, NavigationSkippedError, NonRetryableError, OwnedOrInjected, purgeDefaultStorages, RequestHandlerError, parseRetryAfterHeader, RequestThrottledError, RequestManagerTandem, RequestQueue, RequestState, RetryRequestError, supportsDomainThrottling, Router, ServiceLocator, serviceLocator, Session, SessionError, SessionPool, Statistics, validateUserData, validators, withDirectStorageAccess, } from '@crawlee/core';
|
|
3
|
+
import { AutoscaledPool, bindMethodsToServiceLocator, BLOCKED_STATUS_CODES, ConcurrencySystem, ContextPipeline, ContextPipelineCleanupError, ContextPipelineInitializationError, ContextPipelineInterruptedError, createStorageTransaction, CriticalError, currentStorageTransaction, Dataset, enqueueLinks, EnqueueStrategy, EventType, getObjectType, KeyValueStore, log, LogLevel, mergeCookies, MissingSessionError, NavigationSkippedError, NonRetryableError, OwnedOrInjected, purgeDefaultStorages, RequestHandlerError, parseRetryAfterHeader, RequestThrottledError, RequestManagerTandem, RequestQueue, RequestState, RetryRequestError, supportsDomainThrottling, Router, ServiceLocator, serviceLocator, Session, SessionError, SessionPool, Statistics, validateUserData, validators, withDirectStorageAccess, } from '@crawlee/core';
|
|
4
4
|
import { FetchHttpClient } from '@crawlee/http-client';
|
|
5
5
|
import { isAsyncIterable, isIterable, ROTATE_PROXY_ERRORS } from '@crawlee/utils/internal';
|
|
6
6
|
import { RobotsTxtFile } from '@crawlee/utils';
|
|
@@ -662,7 +662,7 @@ export class BasicCrawler {
|
|
|
662
662
|
// subscribe to `EventType.STATUS_MESSAGE` and propagate it to their status-reporting backend.
|
|
663
663
|
// Setting the status message is not a storage concern, so we intentionally don't route it
|
|
664
664
|
// through the storage client anymore.
|
|
665
|
-
serviceLocator.getEventManager().emit(
|
|
665
|
+
serviceLocator.getEventManager().emit(EventType.STATUS_MESSAGE, {
|
|
666
666
|
crawlerId: this.identity.id,
|
|
667
667
|
message,
|
|
668
668
|
isStatusMessageTerminal: options.isStatusMessageTerminal,
|
|
@@ -776,8 +776,8 @@ export class BasicCrawler {
|
|
|
776
776
|
const boundPauseOnMigration = this.pauseOnMigration.bind(this);
|
|
777
777
|
process.once('SIGINT', sigintHandler);
|
|
778
778
|
const eventManager = serviceLocator.getEventManager();
|
|
779
|
-
eventManager.on(
|
|
780
|
-
eventManager.on(
|
|
779
|
+
eventManager.on(EventType.MIGRATING, boundPauseOnMigration);
|
|
780
|
+
eventManager.on(EventType.ABORTING, boundPauseOnMigration);
|
|
781
781
|
let stats = {};
|
|
782
782
|
try {
|
|
783
783
|
await this.#autoscaledPool.run();
|
|
@@ -786,8 +786,8 @@ export class BasicCrawler {
|
|
|
786
786
|
await this.teardown();
|
|
787
787
|
await this.stats.stopCapturing();
|
|
788
788
|
process.off('SIGINT', sigintHandler);
|
|
789
|
-
eventManager.off(
|
|
790
|
-
eventManager.off(
|
|
789
|
+
eventManager.off(EventType.MIGRATING, boundPauseOnMigration);
|
|
790
|
+
eventManager.off(EventType.ABORTING, boundPauseOnMigration);
|
|
791
791
|
const finalStats = this.stats.calculate();
|
|
792
792
|
stats = {
|
|
793
793
|
requestsFinished: this.stats.state.requestsFinished,
|
|
@@ -1668,7 +1668,7 @@ export class BasicCrawler {
|
|
|
1668
1668
|
* To stop the crawler gracefully (waiting for all running requests to finish), use {@link BasicCrawler.stop|`crawler.stop()`} instead.
|
|
1669
1669
|
*/
|
|
1670
1670
|
async teardown() {
|
|
1671
|
-
serviceLocator.getEventManager().emit(
|
|
1671
|
+
serviceLocator.getEventManager().emit(EventType.PERSIST_STATE, { isMigrating: false });
|
|
1672
1672
|
if (this.#closeEvents) {
|
|
1673
1673
|
await serviceLocator.getEventManager().close();
|
|
1674
1674
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/basic",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.116",
|
|
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": ">=22.0.0"
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"@apify/datastructures": "^2.0.0",
|
|
43
43
|
"@apify/timeout": "^0.4.4",
|
|
44
44
|
"@apify/utilities": "^2.15.5",
|
|
45
|
-
"@crawlee/core": "4.0.0-beta.
|
|
46
|
-
"@crawlee/http-client": "4.0.0-beta.
|
|
47
|
-
"@crawlee/types": "4.0.0-beta.
|
|
48
|
-
"@crawlee/utils": "4.0.0-beta.
|
|
45
|
+
"@crawlee/core": "4.0.0-beta.116",
|
|
46
|
+
"@crawlee/http-client": "4.0.0-beta.116",
|
|
47
|
+
"@crawlee/types": "4.0.0-beta.116",
|
|
48
|
+
"@crawlee/utils": "4.0.0-beta.116",
|
|
49
49
|
"csv-stringify": "^6.5.2",
|
|
50
50
|
"ow": "^2.0.0",
|
|
51
51
|
"tldts": "^7.0.6",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"type-fest": "^4.41.0"
|
|
54
54
|
},
|
|
55
55
|
"optionalDependencies": {
|
|
56
|
-
"@crawlee/impit-client": "^4.0.0-beta.
|
|
56
|
+
"@crawlee/impit-client": "^4.0.0-beta.116"
|
|
57
57
|
},
|
|
58
58
|
"lerna": {
|
|
59
59
|
"command": {
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "2bdc17928f47674f08fff7a83de861d881b7947a"
|
|
66
66
|
}
|