import scrapy
from scrapy.crawler import CrawlerRunner
class Livescores2(scrapy.Spider):
name = 'Home'
def start_requests(self):
yield scrapy.Request('https://www.livescores.com/football/turkey/super-lig/?tz=3&table=league-home')
def parse(self, response):
for total in response.css('td'):
yield{
'total': total.css('::text').get()
}
runner2 = CrawlerRunner()
runner2.crawl(Livescores2)
When i adjust settings like below, i can save the data as json without a problem.
runner2 = CrawlerRunner(settings = {
"FEEDS": {
"Home.json": {"format": "json", "overwrite": True},
},
})
I want to assign the returned Scrapy data to a Variable so i can work on it. I don't want any Json data!
I tried:
import scrapy
from scrapy.crawler import CrawlerRunner
class Livescores2(scrapy.Spider):
name = 'Home'
def start_requests(self):
yield scrapy.Request('https://www.livescores.com/football/turkey/super-lig/?tz=3&table=league-home')
def parse(self, response):
for total in response.css('td'):
yield{
'total': total.css('::text').get()
}
runner2 = CrawlerRunner()
a = runner2.crawl(Livescores2)
print(a)
Result is: <Deferred at 0x65cbfb6d0>
How can i reach the data from a variable? I develop a Android app so i don't need any Json file. I don't know how to use "return" function on this code.
Thanks very much