Class: RemoteDevJobs::Launch::AuthenticScraper

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

Class Method Summary collapse

Class Method Details

.scrape_job_listObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/remote_dev_jobs/authentic_scraper.rb', line 4

def self.scrape_job_list
  data = Nokogiri::HTML(open("https://authenticjobs.com/#types=7,1,5,4&onlyremote=1"))
  base = "https://authenticjobs.com"
  data.css("div#listings-wrapper li").map do |job|
    job_link = URI.join(base, job.css("a").attribute('href').value.to_s)
    job_hash = {
      company: job.css("div.role h4").text,
      location: job.css("span.location").text,
      position: job.css("div.role h3").text,
      seniority: nil,
      job_url: job_link
    }
  end 
end

.scrape_job_page(job_url) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/remote_dev_jobs/authentic_scraper.rb', line 19

def self.scrape_job_page(job_url)
  data = Nokogiri::HTML(open(job_url))
  company_site = data.css("div.title a")
  company_site.empty? ? company_site = "Not listed." : company_site = company_site.attribute("href").value.to_s
  attributes = {
    description: data.css("div.role section#description p").text,
    company_site: company_site
  }
end