Sha256: 48215b5f6c8992672c8f5bd98d9478ae56c2104913965c6cb2aa62a1d5f187c3

Contents?: true

Size: 305 Bytes

Versions: 3

Compression:

Stored size: 305 Bytes

Contents

require 'open-uri'
require 'cgi'
require 'nokogiri'

module PageRankr
  class Alexa
    class << self
      def lookup(site)
        url = "http://data.alexa.com/data?cli=10&dat=snbamz&url="
        Nokogiri::HTML(open(url + CGI.escape(site))).search("//reach/@rank").to_s.to_i
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
PageRankr-1.2.0 lib/page_rankr/alexa.rb
PageRankr-1.1.0 lib/page_rankr/alexa.rb
PageRankr-1.0.0 lib/page_rankr/alexa.rb