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
added getPublicUrl function to key_value_store
Aaron Jackson4443fc793e70
diff --git a/package.json b/package.jsonindex ca17a197e..4786b398d 100644--- a/package.json+++ b/package.json@@ -79,6 +79,7 @@"eslint-config-airbnb-base": "^13.1.0","eslint-plugin-import": "^2.14.0","eslint-plugin-jsx-a11y": "^6.1.2",+ "eslint-plugin-mocha": "^5.2.0","eslint-plugin-promise": "^4.0.1","eslint-plugin-react": "^7.11.1","jsdoc": "^3.5.5",diff --git a/src/key_value_store.js b/src/key_value_store.jsindex 3fcf7b663..2f78ddf1a 100644--- a/src/key_value_store.js+++ b/src/key_value_store.js@@ -289,6 +289,12 @@ export class KeyValueStore {if (this.storeName) storesCache.remove(this.storeName);});}++ getPublicUrl(fileName) {+ ensureTokenOrLocalStorageEnvExists('key value store');+ const publicUrl = `https://api.apify.com/v2/key-value-stores/${this.storeId}/records/${fileName}`;+ return publicUrl;+ }}/**@@ -430,16 +436,12 @@ export class KeyValueStoreLocal {/*** Retrieves the full public url of the designated file.- * @param {String} fileName+ * @param {String} fileName*/- _getPublicUrl( fileName ) {+ getPublicUrl(fileName) {ensureTokenOrLocalStorageEnvExists('key value store');- var storeId = process.env[ENV_VARS.DEFAULT_KEY_VALUE_STORE_ID];-- const publicUrl = `https://api.apify.com/v2/key-value-stores/${storeId}/records/${fileName}`;const publicLocalUrl = `file://${this.localStoragePath}/${fileName}`;-- return process.env[_consts.ENV_VARS.LOCAL_STORAGE_DIR] && !this.forceCloud ? publicLocalUrl : publicUrl;+ return process.env[ENV_VARS.LOCAL_STORAGE_DIR] && !this.forceCloud ? publicLocalUrl : publicUrl;}}