refactor: change Academy code examples to use Crawlee router#2293
Open
honzajavorek wants to merge 2 commits intomasterfrom
Open
refactor: change Academy code examples to use Crawlee router#2293honzajavorek wants to merge 2 commits intomasterfrom
honzajavorek wants to merge 2 commits intomasterfrom
Conversation
Fix #2181 Address #2097 (comment) by @B4nan
|
Preview for this PR was built for commit |
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the JavaScript Academy “Using a framework” lesson and its two associated Crawlee exercise solutions to use a router-based request handling structure instead of request.label branching inside a single inline requestHandler.
Changes:
- Update lesson code examples to register handlers via
addDefaultHandler()and labeledaddHandler()routes. - Refactor
crawlee_f1_drivers.mjsandcrawlee_netflix_ratings.mjsexercise solutions to split logic into dedicated router handlers. - Minor variable naming adjustment in the Netflix/IMDb exercise handler logic.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
sources/academy/webscraping/scraping_basics_javascript/exercises/crawlee_netflix_ratings.mjs |
Refactors the Netflix → IMDb workflow to router handlers (default, IMDB_SEARCH, IMDB). |
sources/academy/webscraping/scraping_basics_javascript/exercises/crawlee_f1_drivers.mjs |
Refactors listing vs. detail handling into router default + DRIVER handler. |
sources/academy/webscraping/scraping_basics_javascript/12_framework.md |
Updates lesson narrative and snippets to demonstrate the router-based approach. |
sources/academy/webscraping/scraping_basics_javascript/exercises/crawlee_f1_drivers.mjs
Show resolved
Hide resolved
sources/academy/webscraping/scraping_basics_javascript/exercises/crawlee_netflix_ratings.mjs
Show resolved
Hide resolved
sources/academy/webscraping/scraping_basics_javascript/exercises/crawlee_netflix_ratings.mjs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Preview for this PR was built for commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #2181, address #2097 (comment) by @B4nan
Note
Low Risk
Low risk documentation/exercise refactor that changes sample code structure to the newer Crawlee
routerAPI without altering the scraping behavior.Overview
Refactors the Crawlee lesson (
12_framework.md) to constructCheerioCrawlerwithout an inlinerequestHandlerand instead register routing viacrawler.router.addDefaultHandler()plus labeledaddHandler()functions (e.g.DETAIL,IMDB_SEARCH,IMDB).Updates the associated exercise solutions (
crawlee_f1_drivers.mjs,crawlee_netflix_ratings.mjs) to match the router-based pattern, removingrequest.labelbranching and splitting listing/search/detail logic into dedicated handlers while keeping the same data extraction and dataset export steps.Written by Cursor Bugbot for commit 1aa2eb6. Configure here.