apify 2.3.1-beta.4 → 3.0.0-alpha.0

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.
Files changed (211) hide show
  1. package/README.md +6 -5
  2. package/package.json +69 -128
  3. package/build/actor.d.ts +0 -113
  4. package/build/actor.d.ts.map +0 -1
  5. package/build/actor.js +0 -582
  6. package/build/actor.js.map +0 -1
  7. package/build/apify.d.ts +0 -752
  8. package/build/apify.d.ts.map +0 -1
  9. package/build/apify.js +0 -877
  10. package/build/apify.js.map +0 -1
  11. package/build/autoscaling/autoscaled_pool.d.ts +0 -384
  12. package/build/autoscaling/autoscaled_pool.d.ts.map +0 -1
  13. package/build/autoscaling/autoscaled_pool.js +0 -557
  14. package/build/autoscaling/autoscaled_pool.js.map +0 -1
  15. package/build/autoscaling/snapshotter.d.ts +0 -278
  16. package/build/autoscaling/snapshotter.d.ts.map +0 -1
  17. package/build/autoscaling/snapshotter.js +0 -447
  18. package/build/autoscaling/snapshotter.js.map +0 -1
  19. package/build/autoscaling/system_status.d.ts +0 -224
  20. package/build/autoscaling/system_status.d.ts.map +0 -1
  21. package/build/autoscaling/system_status.js +0 -228
  22. package/build/autoscaling/system_status.js.map +0 -1
  23. package/build/browser_launchers/browser_launcher.d.ts +0 -154
  24. package/build/browser_launchers/browser_launcher.d.ts.map +0 -1
  25. package/build/browser_launchers/browser_launcher.js +0 -160
  26. package/build/browser_launchers/browser_launcher.js.map +0 -1
  27. package/build/browser_launchers/browser_plugin.d.ts +0 -23
  28. package/build/browser_launchers/browser_plugin.d.ts.map +0 -1
  29. package/build/browser_launchers/browser_plugin.js +0 -25
  30. package/build/browser_launchers/browser_plugin.js.map +0 -1
  31. package/build/browser_launchers/playwright_launcher.d.ts +0 -131
  32. package/build/browser_launchers/playwright_launcher.d.ts.map +0 -1
  33. package/build/browser_launchers/playwright_launcher.js +0 -150
  34. package/build/browser_launchers/playwright_launcher.js.map +0 -1
  35. package/build/browser_launchers/puppeteer_launcher.d.ts +0 -153
  36. package/build/browser_launchers/puppeteer_launcher.d.ts.map +0 -1
  37. package/build/browser_launchers/puppeteer_launcher.js +0 -197
  38. package/build/browser_launchers/puppeteer_launcher.js.map +0 -1
  39. package/build/cache_container.d.ts +0 -31
  40. package/build/cache_container.d.ts.map +0 -1
  41. package/build/cache_container.js +0 -48
  42. package/build/cache_container.js.map +0 -1
  43. package/build/configuration.d.ts +0 -226
  44. package/build/configuration.d.ts.map +0 -1
  45. package/build/configuration.js +0 -325
  46. package/build/configuration.js.map +0 -1
  47. package/build/constants.d.ts +0 -37
  48. package/build/constants.d.ts.map +0 -1
  49. package/build/constants.js +0 -41
  50. package/build/constants.js.map +0 -1
  51. package/build/crawlers/basic_crawler.d.ts +0 -443
  52. package/build/crawlers/basic_crawler.d.ts.map +0 -1
  53. package/build/crawlers/basic_crawler.js +0 -664
  54. package/build/crawlers/basic_crawler.js.map +0 -1
  55. package/build/crawlers/browser_crawler.d.ts +0 -512
  56. package/build/crawlers/browser_crawler.d.ts.map +0 -1
  57. package/build/crawlers/browser_crawler.js +0 -540
  58. package/build/crawlers/browser_crawler.js.map +0 -1
  59. package/build/crawlers/cheerio_crawler.d.ts +0 -931
  60. package/build/crawlers/cheerio_crawler.d.ts.map +0 -1
  61. package/build/crawlers/cheerio_crawler.js +0 -913
  62. package/build/crawlers/cheerio_crawler.js.map +0 -1
  63. package/build/crawlers/crawler_extension.d.ts +0 -10
  64. package/build/crawlers/crawler_extension.d.ts.map +0 -1
  65. package/build/crawlers/crawler_extension.js +0 -19
  66. package/build/crawlers/crawler_extension.js.map +0 -1
  67. package/build/crawlers/crawler_utils.d.ts +0 -34
  68. package/build/crawlers/crawler_utils.d.ts.map +0 -1
  69. package/build/crawlers/crawler_utils.js +0 -87
  70. package/build/crawlers/crawler_utils.js.map +0 -1
  71. package/build/crawlers/playwright_crawler.d.ts +0 -448
  72. package/build/crawlers/playwright_crawler.d.ts.map +0 -1
  73. package/build/crawlers/playwright_crawler.js +0 -299
  74. package/build/crawlers/playwright_crawler.js.map +0 -1
  75. package/build/crawlers/puppeteer_crawler.d.ts +0 -425
  76. package/build/crawlers/puppeteer_crawler.d.ts.map +0 -1
  77. package/build/crawlers/puppeteer_crawler.js +0 -299
  78. package/build/crawlers/puppeteer_crawler.js.map +0 -1
  79. package/build/crawlers/statistics.d.ts +0 -185
  80. package/build/crawlers/statistics.d.ts.map +0 -1
  81. package/build/crawlers/statistics.js +0 -331
  82. package/build/crawlers/statistics.js.map +0 -1
  83. package/build/enqueue_links/click_elements.d.ts +0 -179
  84. package/build/enqueue_links/click_elements.d.ts.map +0 -1
  85. package/build/enqueue_links/click_elements.js +0 -434
  86. package/build/enqueue_links/click_elements.js.map +0 -1
  87. package/build/enqueue_links/enqueue_links.d.ts +0 -117
  88. package/build/enqueue_links/enqueue_links.d.ts.map +0 -1
  89. package/build/enqueue_links/enqueue_links.js +0 -163
  90. package/build/enqueue_links/enqueue_links.js.map +0 -1
  91. package/build/enqueue_links/shared.d.ts +0 -42
  92. package/build/enqueue_links/shared.d.ts.map +0 -1
  93. package/build/enqueue_links/shared.js +0 -121
  94. package/build/enqueue_links/shared.js.map +0 -1
  95. package/build/errors.d.ts +0 -29
  96. package/build/errors.d.ts.map +0 -1
  97. package/build/errors.js +0 -38
  98. package/build/errors.js.map +0 -1
  99. package/build/events.d.ts +0 -11
  100. package/build/events.d.ts.map +0 -1
  101. package/build/events.js +0 -147
  102. package/build/events.js.map +0 -1
  103. package/build/index.d.ts +0 -4
  104. package/build/index.d.ts.map +0 -1
  105. package/build/index.js +0 -7
  106. package/build/index.js.map +0 -1
  107. package/build/main.d.ts +0 -179
  108. package/build/main.d.ts.map +0 -1
  109. package/build/main.js +0 -81
  110. package/build/main.js.map +0 -1
  111. package/build/playwright_utils.d.ts +0 -9
  112. package/build/playwright_utils.d.ts.map +0 -1
  113. package/build/playwright_utils.js +0 -90
  114. package/build/playwright_utils.js.map +0 -1
  115. package/build/proxy_configuration.d.ts +0 -411
  116. package/build/proxy_configuration.d.ts.map +0 -1
  117. package/build/proxy_configuration.js +0 -517
  118. package/build/proxy_configuration.js.map +0 -1
  119. package/build/pseudo_url.d.ts +0 -86
  120. package/build/pseudo_url.d.ts.map +0 -1
  121. package/build/pseudo_url.js +0 -153
  122. package/build/pseudo_url.js.map +0 -1
  123. package/build/puppeteer_request_interception.d.ts +0 -8
  124. package/build/puppeteer_request_interception.d.ts.map +0 -1
  125. package/build/puppeteer_request_interception.js +0 -235
  126. package/build/puppeteer_request_interception.js.map +0 -1
  127. package/build/puppeteer_utils.d.ts +0 -250
  128. package/build/puppeteer_utils.d.ts.map +0 -1
  129. package/build/puppeteer_utils.js +0 -551
  130. package/build/puppeteer_utils.js.map +0 -1
  131. package/build/request.d.ts +0 -180
  132. package/build/request.d.ts.map +0 -1
  133. package/build/request.js +0 -261
  134. package/build/request.js.map +0 -1
  135. package/build/request_list.d.ts +0 -581
  136. package/build/request_list.d.ts.map +0 -1
  137. package/build/request_list.js +0 -826
  138. package/build/request_list.js.map +0 -1
  139. package/build/serialization.d.ts +0 -5
  140. package/build/serialization.d.ts.map +0 -1
  141. package/build/serialization.js +0 -139
  142. package/build/serialization.js.map +0 -1
  143. package/build/session_pool/errors.d.ts +0 -11
  144. package/build/session_pool/errors.d.ts.map +0 -1
  145. package/build/session_pool/errors.js +0 -18
  146. package/build/session_pool/errors.js.map +0 -1
  147. package/build/session_pool/events.d.ts +0 -5
  148. package/build/session_pool/events.d.ts.map +0 -1
  149. package/build/session_pool/events.js +0 -6
  150. package/build/session_pool/events.js.map +0 -1
  151. package/build/session_pool/session.d.ts +0 -286
  152. package/build/session_pool/session.d.ts.map +0 -1
  153. package/build/session_pool/session.js +0 -355
  154. package/build/session_pool/session.js.map +0 -1
  155. package/build/session_pool/session_pool.d.ts +0 -280
  156. package/build/session_pool/session_pool.d.ts.map +0 -1
  157. package/build/session_pool/session_pool.js +0 -393
  158. package/build/session_pool/session_pool.js.map +0 -1
  159. package/build/session_pool/session_utils.d.ts +0 -4
  160. package/build/session_pool/session_utils.d.ts.map +0 -1
  161. package/build/session_pool/session_utils.js +0 -24
  162. package/build/session_pool/session_utils.js.map +0 -1
  163. package/build/stealth/hiding_tricks.d.ts +0 -22
  164. package/build/stealth/hiding_tricks.d.ts.map +0 -1
  165. package/build/stealth/hiding_tricks.js +0 -308
  166. package/build/stealth/hiding_tricks.js.map +0 -1
  167. package/build/stealth/stealth.d.ts +0 -56
  168. package/build/stealth/stealth.d.ts.map +0 -1
  169. package/build/stealth/stealth.js +0 -125
  170. package/build/stealth/stealth.js.map +0 -1
  171. package/build/storages/dataset.d.ts +0 -288
  172. package/build/storages/dataset.d.ts.map +0 -1
  173. package/build/storages/dataset.js +0 -480
  174. package/build/storages/dataset.js.map +0 -1
  175. package/build/storages/key_value_store.d.ts +0 -243
  176. package/build/storages/key_value_store.d.ts.map +0 -1
  177. package/build/storages/key_value_store.js +0 -462
  178. package/build/storages/key_value_store.js.map +0 -1
  179. package/build/storages/request_queue.d.ts +0 -318
  180. package/build/storages/request_queue.d.ts.map +0 -1
  181. package/build/storages/request_queue.js +0 -636
  182. package/build/storages/request_queue.js.map +0 -1
  183. package/build/storages/storage_manager.d.ts +0 -87
  184. package/build/storages/storage_manager.d.ts.map +0 -1
  185. package/build/storages/storage_manager.js +0 -150
  186. package/build/storages/storage_manager.js.map +0 -1
  187. package/build/tsconfig.tsbuildinfo +0 -1
  188. package/build/typedefs.d.ts +0 -146
  189. package/build/typedefs.d.ts.map +0 -1
  190. package/build/typedefs.js +0 -88
  191. package/build/typedefs.js.map +0 -1
  192. package/build/utils.d.ts +0 -175
  193. package/build/utils.d.ts.map +0 -1
  194. package/build/utils.js +0 -731
  195. package/build/utils.js.map +0 -1
  196. package/build/utils_log.d.ts +0 -41
  197. package/build/utils_log.d.ts.map +0 -1
  198. package/build/utils_log.js +0 -192
  199. package/build/utils_log.js.map +0 -1
  200. package/build/utils_request.d.ts +0 -77
  201. package/build/utils_request.d.ts.map +0 -1
  202. package/build/utils_request.js +0 -385
  203. package/build/utils_request.js.map +0 -1
  204. package/build/utils_social.d.ts +0 -210
  205. package/build/utils_social.d.ts.map +0 -1
  206. package/build/utils_social.js +0 -787
  207. package/build/utils_social.js.map +0 -1
  208. package/build/validators.d.ts +0 -23
  209. package/build/validators.d.ts.map +0 -1
  210. package/build/validators.js +0 -29
  211. package/build/validators.js.map +0 -1
@@ -1,540 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const ow_1 = (0, tslib_1.__importDefault)(require("ow"));
5
- const timeout_1 = require("@apify/timeout");
6
- const browser_pool_1 = require("browser-pool"); // eslint-disable-line import/no-duplicates,no-unused-vars
7
- const constants_1 = require("../constants");
8
- const events_1 = (0, tslib_1.__importDefault)(require("../session_pool/events")); // eslint-disable-line import/no-duplicates
9
- const validators_1 = require("../validators");
10
- const crawler_utils_1 = require("./crawler_utils");
11
- /* eslint-disable no-unused-vars,import/named,import/no-duplicates,import/order */
12
- const basic_crawler_1 = require("./basic_crawler");
13
- /* eslint-enable no-unused-vars,import/named,import/no-duplicates,import/order */
14
- /**
15
- * @typedef BrowserCrawlingContext
16
- * @property {BrowserController} browserController
17
- */
18
- /**
19
- * @callback Hook
20
- * @param {BrowserCrawlingContext & CrawlingContext} crawlingContext
21
- * @param {Object<string,*>} gotoOptions
22
- * @returns {Promise<void>}
23
- */
24
- /**
25
- * @callback BrowserHandlePageFunction
26
- * @param {BrowserCrawlingContext & CrawlingContext} context
27
- * @returns {Promise<void>}
28
- */
29
- /**
30
- * @callback GotoFunction
31
- * @param {BrowserCrawlingContext & CrawlingContext} context
32
- * @param {Object<string,*>} gotoOptions
33
- * @returns {Promise<*>}
34
- */
35
- /**
36
- * @typedef BrowserCrawlerOptions
37
- * @property {BrowserHandlePageFunction} handlePageFunction
38
- * Function that is called to process each request.
39
- * It is passed an object with the following fields:
40
- *
41
- * ```
42
- * {
43
- * request: Request,
44
- * response: Response,
45
- * page: Page,
46
- * session: Session,
47
- * browserController: BrowserController,
48
- * proxyInfo: ProxyInfo,
49
- * crawler: BrowserCrawler,
50
- * }
51
- * ```
52
- *
53
- * `request` is an instance of the {@link Request} object with details about the URL to open, HTTP method etc.
54
- * `page` is an instance of the `Puppeteer`
55
- * [`Page`](https://pptr.dev/#?product=Puppeteer&show=api-class-page) or `Playwright`
56
- * [`Page`](https://playwright.dev/docs/api/class-page)
57
- * `browserPool` is an instance of the
58
- * [`BrowserPool`](https://github.com/apify/browser-pool#BrowserPool),
59
- * `browserController` is an instance of the
60
- * [`BrowserController`](https://github.com/apify/browser-pool#browsercontroller),
61
- * `response` is an instance of the `Puppeteer`
62
- * [`Response`](https://pptr.dev/#?product=Puppeteer&show=api-class-response) or `Playwright`
63
- * [`Response`](https://playwright.dev/docs/api/class-response),
64
- * which is the main resource response as returned by `page.goto(request.url)`.
65
- * The function must return a promise, which is then awaited by the crawler.
66
- *
67
- * If the function throws an exception, the crawler will try to re-crawl the
68
- * request later, up to `option.maxRequestRetries` times.
69
- * If all the retries fail, the crawler calls the function
70
- * provided to the `handleFailedRequestFunction` parameter.
71
- * To make this work, you should **always**
72
- * let your function throw exceptions rather than catch them.
73
- * The exceptions are logged to the request using the
74
- * {@link Request#pushErrorMessage} function.
75
- * @property {number} [handlePageTimeoutSecs=60]
76
- * Timeout in which the function passed as `handlePageFunction` needs to finish, in seconds.
77
- * @property {GotoFunction} [gotoFunction]
78
- * Navigation function for corresponding library. `page.goto(url)` is supported by both `playwright` and `puppeteer`.
79
- * @property {HandleFailedRequest} [handleFailedRequestFunction]
80
- * A function to handle requests that failed more than `option.maxRequestRetries` times.
81
- *
82
- * The function receives the following object as an argument:
83
- * ```
84
- * {
85
- * request: Request,
86
- * response: Response,
87
- * page: Page,
88
- * browserPool: BrowserPool,
89
- * autoscaledPool: AutoscaledPool,
90
- * session: Session,
91
- * browserController: BrowserController,
92
- * proxyInfo: ProxyInfo,
93
- * }
94
- * ```
95
- * Where the {@link Request} instance corresponds to the failed request, and the `Error` instance
96
- * represents the last error thrown during processing of the request.
97
- * @property {BrowserPoolOptions} [browserPoolOptions]
98
- * Custom options passed to the underlying [`BrowserPool`](https://github.com/apify/browser-pool#BrowserPool) constructor.
99
- * You can tweak those to fine-tune browser management.
100
- * @property {boolean} [persistCookiesPerSession=true]
101
- * Automatically saves cookies to Session. Works only if Session Pool is used.
102
- * @property {ProxyConfiguration} [proxyConfiguration]
103
- * If set, `PuppeteerCrawler` will be configured for all connections to use
104
- * [Apify Proxy](https://console.apify.com/proxy) or your own Proxy URLs provided and rotated according to the configuration.
105
- * For more information, see the [documentation](https://docs.apify.com/proxy).
106
- * @property {Array<Hook>} [preNavigationHooks]
107
- * Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies
108
- * or browser properties before navigation. The function accepts two parameters, `crawlingContext` and `gotoOptions`,
109
- * which are passed to the `page.goto()` function the crawler calls to navigate.
110
- * Example:
111
- * ```
112
- * preNavigationHooks: [
113
- * async (crawlingContext, gotoOptions) => {
114
- * const { page } = crawlingContext;
115
- * await page.evaluate((attr) => { window.foo = attr; }, 'bar');
116
- * },
117
- * ]
118
- * ```
119
- * @property {Array<Hook>} [postNavigationHooks]
120
- * Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful.
121
- * The function accepts `crawlingContext` as the only parameter.
122
- * Example:
123
- * ```
124
- * postNavigationHooks: [
125
- * async (crawlingContext) => {
126
- * const { page } = crawlingContext;
127
- * if (hasCaptcha(page)) {
128
- * await solveCaptcha (page);
129
- * }
130
- * },
131
- * ]
132
- * ```
133
- * @property {RequestList} [requestList]
134
- * Static list of URLs to be processed.
135
- * Either `requestList` or `requestQueue` option must be provided (or both).
136
- * @property {RequestQueue} [requestQueue]
137
- * Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites.
138
- * Either `requestList` or `requestQueue` option must be provided (or both).
139
- * @property {number} [handleRequestTimeoutSecs=60]
140
- * Timeout in which the function passed as `handleRequestFunction` needs to finish, in seconds.
141
- * @property {HandleFailedRequest} [handleFailedRequestFunction]
142
- * A function to handle requests that failed more than `option.maxRequestRetries` times.
143
- *
144
- * The function receives the following object as an argument:
145
- * ```
146
- * {
147
- * request: Request,
148
- * error: Error,
149
- * session: Session,
150
- * crawler: BrowserCrawler,
151
- * }
152
- * ```
153
- * where the {@link Request} instance corresponds to the failed request, and the `Error` instance
154
- * represents the last error thrown during processing of the request.
155
- *
156
- * See
157
- * [source code](https://github.com/apify/apify-js/blob/master/src/crawlers/basic_crawler.js#L11)
158
- * for the default implementation of this function.
159
- * @property {number} [maxRequestRetries=3]
160
- * Indicates how many times the request is retried if {@link BasicCrawlerOptions.handleRequestFunction} fails.
161
- * @property {number} [maxRequestsPerCrawl]
162
- * Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached.
163
- * Always set this value in order to prevent infinite loops in misconfigured crawlers.
164
- * Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value.
165
- * @property {AutoscaledPoolOptions} [autoscaledPoolOptions]
166
- * Custom options passed to the underlying {@link AutoscaledPool} constructor.
167
- * Note that the `runTaskFunction` and `isTaskReadyFunction` options
168
- * are provided by `BasicCrawler` and cannot be overridden.
169
- * However, you can provide a custom implementation of `isFinishedFunction`.
170
- * @property {number} [minConcurrency=1]
171
- * Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding {@link AutoscaledPool} option.
172
- *
173
- * *WARNING:* If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash.
174
- * If you're not sure, just keep the default value and the concurrency will scale up automatically.
175
- * @property {number} [maxConcurrency=1000]
176
- * Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding {@link AutoscaledPool} option.
177
- * @property {boolean} [useSessionPool=true]
178
- * Browser crawler will initialize the {@link SessionPool} with the corresponding `sessionPoolOptions`.
179
- * The session instance will be than available in the `handleRequestFunction`.
180
- * @property {SessionPoolOptions} [sessionPoolOptions] The configuration options for {@link SessionPool} to use.
181
- * @ignore
182
- */
183
- /**
184
- * Provides a simple framework for parallel crawling of web pages
185
- * using headless browsers with [Puppeteer](https://github.com/puppeteer/puppeteer)
186
- * and [Playwright](https://github.com/microsoft/playwright).
187
- * The URLs to crawl are fed either from a static list of URLs
188
- * or from a dynamic queue of URLs enabling recursive crawling of websites.
189
- *
190
- * Since `BrowserCrawler` uses headless or even headfull browsers to download web pages and extract data,
191
- * it is useful for crawling of websites that require to execute JavaScript.
192
- * If the target website doesn't need JavaScript, consider using {@link CheerioCrawler},
193
- * which downloads the pages using raw HTTP requests and is about 10x faster. @TODO: more?
194
- *
195
- * The source URLs are represented using {@link Request} objects that are fed from
196
- * {@link RequestList} or {@link RequestQueue} instances provided by the {@link BrowserCrawlerOptions.requestList}
197
- * or {@link BrowserCrawlerOptions.requestQueue} constructor options, respectively.
198
- *
199
- * If both {@link BrowserCrawlerOptions.requestList} and {@link BrowserCrawlerOptions.requestQueue} are used,
200
- * the instance first processes URLs from the {@link RequestList} and automatically enqueues all of them
201
- * to {@link RequestQueue} before it starts their processing. This ensures that a single URL is not crawled multiple times.
202
- *
203
- * The crawler finishes when there are no more {@link Request} objects to crawl.
204
- *
205
- * `BrowserCrawler` opens a new browser page (i.e. tab or window) for each {@link Request} object to crawl
206
- * and then calls the function provided by user as the {@link BrowserCrawlerOptions.handlePageFunction} option.
207
- *
208
- * New pages are only opened when there is enough free CPU and memory available,
209
- * using the functionality provided by the {@link AutoscaledPool} class.
210
- * All {@link AutoscaledPool} configuration options can be passed to the {@link BrowserCrawlerOptions.autoscaledPoolOptions}
211
- * parameter of the `BrowserCrawler` constructor. For user convenience, the `minConcurrency` and `maxConcurrency`
212
- * {@link AutoscaledPoolOptions} are available directly in the `BrowserCrawler` constructor.
213
- *
214
- * Note that the pool of browser instances is internally managed by the {@link BrowserPool} class.
215
- *
216
- * await crawler.run();
217
- * ```
218
- * @property {Statistics} stats
219
- * Contains statistics about the current run.
220
- * @property {RequestList} [requestList]
221
- * A reference to the underlying {@link RequestList} class that manages the crawler's {@link Request}s.
222
- * Only available if used by the crawler.
223
- * @property {RequestQueue} [requestQueue]
224
- * A reference to the underlying {@link RequestQueue} class that manages the crawler's {@link Request}s.
225
- * Only available if used by the crawler.
226
- * @property {SessionPool} [sessionPool]
227
- * A reference to the underlying {@link SessionPool} class that manages the crawler's {@link Session}s.
228
- * Only available if used by the crawler.
229
- * @property {ProxyConfiguration} [proxyConfiguration]
230
- * A reference to the underlying {@link ProxyConfiguration} class that manages the crawler's proxies.
231
- * Only available if used by the crawler.
232
- * @property {BrowserPool} browserPool
233
- * A reference to the underlying `BrowserPool` class that manages the crawler's browsers.
234
- * For more information about it, see the [`browser-pool` module](https://github.com/apify/browser-pool).
235
- * @property {AutoscaledPool} autoscaledPool
236
- * A reference to the underlying {@link AutoscaledPool} class that manages the concurrency of the crawler.
237
- * Note that this property is only initialized after calling the {@link CheerioCrawler#run} function.
238
- * You can use it to change the concurrency settings on the fly,
239
- * to pause the crawler by calling {@link AutoscaledPool#pause}
240
- * or to abort it by calling {@link AutoscaledPool#abort}.
241
- * @ignore
242
- */
243
- class BrowserCrawler extends basic_crawler_1.BasicCrawler {
244
- /**
245
- * @param {BrowserCrawlerOptions} options
246
- * All `BrowserCrawler` parameters are passed via an options object.
247
- */
248
- constructor(options) {
249
- (0, ow_1.default)(options, 'BrowserCrawlerOptions', ow_1.default.object.exactShape(BrowserCrawler.optionsShape));
250
- const { handlePageFunction, handlePageTimeoutSecs = 60, navigationTimeoutSecs = 60, gotoFunction, // deprecated
251
- gotoTimeoutSecs, // deprecated
252
- persistCookiesPerSession, proxyConfiguration, browserPoolOptions, preNavigationHooks = [], postNavigationHooks = [], ...basicCrawlerOptions } = options;
253
- super({
254
- ...basicCrawlerOptions,
255
- handleRequestFunction: (...args) => this._handleRequestFunction(...args),
256
- handleRequestTimeoutSecs: navigationTimeoutSecs + handlePageTimeoutSecs + constants_1.BASIC_CRAWLER_TIMEOUT_BUFFER_SECS,
257
- });
258
- // Cookies should be persisted per session only if session pool is used
259
- if (!this.useSessionPool && persistCookiesPerSession) {
260
- throw new Error('You cannot use "persistCookiesPerSession" without "useSessionPool" set to true.');
261
- }
262
- if (gotoTimeoutSecs) {
263
- this.log.deprecated('Option "gotoTimeoutSecs" is deprecated. Use "navigationTimeoutSecs" instead.');
264
- }
265
- this.handlePageFunction = handlePageFunction;
266
- this.handlePageTimeoutSecs = handlePageTimeoutSecs;
267
- this.handlePageTimeoutMillis = this.handlePageTimeoutSecs * 1000;
268
- this.navigationTimeoutMillis = (gotoTimeoutSecs || navigationTimeoutSecs) * 1000;
269
- this.gotoFunction = gotoFunction;
270
- this.defaultGotoOptions = {
271
- timeout: this.navigationTimeoutMillis,
272
- };
273
- this.proxyConfiguration = proxyConfiguration;
274
- /** @type {Array<Hook>} */
275
- this.preNavigationHooks = preNavigationHooks;
276
- /** @type {Array<Hook>} */
277
- this.postNavigationHooks = postNavigationHooks;
278
- if (this.useSessionPool) {
279
- this.persistCookiesPerSession = persistCookiesPerSession !== undefined ? persistCookiesPerSession : true;
280
- }
281
- else {
282
- this.persistCookiesPerSession = false;
283
- }
284
- const { preLaunchHooks = [], postLaunchHooks = [], ...rest } = browserPoolOptions;
285
- this.browserPool = new browser_pool_1.BrowserPool({
286
- ...rest,
287
- preLaunchHooks: [
288
- this._extendLaunchContext.bind(this),
289
- ...preLaunchHooks,
290
- ],
291
- postLaunchHooks: [
292
- this._maybeAddSessionRetiredListener.bind(this),
293
- ...postLaunchHooks,
294
- ],
295
- });
296
- }
297
- /**
298
- * Wrapper around handlePageFunction that opens and closes pages etc.
299
- *
300
- * @param {BrowserCrawlingContext & CrawlingContext} crawlingContext
301
- * @ignore
302
- * @protected
303
- * @internal
304
- */
305
- async _handleRequestFunction(crawlingContext) {
306
- const newPageOptions = {
307
- id: crawlingContext.id,
308
- };
309
- const useIncognitoPages = this.launchContext && this.launchContext.useIncognitoPages;
310
- if (this.proxyConfiguration && useIncognitoPages) {
311
- const { session } = crawlingContext;
312
- const proxyInfo = this.proxyConfiguration.newProxyInfo(session && session.id);
313
- crawlingContext.session = session;
314
- crawlingContext.proxyInfo = proxyInfo;
315
- newPageOptions.proxyUrl = proxyInfo.url;
316
- // Disable SSL verification for MITM proxies
317
- if (this.proxyConfiguration.isManInTheMiddle) {
318
- /**
319
- * @see https://playwright.dev/docs/api/class-browser/#browser-new-context
320
- * @see https://github.com/puppeteer/puppeteer/blob/main/docs/api.md
321
- */
322
- newPageOptions.pageOptions = {
323
- ignoreHTTPSErrors: true,
324
- };
325
- }
326
- }
327
- const page = await this.browserPool.newPage(newPageOptions);
328
- (0, timeout_1.tryCancel)();
329
- this._enhanceCrawlingContextWithPageInfo(crawlingContext, page, useIncognitoPages);
330
- // DO NOT MOVE THIS LINE ABOVE!
331
- // `enhanceCrawlingContextWithPageInfo` gives us a valid session.
332
- // For example, `sessionPoolOptions.sessionOptions.maxUsageCount` can be `1`.
333
- // So we must not save the session prior to making sure it was used only once, otherwise we would use it twice.
334
- const { request, session } = crawlingContext;
335
- if (this.useSessionPool) {
336
- const sessionCookies = session.getPuppeteerCookies(request.url);
337
- if (sessionCookies.length) {
338
- await crawlingContext.browserController.setCookies(page, sessionCookies);
339
- (0, timeout_1.tryCancel)();
340
- }
341
- }
342
- try {
343
- await this._handleNavigation(crawlingContext);
344
- (0, timeout_1.tryCancel)();
345
- await this._responseHandler(crawlingContext);
346
- (0, timeout_1.tryCancel)();
347
- // save cookies
348
- // @TODO: Should we save the cookies also after/only the handle page?
349
- if (this.persistCookiesPerSession) {
350
- const cookies = await crawlingContext.browserController.getCookies(page);
351
- (0, timeout_1.tryCancel)();
352
- session.setPuppeteerCookies(cookies, request.loadedUrl);
353
- }
354
- await (0, timeout_1.addTimeoutToPromise)(() => this.handlePageFunction(crawlingContext), this.handlePageTimeoutMillis, `handlePageFunction timed out after ${this.handlePageTimeoutMillis / 1000} seconds.`);
355
- (0, timeout_1.tryCancel)();
356
- if (session)
357
- session.markGood();
358
- }
359
- finally {
360
- page.close().catch((error) => this.log.debug('Error while closing page', { error }));
361
- }
362
- }
363
- /**
364
- * @param {BrowserCrawlingContext & CrawlingContext} crawlingContext
365
- * @param {*} page
366
- * @param {boolean} useIncognitoPages
367
- * @ignore
368
- * @protected
369
- * @internal
370
- */
371
- _enhanceCrawlingContextWithPageInfo(crawlingContext, page, useIncognitoPages) {
372
- crawlingContext.page = page;
373
- // This switch is because the crawlingContexts are created on per request basis.
374
- // However, we need to add the proxy info and session from browser, which is created based on the browser-pool configuration.
375
- // We would not have to do this switch if the proxy and configuration worked as in CheerioCrawler,
376
- // which configures proxy and session for every new request
377
- const browserControllerInstance = this.browserPool.getBrowserControllerByPage(page);
378
- crawlingContext.browserController = browserControllerInstance;
379
- if (!useIncognitoPages) {
380
- crawlingContext.session = browserControllerInstance.launchContext.session;
381
- }
382
- if (!crawlingContext.proxyInfo) {
383
- crawlingContext.proxyInfo = browserControllerInstance.launchContext.proxyInfo;
384
- }
385
- }
386
- /**
387
- * @param {BrowserCrawlingContext & CrawlingContext} crawlingContext
388
- * @ignore
389
- * @protected
390
- * @internal
391
- */
392
- async _handleNavigation(crawlingContext) {
393
- /** @type {*} */
394
- const gotoOptions = { ...this.defaultGotoOptions };
395
- await this._executeHooks(this.preNavigationHooks, crawlingContext, gotoOptions);
396
- (0, timeout_1.tryCancel)();
397
- try {
398
- crawlingContext.response = await this._navigationHandler(crawlingContext, gotoOptions);
399
- }
400
- catch (error) {
401
- this._handleNavigationTimeout(crawlingContext, error);
402
- throw error;
403
- }
404
- (0, timeout_1.tryCancel)();
405
- await this._executeHooks(this.postNavigationHooks, crawlingContext, gotoOptions);
406
- }
407
- /**
408
- * Marks session bad in case of navigation timeout.
409
- * @param {BrowserCrawlingContext & CrawlingContext} crawlingContext
410
- * @param {Error} error
411
- * @ignore
412
- * @protected
413
- * @internal
414
- */
415
- _handleNavigationTimeout(crawlingContext, error) {
416
- const { session } = crawlingContext;
417
- if (error && error.constructor.name === 'TimeoutError') {
418
- (0, crawler_utils_1.handleRequestTimeout)(session, error.message);
419
- }
420
- }
421
- /**
422
- * @param {BrowserCrawlingContext & CrawlingContext} crawlingContext
423
- * @param {Object<string,*>} gotoOptions
424
- * @ignore
425
- * @protected
426
- * @internal
427
- */
428
- async _navigationHandler(crawlingContext, gotoOptions) {
429
- if (!this.gotoFunction) {
430
- // @TODO: although it is optional in the validation,
431
- // because when you make automation library specific you can override this handler.
432
- throw new Error('BrowserCrawler: You must specify a gotoFunction!');
433
- }
434
- return this.gotoFunction(crawlingContext, gotoOptions);
435
- }
436
- /**
437
- * Should be overriden in case of different automation library that does not support this response API.
438
- * // @TODO: This can be also done as a postNavigation hook except the loadedUrl marking.
439
- * @param {BrowserCrawlingContext & CrawlingContext} crawlingContext
440
- * @return {Promise<void>}
441
- * @ignore
442
- * @protected
443
- * @internal
444
- */
445
- async _responseHandler(crawlingContext) {
446
- const { response, session, request, page } = crawlingContext;
447
- if (this.sessionPool && response) {
448
- if (typeof response === 'object' && typeof response.status === 'function') {
449
- (0, crawler_utils_1.throwOnBlockedRequest)(session, response.status());
450
- }
451
- else {
452
- this.log.debug('Got a malformed Browser response.', { request, response });
453
- }
454
- }
455
- request.loadedUrl = await page.url();
456
- }
457
- /**
458
- * @param {string} pageId
459
- * @param {*} launchContext
460
- * @ignore
461
- * @protected
462
- * @internal
463
- */
464
- async _extendLaunchContext(pageId, launchContext) {
465
- const launchContextExtends = {};
466
- if (this.sessionPool) {
467
- launchContextExtends.session = await this.sessionPool.getSession();
468
- }
469
- if (this.proxyConfiguration) {
470
- const proxyInfo = this.proxyConfiguration.newProxyInfo(launchContextExtends.session && launchContextExtends.session.id);
471
- launchContext.proxyUrl = proxyInfo.url;
472
- launchContextExtends.proxyInfo = proxyInfo;
473
- // Disable SSL verification for MITM proxies
474
- if (this.proxyConfiguration.isManInTheMiddle) {
475
- /**
476
- * @see https://playwright.dev/docs/api/class-browser/#browser-new-context
477
- * @see https://github.com/puppeteer/puppeteer/blob/main/docs/api.md
478
- */
479
- launchContext.launchOptions.ignoreHTTPSErrors = true;
480
- }
481
- }
482
- launchContext.extend(launchContextExtends);
483
- }
484
- /**
485
- *
486
- * @param {string} pageId
487
- * @param {BrowserController} browserController
488
- * @ignore
489
- * @protected
490
- * @internal
491
- */
492
- _maybeAddSessionRetiredListener(pageId, browserController) {
493
- if (this.sessionPool) {
494
- const listener = (session) => {
495
- const { launchContext } = browserController;
496
- if (session.id === launchContext.session.id) {
497
- this.browserPool.retireBrowserController(browserController);
498
- }
499
- };
500
- this.sessionPool.on(events_1.default.SESSION_RETIRED, listener);
501
- browserController.on('browserClosed', () => this.sessionPool.removeListener(events_1.default.SESSION_RETIRED, listener));
502
- }
503
- }
504
- /**
505
- * Function for cleaning up after all request are processed.
506
- * @ignore
507
- */
508
- async teardown() {
509
- await this.browserPool.destroy();
510
- await super.teardown();
511
- }
512
- }
513
- exports.default = BrowserCrawler;
514
- /**
515
- * @internal
516
- * @type any
517
- */
518
- Object.defineProperty(BrowserCrawler, "optionsShape", {
519
- enumerable: true,
520
- configurable: true,
521
- writable: true,
522
- value: {
523
- ...basic_crawler_1.BasicCrawler.optionsShape,
524
- // TODO temporary until the API is unified in V2
525
- handleRequestFunction: ow_1.default.undefined,
526
- handlePageFunction: ow_1.default.function,
527
- gotoFunction: ow_1.default.optional.function,
528
- gotoTimeoutSecs: ow_1.default.optional.number.greaterThan(0),
529
- navigationTimeoutSecs: ow_1.default.optional.number.greaterThan(0),
530
- handlePageTimeoutSecs: ow_1.default.optional.number.greaterThan(0),
531
- preNavigationHooks: ow_1.default.optional.array,
532
- postNavigationHooks: ow_1.default.optional.array,
533
- browserPoolOptions: ow_1.default.object,
534
- sessionPoolOptions: ow_1.default.optional.object,
535
- persistCookiesPerSession: ow_1.default.optional.boolean,
536
- useSessionPool: ow_1.default.optional.boolean,
537
- proxyConfiguration: ow_1.default.optional.object.validate(validators_1.validators.proxyConfiguration),
538
- }
539
- });
540
- //# sourceMappingURL=browser_crawler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser_crawler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