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.

Improve clarity

Ondra Urbanda8dc5500295
diff --git a/src/enqueue_links.js b/src/enqueue_links.js
index 221e4bea5..2a0426f7b 100644
--- a/src/enqueue_links.js
+++ b/src/enqueue_links.js
@@ -73,7 +73,7 @@ export const extraxtUrlsFromCheerio = ($, selector, baseUrl) => {
return $(selector)
.map((i, el) => $(el).attr('href'))
.get()
- .filter(href => href)
+ .filter(href => !!href)
.map((href) => {
// Throw a meaningful error when only a relative URL would be extracted instead of waiting for the Request to fail later.
const isHrefAbsolute = /^[a-z][a-z0-9+.-]*:/.test(href); // Grabbed this in 'is-absolute-url' package.