Sha256: b3eabb44b77332b98cd39e53bd8b0ea103cf030e284b2f34566532061f894f1f
Contents?: true
Size: 559 Bytes
Versions: 1
Compression:
Stored size: 559 Bytes
Contents
require 'open-uri' require 'cgi' require 'nokogiri' module PageRankr class Ranks < Tracker class Compete < Rank def initialize(site) @rank = Nokogiri::HTML(open(url(site))).search(xpath).to_s.gsub(',', '').to_i rescue @rank = 0 #compete only accepts urls without http:// and www, will be fixed in 2.0 end def xpath "//div[@id='rank']/div[@class='number value']/text()" end def url(site) "http://siteanalytics.compete.com/#{CGI.escape(site)}/" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
PageRankr-1.7.1 | lib/page_rankr/ranks/compete.rb |