June 2018
Beginner
508 pages
13h 8m
English
Here's how the script starts:
# scrape.pyimport argparseimport base64import jsonimport osfrom bs4 import BeautifulSoupimport requests
Going through them from the top, you can see that we'll need to parse the arguments, which we'll feed to the script itself (argparse). We will need the base64 library to save the images within a JSON file (json), and we'll need to open files for writing (os). Finally, we'll need BeautifulSoup for scraping the web page easily, and requests to fetch its content. I assume you're familiar with requests as we have used it in previous chapters.
Read now
Unlock full access