From 5c3cc0df6aef0fca22589f53fde96ec38955650c Mon Sep 17 00:00:00 2001 From: Honza Javorek Date: Thu, 4 Sep 2025 10:32:49 +0200 Subject: [PATCH] fix: missing semicolon --- .../scraping_basics_javascript2/09_getting_links.md | 4 ++-- .../webscraping/scraping_basics_javascript2/10_crawling.md | 6 +++--- .../scraping_basics_javascript2/11_scraping_variants.md | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sources/academy/webscraping/scraping_basics_javascript2/09_getting_links.md b/sources/academy/webscraping/scraping_basics_javascript2/09_getting_links.md index db62d6394a..104e7da8da 100644 --- a/sources/academy/webscraping/scraping_basics_javascript2/09_getting_links.md +++ b/sources/academy/webscraping/scraping_basics_javascript2/09_getting_links.md @@ -187,7 +187,7 @@ async function exportCSV(data) { return await parser.parse(data).promise(); } -const listingURL = "https://warehouse-theme-metal.myshopify.com/collections/sales" +const listingURL = "https://warehouse-theme-metal.myshopify.com/collections/sales"; const $ = await download(listingURL); const $items = $(".product-item").map((i, element) => { @@ -283,7 +283,7 @@ function parseProduct($productItem, baseURL) { Now we'll pass the base URL to the function in the main body of our program: ```js -const listingURL = "https://warehouse-theme-metal.myshopify.com/collections/sales" +const listingURL = "https://warehouse-theme-metal.myshopify.com/collections/sales"; const $ = await download(listingURL); const $items = $(".product-item").map((i, element) => { diff --git a/sources/academy/webscraping/scraping_basics_javascript2/10_crawling.md b/sources/academy/webscraping/scraping_basics_javascript2/10_crawling.md index 10546ab2f2..6bac324a05 100644 --- a/sources/academy/webscraping/scraping_basics_javascript2/10_crawling.md +++ b/sources/academy/webscraping/scraping_basics_javascript2/10_crawling.md @@ -64,7 +64,7 @@ async function exportCSV(data) { return await parser.parse(data).promise(); } -const listingURL = "https://warehouse-theme-metal.myshopify.com/collections/sales" +const listingURL = "https://warehouse-theme-metal.myshopify.com/collections/sales"; const $ = await download(listingURL); const $items = $(".product-item").map((i, element) => { @@ -134,7 +134,7 @@ In the `.map()` loop, we're already going through all the products. Let's expand First, we need to make the loop asynchronous so that we can use `await download()` for each product. We'll add the `async` keyword to the inner function and rename the collection to `$promises`, since it will now store promises that resolve to items rather than the items themselves. We'll still convert the collection to a standard JavaScript array, but this time we'll pass it to `await Promise.all()` to resolve all the promises and retrieve the actual items. ```js -const listingURL = "https://warehouse-theme-metal.myshopify.com/collections/sales" +const listingURL = "https://warehouse-theme-metal.myshopify.com/collections/sales"; const $ = await download(listingURL); // highlight-next-line @@ -150,7 +150,7 @@ const data = await Promise.all($promises.get()); The program behaves the same as before, but now the code is prepared to make HTTP requests from within the inner function. Let's do it: ```js -const listingURL = "https://warehouse-theme-metal.myshopify.com/collections/sales" +const listingURL = "https://warehouse-theme-metal.myshopify.com/collections/sales"; const $ = await download(listingURL); const $promises = $(".product-item").map(async (i, element) => { diff --git a/sources/academy/webscraping/scraping_basics_javascript2/11_scraping_variants.md b/sources/academy/webscraping/scraping_basics_javascript2/11_scraping_variants.md index 48a64b389d..f2f3827907 100644 --- a/sources/academy/webscraping/scraping_basics_javascript2/11_scraping_variants.md +++ b/sources/academy/webscraping/scraping_basics_javascript2/11_scraping_variants.md @@ -102,7 +102,7 @@ We loop over the variants using Cheerio's `.map()` method to create a collection Let's adjust the loop so it returns a promise that resolves to an array of items instead of a single item. If a product has no variants, we'll return an array with a single item, setting `variantName` to `null`: ```js -const listingURL = "https://warehouse-theme-metal.myshopify.com/collections/sales" +const listingURL = "https://warehouse-theme-metal.myshopify.com/collections/sales"; const $ = await download(listingURL); const $promises = $(".product-item").map(async (i, element) => { @@ -285,7 +285,7 @@ function parseVariant($option) { } // highlight-end -const listingURL = "https://warehouse-theme-metal.myshopify.com/collections/sales" +const listingURL = "https://warehouse-theme-metal.myshopify.com/collections/sales"; const $ = await download(listingURL); const $promises = $(".product-item").map(async (i, element) => {