Exemplo n.º 1
0
 def parse(self, response):
     sel = Selector(response)
     sites = sel.xpath('//ul')
     items = []
     for site in sites:
         item = {}
         item['quotes'] = site.xpath('li/b/text()').extract()
         if len(item['quotes']) != 0: 
             items.append(item)
     data.saveQuotes(self.start_urls, self.allowed_domains, items)
     return 0
Exemplo n.º 2
0
 def parse(self, response):
     sel = Selector(response)
     sites = sel.xpath('//div')
     items = []
     for site in sites:
         item = {}
         item['body'] = str("".join(site.xpath('div[@class="quoteText"]/text()').extract()).encode('UTF-8'))
         item['author'] = str("".join(site.xpath('div[@class="quoteText"]/a/text()').extract()).encode('UTF-8'))
         item['work'] = str("".join(site.xpath('div[@class="quoteText"]/i/a/text()').extract()).encode('UTF-8'))
         if len(item['body']) != 0: 
             items.append(item)
     data.saveQuotes(self.start_urls,self.allowed_domains,items)
     return 0
Exemplo n.º 3
0
 def parse(self, response):
     sel = Selector(response)
     sites = sel.xpath('//div')
     items = []
     for site in sites:
         item = {}
         item['body'] = str("".join(
             site.xpath('div[@class="quoteText"]/text()').extract()).
                            encode('UTF-8'))
         item['author'] = str("".join(
             site.xpath('div[@class="quoteText"]/a/text()').extract()).
                              encode('UTF-8'))
         item['work'] = str("".join(
             site.xpath('div[@class="quoteText"]/i/a/text()').extract()
         ).encode('UTF-8'))
         if len(item['body']) != 0:
             items.append(item)
     data.saveQuotes(self.start_urls, self.allowed_domains, items)
     return 0