Skip to content

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.

Update with PR comments

Ondra Urband44d5668d1b2
diff --git a/src/enqueue_links.js b/src/enqueue_links.js
index 703ccdeb9..d7a515e5e 100644
--- a/src/enqueue_links.js
+++ b/src/enqueue_links.js
@@ -16,7 +16,7 @@ const enqueueLinksCache = new Map();
export const MAX_ENQUEUE_LINKS_CACHE_SIZE = 1000;
/**
- * Helper factory used in the `enqeueLinks()` function.
+ * Helper factory used in the `enqueueLinks()` function.
* @param {Array} pseudoUrls
* @returns {Array}
* @ignore
diff --git a/src/puppeteer_utils.js b/src/puppeteer_utils.js
index b91d2f877..d58c98df3 100644
--- a/src/puppeteer_utils.js
+++ b/src/puppeteer_utils.js
@@ -332,6 +332,7 @@ const compileScript = (scriptString, context = Object.create(null)) => {
return func;
};
+let logEnqueueLinksDeprecationWarning = true;
/**
* A namespace that contains various utilities for
@@ -359,7 +360,14 @@ export const puppeteerUtils = {
injectJQuery,
injectUnderscore,
enqueueRequestsFromClickableElements,
- enqueueLinks,
+ enqueueLinks: async (...args) => {
+ if (logEnqueueLinksDeprecationWarning) {
+ log.warning('Using enqueueLinks() from the Apify.utils.puppeteer namespace is deprecated. '
+ + 'Please use the Apify.utils.enqueueLinks().');
+ logEnqueueLinksDeprecationWarning = false;
+ return enqueueLinks(...args);
+ }
+ },
blockResources,
cacheResponses,
compileScript,
diff --git a/test/puppeteer_utils.js b/test/puppeteer_utils.js
index feed17122..5c15819cc 100644
--- a/test/puppeteer_utils.js
+++ b/test/puppeteer_utils.js
@@ -98,8 +98,15 @@ describe('Apify.utils.puppeteer', () => {
}
});
+ // TODO Remove with 1.0.0. This is here as a backwards comp for moving
+ // the function from utils.puppeteer to utils.
it('enqueueLinks() exists in this namespace', async () => {
expect(Apify.utils.puppeteer.enqueueLinks).to.be.a('function');
+ try {
+ await Apify.utils.puppeteer.enqueueLinks({ page: {}, $: () => {} });
+ } catch (err) {
+ expect(err.message).to.be.eql('Only one of the parameters "options.page" or "options.$" must be provided!');
+ }
});
it('supports blockResources() with default values', async () => {