You've watched the screencast, here's the code! The screencast starts off with fruit-step-0.mjs, and progresses from there.
The changes for each step are as follows:
- fruit-step-0.mjs: we start here
- fruit-step-1.mjs: adds thumbnail url parsing and downloadResults function to download thumbnails from a single result page
- fruit-step-2.mjs: adds parsing of each result's common name and adds skip condition for apples
- fruit-step-3.mjs: adds paging
- fruit-step-4.mjs: adds collection of save results with common name into array of objects, then saving to 'saved-fruits.json'
Finally, we make a directory called 'cropped' and created a cropped version of each downloaded image using ImageMagick's 'chop' command:
mkdir cropped
for f in ./*.jpg ; do convert "$f" -gravity north -chop 0x10 -gravity east -chop 10x0 -gravity south -chop 0x10 -gravity west -chop 10x0 "cropped/${f%.jpg}.jpg" ; done