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
Update example_basic_crawler.js
Marek Trunkát82cccd439649
diff --git a/examples/example_basic_crawler.js b/examples/example_basic_crawler.jsindex d0eb88113..330fadf34 100644--- a/examples/example_basic_crawler.js+++ b/examples/example_basic_crawler.js@@ -6,10 +6,10 @@ Apify.main(async () => {const requestList = new Apify.RequestList({sources: [{ url: 'http://www.example.com' },- { url: 'http://www.example.com/page-2' },- { url: 'http://www.example.com/page-3' },- { url: 'http://www.example.com/page-4' },- { url: 'http://www.example.com/page-5' },+ { url: 'http://www.example.com/?page=2' },+ { url: 'http://www.example.com/?page=3' },+ { url: 'http://www.example.com/?page=4' },+ { url: 'http://www.example.com/?page=5' },],});@@ -24,11 +24,25 @@ Apify.main(async () => {const pageHtml = await rp(request.url);console.log(`Request ${request.url} succeeded with return html of length ${pageHtml.length}`);++ await Apify.pushData({+ url: request.url,+ html: pageHtml,+ errors: null,+ })},// If request failed 4 times then this function is executed.handleFailedRequestFunction: async ({ request }) => {console.log(`Request ${request.url} failed 4 times`);++ console.log(request);++ await Apify.pushData({+ url: request.url,+ html: null,+ errors: request.errorMessages,+ })},});