How to give URL to scrapy for crawling?

I’m not really sure about the commandline option. However, you could write your spider like this.

class MySpider(BaseSpider):

    name="my_spider"    

    def __init__(self, *args, **kwargs): 
      super(MySpider, self).__init__(*args, **kwargs) 

      self.start_urls = [kwargs.get('start_url')] 

And start it like:
scrapy crawl my_spider -a start_url="http://some_url"

Leave a Comment