Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
Build docs
Ondra Urban82d5c4730728
diff --git a/docs/api/Apify.md b/docs/api/Apify.mdindex 3d6b8f8c1..746d39603 100644--- a/docs/api/Apify.md+++ b/docs/api/Apify.md@@ -40,7 +40,13 @@ If the value is less than or equal to zero, the function returns immediately aftThe result of the function is an [`ActorRun`](../typedefs/actorrun) objectthat contains details about the actor run and its output (if any).-If the actor run failed, the function fails with [`ApifyCallError`](../typedefs/apifycallerror) exception.+If the actor run fails, the function throws the [`ApifyCallError`](../typedefs/apifycallerror) exception.++If you want to run an actor task rather than an actor, please use the+[`Apify.callTask()`](../api/apify#module_Apify.callTask) function instead.++For more information about actors, read the+<a href="https://www.apify.com/docs/actor" target="_blank">documentation</a>.**Example usage:**@@ -49,9 +55,9 @@ const run = await Apify.call('apify/hello-world', { myInput: 123 });console.log(`Received message: ${run.output.body.message}`);```-Internally, the `call()` function calls the+Internally, the `call()` function invokes the<a href="https://www.apify.com/docs/api/v2#/reference/actors/run-collection/run-actor" target="_blank">Run actor</a>-Apify API endpoint and few others to obtain the output.+and several other API endpoints to obtain the output.**Throws**:@@ -104,7 +110,7 @@ Apify API endpoint and few others to obtain the output.<td><code>[options.timeoutSecs]</code></td><td><code>Number</code></td><td></td></tr><tr>-<td colspan="3"><p>Timeout for the act run in seconds. Zero value means there is no timeout.+<td colspan="3"><p>Timeout for the actor run in seconds. Zero value means there is no timeout.If not provided, the run uses timeout of the default actor run configuration.</p></td></tr><tr><td><code>[options.build]</code></td><td><code>String</code></td><td></td>@@ -136,8 +142,8 @@ Apify API endpoint and few others to obtain the output.<a name="module_Apify.callTask"></a>## `Apify.callTask(taskId, [input], [options])` ⇒ [<code>Promise<ActorRun></code>](../typedefs/actorrun)-Runs an actor on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),-waits for the actor to finish and fetches its output.+Runs an actor task on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),+waits for the task to finish and fetches its output.By passing the `waitSecs` option you can reduce the maximum amount of time to wait for the run to finish.If the value is less than or equal to zero, the function returns immediately after the run is started.@@ -146,16 +152,22 @@ The result of the function is an [`ActorRun`](../typedefs/actorrun) objectthat contains details about the actor run and its output (if any).If the actor run failed, the function fails with [`ApifyCallError`](../typedefs/apifycallerror) exception.+Note that an actor task is a saved input configuration and options for an actor.+If you want to run an actor directly rather than an actor task, please use the+[`Apify.call()`](../api/apify#module_Apify.call) function instead.++For more information about actor tasks, read the [`documentation`](https://www.apify.com/docs/tasks).+**Example usage:**```javascript-const run = await Apify.call('apify/hello-world-task');+const run = await Apify.callTask('bob/some-task');console.log(`Received message: ${run.output.body.message}`);```-Internally, the `call()` function calls the-<a href="https://www.apify.com/docs/api/v2#/reference/actor-tasks/runs-collection/run-task-asynchronously" target="_blank">Run actor</a>-Apify API endpoint and few others to obtain the output.+Internally, the `callTask()` function calls the+<a href="https://www.apify.com/docs/api/v2#/reference/actor-tasks/runs-collection/run-task-asynchronously" target="_blank">Run task</a>+and several other API endpoints to obtain the output.**Throws**:diff --git a/docs/api/AutoscaledPool.md b/docs/api/AutoscaledPool.mdindex a009b936f..d8989ff5b 100644--- a/docs/api/AutoscaledPool.md+++ b/docs/api/AutoscaledPool.md@@ -102,6 +102,8 @@ await pool.run();</tr><tr><td colspan="3"><p>Minimum number of tasks running in parallel.</p>+<p> <em>WARNING:</em> If you set this value too high with respect to the available system memory and CPU, your code might run extremely slow or crash.+ If you're not sure, just keep the default value and the concurrency will scale up automatically.</p></td></tr><tr><td><code>[options.maxConcurrency]</code></td><td><code>Number</code></td><td><code>1000</code></td></tr>@@ -181,6 +183,9 @@ Overrides max concurrency configuration.## `autoscaledPool.setMinConcurrency(minConcurrency)`Overrides min concurrency configuration.+*WARNING:* If you set this value too high with respect to the available system memory and CPU, your code might run extremely slow or crash.+If you're not sure, just keep the default value and the concurrency will scale up automatically.+<table><thead><tr>diff --git a/docs/api/BasicCrawler.md b/docs/api/BasicCrawler.mdindex 77ee85757..1e36308a9 100644--- a/docs/api/BasicCrawler.md+++ b/docs/api/BasicCrawler.md@@ -87,8 +87,15 @@ await crawler.run();<pre><code>{request: Request}-</code></pre><p> where the <a href="request"><code>Request</code></a> instance represents the URL to crawl.- The function must return a promise.</p>+</code></pre><p> where the <a href="request"><code>Request</code></a> instance represents the URL to crawl.</p>+<p> The function must return a promise, which is then awaited by the crawler.</p>+<p> If the function throws an exception, the crawler will try to re-crawl the+ request later, up to <code>option.maxRequestRetries</code> times.+ If all the retries fail, the crawler calls the function+ provided to the <code>options.handleFailedRequestFunction</code> parameter.+ To make this work, you should <strong>always</strong>+ let your function throw exceptions rather than catch them.+ The exceptions are logged to the request using the <a href="request.pusherrormessage"><code>Request.pushErrorMessage</code></a> function.</p></td></tr><tr><td><code>options.requestList</code></td><td><code><a href="requestlist">RequestList</a></code></td><td></td></tr>@@ -140,6 +147,8 @@ await crawler.run();</tr><tr><td colspan="3"><p>Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="autoscaledpool"><code>AutoscaledPool</code></a> option.</p>+<p> <em>WARNING:</em> If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash.+ If you're not sure, just keep the default value and the concurrency will scale up automatically.</p></td></tr><tr><td><code>[options.maxConcurrency]</code></td><td><code>Object</code></td><td><code>1000</code></td></tr>diff --git a/docs/api/CheerioCrawler.md b/docs/api/CheerioCrawler.mdindex 5e52e1978..c67647c3f 100644--- a/docs/api/CheerioCrawler.md+++ b/docs/api/CheerioCrawler.md@@ -47,8 +47,7 @@ await requestList.initialize();// Crawl the URLsconst crawler = new Apify.CheerioCrawler({requestList,- handlePageFunction: async ({ $, html, request }) => {-+ handlePageFunction: async ({ request, response, html, $ }) => {const data = [];// Do some data extraction from the page with Cheerio.@@ -70,13 +69,13 @@ await crawler.run();* [CheerioCrawler](cheeriocrawler)- * [`new CheerioCrawler(options, [useApifyProxy], [apifyProxyGroups], [apifyProxySession])`](#new_CheerioCrawler_new)+ * [`new CheerioCrawler(options)`](#new_CheerioCrawler_new)* [`.run()`](#CheerioCrawler+run) ⇒ <code>Promise</code>* [`.abort()`](#CheerioCrawler+abort) ⇒ <code>Promise</code><a name="new_CheerioCrawler_new"></a>-## `new CheerioCrawler(options, [useApifyProxy], [apifyProxyGroups], [apifyProxySession])`+## `new CheerioCrawler(options)`<table><thead><tr>@@ -101,10 +100,17 @@ await crawler.run();$: Cheerio, // the Cheerio object with parsed HTMLhtml: String // the raw HTML of the pagerequest: Request,- response: Object // a http.IncomingMessage object with properties such as the `statusCode`+ response: Object // An instance of Node's http.IncomingMessage object}-</code></pre><p> With the <a href="request"><code>Request</code></a> object representing the URL to crawl.- If the function returns a promise, it is awaited.</p>+</code></pre><p> With the <a href="request"><code>Request</code></a> object representing the URL to crawl.</p>+<p> If the function returns a promise, it is awaited by the crawler.</p>+<p> If the function throws an exception, the crawler will try to re-crawl the+ request later, up to <code>option.maxRequestRetries</code> times.+ If all the retries fail, the crawler calls the function+ provided to the <code>options.handleFailedRequestFunction</code> parameter.+ To make this work, you should <strong>always</strong>+ let your function throw exceptions rather than catch them.+ The exceptions are logged to the request using the <a href="request.pusherrormessage"><code>Request.pushErrorMessage</code></a> function.</p></td></tr><tr><td><code>options.requestList</code></td><td><code><a href="requestlist">RequestList</a></code></td><td></td></tr>@@ -147,21 +153,21 @@ await crawler.run();<td colspan="3"><p>If set to true, SSL certificate errors will be ignored. This is dependent on using the defaultrequest function. If using a custom <code>options.requestFunction</code>, user needs to implement this functionality.</p></td></tr><tr>-<td><code>[useApifyProxy]</code></td><td><code>Boolean</code></td><td><code>false</code></td>+<td><code>[options.useApifyProxy]</code></td><td><code>Boolean</code></td><td><code>false</code></td></tr><tr><td colspan="3"><p>If set to <code>true</code>, <code>CheerioCrawler</code> will be configured to use<a href="https://my.apify.com/proxy" target="_blank">Apify Proxy</a> for all connections.For more information, see the <a href="https://www.apify.com/docs/proxy" target="_blank">documentation</a></p></td></tr><tr>-<td><code>[apifyProxyGroups]</code></td><td><code>Array<String></code></td><td></td>+<td><code>[options.apifyProxyGroups]</code></td><td><code>Array<String></code></td><td></td></tr><tr><td colspan="3"><p>An array of proxy groups to be usedby the <a href="https://www.apify.com/docs/proxy" target="_blank">Apify Proxy</a>.Only applied if the <code>useApifyProxy</code> option is <code>true</code>.</p></td></tr><tr>-<td><code>[apifyProxySession]</code></td><td><code>String</code></td><td></td>+<td><code>[options.apifyProxySession]</code></td><td><code>String</code></td><td></td></tr><tr><td colspan="3"><p>Apify Proxy session identifier to be used with requests made by <code>CheerioCrawler</code>.@@ -215,6 +221,8 @@ await crawler.run();</tr><tr><td colspan="3"><p>Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="autoscaledpool"><code>AutoscaledPool</code></a> option.</p>+<p> <em>WARNING:</em> If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash.+ If you're not sure, just keep the default value and the concurrency will scale up automatically.</p></td></tr><tr><td><code>[options.maxConcurrency]</code></td><td><code>Object</code></td><td><code>1000</code></td></tr>diff --git a/docs/api/PuppeteerCrawler.md b/docs/api/PuppeteerCrawler.mdindex ad3e7cb96..540ebe024 100644--- a/docs/api/PuppeteerCrawler.md+++ b/docs/api/PuppeteerCrawler.md@@ -100,6 +100,14 @@ await crawler.run();<a href="https://pptr.dev/#?product=Puppeteer&show=api-class-response" target="_blank"><code>Response</code></a>,which is the main resource response as returned by <code>page.goto(request.url)</code>.<code>puppeteerPool</code> is an instance of the <a href="puppeteerpool"><code>PuppeteerPool</code></a> used by this <code>PuppeteerCrawler</code>.</p>+<p> The function must return a promise, which is then awaited by the crawler.</p>+<p> If the function throws an exception, the crawler will try to re-crawl the+ request later, up to <code>option.maxRequestRetries</code> times.+ If all the retries fail, the crawler calls the function+ provided to the <code>options.handleFailedRequestFunction</code> parameter.+ To make this work, you should <strong>always</strong>+ let your function throw exceptions rather than catch them.+ The exceptions are logged to the request using the <a href="request.pusherrormessage"><code>Request.pushErrorMessage</code></a> function.</p></td></tr><tr><td><code>options.requestList</code></td><td><code><a href="requestlist">RequestList</a></code></td><td></td></tr>@@ -221,6 +229,8 @@ await crawler.run();</tr><tr><td colspan="3"><p>Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="autoscaledpool"><code>AutoscaledPool</code></a> option.</p>+<p> <em>WARNING:</em> If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash.+ If you're not sure, just keep the default value and the concurrency will scale up automatically.</p></td></tr><tr><td><code>[options.maxConcurrency]</code></td><td><code>Object</code></td><td><code>1000</code></td></tr>diff --git a/docs/api/PuppeteerPool.md b/docs/api/PuppeteerPool.mdindex b7a6a0d48..68527de03 100644--- a/docs/api/PuppeteerPool.md+++ b/docs/api/PuppeteerPool.md@@ -45,6 +45,7 @@ await puppeteerPool.destroy();* [`.newPage()`](#PuppeteerPool+newPage) ⇒ <code>Promise<Page></code>* [`.destroy()`](#PuppeteerPool+destroy) ⇒ <code>Promise</code>* [`.retire(browser)`](#PuppeteerPool+retire) ⇒ <code>Promise</code>+ * [`.recyclePage(page)`](#PuppeteerPool+recyclePage) ⇒ <code>Promise</code><a name="new_PuppeteerPool_new"></a>@@ -63,6 +64,13 @@ await puppeteerPool.destroy();<td colspan="3"><p>All <code>PuppeteerPool</code> parameters are passedvia an options object with the following keys:</p></td></tr><tr>+<td><code>[options.reusePages]</code></td><td><code>boolean</code></td><td><code>false</code></td>+</tr>+<tr>+<td colspan="3"><p>Individual browser tabs will be reused after their task is complete instead+ of closing them and spawning a new tab. This saves CPU resources.+ Try disabling this feature if you encounter any weird behavior in your crawlers.</p>+</td></tr><tr><td><code>[options.maxOpenPagesPerInstance]</code></td><td><code>Number</code></td><td><code>50</code></td></tr><tr>@@ -114,9 +122,11 @@ await puppeteerPool.destroy();<a name="PuppeteerPool+newPage"></a>## `puppeteerPool.newPage()` ⇒ <code>Promise<Page></code>-Opens new tab in one of the browsers in the pool and returns a `Promise`-that resolves to an instance of a Puppeteer-<a href="https://pptr.dev/#?product=Puppeteer&show=api-class-page" target="_blank"><code>Page</code></a>.+Produces a new page instance either by reusing an idle page that currently isn't processing+any request or by spawning a new page (new browser tab) in one of the available+browsers when no idle pages are available.++To spawn a new browser tab for each page, set the `reusePages` constructor option to false.<a name="PuppeteerPool+destroy"></a>@@ -144,3 +154,28 @@ This is unlike `browser.close()` which will forcibly terminate the browser and a<tr></tr></tbody></table>+<a name="PuppeteerPool+recyclePage"></a>++## `puppeteerPool.recyclePage(page)` ⇒ <code>Promise</code>+Recycles the page, which means that it will be enqueued for future reuse+instead of spawning a new tab. This is done automatically unless the `reusePages`+option of the `PuppeteerPool` constructor is set to false. You can also use this+function manually to tell the pool that you no longer need this specific page+and it can be reused in the future.++Using this function without setting the `reusePages` option to false causes+this function to trigger a page.close().++<table>+<thead>+<tr>+<th>Param</th><th>Type</th>+</tr>+</thead>+<tbody>+<tr>+<td><code>page</code></td><td><code>Page</code></td>+</tr>+<tr>+</tr></tbody>+</table>diff --git a/docs/api/RequestQueue.md b/docs/api/RequestQueue.mdindex 114fcebde..a19f8b777 100644--- a/docs/api/RequestQueue.md+++ b/docs/api/RequestQueue.md@@ -77,6 +77,7 @@ await queue.reclaimRequest(request2);* [`.isEmpty()`](#RequestQueue+isEmpty) ⇒ <code>Promise<Boolean></code>* [`.isFinished()`](#RequestQueue+isFinished) ⇒ <code>Promise<Boolean></code>* [`.delete()`](#RequestQueue+delete) ⇒ <code>Promise</code>+ * [`.handledCount()`](#RequestQueue+handledCount) ⇒ <code>Promise<number></code><a name="RequestQueue+addRequest"></a>@@ -203,3 +204,8 @@ the function might occasionally return a false negative, but it will never returRemoves the queue either from the Apify Cloud storage or from the local directory,depending on the mode of operation.+<a name="RequestQueue+handledCount"></a>++## `requestQueue.handledCount()` ⇒ <code>Promise<number></code>+Returns the number of handled requests.+diff --git a/docs/api/puppeteer.md b/docs/api/puppeteer.mdindex 61f42fddf..a709b93b6 100644--- a/docs/api/puppeteer.md+++ b/docs/api/puppeteer.md@@ -4,7 +4,8 @@ title: utils.puppeteer---<a name="puppeteer"></a>-A namespace that contains various Puppeteer utilities.+A namespace that contains various utilities for+[Puppeteer](https://github.com/GoogleChrome/puppeteer) - the headless Chrome Node API.**Example usage:**@@ -28,7 +29,7 @@ await puppeteer.injectJQuery(page);* [`.injectJQuery(page)`](#puppeteer.injectJQuery) ⇒ <code>Promise</code>* [`.injectUnderscore(page)`](#puppeteer.injectUnderscore) ⇒ <code>Promise</code>* [`.enqueueLinks(options)`](#puppeteer.enqueueLinks) ⇒ <code>Promise<Array<QueueOperationInfo>></code>- * [`.blockResources(page, resourceTypes)`](#puppeteer.blockResources) ⇒ <code>Promise</code>+ * [`.blockResources(page, [resourceTypes])`](#puppeteer.blockResources) ⇒ <code>Promise</code>* [`.cacheResponses(page, cache, responseUrlRules)`](#puppeteer.cacheResponses) ⇒ <code>Promise</code>* [`.compileScript(scriptString, context)`](#puppeteer.compileScript) ⇒ <code>function</code>@@ -59,6 +60,9 @@ Injects a JavaScript file into a Puppeteer page.Unlike Puppeteer's `addScriptTag` function, this function works on pageswith arbitrary Cross-Origin Resource Sharing (CORS) policies.+Make sure that you're injecting the file after the page has loaded (after `page.goto()`). Otherwise,+the navigation will override the existing environment and the library will no longer be available.+<table><thead><tr>@@ -82,13 +86,18 @@ with arbitrary Cross-Origin Resource Sharing (CORS) policies.## `puppeteer.injectJQuery(page)` ⇒ <code>Promise</code>Injects the <a href="https://jquery.com/" target="_blank"><code>jQuery</code></a> library into a Puppeteer page.-jQuery is often useful for various web scraping and crawling tasks,-e.g. to extract data from HTML elements using CSS selectors.+jQuery is often useful for various web scraping and crawling tasks.+For example, it can help extract text from HTML elements using CSS selectors.Beware that the injected jQuery object will be set to the `window.$` variable and thus it might cause conflicts with-libraries included by the page that use the same variable (e.g. another version of jQuery).+other libraries included by the page that use the same variable name (e.g. another version of jQuery).+This can affect functionality of page's scripts.++Also make sure that you're injecting jQuery after the page has loaded+(i.e. after [`page.goto()`](https://pptr.dev/#?product=Puppeteer&show=api-pagegotourl-options)).+Otherwise, the navigation will override the existing environment and the library will no longer be available.-Example usage:+**Example usage:**```javascriptawait Apify.utils.puppeteer.injectJQuery(page);const title = await page.evaluate(() => {@@ -118,8 +127,22 @@ function in any way.## `puppeteer.injectUnderscore(page)` ⇒ <code>Promise</code>Injects the <a href="https://underscorejs.org/" target="_blank"><code>Underscore.js</code></a> library into a Puppeteer page.+Beware that the injected Underscore object will be set to the `window._` variable and thus it might cause conflicts with-libraries included by the page that use the same variable.+libraries included by the page that use the same variable name.+This can affect functionality of page's scripts.++Also make sure that you're injecting Underscore after the page has loaded+(i.e. after [`page.goto()`](https://pptr.dev/#?product=Puppeteer&show=api-pagegotourl-options)).+Otherwise, the navigation will override the existing environment and the library will no longer be available.++**Example usage:**+```javascript+await Apify.utils.puppeteer.injectUnderscore(page);+const escapedHtml = await page.evaluate(() => {+ return _.escape('<h1>Hello</h1>');+});+```<table><thead>@@ -212,12 +235,12 @@ To create a Request object function uses `requestTemplate` from a matching [`Pse</table><a name="puppeteer.blockResources"></a>-## `puppeteer.blockResources(page, resourceTypes)` ⇒ <code>Promise</code>-Forces the browser tab to block loading certain page resources,-using the `Page.setRequestInterception(value)` method.-This is useful to speed up crawling of websites.+## `puppeteer.blockResources(page, [resourceTypes])` ⇒ <code>Promise</code>+Forces the Puppeteer browser tab to block loading certain HTTP resources.+This is useful to speed up crawling of websites, since it reduces the amount+of data that need to be downloaded from the web.-The resource types to block can be controlled using the `resourceTypes` parameter,+The resource types to block can be specified using the `resourceTypes` parameter,which indicates the types of resources as they are perceived by the rendering engine.The following resource types are currently supported:`document`, `stylesheet`, `image`, `media`, `font`, `script`, `texttrack`, `xhr`, `fetch`,@@ -225,22 +248,43 @@ The following resource types are currently supported:For more details, see Puppeteer's<a href="https://pptr.dev/#?product=Puppeteer&show=api-requestresourcetype" target="_blank">Request.resourceType() documentation</a>.-By default, the function blocks these resource types: `stylesheet`, `font`, `image`, `media`.+If the `resourceTypes` parameter is not provided,+by default the function blocks these resource types: `stylesheet`, `font`, `image`, `media`.++Note that the `blockResources` function internally uses Puppeteer's+[`Page.setRequestInterception()`](https://pptr.dev/#?product=Puppeteer&show=api-pagesetrequestinterceptionvalue) function,+which can only be used once per `Page` object.++**Example usage**+```javascript+const Apify = require('apify');++const browser = await Apify.launchPuppeteer();+const page = await browser.newPage();++// Block all resources except for the main HTML document+await Apify.utils.puppeteer.blockResources(page,+ ['stylesheet', 'image', 'media', 'font', 'script', 'texttrack', 'xhr',+ 'fetch', 'eventsource', 'websocket', 'manifest', 'other']+);++await page.goto('https://www.example.com');+```<table><thead><tr>-<th>Param</th><th>Type</th>+<th>Param</th><th>Type</th><th>Default</th></tr></thead><tbody><tr>-<td><code>page</code></td><td><code>Page</code></td>+<td><code>page</code></td><td><code>Page</code></td><td></td></tr><tr><td colspan="3"><p>Puppeteer <a href="https://pptr.dev/#?product=Puppeteer&show=api-class-page" target="_blank"><code>Page</code></a> object.</p></td></tr><tr>-<td><code>resourceTypes</code></td><td><code>Array<String></code></td>+<td><code>[resourceTypes]</code></td><td><code>Array<String></code></td><td><code>['stylesheet', 'font', 'image', 'media']</code></td></tr><tr><td colspan="3"><p>Array of resource types to block.</p>diff --git a/docs/api/social.md b/docs/api/social.mdindex 0eada551e..0123feac0 100644--- a/docs/api/social.md+++ b/docs/api/social.md@@ -35,55 +35,205 @@ const emails = Apify.utils.social.emailsFromText('[email protected] bob@example.<a name="social.LINKEDIN_REGEX"></a>## `social.LINKEDIN\_REGEX` : <code>RegExp</code>-Regular expression to exactly match a single LinkedIn profile URL, without any additional-subdirectories or query parameters. The regular expression has the following form: `/^...$/i`.+Regular expression to exactly match a single LinkedIn profile URL.+It has the following form: `/^...$/i` and matches URLs such as:+```+https://www.linkedin.com/in/alan-turing+en.linkedin.com/in/alan-turing+linkedin.com/in/alan-turing+```++The regular expression does NOT match URLs with additional+subdirectories or query parameters, such as:+```+https://www.linkedin.com/in/linus-torvalds/latest-activity+```Example usage:```-TODO+if (Apify.utils.social.LINKEDIN_REGEX.test('https://www.linkedin.com/in/alan-turing')) {+ console.log('Match!');+}```<a name="social.LINKEDIN_REGEX_GLOBAL"></a>## `social.LINKEDIN\_REGEX\_GLOBAL` : <code>RegExp</code>-Regular expression to find multiple LinkedIn profile URLs in a text.-It has the following form: `/.../ig`.+Regular expression to find multiple LinkedIn profile URLs in a text or HTML.+It has the following form: `/.../ig` and matches URLs such as:+```+https://www.linkedin.com/in/alan-turing+en.linkedin.com/in/alan-turing+linkedin.com/in/alan-turing+```++If the profile URL contains subdirectories or query parameters, the regular expression+extracts just the base part of the profile URL. For example, from text such as:+```+https://www.linkedin.com/in/linus-torvalds/latest-activity+```+the expression extracts just the following base URL:+```+https://www.linkedin.com/in/linus-torvalds+```++Example usage:+```+const matches = text.match(Apify.utils.social.LINKEDIN_REGEX_GLOBAL);+if (matches) console.log(`${matches.length} LinkedIn profiles found!`);+```<a name="social.INSTAGRAM_REGEX"></a>## `social.INSTAGRAM\_REGEX` : <code>RegExp</code>Regular expression to exactly match a single Instagram profile URL.-It has the following form: `/^...$/i`.+It has the following form: `/^...$/i` and matches URLs such as:+```+https://www.instagram.com/old_prague+www.instagram.com/old_prague/+instagr.am/old_prague+```++The regular expression does NOT match URLs with additional+subdirectories or query parameters, such as:+```+https://www.instagram.com/cristiano/followers+```++Example usage:+```+if (Apify.utils.social.INSTAGRAM_REGEX_STRING.test('https://www.instagram.com/old_prague')) {+ console.log('Match!');+}+```<a name="social.INSTAGRAM_REGEX_GLOBAL"></a>## `social.INSTAGRAM\_REGEX\_GLOBAL` : <code>RegExp</code>-Regular expression to find multiple Instagram profile URLs in a text.-It has the following form: `/.../ig`.+Regular expression to find multiple Instagram profile URLs in a text or HTML.+It has the following form: `/.../ig` and matches URLs such as:+```+https://www.instagram.com/old_prague+www.instagram.com/old_prague/+instagr.am/old_prague+```++If the profile URL contains subdirectories or query parameters, the regular expression+extracts just the base part of the profile URL. For example, from text such as:+```+https://www.instagram.com/cristiano/followers+```+the expression extracts just the following base URL:+```+https://www.instagram.com/cristiano+```++Example usage:+```+const matches = text.match(Apify.utils.social.INSTAGRAM_REGEX_GLOBAL);+if (matches) console.log(`${matches.length} Instagram profiles found!`);+```<a name="social.TWITTER_REGEX"></a>## `social.TWITTER\_REGEX` : <code>RegExp</code>-Regular expression to exactly match a single Instagram profile URL.-It has the following form: `/^...$/i`.+Regular expression to exactly match a single Twitter profile URL.+It has the following form: `/^...$/i` and matches URLs such as:+```+https://www.twitter.com/apify+twitter.com/apify+```++The regular expression does NOT match URLs with additional+subdirectories or query parameters, such as:+```+https://www.twitter.com/realdonaldtrump/following+```++Example usage:+```+if (Apify.utils.social.TWITTER_REGEX_STRING.test('https://www.twitter.com/apify')) {+ console.log('Match!');+}+```<a name="social.TWITTER_REGEX_GLOBAL"></a>## `social.TWITTER\_REGEX\_GLOBAL` : <code>RegExp</code>-Regular expression to find multiple Instagram profile URLs in a text.-It has the following form: `/.../ig`.+Regular expression to find multiple Twitter profile URLs in a text or HTML.+It has the following form: `/.../ig` and matches URLs such as:+```+https://www.twitter.com/apify+twitter.com/apify+```++If the profile URL contains subdirectories or query parameters, the regular expression+extracts just the base part of the profile URL. For example, from text such as:+```+https://www.twitter.com/realdonaldtrump/following+```+the expression extracts only the following base URL:+```+https://www.twitter.com/realdonaldtrump+```++Example usage:+```+const matches = text.match(Apify.utils.social.TWITTER_REGEX_STRING);+if (matches) console.log(`${matches.length} Twitter profiles found!`);+```<a name="social.FACEBOOK_REGEX"></a>## `social.FACEBOOK\_REGEX` : <code>RegExp</code>-Regular expression to exactly match a single Facebook user profile URL.-It has the following form: `/^...$/i`.+Regular expression to exactly match a single Facebook profile URL.+It has the following form: `/^...$/i` and matches URLs such as:+```+https://www.facebook.com/apifytech+facebook.com/apifytech+fb.com/apifytech+https://www.facebook.com/profile.php?id=123456789+```++The regular expression does NOT match URLs with additional+subdirectories or query parameters, such as:+```+https://www.facebook.com/apifytech/photos+```++Example usage:+```+if (Apify.utils.social.FACEBOOK_REGEX_STRING.test('https://www.facebook.com/apifytech')) {+ console.log('Match!');+}+```<a name="social.FACEBOOK_REGEX_GLOBAL"></a>## `social.FACEBOOK\_REGEX\_GLOBAL` : <code>RegExp</code>-Regular expression to find multiple Instagram profile URLs in a text.-It has the following form: `/.../ig`.+Regular expression to find multiple Facebook profile URLs in a text or HTML.+It has the following form: `/.../ig` and matches URLs such as:+```+https://www.facebook.com/apifytech+facebook.com/apifytech+fb.com/apifytech+```++If the profile URL contains subdirectories or query parameters, the regular expression+extracts just the base part of the profile URL. For example, from text such as:+```+https://www.facebook.com/apifytech/photos+```+the expression extracts only the following base URL:+```+https://www.facebook.com/apifytech+```++Example usage:+```+const matches = text.match(Apify.utils.social.FACEBOOK_REGEX_GLOBAL);+if (matches) console.log(`${matches.length} Facebook profiles found!`);+```<a name="social.EMAIL_REGEX"></a>diff --git a/docs/examples/BasicCrawler.md b/docs/examples/BasicCrawler.mdindex f8c4fc8b5..f99f72092 100644--- a/docs/examples/BasicCrawler.md+++ b/docs/examples/BasicCrawler.md@@ -11,6 +11,9 @@ The script just downloads several web pages with plain HTTP requests (using the<a href="https://www.npmjs.com/package/request-promise" target="_blank">request-promise</a> library)and stores their raw HTML and URL to the default dataset.In local configuration, the data will be stored as JSON files in `./apify_storage/datasets/default`.++To run this example on the Apify Platform, select the `Node.js 8 on Alpine Linux (apify/actor-node-basic)` base image+on the source tab of your actor configuration.```javascriptconst Apify = require('apify');const requestPromise = require('request-promise');diff --git a/docs/examples/CallActor.md b/docs/examples/CallActor.mdindex c710e99d4..2ae39042b 100644--- a/docs/examples/CallActor.md+++ b/docs/examples/CallActor.md@@ -15,6 +15,9 @@ Go to <a href="https://my.apify.com/account#/integrations" target="_blank">Accouand set it to the `APIFY_TOKEN` [environment variable](../guides/environmentvariables), or run the script using the CLI.If you deploy this actor to the Apify Cloud then you can set up a scheduler for earlymorning.++To run this example on the Apify Platform, select the `Node.js 8 + Chrome on Debian (apify/actor-node-chrome)` base image+on the source tab of your actor configuration.```javascriptconst Apify = require('apify');diff --git a/docs/examples/CheerioCrawler.md b/docs/examples/CheerioCrawler.mdindex 8ce77ea66..f570734b5 100644--- a/docs/examples/CheerioCrawler.md+++ b/docs/examples/CheerioCrawler.md@@ -7,6 +7,9 @@ This example demonstrates how to use [`CheerioCrawler`](../api/cheeriocrawler)to crawl a list of URLs from an external file,load each URL using a plain HTTP request, parse the HTML using <a href="https://www.npmjs.com/package/cheerio" target="_blank">cheerio</a>and extract some data from it: the page title and all H1 tags.++To run this example on the Apify Platform, select the `Node.js 8 on Alpine Linux (apify/actor-node-basic)` base image+on the source tab of your actor configuration.```javascriptconst Apify = require('apify');diff --git a/docs/examples/HelloWorld.md b/docs/examples/HelloWorld.mdindex 76cc4d74e..d52678b9a 100644--- a/docs/examples/HelloWorld.md+++ b/docs/examples/HelloWorld.md@@ -4,6 +4,9 @@ title: Hello World---Run the following example to perform a recursive crawl of a website using Puppeteer.++To run this example on the Apify Platform, select the `Node.js 8 + Chrome on Debian (apify/actor-node-chrome)` base image+on the source tab of your actor configuration.```javascriptconst Apify = require('apify');diff --git a/docs/examples/PuppeteerCrawler.md b/docs/examples/PuppeteerCrawler.mdindex db5f184bb..e9ffdc7f6 100644--- a/docs/examples/PuppeteerCrawler.md+++ b/docs/examples/PuppeteerCrawler.md@@ -10,6 +10,9 @@ and [`RequestQueue`](../api/requestqueue) to recursively scrape theThe crawler starts with a single URL, finds links to next pages,enqueues them and continues until no more desired links are available.The results are stored to the default dataset. In local configuration, the results are stored as JSON files in `./apify_storage/datasets/default`++To run this example on the Apify Platform, select the `Node.js 8 + Chrome on Debian (apify/actor-node-chrome)` base image+on the source tab of your actor configuration.```javascriptconst Apify = require('apify');diff --git a/docs/examples/PuppeteerSitemap.md b/docs/examples/PuppeteerSitemap.mdindex c83595a0e..e7f635cc4 100644--- a/docs/examples/PuppeteerSitemap.md+++ b/docs/examples/PuppeteerSitemap.md@@ -7,6 +7,9 @@ This example demonstrates how to use [`PuppeteerCrawler`](../api/puppeteercrawlespecified in a sitemap. The crawler extracts page title and URL from each pageand stores them as a record to the default dataset.In local configuration, the results are stored as JSON files in `./apify_storage/datasets/default`++To run this example on the Apify Platform, select the `Node.js 8 + Chrome on Debian (apify/actor-node-chrome)` base image+on the source tab of your actor configuration.```javascriptconst Apify = require('apify');diff --git a/docs/examples/PuppeteerWithProxy.md b/docs/examples/PuppeteerWithProxy.mdindex def3a8623..d70baa2fb 100644--- a/docs/examples/PuppeteerWithProxy.md+++ b/docs/examples/PuppeteerWithProxy.md@@ -10,6 +10,9 @@ that has access to the proxy.The proxy password is available on the <a href="https://my.apify.com/proxy" target="_blank">Proxy</a> page in the app.Just set it to the `APIFY_PROXY_PASSWORD` [environment variable](../guides/environmentvariables)or run the script using the CLI.++To run this example on the Apify Platform, select the `Node.js 8 + Chrome on Debian (apify/actor-node-chrome)` base image+on the source tab of your actor configuration.```javascriptconst Apify = require('apify');diff --git a/docs/examples/Screenshots.md b/docs/examples/Screenshots.mdindex 9ba1bcedf..e4a68b207 100644--- a/docs/examples/Screenshots.md+++ b/docs/examples/Screenshots.md@@ -24,6 +24,9 @@ in the UI app or passed as the POST payload to the<a href="https://www.apify.com/docs/api/v2#/reference/actors/run-collection/run-actor" target="_blank">Run actor API call</a>.For more details, see <a href="https://www.apify.com/docs/actor#input-output" target="_blank">Input and output</a>in the Apify Actor documentation.++To run this example on the Apify Platform, select the `Node.js 8 + Chrome on Debian (apify/actor-node-chrome)` base image+on the source tab of your actor configuration.```javascriptconst Apify = require('apify');diff --git a/docs/examples/SynchronousRun.md b/docs/examples/SynchronousRun.mdindex 817be68d6..610ecd3dd 100644--- a/docs/examples/SynchronousRun.md+++ b/docs/examples/SynchronousRun.md@@ -16,6 +16,9 @@ actor in the Apify library, so you can test it directly there simply by sending```httphttps://api.apify.com/v2/acts/apify~example-golden-gate-webcam/run-sync?token=[YOUR_API_TOKEN]```++To run this example on the Apify Platform, select the `Node.js 8 + Chrome on Debian (apify/actor-node-chrome)` base image+on the source tab of your actor configuration.```javascriptconst Apify = require('apify');diff --git a/docs/typedefs/ActorRun.md b/docs/typedefs/ActorRun.mdindex 3458035f3..56e574ac8 100644--- a/docs/typedefs/ActorRun.md+++ b/docs/typedefs/ActorRun.md@@ -5,7 +5,7 @@ title: ActorRun<a name="ActorRun"></a>Represents information about an actor run, as returned by the-[`Apify.call()`](../api/apify#module_Apify.call) function.+[`Apify.call()`](../api/apify#module_Apify.call) or [`Apify.callTask()`](../api/apify#module_Apify.callTask) function.The object is almost equivalent to the JSON responseof the<a href="https://www.apify.com/docs/api/v2#/reference/actors/run-collection/run-actor" target="_blank">Actor run</a>