require 'rubygems'
require 'mechanize'
module PortfolioAdvisor
module Crawler
# Display content of HTML articles
class Api
attr_reader :url
def initialize(url)
@url = url
end
def crawl
content_exist?
rescue StandardError
raise 'NotFound'
end
def content_exist?
agent = Mechanize.new
html_text = agent.get(@url).body
open_article = Nokogiri::HTML(html_text)
open_article.css('p').map(&:text)
end
end
end
end
try to fix with