Skip to content

Commit 3bde6d6

Browse files
committed
fix: address bugbot comments
1 parent 1e413ef commit 3bde6d6

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

sources/academy/webscraping/scraping_basics_javascript/exercises/crawlee_netflix_ratings.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@ const crawler = new CheerioCrawler({
1616
}
1717
} else if (request.label === 'IMDB_SEARCH') {
1818
await enqueueLinks({ selector: '.find-result-item a', label: 'IMDB', limit: 1 });
19-
} else if (request.label === 'NETFLIX') {
19+
} else {
2020
const requests = $("[data-uia='top10-table-row-title'] button").toArray().map((buttonElement) => {
2121
const name = $(buttonElement).text().trim();
2222
const imdbSearchUrl = `https://www.imdb.com/find/?q=${escape(name)}&s=tt&ttype=ft`;
2323
return new Request({ url: imdbSearchUrl, label: 'IMDB_SEARCH' });
2424
});
2525
await addRequests(requests);
26-
} else {
27-
throw new Error(`Unexpected request label: ${request.label}`);
2826
}
2927
},
3028
});

sources/academy/webscraping/scraping_basics_javascript/exercises/test.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,6 @@ teardown_file() {
145145
(( status == 0 ))
146146
[[ -f dataset.json ]]
147147
[[ $(cat dataset.json | jq '. | length') == "10" ]]
148-
[[ $(cat dataset.json | jq -c '.[0] | keys') == '["url","title","rating"]' ]]
148+
[[ $(cat dataset.json | jq -c '.[0] | keys') == '["rating","title","url"]' ]]
149149
[[ $(cat dataset.json | jq '.[].url') == *"https://www.imdb.com/title/"* ]]
150150
}

sources/academy/webscraping/scraping_basics_python/exercises/test.bats

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ teardown() {
7070
}
7171

7272
@test "filters products from JSON" {
73-
echo '[{"title":"Premium Speakers","minPrice":75000,"price":75000},{"title":"Budget Headphones","minPrice":25000,"price":25000}]' > products.json
73+
echo '[{"title":"Premium Speakers","min_price":75000,"price":75000},{"title":"Budget Headphones","min_price":25000,"price":25000}]' > products.json
7474

7575
run uv run python process_products_json.py
7676

77-
[[ "$output" == "{ title: 'Premium Speakers', minPrice: 75000, price: 75000 }" ]]
77+
[[ "$output" == "{'title': 'Premium Speakers', 'min_price': 75000, 'price': 75000}" ]]
7878
}
7979

8080
@test "lists Wikipedia country links" {
@@ -140,6 +140,6 @@ teardown() {
140140
(( status == 0 ))
141141
[[ -f dataset.json ]]
142142
[[ $(cat dataset.json | jq '. | length') == "10" ]]
143-
[[ $(cat dataset.json | jq -c '.[0] | keys') == '["url","title","rating"]' ]]
143+
[[ $(cat dataset.json | jq -c '.[0] | keys') == '["rating","title","url"]' ]]
144144
[[ $(cat dataset.json | jq '.[].url') == *"https://www.imdb.com/title/"* ]]
145145
}

0 commit comments

Comments
 (0)