I successfully tried to export my items into a csv file from the command line like:
scrapy crawl spiderName -o filename.csv
My question
Up-to-date answer is:
Use build-in exporter. You can set filename as key. Config may look like:
filename = 'export'
class mySpider(scrapy.Spider):
custom_settings = {
'FEEDS': {
f'{filename}.csv': {
'format': 'csv',
'overwrite': True
}
}
}
Documentation: https://docs.scrapy.org/en/latest/topics/feed-exports.html#std-setting-FEEDS