Sha256: 287043866a3ad859ed2e1badf69eb06392a8c2b01419deb1a4599cc8e610ed7d

Contents?: true

Size: 428 Bytes

Versions: 1

Compression:

Stored size: 428 Bytes

Contents

require 'open-uri'
require 'nokogiri'
require 'pry'

module Quorable
  BASE_URL = 'http://www.quora.com'

  def self.feed(topic)
    doc = Nokogiri::HTML.parse(open("#{BASE_URL}/#{Quorable.parameterize(topic)}"))
    paths = doc.css('.question_link').map { |link| "#{BASE_URL}#{link['href']}" }
    paths
  end

  private

  def self.parameterize(topic)
    topic.split(' ').map(&:downcase).map(&:capitalize).join('-')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quorable-0.1.7 lib/quorable.rb