总共有1000页,每一页有10个项,每个项有一个通向详情页的url,现在需要爬详情的内容,用scrappy。
class AskdSpider(scrapy.Spider):
name = 'ym'
allowed_domains = ['j4b.x4y.com', 'z4k.x4y.com']
start_urls = []
# for i in range(0, 10137):
for i in range(1, 10137):
start_urls.append('http://j4b.x4y.com/il_s4i/symptom/' + str(i) + '.htm')
def parse(self, response):
item = AskdoctorItem()
#<div class="jb-name fYaHei gre">肺出血-肾炎综合征</div>
#获取div内容
item['title'] = response.xpath("//*[@class='jb-name fYaHei gre']/te