Commit 6d9625dc by thanhnd

fix review 20200218 2

parent 591cf6e6
Pipeline #466 canceled with stages
in 0 seconds
...@@ -29,19 +29,20 @@ namespace :crawler do ...@@ -29,19 +29,20 @@ namespace :crawler do
uri = URI::encode(url) uri = URI::encode(url)
job = Nokogiri::HTML(open(uri)) job = Nokogiri::HTML(open(uri))
detail_selector = '#showScroll .DetailJobNew' job_detail = job.css('#showScroll .DetailJobNew')
title = job.css('.top-job-info h1') title = job.css('.top-job-info h1')
company_name = job.css('.top-job-info .tit_company') company_name = job.css('.top-job-info .tit_company')
updated_date = job.css('.datepost span') updated_date = job.css('.datepost span')
location = job.css("#{detail_selector} li[1].bgLine1 p[1].fl_left b a[2]") location = job_detail.css('li[1].bgLine1 p[1].fl_left b a[2]')
experience = job.css("#{detail_selector} li[2].bgLine2 p[1].fl_left > text()") experience = job_detail.css('li[2].bgLine2 p[1].fl_left > text()')
industry = job.css("#{detail_selector} li[3].bgLine1 p[1].fl_left b") industry = job_detail.css('li[3].bgLine1 p[1].fl_left b')
level = job.css("#{detail_selector} .bgLine1 .fl_right label") level = job_detail.css('.bgLine1 .fl_right label')
salary = job.css("#{detail_selector} .bgLine2 .fl_right label") salary = job_detail.css('.bgLine2 .fl_right label')
deadline = job.css("#{detail_selector} li[3].bgLine1 p[2].fl_right > text()") deadline = job_detail.css('li[3].bgLine1 p[2].fl_right > text()')
description = job.css('.MarBot20') description = job.css('.MarBot20')
address = job.css('.box1Detail .TitleDetailNew label label') address = job.css('.box1Detail .TitleDetailNew label label')
company_intro = job.css('#emp_more') company_intro = job.css('.desc_company.content_fck span#emp_more')
#skip if field blank #skip if field blank
next if industry.text.blank? next if industry.text.blank?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment