There's more...

The script also defines code for when executing the script directly with Python:

if __name__ == "__main__":    process = CrawlerProcess({        'DOWNLOAD_DELAY': 5,        'RANDOMIZED_DOWNLOAD_DELAY': False,        'LOG_LEVEL': 'DEBUG'    })    process.crawl(Spider)    process.start()

This begins by creating a CrawlerProcess object. This object can be passed a dictionary representing the settings and values to configure the crawl with. This defaults to a five-second delay, without randomization, and an output level of DEBUG.

Get Python Web Scraping Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.