Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

How to pass a user defined argument in scrapy spider

class VisualScrapySpider(scrapy.Spider):
    name = 'visualscrapy'

    def __init__(self, category='', **kwargs):
        self.start_urls = [f'http://www.visualscrapy.com/search?query={category}']
        super().__init__(**kwargs)

#scrapy crawl visualscrapy -a category=<search_parameter>
 
PREVIOUS NEXT
Tagged: #How #pass #user #defined #argument #scrapy #spider
ADD COMMENT
Topic
Name
8+9 =