拉钩招聘网
以拉钩具体详情页为例,进行抓取
http://www.lagou.com/jobs/2101463.html
from lxml import etreeimport requestsimport reresponse = requests.get('http://www.lagou.com/jobs/2101463.html')resHtml = response.texthtml = etree.HTML(resHtml)title = html.xpath('//h1[@title]')[0].attrib['title']#salary= html.xpath('//span[@class="red"]')[0].textsalary = html.xpath('//dd[@class="job_request"]/p/span')[0].textworklocation = html.xpath('//dd[@class="job_request"]/p/span')[1].textexperience = html.xpath('//dd[@class="job_request"]/p/span')[2].texteducation = html.xpath('//dd[@class="job_request"]/p/span')[3].textworktype = html.xpath('//dd[@class="job_request"]/p/span')[4].textTemptation = html.xpath('//dd[@class="job_request"]/p[2]')[0].textprint salary,worklocation,experience,education,worktype,Temptationdescription_tag = html.xpath('//dd[@class="job_bt"]')[0]description = etree.tostring( description_tag,encoding='utf-8')#print descriptiondeal_descp = re.sub('<.*?>','',description)print deal_descp.strip()publisher_name = html.xpath('//*[@class="publisher_name"]//@title')[0]pos = html.xpath('//*[@class="pos"]')[0].textchuli_lv = html.xpath('//*[@class="data"]')[0].textchuli_yongshi = html.xpath('//*[@class="data"]')[1].textprint chuli_lv,chuli_yongshi,pos,publisher_name
当前内容版权归 piaosanlang 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 piaosanlang .