I am trying to yield the value of a tag that isn't always present in the pages that I scrape with Scrapy. I am using the extract() function rather than extract_first(). Therefore I cannot seem to set a default value, like suggested in this SO post.
This doesn't work:
def parse(self, response):
yield {
'comments': response.css('[itemprop=commentCount]::attr(content)').extract(default=None)
}
How can I set None as default when I want to use extract() rather than extract_first()?
Thanks very much in advance!