apify 2.3.1-beta.2 → 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.
- package/README.md +6 -5
- package/package.json +69 -128
- package/build/actor.d.ts +0 -113
- package/build/actor.d.ts.map +0 -1
- package/build/actor.js +0 -582
- package/build/actor.js.map +0 -1
- package/build/apify.d.ts +0 -752
- package/build/apify.d.ts.map +0 -1
- package/build/apify.js +0 -877
- package/build/apify.js.map +0 -1
- package/build/autoscaling/autoscaled_pool.d.ts +0 -384
- package/build/autoscaling/autoscaled_pool.d.ts.map +0 -1
- package/build/autoscaling/autoscaled_pool.js +0 -557
- package/build/autoscaling/autoscaled_pool.js.map +0 -1
- package/build/autoscaling/snapshotter.d.ts +0 -278
- package/build/autoscaling/snapshotter.d.ts.map +0 -1
- package/build/autoscaling/snapshotter.js +0 -447
- package/build/autoscaling/snapshotter.js.map +0 -1
- package/build/autoscaling/system_status.d.ts +0 -224
- package/build/autoscaling/system_status.d.ts.map +0 -1
- package/build/autoscaling/system_status.js +0 -228
- package/build/autoscaling/system_status.js.map +0 -1
- package/build/browser_launchers/browser_launcher.d.ts +0 -154
- package/build/browser_launchers/browser_launcher.d.ts.map +0 -1
- package/build/browser_launchers/browser_launcher.js +0 -160
- package/build/browser_launchers/browser_launcher.js.map +0 -1
- package/build/browser_launchers/browser_plugin.d.ts +0 -23
- package/build/browser_launchers/browser_plugin.d.ts.map +0 -1
- package/build/browser_launchers/browser_plugin.js +0 -25
- package/build/browser_launchers/browser_plugin.js.map +0 -1
- package/build/browser_launchers/playwright_launcher.d.ts +0 -131
- package/build/browser_launchers/playwright_launcher.d.ts.map +0 -1
- package/build/browser_launchers/playwright_launcher.js +0 -150
- package/build/browser_launchers/playwright_launcher.js.map +0 -1
- package/build/browser_launchers/puppeteer_launcher.d.ts +0 -153
- package/build/browser_launchers/puppeteer_launcher.d.ts.map +0 -1
- package/build/browser_launchers/puppeteer_launcher.js +0 -197
- package/build/browser_launchers/puppeteer_launcher.js.map +0 -1
- package/build/cache_container.d.ts +0 -31
- package/build/cache_container.d.ts.map +0 -1
- package/build/cache_container.js +0 -48
- package/build/cache_container.js.map +0 -1
- package/build/configuration.d.ts +0 -226
- package/build/configuration.d.ts.map +0 -1
- package/build/configuration.js +0 -325
- package/build/configuration.js.map +0 -1
- package/build/constants.d.ts +0 -37
- package/build/constants.d.ts.map +0 -1
- package/build/constants.js +0 -41
- package/build/constants.js.map +0 -1
- package/build/crawlers/basic_crawler.d.ts +0 -443
- package/build/crawlers/basic_crawler.d.ts.map +0 -1
- package/build/crawlers/basic_crawler.js +0 -664
- package/build/crawlers/basic_crawler.js.map +0 -1
- package/build/crawlers/browser_crawler.d.ts +0 -512
- package/build/crawlers/browser_crawler.d.ts.map +0 -1
- package/build/crawlers/browser_crawler.js +0 -540
- package/build/crawlers/browser_crawler.js.map +0 -1
- package/build/crawlers/cheerio_crawler.d.ts +0 -931
- package/build/crawlers/cheerio_crawler.d.ts.map +0 -1
- package/build/crawlers/cheerio_crawler.js +0 -913
- package/build/crawlers/cheerio_crawler.js.map +0 -1
- package/build/crawlers/crawler_extension.d.ts +0 -10
- package/build/crawlers/crawler_extension.d.ts.map +0 -1
- package/build/crawlers/crawler_extension.js +0 -19
- package/build/crawlers/crawler_extension.js.map +0 -1
- package/build/crawlers/crawler_utils.d.ts +0 -34
- package/build/crawlers/crawler_utils.d.ts.map +0 -1
- package/build/crawlers/crawler_utils.js +0 -87
- package/build/crawlers/crawler_utils.js.map +0 -1
- package/build/crawlers/playwright_crawler.d.ts +0 -448
- package/build/crawlers/playwright_crawler.d.ts.map +0 -1
- package/build/crawlers/playwright_crawler.js +0 -299
- package/build/crawlers/playwright_crawler.js.map +0 -1
- package/build/crawlers/puppeteer_crawler.d.ts +0 -425
- package/build/crawlers/puppeteer_crawler.d.ts.map +0 -1
- package/build/crawlers/puppeteer_crawler.js +0 -299
- package/build/crawlers/puppeteer_crawler.js.map +0 -1
- package/build/crawlers/statistics.d.ts +0 -185
- package/build/crawlers/statistics.d.ts.map +0 -1
- package/build/crawlers/statistics.js +0 -331
- package/build/crawlers/statistics.js.map +0 -1
- package/build/enqueue_links/click_elements.d.ts +0 -179
- package/build/enqueue_links/click_elements.d.ts.map +0 -1
- package/build/enqueue_links/click_elements.js +0 -434
- package/build/enqueue_links/click_elements.js.map +0 -1
- package/build/enqueue_links/enqueue_links.d.ts +0 -117
- package/build/enqueue_links/enqueue_links.d.ts.map +0 -1
- package/build/enqueue_links/enqueue_links.js +0 -163
- package/build/enqueue_links/enqueue_links.js.map +0 -1
- package/build/enqueue_links/shared.d.ts +0 -42
- package/build/enqueue_links/shared.d.ts.map +0 -1
- package/build/enqueue_links/shared.js +0 -121
- package/build/enqueue_links/shared.js.map +0 -1
- package/build/errors.d.ts +0 -29
- package/build/errors.d.ts.map +0 -1
- package/build/errors.js +0 -38
- package/build/errors.js.map +0 -1
- package/build/events.d.ts +0 -11
- package/build/events.d.ts.map +0 -1
- package/build/events.js +0 -147
- package/build/events.js.map +0 -1
- package/build/index.d.ts +0 -4
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -7
- package/build/index.js.map +0 -1
- package/build/main.d.ts +0 -179
- package/build/main.d.ts.map +0 -1
- package/build/main.js +0 -81
- package/build/main.js.map +0 -1
- package/build/playwright_utils.d.ts +0 -9
- package/build/playwright_utils.d.ts.map +0 -1
- package/build/playwright_utils.js +0 -90
- package/build/playwright_utils.js.map +0 -1
- package/build/proxy_configuration.d.ts +0 -411
- package/build/proxy_configuration.d.ts.map +0 -1
- package/build/proxy_configuration.js +0 -517
- package/build/proxy_configuration.js.map +0 -1
- package/build/pseudo_url.d.ts +0 -86
- package/build/pseudo_url.d.ts.map +0 -1
- package/build/pseudo_url.js +0 -153
- package/build/pseudo_url.js.map +0 -1
- package/build/puppeteer_request_interception.d.ts +0 -8
- package/build/puppeteer_request_interception.d.ts.map +0 -1
- package/build/puppeteer_request_interception.js +0 -235
- package/build/puppeteer_request_interception.js.map +0 -1
- package/build/puppeteer_utils.d.ts +0 -250
- package/build/puppeteer_utils.d.ts.map +0 -1
- package/build/puppeteer_utils.js +0 -551
- package/build/puppeteer_utils.js.map +0 -1
- package/build/request.d.ts +0 -180
- package/build/request.d.ts.map +0 -1
- package/build/request.js +0 -261
- package/build/request.js.map +0 -1
- package/build/request_list.d.ts +0 -581
- package/build/request_list.d.ts.map +0 -1
- package/build/request_list.js +0 -826
- package/build/request_list.js.map +0 -1
- package/build/serialization.d.ts +0 -5
- package/build/serialization.d.ts.map +0 -1
- package/build/serialization.js +0 -139
- package/build/serialization.js.map +0 -1
- package/build/session_pool/errors.d.ts +0 -11
- package/build/session_pool/errors.d.ts.map +0 -1
- package/build/session_pool/errors.js +0 -18
- package/build/session_pool/errors.js.map +0 -1
- package/build/session_pool/events.d.ts +0 -5
- package/build/session_pool/events.d.ts.map +0 -1
- package/build/session_pool/events.js +0 -6
- package/build/session_pool/events.js.map +0 -1
- package/build/session_pool/session.d.ts +0 -286
- package/build/session_pool/session.d.ts.map +0 -1
- package/build/session_pool/session.js +0 -355
- package/build/session_pool/session.js.map +0 -1
- package/build/session_pool/session_pool.d.ts +0 -280
- package/build/session_pool/session_pool.d.ts.map +0 -1
- package/build/session_pool/session_pool.js +0 -393
- package/build/session_pool/session_pool.js.map +0 -1
- package/build/session_pool/session_utils.d.ts +0 -4
- package/build/session_pool/session_utils.d.ts.map +0 -1
- package/build/session_pool/session_utils.js +0 -24
- package/build/session_pool/session_utils.js.map +0 -1
- package/build/stealth/hiding_tricks.d.ts +0 -22
- package/build/stealth/hiding_tricks.d.ts.map +0 -1
- package/build/stealth/hiding_tricks.js +0 -308
- package/build/stealth/hiding_tricks.js.map +0 -1
- package/build/stealth/stealth.d.ts +0 -56
- package/build/stealth/stealth.d.ts.map +0 -1
- package/build/stealth/stealth.js +0 -125
- package/build/stealth/stealth.js.map +0 -1
- package/build/storages/dataset.d.ts +0 -288
- package/build/storages/dataset.d.ts.map +0 -1
- package/build/storages/dataset.js +0 -480
- package/build/storages/dataset.js.map +0 -1
- package/build/storages/key_value_store.d.ts +0 -243
- package/build/storages/key_value_store.d.ts.map +0 -1
- package/build/storages/key_value_store.js +0 -462
- package/build/storages/key_value_store.js.map +0 -1
- package/build/storages/request_queue.d.ts +0 -318
- package/build/storages/request_queue.d.ts.map +0 -1
- package/build/storages/request_queue.js +0 -636
- package/build/storages/request_queue.js.map +0 -1
- package/build/storages/storage_manager.d.ts +0 -87
- package/build/storages/storage_manager.d.ts.map +0 -1
- package/build/storages/storage_manager.js +0 -150
- package/build/storages/storage_manager.js.map +0 -1
- package/build/tsconfig.tsbuildinfo +0 -1
- package/build/typedefs.d.ts +0 -146
- package/build/typedefs.d.ts.map +0 -1
- package/build/typedefs.js +0 -88
- package/build/typedefs.js.map +0 -1
- package/build/utils.d.ts +0 -175
- package/build/utils.d.ts.map +0 -1
- package/build/utils.js +0 -731
- package/build/utils.js.map +0 -1
- package/build/utils_log.d.ts +0 -41
- package/build/utils_log.d.ts.map +0 -1
- package/build/utils_log.js +0 -192
- package/build/utils_log.js.map +0 -1
- package/build/utils_request.d.ts +0 -77
- package/build/utils_request.d.ts.map +0 -1
- package/build/utils_request.js +0 -385
- package/build/utils_request.js.map +0 -1
- package/build/utils_social.d.ts +0 -210
- package/build/utils_social.d.ts.map +0 -1
- package/build/utils_social.js +0 -787
- package/build/utils_social.js.map +0 -1
- package/build/validators.d.ts +0 -23
- package/build/validators.d.ts.map +0 -1
- package/build/validators.js +0 -29
- package/build/validators.js.map +0 -1
package/build/apify.d.ts
DELETED
|
@@ -1,752 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `Apify` class serves as an alternative approach to the static helpers exported from the package. It allows to pass configuration
|
|
3
|
-
* that will be used on the instance methods. Environment variables will have precedence over this configuration.
|
|
4
|
-
* See {@link Configuration} for details about what can be configured and what are the default values.
|
|
5
|
-
*
|
|
6
|
-
* @property {Configuration} config Configuration of this SDK instance (provided to its constructor). See {@link Configuration} for details.
|
|
7
|
-
* @ignore
|
|
8
|
-
*/
|
|
9
|
-
export class Apify {
|
|
10
|
-
constructor(options?: {});
|
|
11
|
-
config: Configuration;
|
|
12
|
-
_storageManagers: Map<any, any>;
|
|
13
|
-
/**
|
|
14
|
-
* Runs the main user function that performs the job of the actor
|
|
15
|
-
* and terminates the process when the user function finishes.
|
|
16
|
-
*
|
|
17
|
-
* **The `Apify.main()` function is optional** and is provided merely for your convenience.
|
|
18
|
-
* It is mainly useful when you're running your code as an actor on the [Apify platform](https://apify.com/actors).
|
|
19
|
-
* However, if you want to use Apify SDK tools directly inside your existing projects, e.g.
|
|
20
|
-
* running in an [Express](https://expressjs.com/) server, on
|
|
21
|
-
* [Google Cloud functions](https://cloud.google.com/functions)
|
|
22
|
-
* or [AWS Lambda](https://aws.amazon.com/lambda/), it's better to avoid
|
|
23
|
-
* it since the function terminates the main process when it finishes!
|
|
24
|
-
*
|
|
25
|
-
* The `Apify.main()` function performs the following actions:
|
|
26
|
-
*
|
|
27
|
-
* - When running on the Apify platform (i.e. <code>APIFY_IS_AT_HOME</code> environment variable is set),
|
|
28
|
-
* it sets up a connection to listen for platform events.
|
|
29
|
-
* For example, to get a notification about an imminent migration to another server.
|
|
30
|
-
* See {@link Apify.events} for details.
|
|
31
|
-
* - It checks that either <code>APIFY_TOKEN</code> or <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable
|
|
32
|
-
* is defined. If not, the functions sets <code>APIFY_LOCAL_STORAGE_DIR</code> to <code>./apify_storage</code>
|
|
33
|
-
* inside the current working directory. This is to simplify running code examples.
|
|
34
|
-
* - It invokes the user function passed as the <code>userFunc</code> parameter.
|
|
35
|
-
* - If the user function returned a promise, waits for it to resolve.
|
|
36
|
-
* - If the user function throws an exception or some other error is encountered,
|
|
37
|
-
* prints error details to console so that they are stored to the log.
|
|
38
|
-
* - Exits the Node.js process, with zero exit code on success and non-zero on errors.
|
|
39
|
-
*
|
|
40
|
-
* The user function can be synchronous:
|
|
41
|
-
*
|
|
42
|
-
* ```javascript
|
|
43
|
-
* Apify.main(() => {
|
|
44
|
-
* // My synchronous function that returns immediately
|
|
45
|
-
* console.log('Hello world from actor!');
|
|
46
|
-
* });
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* If the user function returns a promise, it is considered asynchronous:
|
|
50
|
-
* ```javascript
|
|
51
|
-
* const { requestAsBrowser } = require('some-request-library');
|
|
52
|
-
*
|
|
53
|
-
* Apify.main(() => {
|
|
54
|
-
* // My asynchronous function that returns a promise
|
|
55
|
-
* return request('http://www.example.com').then((html) => {
|
|
56
|
-
* console.log(html);
|
|
57
|
-
* });
|
|
58
|
-
* });
|
|
59
|
-
* ```
|
|
60
|
-
*
|
|
61
|
-
* To simplify your code, you can take advantage of the `async`/`await` keywords:
|
|
62
|
-
*
|
|
63
|
-
* ```javascript
|
|
64
|
-
* const request = require('some-request-library');
|
|
65
|
-
*
|
|
66
|
-
* Apify.main(async () => {
|
|
67
|
-
* // My asynchronous function
|
|
68
|
-
* const html = await request('http://www.example.com');
|
|
69
|
-
* console.log(html);
|
|
70
|
-
* });
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* @param {UserFunc} userFunc User function to be executed. If it returns a promise,
|
|
74
|
-
* the promise will be awaited. The user function is called with no arguments.
|
|
75
|
-
* @return {Promise<unknown>}
|
|
76
|
-
*/
|
|
77
|
-
main(userFunc: UserFunc): Promise<unknown>;
|
|
78
|
-
/**
|
|
79
|
-
* Runs an actor on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
|
|
80
|
-
* waits for the actor to finish and fetches its output.
|
|
81
|
-
*
|
|
82
|
-
* By passing the `waitSecs` option you can reduce the maximum amount of time to wait for the run to finish.
|
|
83
|
-
* If the value is less than or equal to zero, the function returns immediately after the run is started.
|
|
84
|
-
*
|
|
85
|
-
* The result of the function is an {@link ActorRun} object
|
|
86
|
-
* that contains details about the actor run and its output (if any).
|
|
87
|
-
* If the actor run fails, the function throws the {@link ApifyCallError} exception.
|
|
88
|
-
*
|
|
89
|
-
* If you want to run an actor task rather than an actor, please use the
|
|
90
|
-
* {@link Apify#callTask} function instead.
|
|
91
|
-
*
|
|
92
|
-
* For more information about actors, read the
|
|
93
|
-
* [documentation](https://docs.apify.com/actor).
|
|
94
|
-
*
|
|
95
|
-
* **Example usage:**
|
|
96
|
-
*
|
|
97
|
-
* ```javascript
|
|
98
|
-
* const run = await Apify.call('apify/hello-world', { myInput: 123 });
|
|
99
|
-
* console.log(`Received message: ${run.output.body.message}`);
|
|
100
|
-
* ```
|
|
101
|
-
*
|
|
102
|
-
* Internally, the `call()` function invokes the
|
|
103
|
-
* [Run actor](https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor)
|
|
104
|
-
* and several other API endpoints to obtain the output.
|
|
105
|
-
*
|
|
106
|
-
* @param {string} actId
|
|
107
|
-
* Allowed formats are `username/actor-name`, `userId/actor-name` or actor ID.
|
|
108
|
-
* @param {Object<string, *>} [input]
|
|
109
|
-
* Input for the actor. If it is an object, it will be stringified to
|
|
110
|
-
* JSON and its content type set to `application/json; charset=utf-8`.
|
|
111
|
-
* Otherwise the `options.contentType` parameter must be provided.
|
|
112
|
-
* @param {object} [options]
|
|
113
|
-
* Object with the settings below:
|
|
114
|
-
* @param {string} [options.contentType]
|
|
115
|
-
* Content type for the `input`. If not specified,
|
|
116
|
-
* `input` is expected to be an object that will be stringified to JSON and content type set to
|
|
117
|
-
* `application/json; charset=utf-8`. If `options.contentType` is specified, then `input` must be a
|
|
118
|
-
* `String` or `Buffer`.
|
|
119
|
-
* @param {string} [options.token]
|
|
120
|
-
* User API token that is used to run the actor. By default, it is taken from the `APIFY_TOKEN` environment variable.
|
|
121
|
-
* @param {number} [options.memoryMbytes]
|
|
122
|
-
* Memory in megabytes which will be allocated for the new actor run.
|
|
123
|
-
* If not provided, the run uses memory of the default actor run configuration.
|
|
124
|
-
* @param {number} [options.timeoutSecs]
|
|
125
|
-
* Timeout for the actor run in seconds. Zero value means there is no timeout.
|
|
126
|
-
* If not provided, the run uses timeout of the default actor run configuration.
|
|
127
|
-
* @param {string} [options.build]
|
|
128
|
-
* Tag or number of the actor build to run (e.g. `beta` or `1.2.345`).
|
|
129
|
-
* If not provided, the run uses build tag or number from the default actor run configuration (typically `latest`).
|
|
130
|
-
* @param {number} [options.waitSecs]
|
|
131
|
-
* Maximum time to wait for the actor run to finish, in seconds.
|
|
132
|
-
* If the limit is reached, the returned promise is resolved to a run object that will have
|
|
133
|
-
* status `READY` or `RUNNING` and it will not contain the actor run output.
|
|
134
|
-
* If `waitSecs` is null or undefined, the function waits for the actor to finish (default behavior).
|
|
135
|
-
* @param {boolean} [options.fetchOutput=true]
|
|
136
|
-
* If `false` then the function does not fetch output of the actor.
|
|
137
|
-
* @param {boolean} [options.disableBodyParser=false]
|
|
138
|
-
* If `true` then the function will not attempt to parse the
|
|
139
|
-
* actor's output and will return it in a raw `Buffer`.
|
|
140
|
-
* @param {Array<AdhocWebhook>} [options.webhooks] Specifies optional webhooks associated with the actor run, which can be used
|
|
141
|
-
* to receive a notification e.g. when the actor finished or failed, see
|
|
142
|
-
* [ad hook webhooks documentation](https://docs.apify.com/webhooks/ad-hoc-webhooks) for detailed description.
|
|
143
|
-
* @returns {Promise<ActorRun>}
|
|
144
|
-
* @throws {ApifyCallError} If the run did not succeed, e.g. if it failed or timed out.
|
|
145
|
-
*/
|
|
146
|
-
call(actId: string, input?: {
|
|
147
|
-
[x: string]: any;
|
|
148
|
-
} | undefined, options?: {
|
|
149
|
-
contentType?: string | undefined;
|
|
150
|
-
token?: string | undefined;
|
|
151
|
-
memoryMbytes?: number | undefined;
|
|
152
|
-
timeoutSecs?: number | undefined;
|
|
153
|
-
build?: string | undefined;
|
|
154
|
-
waitSecs?: number | undefined;
|
|
155
|
-
fetchOutput?: boolean | undefined;
|
|
156
|
-
disableBodyParser?: boolean | undefined;
|
|
157
|
-
webhooks?: AdhocWebhook[] | undefined;
|
|
158
|
-
} | undefined): Promise<ActorRun>;
|
|
159
|
-
/**
|
|
160
|
-
* Runs an actor task on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
|
|
161
|
-
* waits for the task to finish and fetches its output.
|
|
162
|
-
*
|
|
163
|
-
* By passing the `waitSecs` option you can reduce the maximum amount of time to wait for the run to finish.
|
|
164
|
-
* If the value is less than or equal to zero, the function returns immediately after the run is started.
|
|
165
|
-
*
|
|
166
|
-
* The result of the function is an {@link ActorRun} object
|
|
167
|
-
* that contains details about the actor run and its output (if any).
|
|
168
|
-
* If the actor run failed, the function fails with {@link ApifyCallError} exception.
|
|
169
|
-
*
|
|
170
|
-
* Note that an actor task is a saved input configuration and options for an actor.
|
|
171
|
-
* If you want to run an actor directly rather than an actor task, please use the
|
|
172
|
-
* {@link Apify#call} function instead.
|
|
173
|
-
*
|
|
174
|
-
* For more information about actor tasks, read the [documentation](https://docs.apify.com/tasks).
|
|
175
|
-
*
|
|
176
|
-
* **Example usage:**
|
|
177
|
-
*
|
|
178
|
-
* ```javascript
|
|
179
|
-
* const run = await Apify.callTask('bob/some-task');
|
|
180
|
-
* console.log(`Received message: ${run.output.body.message}`);
|
|
181
|
-
* ```
|
|
182
|
-
*
|
|
183
|
-
* Internally, the `callTask()` function calls the
|
|
184
|
-
* [Run task](https://apify.com/docs/api/v2#/reference/actor-tasks/run-collection/run-task)
|
|
185
|
-
* and several other API endpoints to obtain the output.
|
|
186
|
-
*
|
|
187
|
-
* @param {string} taskId
|
|
188
|
-
* Allowed formats are `username/task-name`, `userId/task-name` or task ID.
|
|
189
|
-
* @param {Object<string, *>} [input]
|
|
190
|
-
* Input overrides for the actor task. If it is an object, it will be stringified to
|
|
191
|
-
* JSON and its content type set to `application/json; charset=utf-8`.
|
|
192
|
-
* Provided input will be merged with actor task input.
|
|
193
|
-
* @param {object} [options]
|
|
194
|
-
* Object with the settings below:
|
|
195
|
-
* @param {string} [options.token]
|
|
196
|
-
* User API token that is used to run the actor. By default, it is taken from the `APIFY_TOKEN` environment variable.
|
|
197
|
-
* @param {number} [options.memoryMbytes]
|
|
198
|
-
* Memory in megabytes which will be allocated for the new actor task run.
|
|
199
|
-
* If not provided, the run uses memory of the default actor run configuration.
|
|
200
|
-
* @param {number} [options.timeoutSecs]
|
|
201
|
-
* Timeout for the actor task run in seconds. Zero value means there is no timeout.
|
|
202
|
-
* If not provided, the run uses timeout of the default actor run configuration.
|
|
203
|
-
* @param {string} [options.build]
|
|
204
|
-
* Tag or number of the actor build to run (e.g. `beta` or `1.2.345`).
|
|
205
|
-
* If not provided, the run uses build tag or number from the default actor run configuration (typically `latest`).
|
|
206
|
-
* @param {number} [options.waitSecs]
|
|
207
|
-
* Maximum time to wait for the actor task run to finish, in seconds.
|
|
208
|
-
* If the limit is reached, the returned promise is resolved to a run object that will have
|
|
209
|
-
* status `READY` or `RUNNING` and it will not contain the actor run output.
|
|
210
|
-
* If `waitSecs` is null or undefined, the function waits for the actor task to finish (default behavior).
|
|
211
|
-
* @param {Array<AdhocWebhook>} [options.webhooks] Specifies optional webhooks associated with the actor run, which can be used
|
|
212
|
-
* to receive a notification e.g. when the actor finished or failed, see
|
|
213
|
-
* [ad hook webhooks documentation](https://docs.apify.com/webhooks/ad-hoc-webhooks) for detailed description.
|
|
214
|
-
* @returns {Promise<ActorRun>}
|
|
215
|
-
* @throws {ApifyCallError} If the run did not succeed, e.g. if it failed or timed out.
|
|
216
|
-
*/
|
|
217
|
-
callTask(taskId: string, input?: {
|
|
218
|
-
[x: string]: any;
|
|
219
|
-
} | undefined, options?: {
|
|
220
|
-
token?: string | undefined;
|
|
221
|
-
memoryMbytes?: number | undefined;
|
|
222
|
-
timeoutSecs?: number | undefined;
|
|
223
|
-
build?: string | undefined;
|
|
224
|
-
waitSecs?: number | undefined;
|
|
225
|
-
webhooks?: AdhocWebhook[] | undefined;
|
|
226
|
-
} | undefined): Promise<ActorRun>;
|
|
227
|
-
/**
|
|
228
|
-
* Transforms this actor run to an actor run of a given actor. The system stops the current container and starts
|
|
229
|
-
* the new container instead. All the default storages are preserved and the new input is stored under the `INPUT-METAMORPH-1` key
|
|
230
|
-
* in the same default key-value store.
|
|
231
|
-
*
|
|
232
|
-
* @param {string} targetActorId
|
|
233
|
-
* Either `username/actor-name` or actor ID of an actor to which we want to metamorph.
|
|
234
|
-
* @param {Object<string, *>} [input]
|
|
235
|
-
* Input for the actor. If it is an object, it will be stringified to
|
|
236
|
-
* JSON and its content type set to `application/json; charset=utf-8`.
|
|
237
|
-
* Otherwise the `options.contentType` parameter must be provided.
|
|
238
|
-
* @param {object} [options]
|
|
239
|
-
* Object with the settings below:
|
|
240
|
-
* @param {string} [options.contentType]
|
|
241
|
-
* Content type for the `input`. If not specified,
|
|
242
|
-
* `input` is expected to be an object that will be stringified to JSON and content type set to
|
|
243
|
-
* `application/json; charset=utf-8`. If `options.contentType` is specified, then `input` must be a
|
|
244
|
-
* `String` or `Buffer`.
|
|
245
|
-
* @param {string} [options.build]
|
|
246
|
-
* Tag or number of the target actor build to metamorph into (e.g. `beta` or `1.2.345`).
|
|
247
|
-
* If not provided, the run uses build tag or number from the default actor run configuration (typically `latest`).
|
|
248
|
-
* @returns {Promise<void>}
|
|
249
|
-
*/
|
|
250
|
-
metamorph(targetActorId: string, input?: {
|
|
251
|
-
[x: string]: any;
|
|
252
|
-
} | undefined, options?: {
|
|
253
|
-
contentType?: string | undefined;
|
|
254
|
-
build?: string | undefined;
|
|
255
|
-
} | undefined): Promise<void>;
|
|
256
|
-
/**
|
|
257
|
-
*
|
|
258
|
-
* Creates an ad-hoc webhook for the current actor run, which lets you receive a notification when the actor run finished or failed.
|
|
259
|
-
* For more information about Apify actor webhooks, please see the [documentation](https://docs.apify.com/webhooks).
|
|
260
|
-
*
|
|
261
|
-
* Note that webhooks are only supported for actors running on the Apify platform.
|
|
262
|
-
* In local environment, the function will print a warning and have no effect.
|
|
263
|
-
*
|
|
264
|
-
* @param {object} options
|
|
265
|
-
* @param {EventTypes} options.eventTypes
|
|
266
|
-
* Array of event types, which you can set for actor run, see
|
|
267
|
-
* the [actor run events](https://docs.apify.com/webhooks/events#actor-run) in the Apify doc.
|
|
268
|
-
* @param {string} options.requestUrl
|
|
269
|
-
* URL which will be requested using HTTP POST request, when actor run will reach the set event type.
|
|
270
|
-
* @param {string} [options.payloadTemplate]
|
|
271
|
-
* Payload template is a JSON-like string that describes the structure of the webhook POST request payload.
|
|
272
|
-
* It uses JSON syntax, extended with a double curly braces syntax for injecting variables `{{variable}}`.
|
|
273
|
-
* Those variables are resolved at the time of the webhook's dispatch, and a list of available variables with their descriptions
|
|
274
|
-
* is available in the [Apify webhook documentation](https://docs.apify.com/webhooks).
|
|
275
|
-
* If `payloadTemplate` is omitted, the default payload template is used
|
|
276
|
-
* ([view docs](https://docs.apify.com/webhooks/actions#payload-template)).
|
|
277
|
-
* @param {string} [options.idempotencyKey]
|
|
278
|
-
* Idempotency key enables you to ensure that a webhook will not be added multiple times in case of
|
|
279
|
-
* an actor restart or other situation that would cause the `addWebhook()` function to be called again.
|
|
280
|
-
* We suggest using the actor run ID as the idempotency key. You can get the run ID by calling
|
|
281
|
-
* {@link Apify#getEnv} function.
|
|
282
|
-
* @return {Promise<WebhookRun|undefined>} The return value is the Webhook object.
|
|
283
|
-
* For more information, see the [Get webhook](https://apify.com/docs/api/v2#/reference/webhooks/webhook-object/get-webhook) API endpoint.
|
|
284
|
-
*/
|
|
285
|
-
addWebhook(options: {
|
|
286
|
-
eventTypes: EventTypes;
|
|
287
|
-
requestUrl: string;
|
|
288
|
-
payloadTemplate?: string | undefined;
|
|
289
|
-
idempotencyKey?: string | undefined;
|
|
290
|
-
}): Promise<WebhookRun | undefined>;
|
|
291
|
-
/**
|
|
292
|
-
* Stores an object or an array of objects to the default {@link Dataset} of the current actor run.
|
|
293
|
-
*
|
|
294
|
-
* This is just a convenient shortcut for {@link Dataset#pushData}.
|
|
295
|
-
* For example, calling the following code:
|
|
296
|
-
* ```javascript
|
|
297
|
-
* await Apify.pushData({ myValue: 123 });
|
|
298
|
-
* ```
|
|
299
|
-
*
|
|
300
|
-
* is equivalent to:
|
|
301
|
-
* ```javascript
|
|
302
|
-
* const dataset = await Apify.openDataset();
|
|
303
|
-
* await dataset.pushData({ myValue: 123 });
|
|
304
|
-
* ```
|
|
305
|
-
*
|
|
306
|
-
* For more information, see {@link Apify#openDataset} and {@link Dataset#pushData}
|
|
307
|
-
*
|
|
308
|
-
* **IMPORTANT**: Make sure to use the `await` keyword when calling `pushData()`,
|
|
309
|
-
* otherwise the actor process might finish before the data are stored!
|
|
310
|
-
*
|
|
311
|
-
* @param {object} item Object or array of objects containing data to be stored in the default dataset.
|
|
312
|
-
* The objects must be serializable to JSON and the JSON representation of each object must be smaller than 9MB.
|
|
313
|
-
* @returns {Promise<void>}
|
|
314
|
-
*/
|
|
315
|
-
pushData(item: object): Promise<void>;
|
|
316
|
-
/**
|
|
317
|
-
* Opens a dataset and returns a promise resolving to an instance of the {@link Dataset} class.
|
|
318
|
-
*
|
|
319
|
-
* Datasets are used to store structured data where each object stored has the same attributes,
|
|
320
|
-
* such as online store products or real estate offers.
|
|
321
|
-
* The actual data is stored either on the local filesystem or in the cloud.
|
|
322
|
-
*
|
|
323
|
-
* For more details and code examples, see the {@link Dataset} class.
|
|
324
|
-
*
|
|
325
|
-
* @param {string} [datasetIdOrName]
|
|
326
|
-
* ID or name of the dataset to be opened. If `null` or `undefined`,
|
|
327
|
-
* the function returns the default dataset associated with the actor run.
|
|
328
|
-
* @param {Object} [options]
|
|
329
|
-
* @param {boolean} [options.forceCloud=false]
|
|
330
|
-
* If set to `true` then the function uses cloud storage usage even if the `APIFY_LOCAL_STORAGE_DIR`
|
|
331
|
-
* environment variable is set. This way it is possible to combine local and cloud storage.
|
|
332
|
-
* @returns {Promise<Dataset>}
|
|
333
|
-
*/
|
|
334
|
-
openDataset(datasetIdOrName?: string | undefined, options?: {
|
|
335
|
-
forceCloud?: boolean | undefined;
|
|
336
|
-
} | undefined): Promise<Dataset>;
|
|
337
|
-
/**
|
|
338
|
-
* Gets a value from the default {@link KeyValueStore} associated with the current actor run.
|
|
339
|
-
*
|
|
340
|
-
* This is just a convenient shortcut for {@link KeyValueStore#getValue}.
|
|
341
|
-
* For example, calling the following code:
|
|
342
|
-
* ```javascript
|
|
343
|
-
* const value = await Apify.getValue('my-key');
|
|
344
|
-
* ```
|
|
345
|
-
*
|
|
346
|
-
* is equivalent to:
|
|
347
|
-
* ```javascript
|
|
348
|
-
* const store = await Apify.openKeyValueStore();
|
|
349
|
-
* const value = await store.getValue('my-key');
|
|
350
|
-
* ```
|
|
351
|
-
*
|
|
352
|
-
* To store the value to the default key-value store, you can use the {@link Apify#setValue} function.
|
|
353
|
-
*
|
|
354
|
-
* For more information, see {@link Apify#openKeyValueStore}
|
|
355
|
-
* and {@link KeyValueStore#getValue}.
|
|
356
|
-
*
|
|
357
|
-
* @param {string} key
|
|
358
|
-
* Unique record key.
|
|
359
|
-
* @returns {Promise<Object<string, *>|string|Buffer|null>}
|
|
360
|
-
* Returns a promise that resolves to an object, string
|
|
361
|
-
* or [`Buffer`](https://nodejs.org/api/buffer.html), depending
|
|
362
|
-
* on the MIME content type of the record, or `null`
|
|
363
|
-
* if the record is missing.
|
|
364
|
-
*/
|
|
365
|
-
getValue(key: string): Promise<{
|
|
366
|
-
[x: string]: any;
|
|
367
|
-
} | string | Buffer | null>;
|
|
368
|
-
/**
|
|
369
|
-
* Stores or deletes a value in the default {@link KeyValueStore} associated with the current actor run.
|
|
370
|
-
*
|
|
371
|
-
* This is just a convenient shortcut for {@link KeyValueStore#setValue}.
|
|
372
|
-
* For example, calling the following code:
|
|
373
|
-
* ```javascript
|
|
374
|
-
* await Apify.setValue('OUTPUT', { foo: "bar" });
|
|
375
|
-
* ```
|
|
376
|
-
*
|
|
377
|
-
* is equivalent to:
|
|
378
|
-
* ```javascript
|
|
379
|
-
* const store = await Apify.openKeyValueStore();
|
|
380
|
-
* await store.setValue('OUTPUT', { foo: "bar" });
|
|
381
|
-
* ```
|
|
382
|
-
*
|
|
383
|
-
* To get a value from the default key-value store, you can use the {@link Apify#getValue} function.
|
|
384
|
-
*
|
|
385
|
-
* For more information, see {@link Apify#openKeyValueStore}
|
|
386
|
-
* and {@link KeyValueStore#getValue}.
|
|
387
|
-
*
|
|
388
|
-
* @param {string} key
|
|
389
|
-
* Unique record key.
|
|
390
|
-
* @param {*} value
|
|
391
|
-
* Record data, which can be one of the following values:
|
|
392
|
-
* - If `null`, the record in the key-value store is deleted.
|
|
393
|
-
* - If no `options.contentType` is specified, `value` can be any JavaScript object and it will be stringified to JSON.
|
|
394
|
-
* - If `options.contentType` is set, `value` is taken as is and it must be a `String` or [`Buffer`](https://nodejs.org/api/buffer.html).
|
|
395
|
-
* For any other value an error will be thrown.
|
|
396
|
-
* @param {object} [options]
|
|
397
|
-
* @param {string} [options.contentType]
|
|
398
|
-
* Specifies a custom MIME content type of the record.
|
|
399
|
-
* @return {Promise<void>}
|
|
400
|
-
*/
|
|
401
|
-
setValue(key: string, value: any, options?: {
|
|
402
|
-
contentType?: string | undefined;
|
|
403
|
-
} | undefined): Promise<void>;
|
|
404
|
-
/**
|
|
405
|
-
* Gets the actor input value from the default {@link KeyValueStore} associated with the current actor run.
|
|
406
|
-
*
|
|
407
|
-
* This is just a convenient shortcut for [`keyValueStore.getValue('INPUT')`](key-value-store#getvalue).
|
|
408
|
-
* For example, calling the following code:
|
|
409
|
-
* ```javascript
|
|
410
|
-
* const input = await Apify.getInput();
|
|
411
|
-
* ```
|
|
412
|
-
*
|
|
413
|
-
* is equivalent to:
|
|
414
|
-
* ```javascript
|
|
415
|
-
* const store = await Apify.openKeyValueStore();
|
|
416
|
-
* await store.getValue('INPUT');
|
|
417
|
-
* ```
|
|
418
|
-
*
|
|
419
|
-
* Note that the `getInput()` function does not cache the value read from the key-value store.
|
|
420
|
-
* If you need to use the input multiple times in your actor,
|
|
421
|
-
* it is far more efficient to read it once and store it locally.
|
|
422
|
-
*
|
|
423
|
-
* For more information, see {@link Apify#openKeyValueStore}
|
|
424
|
-
* and {@link KeyValueStore#getValue}.
|
|
425
|
-
*
|
|
426
|
-
* @returns {Promise<Object<string, *>|string|Buffer|null>}
|
|
427
|
-
* Returns a promise that resolves to an object, string
|
|
428
|
-
* or [`Buffer`](https://nodejs.org/api/buffer.html), depending
|
|
429
|
-
* on the MIME content type of the record, or `null`
|
|
430
|
-
* if the record is missing.
|
|
431
|
-
*/
|
|
432
|
-
getInput(): Promise<{
|
|
433
|
-
[x: string]: any;
|
|
434
|
-
} | string | Buffer | null>;
|
|
435
|
-
/**
|
|
436
|
-
* Opens a key-value store and returns a promise resolving to an instance of the {@link KeyValueStore} class.
|
|
437
|
-
*
|
|
438
|
-
* Key-value stores are used to store records or files, along with their MIME content type.
|
|
439
|
-
* The records are stored and retrieved using a unique key.
|
|
440
|
-
* The actual data is stored either on a local filesystem or in the Apify cloud.
|
|
441
|
-
*
|
|
442
|
-
* For more details and code examples, see the {@link KeyValueStore} class.
|
|
443
|
-
*
|
|
444
|
-
* @param {string} [storeIdOrName]
|
|
445
|
-
* ID or name of the key-value store to be opened. If `null` or `undefined`,
|
|
446
|
-
* the function returns the default key-value store associated with the actor run.
|
|
447
|
-
* @param {object} [options]
|
|
448
|
-
* @param {boolean} [options.forceCloud=false]
|
|
449
|
-
* If set to `true` then the function uses cloud storage usage even if the `APIFY_LOCAL_STORAGE_DIR`
|
|
450
|
-
* environment variable is set. This way it is possible to combine local and cloud storage.
|
|
451
|
-
* @returns {Promise<KeyValueStore>}
|
|
452
|
-
*/
|
|
453
|
-
openKeyValueStore(storeIdOrName?: string | undefined, options?: {
|
|
454
|
-
forceCloud?: boolean | undefined;
|
|
455
|
-
} | undefined): Promise<KeyValueStore>;
|
|
456
|
-
/**
|
|
457
|
-
* Opens a request list and returns a promise resolving to an instance
|
|
458
|
-
* of the {@link RequestList} class that is already initialized.
|
|
459
|
-
*
|
|
460
|
-
* {@link RequestList} represents a list of URLs to crawl, which is always stored in memory.
|
|
461
|
-
* To enable picking up where left off after a process restart, the request list sources
|
|
462
|
-
* are persisted to the key-value store at initialization of the list. Then, while crawling,
|
|
463
|
-
* a small state object is regularly persisted to keep track of the crawling status.
|
|
464
|
-
*
|
|
465
|
-
* For more details and code examples, see the {@link RequestList} class.
|
|
466
|
-
*
|
|
467
|
-
* **Example usage:**
|
|
468
|
-
*
|
|
469
|
-
* ```javascript
|
|
470
|
-
* const sources = [
|
|
471
|
-
* 'https://www.example.com',
|
|
472
|
-
* 'https://www.google.com',
|
|
473
|
-
* 'https://www.bing.com'
|
|
474
|
-
* ];
|
|
475
|
-
*
|
|
476
|
-
* const requestList = await Apify.openRequestList('my-name', sources);
|
|
477
|
-
* ```
|
|
478
|
-
*
|
|
479
|
-
* @param {string|null} listName
|
|
480
|
-
* Name of the request list to be opened. Setting a name enables the `RequestList`'s state to be persisted
|
|
481
|
-
* in the key-value store. This is useful in case of a restart or migration. Since `RequestList` is only
|
|
482
|
-
* stored in memory, a restart or migration wipes it clean. Setting a name will enable the `RequestList`'s
|
|
483
|
-
* state to survive those situations and continue where it left off.
|
|
484
|
-
*
|
|
485
|
-
* The name will be used as a prefix in key-value store, producing keys such as `NAME-REQUEST_LIST_STATE`
|
|
486
|
-
* and `NAME-REQUEST_LIST_SOURCES`.
|
|
487
|
-
*
|
|
488
|
-
* If `null`, the list will not be persisted and will only be stored in memory. Process restart
|
|
489
|
-
* will then cause the list to be crawled again from the beginning. We suggest always using a name.
|
|
490
|
-
* @param {Array<RequestOptions|Request|string>} sources
|
|
491
|
-
* An array of sources of URLs for the {@link RequestList}. It can be either an array of strings,
|
|
492
|
-
* plain objects that define at least the `url` property, or an array of {@link Request} instances.
|
|
493
|
-
*
|
|
494
|
-
* **IMPORTANT:** The `sources` array will be consumed (left empty) after {@link RequestList} initializes.
|
|
495
|
-
* This is a measure to prevent memory leaks in situations when millions of sources are
|
|
496
|
-
* added.
|
|
497
|
-
*
|
|
498
|
-
* Additionally, the `requestsFromUrl` property may be used instead of `url`,
|
|
499
|
-
* which will instruct {@link RequestList} to download the source URLs from a given remote location.
|
|
500
|
-
* The URLs will be parsed from the received response. In this case you can limit the URLs
|
|
501
|
-
* using `regex` parameter containing regular expression pattern for URLs to be included.
|
|
502
|
-
*
|
|
503
|
-
* For details, see the {@link RequestListOptions.sources}
|
|
504
|
-
* @param {RequestListOptions} [options]
|
|
505
|
-
* The {@link RequestList} options. Note that the `listName` parameter supersedes
|
|
506
|
-
* the {@link RequestListOptions.persistStateKey} and {@link RequestListOptions.persistRequestsKey}
|
|
507
|
-
* options and the `sources` parameter supersedes the {@link RequestListOptions.sources} option.
|
|
508
|
-
* @returns {Promise<RequestList>}
|
|
509
|
-
*/
|
|
510
|
-
openRequestList(listName: string | null, sources: Array<RequestOptions | Request | string>, options?: any): Promise<RequestList>;
|
|
511
|
-
/**
|
|
512
|
-
* Opens a request queue and returns a promise resolving to an instance
|
|
513
|
-
* of the {@link RequestQueue} class.
|
|
514
|
-
*
|
|
515
|
-
* {@link RequestQueue} represents a queue of URLs to crawl, which is stored either on local filesystem or in the cloud.
|
|
516
|
-
* The queue is used for deep crawling of websites, where you start with several URLs and then
|
|
517
|
-
* recursively follow links to other pages. The data structure supports both breadth-first
|
|
518
|
-
* and depth-first crawling orders.
|
|
519
|
-
*
|
|
520
|
-
* For more details and code examples, see the {@link RequestQueue} class.
|
|
521
|
-
*
|
|
522
|
-
* @param {string} [queueIdOrName]
|
|
523
|
-
* ID or name of the request queue to be opened. If `null` or `undefined`,
|
|
524
|
-
* the function returns the default request queue associated with the actor run.
|
|
525
|
-
* @param {object} [options]
|
|
526
|
-
* @param {boolean} [options.forceCloud=false]
|
|
527
|
-
* If set to `true` then the function uses cloud storage usage even if the `APIFY_LOCAL_STORAGE_DIR`
|
|
528
|
-
* environment variable is set. This way it is possible to combine local and cloud storage.
|
|
529
|
-
* @returns {Promise<RequestQueue>}
|
|
530
|
-
*/
|
|
531
|
-
openRequestQueue(queueIdOrName?: string | undefined, options?: {
|
|
532
|
-
forceCloud?: boolean | undefined;
|
|
533
|
-
} | undefined): Promise<RequestQueue>;
|
|
534
|
-
/**
|
|
535
|
-
* Opens a SessionPool and returns a promise resolving to an instance
|
|
536
|
-
* of the {@link SessionPool} class that is already initialized.
|
|
537
|
-
*
|
|
538
|
-
* For more details and code examples, see the {@link SessionPool} class.
|
|
539
|
-
*
|
|
540
|
-
* @param {SessionPoolOptions} sessionPoolOptions
|
|
541
|
-
* @return {Promise<SessionPool>}
|
|
542
|
-
*/
|
|
543
|
-
openSessionPool(sessionPoolOptions: SessionPoolOptions): Promise<SessionPool>;
|
|
544
|
-
/**
|
|
545
|
-
* Creates a proxy configuration and returns a promise resolving to an instance
|
|
546
|
-
* of the {@link ProxyConfiguration} class that is already initialized.
|
|
547
|
-
*
|
|
548
|
-
* Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking
|
|
549
|
-
* your crawlers based on IP address rate limits or blacklists. Setting proxy configuration in your crawlers automatically configures
|
|
550
|
-
* them to use the selected proxies for all connections.
|
|
551
|
-
*
|
|
552
|
-
* For more details and code examples, see the {@link ProxyConfiguration} class.
|
|
553
|
-
*
|
|
554
|
-
* ```javascript
|
|
555
|
-
*
|
|
556
|
-
* // Returns initialized proxy configuration class
|
|
557
|
-
* const proxyConfiguration = await Apify.createProxyConfiguration({
|
|
558
|
-
* groups: ['GROUP1', 'GROUP2'] // List of Apify proxy groups
|
|
559
|
-
* countryCode: 'US'
|
|
560
|
-
* });
|
|
561
|
-
*
|
|
562
|
-
* const crawler = new Apify.CheerioCrawler({
|
|
563
|
-
* // ...
|
|
564
|
-
* proxyConfiguration,
|
|
565
|
-
* handlePageFunction: ({ proxyInfo }) => {
|
|
566
|
-
* const usedProxyUrl = proxyInfo.url; // Getting the proxy URL
|
|
567
|
-
* }
|
|
568
|
-
* })
|
|
569
|
-
*
|
|
570
|
-
* ```
|
|
571
|
-
*
|
|
572
|
-
* For compatibility with existing Actor Input UI (Input Schema), this function
|
|
573
|
-
* returns `undefined` when the following object is passed as `proxyConfigurationOptions`.
|
|
574
|
-
*
|
|
575
|
-
* ```
|
|
576
|
-
* { useApifyProxy: false }
|
|
577
|
-
* ```
|
|
578
|
-
*
|
|
579
|
-
* @param {ProxyConfigurationOptions} [proxyConfigurationOptions]
|
|
580
|
-
* @returns {Promise<ProxyConfiguration|undefined>}
|
|
581
|
-
*/
|
|
582
|
-
createProxyConfiguration(proxyConfigurationOptions?: any): Promise<ProxyConfiguration | undefined>;
|
|
583
|
-
/**
|
|
584
|
-
* Returns a new {@link ApifyEnv} object which contains information parsed from all the `APIFY_XXX` environment variables.
|
|
585
|
-
*
|
|
586
|
-
* For the list of the `APIFY_XXX` environment variables, see
|
|
587
|
-
* [Actor documentation](https://docs.apify.com/actor/run#environment-variables).
|
|
588
|
-
* If some of the variables are not defined or are invalid, the corresponding value in the resulting object will be null.
|
|
589
|
-
* @returns {ApifyEnv}
|
|
590
|
-
*/
|
|
591
|
-
getEnv(): ApifyEnv;
|
|
592
|
-
/**
|
|
593
|
-
* Returns a new instance of the Apify API client. The `ApifyClient` class is provided
|
|
594
|
-
* by the <a href="https://www.npmjs.com/package/apify-client" target="_blank">apify-client</a>
|
|
595
|
-
* NPM package, and it is automatically configured using the `APIFY_API_BASE_URL`, and `APIFY_TOKEN`
|
|
596
|
-
* environment variables. You can override the token via the available options. That's useful
|
|
597
|
-
* if you want to use the client as a different Apify user than the SDK internals are using.
|
|
598
|
-
*
|
|
599
|
-
* @param {object} [options]
|
|
600
|
-
* @param {string} [options.token]
|
|
601
|
-
* @param {string} [options.maxRetries]
|
|
602
|
-
* @param {string} [options.minDelayBetweenRetriesMillis]
|
|
603
|
-
* @return {ApifyClient}
|
|
604
|
-
*/
|
|
605
|
-
newClient(options?: {
|
|
606
|
-
token?: string | undefined;
|
|
607
|
-
maxRetries?: string | undefined;
|
|
608
|
-
minDelayBetweenRetriesMillis?: string | undefined;
|
|
609
|
-
} | undefined): ApifyClient;
|
|
610
|
-
/**
|
|
611
|
-
* Returns `true` when code is running on Apify platform and `false` otherwise (for example locally).
|
|
612
|
-
*
|
|
613
|
-
* @returns {boolean}
|
|
614
|
-
*/
|
|
615
|
-
isAtHome(): boolean;
|
|
616
|
-
get utils(): {
|
|
617
|
-
puppeteer: {
|
|
618
|
-
// @ts-ignore optional peer dependency
|
|
619
|
-
injectFile: (page: import("puppeteer").Page, filePath: string, options?: {
|
|
620
|
-
surviveNavigations?: boolean | undefined;
|
|
621
|
-
} | undefined) => Promise<any>;
|
|
622
|
-
// @ts-ignore optional peer dependency
|
|
623
|
-
injectJQuery: (page: import("puppeteer").Page) => Promise<any>;
|
|
624
|
-
// @ts-ignore optional peer dependency
|
|
625
|
-
injectUnderscore: (page: import("puppeteer").Page) => Promise<any>;
|
|
626
|
-
enqueueLinksByClickingElements: typeof import("./enqueue_links/click_elements").enqueueLinksByClickingElements;
|
|
627
|
-
// @ts-ignore optional peer dependency
|
|
628
|
-
blockRequests: (page: import("puppeteer").Page, options?: {
|
|
629
|
-
urlPatterns?: string[] | undefined;
|
|
630
|
-
extraUrlPatterns?: string[] | undefined;
|
|
631
|
-
} | undefined) => Promise<void>;
|
|
632
|
-
blockResources: (page: any, resourceTypes?: string[]) => Promise<void>;
|
|
633
|
-
// @ts-ignore optional peer dependency
|
|
634
|
-
cacheResponses: (page: import("puppeteer").Page, cache: {
|
|
635
|
-
[x: string]: any;
|
|
636
|
-
}, responseUrlRules: (string | RegExp)[]) => Promise<void>;
|
|
637
|
-
compileScript: (scriptString: string, context?: {
|
|
638
|
-
[x: string]: any;
|
|
639
|
-
}) => import("./puppeteer_utils").CompiledScriptFunction;
|
|
640
|
-
// @ts-ignore optional peer dependency
|
|
641
|
-
gotoExtended: (page: import("puppeteer").Page, request: Request, gotoOptions?: any) => Promise<any>;
|
|
642
|
-
// @ts-ignore optional peer dependency
|
|
643
|
-
addInterceptRequestHandler: (page: import("puppeteer").Page, handler: import("./puppeteer_request_interception").InterceptHandler) => Promise<void>;
|
|
644
|
-
// @ts-ignore optional peer dependency
|
|
645
|
-
removeInterceptRequestHandler: (page: import("puppeteer").Page, handler: import("./puppeteer_request_interception").InterceptHandler) => Promise<void>;
|
|
646
|
-
// @ts-ignore optional peer dependency
|
|
647
|
-
infiniteScroll: (page: import("puppeteer").Page, options?: {
|
|
648
|
-
timeoutSecs?: number | undefined;
|
|
649
|
-
waitForSecs?: number | undefined;
|
|
650
|
-
scrollDownAndUp?: boolean | undefined;
|
|
651
|
-
buttonSelector?: string | undefined;
|
|
652
|
-
stopScrollCallback?: Function | undefined;
|
|
653
|
-
} | undefined) => Promise<void>;
|
|
654
|
-
// @ts-ignore optional peer dependency
|
|
655
|
-
saveSnapshot: (page: import("puppeteer").Page, options?: {
|
|
656
|
-
key?: string | undefined;
|
|
657
|
-
screenshotQuality?: number | undefined;
|
|
658
|
-
saveScreenshot?: boolean | undefined;
|
|
659
|
-
saveHtml?: boolean | undefined;
|
|
660
|
-
keyValueStoreName?: string | null | undefined;
|
|
661
|
-
} | undefined) => Promise<void>;
|
|
662
|
-
};
|
|
663
|
-
playwright: {
|
|
664
|
-
gotoExtended: (page: import("playwright-core").Page, request: import("./request").default, gotoOptions?: import("./typedefs").DirectNavigationOptions | undefined) => Promise<import("playwright-core").Response | null>;
|
|
665
|
-
};
|
|
666
|
-
social: {
|
|
667
|
-
emailsFromText: (text: string) => string[];
|
|
668
|
-
emailsFromUrls: (urls: string[]) => string[];
|
|
669
|
-
phonesFromText: (text: string) => string[];
|
|
670
|
-
phonesFromUrls: (urls: string[]) => string[];
|
|
671
|
-
parseHandlesFromHtml: (html: string, data?: any) => import("./utils_social").SocialHandles;
|
|
672
|
-
EMAIL_REGEX: RegExp;
|
|
673
|
-
EMAIL_REGEX_GLOBAL: RegExp;
|
|
674
|
-
LINKEDIN_REGEX: RegExp;
|
|
675
|
-
LINKEDIN_REGEX_GLOBAL: RegExp;
|
|
676
|
-
INSTAGRAM_REGEX: RegExp;
|
|
677
|
-
INSTAGRAM_REGEX_GLOBAL: RegExp;
|
|
678
|
-
TWITTER_REGEX: RegExp;
|
|
679
|
-
TWITTER_REGEX_GLOBAL: RegExp;
|
|
680
|
-
FACEBOOK_REGEX: RegExp;
|
|
681
|
-
FACEBOOK_REGEX_GLOBAL: RegExp;
|
|
682
|
-
YOUTUBE_REGEX: RegExp;
|
|
683
|
-
YOUTUBE_REGEX_GLOBAL: RegExp;
|
|
684
|
-
TIKTOK_REGEX: RegExp;
|
|
685
|
-
TIKTOK_REGEX_GLOBAL: RegExp;
|
|
686
|
-
PINTEREST_REGEX: RegExp;
|
|
687
|
-
PINTEREST_REGEX_GLOBAL: RegExp;
|
|
688
|
-
DISCORD_REGEX: RegExp | undefined;
|
|
689
|
-
DISCORD_REGEX_GLOBAL: RegExp;
|
|
690
|
-
};
|
|
691
|
-
log: import("@apify/log/log").Log;
|
|
692
|
-
enqueueLinks: typeof enqueueLinks;
|
|
693
|
-
requestAsBrowser: (options?: import("./utils_request").RequestAsBrowserOptions) => Promise<import("./utils_request").RequestAsBrowserResult>;
|
|
694
|
-
isDocker: (forceReset: boolean) => Promise<boolean>;
|
|
695
|
-
sleep: (millis: number) => Promise<void>;
|
|
696
|
-
downloadListOfUrls: (options: {
|
|
697
|
-
url: string;
|
|
698
|
-
encoding?: string | undefined;
|
|
699
|
-
proxyUrl?: string | undefined;
|
|
700
|
-
urlRegExp?: RegExp | undefined;
|
|
701
|
-
}) => Promise<string[]>;
|
|
702
|
-
extractUrls: (options: {
|
|
703
|
-
string: string;
|
|
704
|
-
urlRegExp?: RegExp | undefined;
|
|
705
|
-
}) => string[];
|
|
706
|
-
htmlToText: (html: string | import("cheerio").CheerioAPI) => string;
|
|
707
|
-
URL_NO_COMMAS_REGEX: RegExp;
|
|
708
|
-
URL_WITH_COMMAS_REGEX: RegExp;
|
|
709
|
-
createRequestDebugInfo: (request: import("./request").default | RequestOptions, response?: any, additionalFields?: {
|
|
710
|
-
[x: string]: any;
|
|
711
|
-
} | undefined) => {
|
|
712
|
-
[x: string]: any;
|
|
713
|
-
};
|
|
714
|
-
waitForRunToFinish: (options: {
|
|
715
|
-
actorId: string;
|
|
716
|
-
runId: string;
|
|
717
|
-
waitSecs?: string | undefined;
|
|
718
|
-
token?: string | undefined;
|
|
719
|
-
}) => Promise<ActorRun>;
|
|
720
|
-
purgeLocalStorage: (folder?: string | undefined) => Promise<void>;
|
|
721
|
-
};
|
|
722
|
-
/**
|
|
723
|
-
* @param {Function} storageClass
|
|
724
|
-
* @return {StorageManager}
|
|
725
|
-
* @private
|
|
726
|
-
*/
|
|
727
|
-
private _getStorageManager;
|
|
728
|
-
/**
|
|
729
|
-
* @param {ACT_JOB_STATUSES} status
|
|
730
|
-
* @return {boolean}
|
|
731
|
-
* @private
|
|
732
|
-
*/
|
|
733
|
-
private _isRunUnsuccessful;
|
|
734
|
-
}
|
|
735
|
-
import { Configuration } from "./configuration";
|
|
736
|
-
import { UserFunc } from "./actor";
|
|
737
|
-
import { AdhocWebhook } from "./actor";
|
|
738
|
-
import { ActorRun } from "./typedefs";
|
|
739
|
-
import { EventTypes } from "./actor";
|
|
740
|
-
import { WebhookRun } from "./actor";
|
|
741
|
-
import { Dataset } from "./storages/dataset";
|
|
742
|
-
import { KeyValueStore } from "./storages/key_value_store";
|
|
743
|
-
import { RequestOptions } from "./request";
|
|
744
|
-
import { RequestList } from "./request_list";
|
|
745
|
-
import { RequestQueue } from "./storages/request_queue";
|
|
746
|
-
import { SessionPoolOptions } from "./session_pool/session_pool";
|
|
747
|
-
import { SessionPool } from "./session_pool/session_pool";
|
|
748
|
-
import { ProxyConfiguration } from "./proxy_configuration";
|
|
749
|
-
import { ApifyEnv } from "./actor";
|
|
750
|
-
import { ApifyClient } from "apify-client/dist/apify_client";
|
|
751
|
-
import { enqueueLinks } from "./enqueue_links/enqueue_links";
|
|
752
|
-
//# sourceMappingURL=apify.d.ts.map
|