web scraping - Scrapy run from Python -
i trying run scrapy python. i'm looking @ code (source):
from twisted.internet import reactor scrapy.crawler import crawler scrapy.settings import settings scrapy import log testspiders.spiders.followall import followallspider spider = followallspider(domain='scrapinghub.com') crawler = crawler(settings()) crawler.configure() crawler.crawl(spider) crawler.start() log.start() reactor.run() # script block here
my issue i'm confused on how adjust code run own spider. have called spider project "spider_a" specifies domain crawl within spider itself.
what asking is, if run spider following code:
scrapy crawl spider_a
how adjust example python code above same?
just import , pass crawler.crawl()
, like:
from testspiders.spiders.spider_a import myspider spider = myspider() crawler.crawl(spider)
Comments
Post a Comment