A
A
Alexander Petrov2016-03-08 19:22:37
Ruby on Rails
Alexander Petrov, 2016-03-08 19:22:37

How to remove a link from the original using nokogiri?

I parse the site using nokogiri in ruby.
Everything is OK, only I need to remove all site.ru from the original from the source.
How to do it?

require 'open-uri'
        require 'nokogiri'
        require 'json'

        url = 'http://site.ru/'
        html = open(url)

        doc = Nokogiri::HTML(html)
        
        detail=doc.css('.content').inner_html
     
        @show=detail

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Petrov, 2016-03-08
@Mirkom63

The very same question and decided:
Maybe someone will come in handy:
@show=detail.sub(" site.ru ", "")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question