Commit 7df5cbbd by Tô Ngọc Ánh

change page variable => page_number

parent 931465fe
Pipeline #728 canceled with stages
in 0 seconds
...@@ -5,9 +5,9 @@ class Crawler ...@@ -5,9 +5,9 @@ class Crawler
@logger = logger @logger = logger
end end
def crawl_data(page, base_link) def crawl_data(page_number, base_link)
crawl_industries_locations crawl_industries_locations
job_links = get_job_links(page, base_link) job_links = get_job_links(page_number, base_link)
job_links.each do |link| job_links.each do |link|
next if link.empty? next if link.empty?
...@@ -15,9 +15,9 @@ class Crawler ...@@ -15,9 +15,9 @@ class Crawler
end end
end end
def get_job_links(page, link) def get_job_links(page_number, link)
job_links = [] job_links = []
page.times do page_number.times do
document = Nokogiri::HTML(URI.open(link)) document = Nokogiri::HTML(URI.open(link))
jobs_xml = document.xpath('//div/a[@class="job_link"]/@href') jobs_xml = document.xpath('//div/a[@class="job_link"]/@href')
jobs_xml.each { |item| job_links << item.value } jobs_xml.each { |item| job_links << item.value }
......
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