Class: RemoteDevJobs::Launch::FlexJobsScraper

Inherits:
Object
  • Object
show all
Defined in:
lib/remote_dev_jobs/flex_jobs_scraper.rb

Class Method Summary collapse

Class Method Details

.scrape_job_listObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/remote_dev_jobs/flex_jobs_scraper.rb', line 5

def self.scrape_job_list
  data = Nokogiri::HTML(open("https://www.flexjobs.com/search?accolade=&career_level=Entry-Level&cats%5B%5D=38&country=&exclude=&location=&search=&tele_level=Any+Level+of+Telecommuting&will_travel="))
  base = "https://www.flexjobs.com"
  data.css("li.list-group-item").map do |job|
    if job.css("h5 a").empty? == false
      job_link = URI.join(base, job.css("h5 a").attribute("href").value)
      job_hash = {
        company: nil,
        location: job.css("p.job-type-info").text,
        position: job.css("h5 a").text,
        seniority: nil,
        job_url: job_link
      }
    end
  end 
end

.scrape_job_page(job_url) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/remote_dev_jobs/flex_jobs_scraper.rb', line 22

def self.scrape_job_page(job_url)
  data = Nokogiri::HTML(open(job_url))
  attributes = {
    description: data.css("div#job-description p").text,
    company_site: nil
  }
end