I'm new in Scrapy and I have some troubles to get a table data. I'm trying to store in a file the table with id = grdTableView_DXMainTable from: view-source:http://databank.worldbank.org/data/reports.aspx?source=2&series=SE.PRM.NENR&country=
I'm using the following code:
import scrapy
class mySpider(scrapy.Spider):
name = "education"
def start_requests(self):
urls = [
'http://databank.worldbank.org/data/reports.aspx?source=2&series=SE.PRM.NENR&country=',
]
for url in urls:
yield scrapy.Request(url=url, callback=self.parse)
def parse(self, response):
page = response.url.split("/")[-2]
filename = 'education-%s.html' % page
with open(filename, 'wb') as f:
f.write(hxs.select('//table[@class="grdTableView_DXMainTable"]/td.//text()').extract())
self.log('Saved file %s' % filename)
The resulting html file is empty. Can anyone help me?