lundi 23 juillet 2018

How to get a tag using Nokogiri

Im doing a simple scraper with Ruby using Nokogiri.

  def processNokogiri

    doc = HTTParty.get("https://www.remotelyawesomejobs.com/jobs")
    @parse_page ||= Nokogiri::HTML(doc)
    @jobs = @parse_page.css(".job").first.at_css "h2"
    puts '*********************'
    puts  @jobs
    puts '*********************'
    flash[:error] = "Noko"

  end

When I print this @jobs, the console shows me:

<h2>
<a itemprop="title" href="/jobs/the-coral-project-mozilla-infrastructure-integration-engineer">Infrastructure &amp; Integration Engineer</a>
<span class="company">
at
<span itemprop="hiringOrganization">The Coral Project @ Mozilla</span>
</span>
</h2>

I want to acess this href="/jobs/the-coral-project-mozilla-infrastructure-integration-engineer" and the name of the Company: The Coral Project @ Mozilla

How can I filter the @jobs entity to acess this data?

Aucun commentaire:

Enregistrer un commentaire