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.

Fix default value when null in extractUrls()

Ondra Urbanab351e8668b6
diff --git a/src/utils.js b/src/utils.js
index 49d733fc7..a1730dc87 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -372,6 +372,7 @@ export const downloadListOfUrls = ({ url, encoding, urlRegExp }) => {
* @param keepCommas
* @returns {Array}
*/
-export const extractUrls = ({ string, urlRegExp = URL_NO_COMMAS_REGEX }) => {
+export const extractUrls = ({ string, urlRegExp }) => {
+ urlRegExp = urlRegExp || URL_NO_COMMAS_REGEX;
return string.match(urlRegExp) || [];
};