-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use CrawlerProcess to run multiple scrapy crawlers simultaneously
- Loading branch information
1 parent
a44e48b
commit a227db1
Showing
2 changed files
with
22 additions
and
6 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from scrapy.utils.project import get_project_settings | ||
from scrapy.crawler import CrawlerProcess | ||
|
||
setting = get_project_settings() | ||
process = CrawlerProcess(setting) | ||
# https://doc.scrapy.org/en/latest/topics/api.html#scrapy.crawler.CrawlerProcess | ||
|
||
for spider in process.spiders.list(): | ||
print("Running spider %s" % (spider)) | ||
process.crawl(spider) | ||
|
||
process.start() |