Sha256: af79d30b2e1ae6a15541738f4607fa4ee913d07e155bb72794ab46cdb610801b
Contents?: true
Size: 612 Bytes
Versions: 1
Compression:
Stored size: 612 Bytes
Contents
require "open-uri" require File.join("page_rankr", "ranks", "google", "checksum") module PageRankr class Ranks class Google attr_reader :rank def initialize(site) checksum = Checksum.generate(site) begin @rank = open(url(site, checksum)) {|io| io.read.scan(regex)[0][0].to_i} rescue -1 end end def regex /Rank_\d+:\d+:(\d+)/ end def url(site, checksum) "http://toolbarqueries.google.com/search?client=navclient-auto&ch=#{checksum}&features=Rank&q=info:#{site}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
PageRankr-1.3.0 | lib/page_rankr/ranks/google.rb |