Sha256: c1f4f36273470f73b19e7db2bc70b7aef73b91f8312a937a9e8df9c09657c5ab

Contents?: true

Size: 847 Bytes

Versions: 3

Compression:

Stored size: 847 Bytes

Contents

require File.expand_path('../../rank', __FILE__)

module PageRankr
  class Ranks
    class AlexaUs
      include Rank
      
      def url
        "http://data.alexa.com/data"
      end

      def params
        {:cli => 10, :dat => "snbamz", :url => @site.to_s}
      end

      # Alexa may sometimes return a result for the incorrect site and thus it is necessary to check if
      # the results returned are for the site we want.
      #
      # For example, slocourts.net returns results for ca.gov, presumably because www.slocourts.ca.gov redirects
      # to slocourts.net. Clearly something is wrong with how Alexa handles this case and so in the event this
      # happens we treat the results as if there were no results.
      def xpath
        "//popularity[contains(@url, '#{@site.domain}')]/../reach/@rank"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
PageRankr-3.0.2 lib/page_rankr/ranks/alexa_us.rb
PageRankr-3.0.1 lib/page_rankr/ranks/alexa_us.rb
PageRankr-3.0.0 lib/page_rankr/ranks/alexa_us.rb