Is there a way to check google rank of page (not domain)? #12

Closed
ronald opened this Issue Nov 25, 2011 · 5 comments

Projects

None yet

2 participants

@ronald
ronald commented Nov 25, 2011

Hello,

thanks a lot for the gem!

I'd like to check page rank of a single (sub) page.

This is what I got:
bundle exec rails runner "puts PageRankr::Ranks::Google.new('aws.amazon.com/').run" => 7
bundle exec rails runner "puts PageRankr::Ranks::Google.new('aws.amazon.com/ec2/faqs/').run" => nil

This is what I expected:
bundle exec rails runner "puts PageRankr::Ranks::Google.new('aws.amazon.com/').run" => 7
bundle exec rails runner "puts PageRankr::Ranks::Google.new('aws.amazon.com/ec2/faqs/').run" => 5

The only way I found to get the results is to overriding a method

# force loading in development
PageRankr::Site

# do override
def PageRankr::Site(site)
  site
end

Is there a better way?

By the way: Ruby 1.8.7, PageRankr 3.0.2

Ronald

@blatyo
Owner
blatyo commented Nov 26, 2011

Yea, the Site class could use some love. Right now, it's basically stripping out everything except the domain and subdomain stuff. I did that originally to fix some issues with Alexa returning the wrong value if a subdomain is provided (it'll ignore the path). Site should probably store the protocol, path, parameters, and hash parameters and each tracker should determine what level of specificity is usable.

@ronald
ronald commented Nov 27, 2011

Thanks for clarifying.

Unforunatly I don't have the time to fork right now.

If you plan to implement this you could use ruby's URI classes

require 'uri'
uri = URI.parse('http://www.sub.example.com/some/file?param1=foo#bar')
puts uri.component.map{|c| "#{c}: #{uri.send(c)}" }

scheme: http
userinfo:
host: www.sub.example.com
port: 80
path: /some/file
query: param1=foo
fragment: bar

@blatyo blatyo was assigned Nov 27, 2011
@blatyo
Owner
blatyo commented Dec 12, 2011

Just as an update, I've started work on this, but there are some issues when I run the specs that I haven't worked out yet.

master...improved_site

@blatyo
Owner
blatyo commented Dec 26, 2011

3.1.0 should fix this.

@blatyo blatyo closed this Dec 26, 2011
@ronald
ronald commented Dec 26, 2011

Great. Thanks a Lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment