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
Updating docs - replacing getValue('INPUT') with getInput()
Marek Trunkat53203624ea9a
diff --git a/docs/guides/data_storage.md b/docs/guides/data_storage.mdindex b1c12201f..783571e82 100644--- a/docs/guides/data_storage.md+++ b/docs/guides/data_storage.md@@ -54,7 +54,7 @@ The following code demonstrates basic operations of key-value stores:```javascript// Get actor input from the default key-value store-const input = await Apify.getValue('INPUT');+const input = await Apify.getInput();// Write actor output to the default key-value store.await Apify.setValue('OUTPUT', { myResult: 123 });diff --git a/docs/guides/getting_started.md b/docs/guides/getting_started.mdindex 4dad3b556..c6140ac8a 100644--- a/docs/guides/getting_started.md+++ b/docs/guides/getting_started.md@@ -1155,10 +1155,10 @@ Anyway, to spark some ideas, let's look at two more things. First, passing an inWe will not go into `KeyValueStore` details here, but for the sake of `INPUT` you need to remember that there is a function that helps you get it (or anything else from the store, actually):```js-const input = await Apify.getValue('INPUT');+const input = await Apify.getInput();```-On the Apify Platform, the actor's input that you can set in the Console is automatically saved to the default `KeyValueStore` under the key `INPUT`. So it follows that by calling [`Apify.getValue('INPUT')`](../api/apify#apify.getValue) you retrieve the value under the given key and voila, there's your `INPUT`.+On the Apify Platform, the actor's input that you can set in the Console is automatically saved to the default `KeyValueStore` under the key `INPUT`. So it follows that by calling [`Apify.getInput()`](../api/apify#apify.getValue) you retrieve the value under the given key and voila, there's your `INPUT`.Running locally, you need to place an `INPUT.json` file in your default key value store for this to work.@@ -1185,7 +1185,7 @@ Once we have that, we can load it in the actor and populate the crawler's source```js// ...-const input = await Apify.getValue('INPUT');+const input = await Apify.getInput();const sources = input.map(category => ({url: `https://www.apify.com/library?type=acts&category=${category}`,@@ -1240,7 +1240,7 @@ Apify.main(async () => {async function getSources() {log.debug('Getting sources.');- const input = await Apify.getValue('INPUT');+ const input = await Apify.getInput();return input.map(category => ({url: `https://www.apify.com/library?type=acts&category=${category}`,diff --git a/examples/screenshots.js b/examples/screenshots.jsindex ed0865409..0897caea0 100644--- a/examples/screenshots.js+++ b/examples/screenshots.js@@ -30,7 +30,7 @@ const Apify = require('apify');Apify.main(async () => {// Read the actor input configuration containing the URLs for the screenshot.// By convention, the input is present in the actor's default key-value store under the "INPUT" key.- const input = await Apify.getValue('INPUT');+ const input = await Apify.getInput();if (!input) throw new Error('Have you passed the correct INPUT ?');const { sources } = input;diff --git a/src/key_value_store.js b/src/key_value_store.jsindex 1682b1702..a513ccad8 100644--- a/src/key_value_store.js+++ b/src/key_value_store.js@@ -112,6 +112,8 @@ export const maybeStringify = (value, options) => {* [`Apify.getValue()`](apify#module_Apify.getValue)* and [`Apify.setValue()`](apify#module_Apify.setValue) convenience functions.*+ * To access the input, you can also use the [`Apify.getInput()`](apify#module_Apify.getInput) convenience function.+ ** `KeyValueStore` stores its data either on local disk or in the Apify cloud,* depending on whether the `APIFY_LOCAL_STORAGE_DIR` or `APIFY_TOKEN` environment variables are set.*@@ -134,7 +136,8 @@ export const maybeStringify = (value, options) => {** ```javascript* // Get actor input from the default key-value store- * const input = await Apify.getValue('INPUT');+ * const input = await Apify.getInput();+ * const otherValue = Apify.getValue('my-key');** // Write actor output to the default key-value store.* await Apify.setValue('OUTPUT', { myResult: 123 });@@ -600,13 +603,13 @@ export const openKeyValueStore = (storeIdOrName, options = {}) => {* This is just a convenient shortcut for [`keyValueStore.getValue()`](keyvaluestore#KeyValueStore+getValue).* For example, calling the following code:* ```javascript- * const input = await Apify.getValue('INPUT');+ * const input = await Apify.getValue('my-key');* ```** is equivalent to:* ```javascript* const store = await Apify.openKeyValueStore();- * await store.getValue('INPUT');+ * await store.getValue('my-key');* ```** To store the value to the default-key value store, you can use the [`Apify.setValue()`](#module_Apify.setValue) function.