Last active
December 13, 2020 04:05
-
-
Save masala-man/7435a7921ff313ae3103da7d444de438 to your computer and use it in GitHub Desktop.
[Run Scrapy Spider] Minimal script to run a single scrapy spider.
This file contains 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
import scrapy | |
from scrapy.crawler import CrawlerProcess | |
class MySpider(scrapy.Spider): | |
# Your spider definition | |
... | |
process = CrawlerProcess({ | |
'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)' | |
}) | |
process.crawl(MySpider) | |
process.start() # the script will block here until the crawling is finished |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment