I am trying to make a scrapy script and I am not capable of what the strip method removes the blanks ... It should be a string but it is an object. Any way to do it?
import scrapy
class GamesSpider(scrapy.Spider):
name = "games"
start_urls = [
'myurl',
]
def parse(self, response):
for game in response.css('ol#products-list li.item'):
yield {
'name': game.css('h2.product-name a::text').extract_first().strip(),
'age': game.css('.list-price ul li:nth-child(1)::text').extract_first(),
'players': game.css('.list-price ul li:nth-child(2)::text').extract_first(),
'duration': game.css('.list-price ul li:nth-child(3)::text').extract_first(),
'dimensions': game.css('.list-price ul li:nth-child(4)::text').extract_first()
}