@crawlee/playwright 4.0.0-beta.85 → 4.0.0-beta.86

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.
@@ -83,7 +83,7 @@ type AdaptiveHook<ContextExtension = Dictionary<never>> = BrowserHook<AdaptiveHo
83
83
  type AdaptivePostNavigationHook<ContextExtension = Dictionary<never>> = BrowserHook<Omit<AdaptiveHookContext, 'request'> & {
84
84
  request: LoadedRequest<Request>;
85
85
  }, ContextExtension>;
86
- export interface AdaptivePlaywrightCrawlerOptions<ContextExtension = Dictionary<never>, ExtendedContext extends AdaptivePlaywrightCrawlerContext = AdaptivePlaywrightCrawlerContext & ContextExtension> extends Omit<BasicCrawlerOptions<AdaptivePlaywrightCrawlerContext, ContextExtension, ExtendedContext>, 'preNavigationHooks' | 'postNavigationHooks'> {
86
+ export interface AdaptivePlaywrightCrawlerOptions<ContextExtension = Dictionary<never>, ExtendedContext extends AdaptivePlaywrightCrawlerContext = AdaptivePlaywrightCrawlerContext & ContextExtension, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<AdaptivePlaywrightCrawlerContext['request']>>> extends Omit<BasicCrawlerOptions<AdaptivePlaywrightCrawlerContext, ContextExtension, ExtendedContext, Routes>, 'preNavigationHooks' | 'postNavigationHooks'> {
87
87
  /**
88
88
  * Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies.
89
89
  * The function accepts a subset of the crawling context. If you attempt to access the `page` property during HTTP-only crawling,
@@ -175,7 +175,7 @@ export interface AdaptivePlaywrightCrawlerOptions<ContextExtension = Dictionary<
175
175
  *
176
176
  * @experimental
177
177
  */
178
- export declare class AdaptivePlaywrightCrawler<ContextExtension = Dictionary<never>, ExtendedContext extends AdaptivePlaywrightCrawlerContext = AdaptivePlaywrightCrawlerContext & ContextExtension> extends BasicCrawler<AdaptivePlaywrightCrawlerContext, ContextExtension, ExtendedContext> {
178
+ export declare class AdaptivePlaywrightCrawler<ContextExtension = Dictionary<never>, ExtendedContext extends AdaptivePlaywrightCrawlerContext = AdaptivePlaywrightCrawlerContext & ContextExtension, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<AdaptivePlaywrightCrawlerContext['request']>>> extends BasicCrawler<AdaptivePlaywrightCrawlerContext, ContextExtension, ExtendedContext, Routes> {
179
179
  private renderingTypePredictor;
180
180
  private resultChecker;
181
181
  private shouldPropagateError;
@@ -188,7 +188,7 @@ export declare class AdaptivePlaywrightCrawler<ContextExtension = Dictionary<nev
188
188
  private resultObjects;
189
189
  private inFlightRenderingTypeDetections;
190
190
  private teardownHooks;
191
- constructor(options?: AdaptivePlaywrightCrawlerOptions<ContextExtension, ExtendedContext>);
191
+ constructor(options?: AdaptivePlaywrightCrawlerOptions<ContextExtension, ExtendedContext, Routes>);
192
192
  protected _init(): Promise<void>;
193
193
  protected buildContextPipeline(): ContextPipeline<CrawlingContext<Dictionary>, CrawlingContext<Dictionary> & {
194
194
  readonly request: LoadedRequest<Request<Dictionary>>;
@@ -13,9 +13,9 @@ export interface PlaywrightCrawlingContext<UserData extends Dictionary = Diction
13
13
  // @ts-ignore optional peer dependency or compatibility with es2022
14
14
  export interface PlaywrightHook extends BrowserHook<PlaywrightCrawlingContext> {
15
15
  }
16
- export interface PlaywrightCrawlerOptions<ContextExtension = Dictionary<never>, ExtendedContext extends PlaywrightCrawlingContext = PlaywrightCrawlingContext & ContextExtension> extends BrowserCrawlerOptions<Page, Response, PlaywrightCrawlingContext, ContextExtension, ExtendedContext, {
16
+ export interface PlaywrightCrawlerOptions<ContextExtension = Dictionary<never>, ExtendedContext extends PlaywrightCrawlingContext = PlaywrightCrawlingContext & ContextExtension, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<PlaywrightCrawlingContext['request']>>> extends BrowserCrawlerOptions<Page, Response, PlaywrightCrawlingContext, ContextExtension, ExtendedContext, {
17
17
  browserPlugins: [PlaywrightPlugin];
18
- }> {
18
+ }, Routes> {
19
19
  /**
20
20
  * The same options as used by {@link launchPlaywright}.
21
21
  */
@@ -42,7 +42,7 @@ export interface PlaywrightCrawlerOptions<ContextExtension = Dictionary<never>,
42
42
  * The exceptions are logged to the request using the
43
43
  * {@link Request.pushErrorMessage} function.
44
44
  */
45
- requestHandler?: RequestHandler<ExtendedContext>;
45
+ requestHandler?: RouterHandler<ExtendedContext, Routes> | RequestHandler<ExtendedContext>;
46
46
  /**
47
47
  * Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies
48
48
  * or browser properties before navigation. The function receives the `crawlingContext`; the options object
@@ -143,9 +143,9 @@ export interface PlaywrightCrawlerOptions<ContextExtension = Dictionary<never>,
143
143
  * ```
144
144
  * @category Crawlers
145
145
  */
146
- export declare class PlaywrightCrawler<ContextExtension = Dictionary<never>, ExtendedContext extends PlaywrightCrawlingContext = PlaywrightCrawlingContext & ContextExtension> extends BrowserCrawler<Page, Response, {
146
+ export declare class PlaywrightCrawler<ContextExtension = Dictionary<never>, ExtendedContext extends PlaywrightCrawlingContext = PlaywrightCrawlingContext & ContextExtension, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<PlaywrightCrawlingContext['request']>>> extends BrowserCrawler<Page, Response, {
147
147
  browserPlugins: [PlaywrightPlugin];
148
- }, LaunchOptions, PlaywrightCrawlingContext, ContextExtension, ExtendedContext> {
148
+ }, LaunchOptions, PlaywrightCrawlingContext, ContextExtension, ExtendedContext, Routes> {
149
149
  protected static optionsShape: {
150
150
  // @ts-ignore optional peer dependency or compatibility with es2022
151
151
  browserPoolOptions: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
@@ -243,7 +243,7 @@ export declare class PlaywrightCrawler<ContextExtension = Dictionary<never>, Ext
243
243
  /**
244
244
  * All `PlaywrightCrawler` parameters are passed via an options object.
245
245
  */
246
- constructor(options?: PlaywrightCrawlerOptions<ContextExtension, ExtendedContext>);
246
+ constructor(options?: PlaywrightCrawlerOptions<ContextExtension, ExtendedContext, Routes>);
247
247
  // @ts-ignore optional peer dependency or compatibility with es2022
248
248
  protected buildContextPipeline(): import("@crawlee/browser").ContextPipeline<import("@crawlee/browser").CrawlingContext<Dictionary>, BrowserCrawlingContext<Page, Response, Dictionary, Dictionary> & {
249
249
  injectFile: (filePath: string, options?: InjectFileOptions) => Promise<unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/playwright",
3
- "version": "4.0.0-beta.85",
3
+ "version": "4.0.0-beta.86",
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"
@@ -49,13 +49,13 @@
49
49
  "dependencies": {
50
50
  "@apify/datastructures": "^2.0.3",
51
51
  "@apify/timeout": "^0.3.2",
52
- "@crawlee/basic": "4.0.0-beta.85",
53
- "@crawlee/browser": "4.0.0-beta.85",
54
- "@crawlee/browser-pool": "4.0.0-beta.85",
55
- "@crawlee/cheerio": "4.0.0-beta.85",
56
- "@crawlee/core": "4.0.0-beta.85",
57
- "@crawlee/types": "4.0.0-beta.85",
58
- "@crawlee/utils": "4.0.0-beta.85",
52
+ "@crawlee/basic": "4.0.0-beta.86",
53
+ "@crawlee/browser": "4.0.0-beta.86",
54
+ "@crawlee/browser-pool": "4.0.0-beta.86",
55
+ "@crawlee/cheerio": "4.0.0-beta.86",
56
+ "@crawlee/core": "4.0.0-beta.86",
57
+ "@crawlee/types": "4.0.0-beta.86",
58
+ "@crawlee/utils": "4.0.0-beta.86",
59
59
  "cheerio": "^1.0.0",
60
60
  "idcac-playwright": "^0.1.3",
61
61
  "jquery": "^3.7.1",
@@ -85,5 +85,5 @@
85
85
  }
86
86
  }
87
87
  },
88
- "gitHead": "8d6d3cd9da3dc9cb0b7822b28eb317019b6806bc"
88
+ "gitHead": "c2f251426f3ccfcc6efc920e6d492be57beac43b"
89
89
  }