Commit c0f80e93 by Mai Hoang Thai Ha

used start_with, next if empty field

parent b8abb807
......@@ -27,6 +27,7 @@ namespace :crawler do
job_page = Nokogiri::HTML(HTTParty.get(url).body)
# Job
job_title = job_page.css('div.job-desc h1.title').text
next if job_title.nil?
# update_at, job_industries, job_type, salary, experience, level, expiration_date
detail_box_items = job_page.css('.job-detail-content .detail-box ul li')
# init
......@@ -121,7 +122,7 @@ namespace :crawler do
list_location.each do |city|
city_name = city.text
region = :international
if city_name.include?('Việc làm tại')
if city_name.start_with?('Việc làm tại')
city_name = city_name.remove('Việc làm tại').strip
region = :vietnam
end
......
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