Skip to content

Commit 2bb3c6f

Browse files
fix: watch out for unexpected corner cases
Co-authored-by: gullmar <[email protected]>
1 parent ed3488b commit 2bb3c6f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sources/academy/webscraping/scraping_basics_javascript2/12_framework.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,14 +525,16 @@ When navigating to the first IMDb search result, you might find it helpful to kn
525525
// handle IMDB search results
526526
await enqueueLinks({ selector: '.find-result-item a', label: 'IMDB', limit: 1 });
527527

528-
} else {
528+
} else if (request.label === 'NETFLIX') {
529529
// handle Netflix table
530530
const $requests = $('[data-uia="top10-table-row-title"] button').map((i, nameButton) => {
531531
const name = $(nameButton).text().trim();
532532
const imdbSearchUrl = `https://www.imdb.com/find/?q=${escape(name)}&s=tt&ttype=ft`;
533533
return new Request({ url: imdbSearchUrl, label: 'IMDB_SEARCH' });
534534
});
535535
await addRequests($requests.get());
536+
} else {
537+
throw new Error(`Unexpected request label: ${request.label}`);
536538
}
537539
},
538540
});

0 commit comments

Comments
 (0)