# -*- coding: utf-8 -*-
import scrapy
from ..items import Mjproject1Item
class MjspideroneSpider(scrapy.Spider):
name = 'MJspiderOne'
allowed_domains = ['www.zuihaodaxue.com']
start_urls = ["http://www.zuihaodaxue.com/zuihaodaxuepaiming2018.html"]
def parse(self, response):
for spd in response.css('tbody.hidden_zhpm'):
item = Mjproject1Item()
item['rank'] = spd.xpath('/html/body/div[3]/div/div[2]/div/div[3]/div/table/tbody/tr/td[1]/text()').extract()
#记得在xpath后面加text()
item['school'] = spd.xpath('/html/body/div[3]/div/div[2]/div/div[3]/div/table/tbody/tr/td[2]/div/text()').extract()
item['city'] = spd.xpath('/html/body/div[3]/div/div[2]/div/div[3]/div/table/tbody/tr/td[3]/text()').extract()
yield item