Class: RemoteDevJobs::Launch::WeWorkRemotelyScraper

Inherits:
GeneralScraper show all
Defined in:
lib/remote_dev_jobs/we_work_remotely_scraper.rb

Class Method Summary collapse

Methods inherited from GeneralScraper

#data

Class Method Details

.scrape_job_listObject



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

def self.scrape_job_list
  data = Nokogiri::HTML(open("https://weworkremotely.com/categories/2-programming/jobs#intro"))
  base = "https://weworkremotely.com"
  data.css("li").map do |job|
    job_link = URI.join(base, job.css("a").attribute("href").value)
    job_hash = {
      company: job.css("a span.company").text,
      location: nil,
      position: job.css("a span.title").text,
      seniority: nil,
      job_url: job_link
    }
  end 
end

.scrape_job_page(job_url) ⇒ Object



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

def self.scrape_job_page(job_url)
  data = Nokogiri::HTML(open(job_url))
  company_site = data.css("h2 a")
  company_site.empty? ? company_site = "Not listed." : company_site = company_site.attribute("href").value
  attributes = {
    description: data.css("div.listing-container").text.gsub(/[\n\r]/,""),
    company_site: company_site
  }
end