5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/indeed_scraper/scraper.rb', line 5
def self.scrape_index_page(input)
html = open(BASE_PATH + "/l-#{input}-jobs.html") parsed_page = Nokogiri::HTML(html)
all_jobs = parsed_page.css('div.jobsearch-SerpJobCard')
all_jobs.collect do |job_card|
job = {
:title => job_card.css('a').attr('title').value,
:company => job_card.css('span.company').text.strip, :location => job_card.css('div.location').text,
:job_url => job_card.css('a').attr('href').value,
:salary => job_card.css('span.salary').text.strip,
:description => job_card.css('span.summary').text.strip
}
job
end
end
|