I have a process (external to Scrapy), which generates a list of URLs to pdf documents, and a list filepaths where I want to save the each pdf.
The following explains how to pass a list of URLs to Scrapy as a command line argument, however, is there a way to pass the filepaths and ensure each pdf is saved in the filepaths provided?
I suspect I need to modify the below based on the tutorial provided in the documentation, but as I understand it the parse
method is used to determine how one response is handled, and does not handle a list.
def parse(self, response):
filename = response.url.split("/")[-2] + '.html'
with open(filename, 'wb') as f:
f.write(response.body)
Any suggestions?