-
Notifications
You must be signed in to change notification settings - Fork 8
/
test.rb
43 lines (36 loc) · 1.32 KB
/
test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require 'lib/linkscape'
require 'yaml'
if File.exists? 'seomoz.yml'
config = YAML.load_file('seomoz.yml')
elsif File.exists? ENV['HOME']+'/.seomoz.yml'
config = YAML.load_file(ENV['HOME']+'/.seomoz.yml')
else
print "Need a config file to read settings from"
exit
end
c = Linkscape::Client.new(:id => config["accessID"], :secret => config['secretKey'])
def do_request r
puts r.inspect
puts ''
puts r.response.body
puts ''
if(r.valid?)
data = r.data
puts data.inspect
puts data.to_s("")
else
puts "Response invalid"
end
puts "\n\n"
end
url = %q[http://www.seomoz.org/blog/21-tactics-to-increase-blog-traffic]
url_array = ["http://www.seomoz.org/blog/21-tactics-to-increase-blog-traffic", "http://www.seomoz.org/tools"]
do_request c.mozRank(url)
# do_request c.urlMetrics(url_array, :cols => :all)
do_request c.topLinks(url, :page, :urlcols => :all, :linkcols => :all, :limit => 3)
#
do_request c.allLinks(url, :page, :domain, :domains_linking_page, :urlcols => [:title, :url, :page_authority, :domain_authority], :linkcols => :all, :filters => :external, :limit => 3)
#
do_request c.topPages(url, :page, :cols => :all, :limit => 3, :limit => 3)
#
do_request c.anchorMetrics(url, :phrase, :page, :cols => :all, :scope => "page_to_domain", :filters => :external, :sort => :domains_linking_page, :limit => 3)