2016-06-23 6 views
0

このリンクのすべてのページを削除します。http://www.jobisjob.co.uk/search?directUserSearch=true&whatInSearchBox=&whereInSearchBox=londonこのリンクのすべてのページをスクラップする方法

私はさまざまな方法を試しましたが、解決策はありませんでした。

以下

は私のコード

import scrapy 

    class jobisjobSpider(scrapy.Spider): 

     enter code here 
     name = 'jobisjob' 
     allowed_domains = ['jobisjob.co.uk'] 

     start_urls = ['http://www.jobisjob.co.uk/search?directUserSearch=true&whatInSearchBox=&whereInSearchBox=london'] 


     def parse(self, response): 

      for sel in response.xpath('//div[@id="ajax-results"]/div[@class="offer_list "]/div[@class="box_offer"]/div[@class="offer"]'): 

       item = JobgoItem() 
       item['title'] = sel.xpath('strong[@class="title"]/a/text()').extract() 
       item['description'] = sel.xpath('p[@class="description"]/text()').extract() 
       item['company'] = sel.xpath('p[@class="company"]/span[@itemprop="hiringOrganization"]/a[@itemprop="name"]/text()').extract() 
       item['location'] = sel.xpath('p[@class="company"]/span/span[@class="location"]/span/text()').extract() 


       yield item 

      next_page = response.css("div.wrap paginator results > ul > li > a[rel='nofollow']::attr('href')") 
      if next_page: 

       url = response.urljoin(next_page[0].extract()) 
       print "next page: " + str(url) 

       yield scrapy.Request(url) 

この問題を解決するためのいずれかの助けがあるでした、私はあなたが次のページセレクタでエラーが発生しているのpython

答えて

0

に全く新しいです。 wrappaginatordivwrapという名前のタグを検索している現在のセレクタ。

右セレクタは

div.wrap.paginator.results > ul > li > a:last-child[rel='nofollow']::attr('href')

です
関連する問題