Skip to content
This repository

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

Closed
ronald opened this Issue · 5 comments

2 participants

Mr. Ronald Allen Madsen
Mr. Ronald

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

Allen Madsen
Owner

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.

Mr. Ronald

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

Allen Madsen
Owner

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

Allen Madsen
Owner

3.1.0 should fix this.

Mr. Ronald

Great. Thanks a Lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.