Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. import scrapy
  2.  
  3.  
  4. class MySpider(scrapy.Spider):
  5. name = 'MySpider'
  6.  
  7. start_urls = [
  8. 'https://www.app4health.it/',
  9. ]
  10.  
  11. def parse(self, response):
  12. self.logger.info('A response from %s just arrived!', response.url)
  13. print ('PRE RISULTATI')
  14.  
  15. risultati = response.selector.xpath('//*[@id="nav"]/ol/li[*]/a/@href').extract()
  16. #risultati = risultati = response.css('li a>href').extract()
  17.  
  18.  
  19. # QUESTO SULLA CONSOLE WORKA, QUANON VA NULLA
  20. #risultati = response.xpath('//*[@id="nav"]/ol/li[1]/a').extract()
  21. print (risultati)
  22.  
  23.  
  24.  
  25.  
  26. #for pagineitems in risultati:
  27. # next_page = pagineitems
  28. print ('PAGINA SUCCESSIVAAAAAAA')
  29. #LO IGNORA PERCHE DICE CHE E' GIA STATA RICHIESTA
  30. yield scrapy.Request(url=risultati, callback=self.prodotti,dont_filter = True)
  31.  
  32. def prodotti(self, response):
  33. self.logger.info('A REEEESPONSEEEEEE from %s just arrived!', response.url)
  34. return 1
  35.  
  36. response.selector.xpath('//*[@id="nav"]/ol/li[*]/a/@href').extract()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement