Sha256: 87cdfa493e6695deb065b035315958d1c942ed6f4232a54b38af7bb505f4f9fc
Contents?: true
Size: 606 Bytes
Versions: 1
Compression:
Stored size: 606 Bytes
Contents
class Libri::Quote attr_accessor :quote def self.scrape_quote html = "https://www.goodreads.com/quotes/tag/books" quotes_page = Nokogiri::HTML(open(html)) quote_section = quotes_page.css("div.quote") quotes_array = [] quote_hash = {} quote_section.each { |quote| quote_hash = { :quote => quote.css("div.quoteText").first.text.scan(/(“.+”)/).join(""), :author => quote.css("div.quoteText a").first.text } quotes_array << quote_hash } quotes_array end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
libri-0.2.1 | lib/libri/quote.rb |