Skip to content

Commit e4617b9

Browse files
committed
fix: variable names in code example
1 parent 094e5e2 commit e4617b9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sources/academy/webscraping/scraping_basics_javascript2/11_scraping_variants.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,13 @@ async function download(url) {
237237
}
238238

239239
function parseProduct(productItem, baseURL) {
240-
const title = productItem.find(".product-item__title");
241-
const titleText = title.text().trim();
242-
const url = new URL(title.attr("href"), baseURL).href;
240+
const $title = $productItem.find(".product-item__title");
241+
const title = $title.text().trim();
242+
const url = new URL($title.attr("href"), baseURL).href;
243243

244-
const price = productItem.find(".price").contents().last();
244+
const $price = $productItem.find(".price").contents().last();
245245
const priceRange = { minPrice: null, price: null };
246-
const priceText = price
246+
const priceText = $price
247247
.text()
248248
.trim()
249249
.replace("$", "")
@@ -257,7 +257,7 @@ function parseProduct(productItem, baseURL) {
257257
priceRange.price = priceRange.minPrice;
258258
}
259259

260-
return { url, title: titleText, ...priceRange };
260+
return { url, title, ...priceRange };
261261
}
262262

263263
async function exportJSON(data) {

0 commit comments

Comments
 (0)