Permalink
Browse files

Fix google and yahoo backlinks and indexes.

  • Loading branch information...
1 parent bcffaba commit df060fe3e340caa67bc20a31d91a998635a88314 @blatyo committed Dec 26, 2011
View
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency "nokogiri", ">= 1.4.1"
s.add_runtime_dependency "json", ">= 1.4.6"
- s.add_runtime_dependency "public_suffix_service", ">= 0.9.0"
+ s.add_runtime_dependency "public_suffix", ">= 0.9.0"
s.add_runtime_dependency "typhoeus", ">= 0.2.1"
s.add_runtime_dependency "jsonpath", ">= 0.4.2"
@@ -5,5 +5,11 @@ module Backlink
include Tracker
alias_method :backlink, :tracked
+
+ def clean(raw)
+ cleaned_content = super(raw)
+ return nil if cleaned_content.nil? || cleaned_content.zero?
+ cleaned_content
+ end
end
end
@@ -10,7 +10,7 @@ def url
end
def params
- {:q => "link:#{tracked_url}"}
+ {:q => "inbody:#{tracked_url}"}
end
def xpath
@@ -14,7 +14,7 @@ def params
end
def xpath
- "//div[@id='resultStats']/text()"
+ "//div[@id='subform_ctrl']/div[2]/b[3]/text()"
end
end
end
@@ -6,14 +6,15 @@ class Yahoo
include Backlink
def url
- "http://siteexplorer.search.yahoo.com/search"
+ "http://search.yahoo.com/search"
end
+
def params
- {:p => "#{tracked_url}"}
+ {:p => "inbody:#{tracked_url}"}
end
def xpath
- "//ul[@id='result-details']/li[2]/a/text()"
+ "//span[@id='resultCount']/text()"
end
end
end
View
@@ -5,5 +5,11 @@ module Index
include Tracker
alias_method :index, :tracked
+
+ def clean(raw)
+ cleaned_content = super(raw)
+ return nil if cleaned_content.nil? || cleaned_content.zero?
+ cleaned_content
+ end
end
end
@@ -1,6 +1,7 @@
require File.expand_path("../trackers", __FILE__)
require File.expand_path("../indexes/bing", __FILE__)
require File.expand_path("../indexes/google", __FILE__)
+require File.expand_path("../indexes/yahoo", __FILE__)
module PageRankr
class Indexes
@@ -14,7 +14,7 @@ def params
end
def xpath
- "//div[@id='resultStats']/text()"
+ "//div[@id='subform_ctrl']/div[2]/b[3]/text()"
end
end
end
@@ -0,0 +1,21 @@
+require File.expand_path('../../index', __FILE__)
+
+module PageRankr
+ class Indexes
+ class Yahoo
+ include Index
+
+ def url
+ "http://search.yahoo.com/search"
+ end
+
+ def params
+ {:p => "site:#{tracked_url}"}
+ end
+
+ def xpath
+ "//span[@id='resultCount']/text()"
+ end
+ end
+ end
+end
View
@@ -1,4 +1,4 @@
-require 'public_suffix_service'
+require 'public_suffix'
require 'delegate'
require 'uri'
@@ -8,10 +8,10 @@ class Site
def initialize(site)
@uri = URI.parse(site)
- @domain = PublicSuffixService.parse(@uri.host)
+ @domain = PublicSuffix.parse(@uri.host)
@domain.valid? or raise DomainInvalid, "The domain provided is invalid.1"
- rescue PublicSuffixService::DomainInvalid, URI::InvalidURIError
+ rescue PublicSuffix::DomainInvalid, URI::InvalidURIError
raise DomainInvalid, "The domain provided is invalid."
end
@@ -10,24 +10,24 @@
code: 200
message: OK
headers:
- content-length:
- - "2455"
content-type:
- text/xml
+ content-length:
+ - "2552"
body: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\
\r\n\
<ALEXA VER=\"0.9\" URL=\"slocourts.ca.gov/\" HOME=\"0\" AID=\"=\">\r\n\
<RLS PREFIX=\"http://\" more=\"23\">\n\
- <RL HREF=\"www.co.san-bernardino.ca.us/Courts\" TITLE=\"Superior Court, San Bernardino\"/>\n\
<RL HREF=\"www.co.riverside.ca.us/depts/courts\" TITLE=\"Superior Court Of California County Of Riverside\"/>\n\
<RL HREF=\"courts.countyofventura.org/\" TITLE=\"Superior Court, Ventura\"/>\n\
+ <RL HREF=\"www.co.san-bernardino.ca.us/Courts\" TITLE=\"Superior Court, San Bernardino\"/>\n\
<RL HREF=\"www.ci.sf.ca.us/courts\" TITLE=\"Superior Court, San Francisco\"/>\n\
- <RL HREF=\"www.sonomasuperiorcourt.com/\" TITLE=\"Superior Court, Sonoma\"/>\n\
- <RL HREF=\"www.solanocourts.com/\" TITLE=\"Superior Court, Solano\"/>\n\
- <RL HREF=\"www.sccsuperiorcourt.org/\" TITLE=\"Superior Court, Santa Clara\"/>\n\
<RL HREF=\"www.sbcourts.org/\" TITLE=\"Superior Court, Santa Barbara\"/>\n\
- <RL HREF=\"www.sanmateocourt.org/\" TITLE=\"Superior Court, San Mateo\"/>\n\
- <RL HREF=\"www.saccourt.com/\" TITLE=\"Superior Court, Sacramento\"/>\n\
+ <RL HREF=\"www.slosheriff.org/\" TITLE=\"San Luis Obispo County Sheriff&apos;s Department\"/>\n\
+ <RL HREF=\"www.slodss.org/\" TITLE=\"San Luis Obispo County Department of Social Services\"/>\n\
+ <RL HREF=\"www.slocountypwd.org/\" TITLE=\"San Luis Obispo County Department of Public Works and Transportation\"/>\n\
+ <RL HREF=\"www.slocountyfranchiseadministration.org/\" TITLE=\"San Luis Obispo County Franchise Administration\"/>\n\
+ <RL HREF=\"www.slocog.org/\" TITLE=\"SLOCOG\"/>\n\
<RL HREF=\"www.buttonware.com/\" TITLE=\"www.buttonware.com/\"/>\n\
</RLS>\n\
<SD TITLE=\"A\" FLAGS=\"DMOZ\" HOST=\"slocourts.ca.gov\">\n\
@@ -57,9 +57,9 @@
</SITE>\n\
</DMOZ>\n\
<SD>\n\
- <POPULARITY URL=\"ca.gov/\" TEXT=\"814\"/>\n\
- <REACH RANK=\"874\"/>\n\
- <RANK DELTA=\"+59\"/>\n\
+ <POPULARITY URL=\"ca.gov/\" TEXT=\"838\"/>\n\
+ <REACH RANK=\"889\"/>\n\
+ <RANK DELTA=\"+81\"/>\n\
</SD>\n\
</ALEXA>"
http_version: "1.1"
Oops, something went wrong.

0 comments on commit df060fe

Please sign in to comment.