PageRankr 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/PageRankr.gemspec +5 -3
- data/README.md +7 -2
- data/VERSION +1 -1
- data/lib/page_rankr.rb +9 -0
- data/lib/page_rankr/backlinks.rb +4 -18
- data/lib/page_rankr/backlinks/alexa.rb +1 -1
- data/lib/page_rankr/backlinks/alltheweb.rb +1 -1
- data/lib/page_rankr/backlinks/altavista.rb +1 -1
- data/lib/page_rankr/backlinks/backlink.rb +2 -1
- data/lib/page_rankr/backlinks/bing.rb +1 -1
- data/lib/page_rankr/backlinks/google.rb +1 -1
- data/lib/page_rankr/backlinks/yahoo.rb +1 -1
- data/lib/page_rankr/ranks.rb +5 -17
- data/lib/page_rankr/ranks/alexa.rb +2 -4
- data/lib/page_rankr/ranks/google.rb +2 -4
- data/lib/page_rankr/ranks/google/checksum.rb +2 -2
- data/lib/page_rankr/ranks/rank.rb +8 -0
- data/lib/page_rankr/tracker.rb +23 -0
- metadata +5 -3
data/CHANGELOG.md
CHANGED
data/PageRankr.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{PageRankr}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Allen Madsen"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-06}
|
13
13
|
s.description = %q{Easy way to retrieve Google Page Rank, Alexa Rank, and backlink counts}
|
14
14
|
s.email = %q{blatyo@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -37,7 +37,9 @@ Gem::Specification.new do |s|
|
|
37
37
|
"lib/page_rankr/ranks.rb",
|
38
38
|
"lib/page_rankr/ranks/alexa.rb",
|
39
39
|
"lib/page_rankr/ranks/google.rb",
|
40
|
-
"lib/page_rankr/ranks/google/checksum.rb"
|
40
|
+
"lib/page_rankr/ranks/google/checksum.rb",
|
41
|
+
"lib/page_rankr/ranks/rank.rb",
|
42
|
+
"lib/page_rankr/tracker.rb"
|
41
43
|
]
|
42
44
|
s.homepage = %q{http://github.com/blatyo/page_rankr}
|
43
45
|
s.rdoc_options = ["--charset=UTF-8"]
|
data/README.md
CHANGED
@@ -28,7 +28,9 @@ If you don't specify a search engine, then all of them are used.
|
|
28
28
|
#=> {:google=>23000, :bing=>215000000, :yahoo=>250522337, :altavista=>137000000, :alltheweb=>74500000, :alexa=>727036}
|
29
29
|
|
30
30
|
You can also use the alias `backlink` instead of `backlinks`.
|
31
|
-
Valid search engines are: `:google, :bing, :yahoo, :altavista, :alltheweb, :alexa`.
|
31
|
+
Valid search engines are: `:google, :bing, :yahoo, :altavista, :alltheweb, :alexa`. To get this list you can do:
|
32
|
+
|
33
|
+
PageRankr.backlink_trackers #=> [:alexa, :alltheweb, :altavista, :bing, :google, :yahoo]
|
32
34
|
|
33
35
|
### Ranks
|
34
36
|
|
@@ -38,7 +40,10 @@ Valid search engines are: `:google, :bing, :yahoo, :altavista, :alltheweb, :alex
|
|
38
40
|
PageRankr.ranks('www.google.com') #=> {:alexa=>1, :google=>10}
|
39
41
|
|
40
42
|
You can also use the alias `rank` instead of `ranks`.
|
41
|
-
There are two valid rank trackers supported: `:alexa, :google`.
|
43
|
+
There are two valid rank trackers supported: `:alexa, :google`. To get this you can do:
|
44
|
+
|
45
|
+
PageRankr.rank_trackers #=> [:alexa, :google]
|
46
|
+
|
42
47
|
Alexa ranks are descending where 1 is the most popular. If a site has an alexa rank of 0 then the site is unranked.
|
43
48
|
Google page ranks are in the range 0-10 where 10 is the most popular. If a site is unindexed then the rank will be -1.
|
44
49
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.0
|
data/lib/page_rankr.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require File.join("page_rankr", "tracker")
|
1
2
|
require File.join("page_rankr", "backlinks")
|
2
3
|
require File.join("page_rankr", "ranks")
|
3
4
|
|
@@ -12,5 +13,13 @@ module PageRankr
|
|
12
13
|
Ranks.new.lookup site, *rank_trackers
|
13
14
|
end
|
14
15
|
alias_method :rank, :ranks
|
16
|
+
|
17
|
+
def rank_trackers
|
18
|
+
Ranks.new.rank_trackers
|
19
|
+
end
|
20
|
+
|
21
|
+
def backlink_trackers
|
22
|
+
Backlinks.new.backlink_trackers
|
23
|
+
end
|
15
24
|
end
|
16
25
|
end
|
data/lib/page_rankr/backlinks.rb
CHANGED
@@ -7,26 +7,12 @@ require File.join("page_rankr", "backlinks", "google")
|
|
7
7
|
require File.join("page_rankr", "backlinks", "yahoo")
|
8
8
|
|
9
9
|
module PageRankr
|
10
|
-
class Backlinks
|
11
|
-
|
10
|
+
class Backlinks < Tracker
|
11
|
+
alias_method :backlink_trackers, :site_trackers
|
12
12
|
|
13
13
|
def initialize
|
14
|
-
|
15
|
-
@
|
16
|
-
end
|
17
|
-
|
18
|
-
def lookup(site, *engines)
|
19
|
-
engines = search_engines if engines.empty?
|
20
|
-
|
21
|
-
backlinks = {}
|
22
|
-
engines.each do |engine|
|
23
|
-
name, klass = engine.to_s.capitalize, self.class
|
24
|
-
|
25
|
-
next unless klass.const_defined? name
|
26
|
-
|
27
|
-
backlinks[engine.to_s.downcase.to_sym] = klass.const_get(name).new(site).backlinks
|
28
|
-
end
|
29
|
-
backlinks
|
14
|
+
super
|
15
|
+
@site_trackers.delete(:backlink)
|
30
16
|
end
|
31
17
|
end
|
32
18
|
end
|
@@ -2,9 +2,10 @@ require 'nokogiri'
|
|
2
2
|
require 'open-uri'
|
3
3
|
|
4
4
|
module PageRankr
|
5
|
-
class Backlinks
|
5
|
+
class Backlinks < Tracker
|
6
6
|
class Backlink
|
7
7
|
attr_reader :backlinks
|
8
|
+
alias_method :tracked, :backlinks
|
8
9
|
|
9
10
|
def initialize(site)
|
10
11
|
@backlinks = clean Nokogiri::HTML(open url(site)).at(xpath).to_s
|
data/lib/page_rankr/ranks.rb
CHANGED
@@ -1,26 +1,14 @@
|
|
1
|
+
require File.join("page_rankr", "ranks", "rank")
|
1
2
|
require File.join("page_rankr", "ranks", "alexa")
|
2
3
|
require File.join("page_rankr", "ranks", "google")
|
3
4
|
|
4
5
|
module PageRankr
|
5
|
-
class Ranks
|
6
|
-
|
6
|
+
class Ranks < Tracker
|
7
|
+
alias_method :rank_trackers, :site_trackers
|
7
8
|
|
8
9
|
def initialize
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
def lookup(site, *trackers)
|
13
|
-
trackers = rank_trackers if trackers.empty?
|
14
|
-
|
15
|
-
ranks = {}
|
16
|
-
trackers.each do |tracker|
|
17
|
-
name, klass = tracker.to_s.capitalize, self.class
|
18
|
-
|
19
|
-
next unless klass.const_defined? name
|
20
|
-
|
21
|
-
ranks[tracker.to_s.downcase.to_sym] = klass.const_get(name).new(site).rank
|
22
|
-
end
|
23
|
-
ranks
|
10
|
+
super
|
11
|
+
@site_trackers.delete(:rank)
|
24
12
|
end
|
25
13
|
end
|
26
14
|
end
|
@@ -2,10 +2,8 @@ require "open-uri"
|
|
2
2
|
require File.join("page_rankr", "ranks", "google", "checksum")
|
3
3
|
|
4
4
|
module PageRankr
|
5
|
-
class Ranks
|
6
|
-
class Google
|
7
|
-
attr_reader :rank
|
8
|
-
|
5
|
+
class Ranks < Tracker
|
6
|
+
class Google < Rank
|
9
7
|
def initialize(site)
|
10
8
|
checksum = Checksum.generate(site)
|
11
9
|
begin
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module PageRankr
|
2
|
+
class Tracker
|
3
|
+
attr_accessor :site_trackers
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@site_trackers = self.class.constants.collect{|tracker| tracker.to_s.downcase.to_sym}
|
7
|
+
end
|
8
|
+
|
9
|
+
def lookup(site, *trackers)
|
10
|
+
trackers = site_trackers if trackers.empty?
|
11
|
+
|
12
|
+
tracked = {}
|
13
|
+
trackers.each do |tracker|
|
14
|
+
name, klass = tracker.to_s.capitalize, self.class
|
15
|
+
|
16
|
+
next unless klass.const_defined? name
|
17
|
+
|
18
|
+
tracked[tracker] = klass.const_get(name).new(site).tracked
|
19
|
+
end
|
20
|
+
tracked
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
7
|
+
- 4
|
8
8
|
- 0
|
9
|
-
version: 1.
|
9
|
+
version: 1.4.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Allen Madsen
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-07-
|
17
|
+
date: 2010-07-06 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -76,6 +76,8 @@ files:
|
|
76
76
|
- lib/page_rankr/ranks/alexa.rb
|
77
77
|
- lib/page_rankr/ranks/google.rb
|
78
78
|
- lib/page_rankr/ranks/google/checksum.rb
|
79
|
+
- lib/page_rankr/ranks/rank.rb
|
80
|
+
- lib/page_rankr/tracker.rb
|
79
81
|
has_rdoc: true
|
80
82
|
homepage: http://github.com/blatyo/page_rankr
|
81
83
|
licenses: []
|