Ich möchte alle Seiten dieses Links, http://www.jobisjob.co.uk/search?directUserSearch=true&whatInSearchBox=&whereInSearchBox=london.wie alle Seiten dieses Links zu verschrotten
Ich habe verschiedene Möglichkeiten ausprobiert, aber ich habe keine Lösung bekommen.
unten ist mein Code
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)
Könnte jemand helfen, dieses Problem zu lösen, ich in Python völlig neu am