Skip to content

How do I remove a node? #80

@CharlyMTO

Description

@CharlyMTO

Thanks for the work you do with this gem

Hello, I am need remove multiples nodes
with class css

.media
.ads
.cite-content

How do I remove a nodes css?:

class ListCrawler
      include Wombat::Crawler

      base_url "https://rpp.pe"
      path "/politica/actualidad/ministerio-publico-las-discrepancias-entre-pablo-sanchez-y-pedro-chavarry-noticia-1142342"

      explore css: '#article-body' do |e|
        e remove: '.media'
        e remove: '.ads'
        e remove: '.cite-content'
      end
end
pp ListCrawler.new.crawl

#ERRORR!!

With standalone gem Mechanize works

 mechanize = Mechanize.new { |agent|
  agent.user_agent_alias = 'Mac Safari'
}

page = mechanize.get('https://rpp.pe/politica/actualidad/ministerio-publico-las-discrepancias-entre-pablo-sanchez-y-pedro-chavarry-noticia-1142342')

text = page.at('#article-body')

text.at_css(".media").remove
text.at_css(".ads").remove
text.at_css(".cite-content").remove

puts text

Someone who is an expert can help me?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions