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
Fix some selectors in tutorial
Travis CI69a96c794bf5
diff --git a/docs/guides/getting_started.md b/docs/guides/getting_started.mdindex cdf7703b0..2e8d742f0 100644--- a/docs/guides/getting_started.md+++ b/docs/guides/getting_started.md@@ -1199,17 +1199,21 @@ Now it's time to add more data to the results. Let's open one of the actor detai-Let's start really easy. By using the element selector tool, we find out that the title is there under an `<h1>` tag, as titles should be.+By using the element selector tool, we find out that the title is there under an `<h1>` tag, as titles should be.+Maybe surprisingly, we find that there are actually two `<h1>` tags on the detail page. This should get us thinking.+Is there any parent element that includes our `<h1>` tag, but not the other ones? Yes, there is! There is a `<header>`+element that we can use to select only the heading we're interested in.> Remember that you can press CTRL+F (CMD+F) in the Elements tab of DevTools to open the search bar where you can quickly search for elements using> their selectors. And always make sure to use the DevTools to verify your scraping process and assumptions. It's faster than changing the crawler> code all the time.-To get the title we just need to find it using `Cheerio`:+To get the title we just need to find it using `Cheerio` and a `header h1` selector, which selects all `<h1>` elements that have a `<header>` parent.+And as we already know, there's only one.```jsreturn {- title: $('h1').text(),+ title: $('header h1').text(),};```@@ -1217,15 +1221,15 @@ return {Getting the actor's description is a little more involved, but still pretty straightforward. We can't just simply search for a `<p>` tag, becausethere's a lot of them in the page. We need to narrow our search down a little. Using the DevTools we find that the actor description is nested within-the `<header>` element, which is nested itself in the `<main>` element. Sadly, we're still left with two `<p>` tags. To finally select only the+the `<header>` element too, same as the title. Sadly, we're still left with two `<p>` tags. To finally select only thedescription, we choose the `<p>` tag that has a `class` that starts with `Text__Paragraph`.```jsreturn {- title: $('h1').text(),- description: $('main header p[class^=Text__Paragraph]').text(),+ title: $('header h1').text(),+ description: $('header p[class^=Text__Paragraph]').text(),};```@@ -1237,8 +1241,8 @@ The DevTools tell us that the `lastRunDate` can be found in the second of the tw```jsreturn {- title: $('h1').text(),- description: $('main header p[class^=Text__Paragraph]').text(),+ title: $('header h1').text(),+ description: $('header p[class^=Text__Paragraph]').text(),lastRunDate: new Date(Number($('time')@@ -1264,8 +1268,8 @@ transformation on the result.```jsreturn {- title: $('h1').text(),- description: $('main header p[class^=Text__Paragraph]').text(),+ title: $('header h1').text(),+ description: $('header p[class^=Text__Paragraph]').text(),lastRunDate: new Date(Number($('time')@@ -1295,8 +1299,8 @@ const results = {url: request.url,uniqueIdentifier: urlArr.join('/'),owner: urlArr[0],- title: $('h1').text(),- description: $('main header p[class^=Text__Paragraph]').text(),+ title: $('header h1').text(),+ description: $('header p[class^=Text__Paragraph]').text(),lastRunDate: new Date(Number($('time')@@ -1346,8 +1350,8 @@ Apify.main(async () => {url: request.url,uniqueIdentifier: urlArr.join('/'),owner: urlArr[0],- title: $('h1').text(),- description: $('main header p[class^=Text__Paragraph]').text(),+ title: $('header h1').text(),+ description: $('header p[class^=Text__Paragraph]').text(),lastRunDate: new Date(Number($('time')@@ -1430,8 +1434,8 @@ Apify.main(async () => {url: request.url,uniqueIdentifier: urlArr.join('/'),owner: urlArr[0],- title: $('h1').text(),- description: $('main header p[class^=Text__Paragraph]').text(),+ title: $('header h1').text(),+ description: $('header p[class^=Text__Paragraph]').text(),lastRunDate: new Date(Number($('time')@@ -1680,8 +1684,8 @@ exports.DETAIL = async ({ $, request }) => {url: request.url,uniqueIdentifier: urlArr.join('/'),owner: urlArr[0],- title: $('h1').text(),- description: $('main header p[class^=Text__Paragraph]').text(),+ title: $('header h1').text(),+ description: $('header p[class^=Text__Paragraph]').text(),lastRunDate: new Date(Number($('time')