├── .gitignore ├── .ruby-gemset ├── .ruby-version ├── .travis.yml ├── CHANGELOG.md ├── Gemfile ├── LICENSE.md ├── PageRankr.gemspec ├── README.md ├── Rakefile ├── lib ├── PageRankr.rb ├── page_rankr.rb └── page_rankr │ ├── backlink.rb │ ├── backlinks.rb │ ├── backlinks │ ├── bing.rb │ ├── google.rb │ └── yahoo.rb │ ├── index.rb │ ├── indexes.rb │ ├── indexes │ ├── bing.rb │ ├── google.rb │ └── yahoo.rb │ ├── proxy_services.rb │ ├── proxy_services │ ├── random.rb │ └── round_robin.rb │ ├── rank.rb │ ├── ranks.rb │ ├── ranks │ ├── alexa_country.rb │ ├── alexa_global.rb │ ├── alexa_us.rb │ ├── domain_authority.rb │ ├── google.rb │ ├── google │ │ └── checksum.rb │ ├── moz_rank.rb │ └── page_authority.rb │ ├── request.rb │ ├── site.rb │ ├── social.rb │ ├── socials.rb │ ├── socials │ ├── facebook.rb │ ├── google.rb │ ├── linkedin.rb │ ├── pinterest.rb │ ├── stumble_upon.rb │ ├── twitter.rb │ └── vk.rb │ ├── tracker.rb │ ├── trackers.rb │ └── version.rb ├── out.html └── spec ├── backlinks ├── bing_spec.rb ├── google_spec.rb └── yahoo_spec.rb ├── fixtures └── vcr_cassettes │ ├── PageRankr_Backlinks_Bing │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Backlinks_Google │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Backlinks_Yahoo │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Indexes_Bing │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Indexes_Google │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Indexes_Yahoo │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Ranks_AlexaCountry │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Ranks_AlexaGlobal │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Ranks_AlexaUs │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Ranks_DomainAuthority │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Ranks_Google │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Ranks_MozRank │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Ranks_PageAuthority │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Socials_Facebook │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Socials_Google │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Socials_LinkedIn │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Socials_Pinterest │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Socials_StumbleUpon │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Socials_Twitter │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── PageRankr_Socials_Vk │ └── _run │ │ ├── with_match │ │ └── .yml │ │ └── with_no_match │ │ └── .yml │ ├── alexa_ranks_edge_case_1.yml │ ├── failure_socials.yml │ └── success_socials.yml ├── indexes ├── bing_spec.rb ├── google_spec.rb └── yahoo_spec.rb ├── page_rankr_spec.rb ├── proxy_services ├── random_spec.rb └── round_robin_spec.rb ├── ranks ├── alexa_country_spec.rb ├── alexa_global_spec.rb ├── alexa_us_spec.rb ├── domain_authority_spec.rb ├── google │ └── checksum_spec.rb ├── google_spec.rb ├── moz_rank_spec.rb └── page_authority_spec.rb ├── site_spec.rb ├── socials ├── facebook_spec.rb ├── google_spec.rb ├── linkedin_spec.rb ├── pinterest_spec.rb ├── stumble_upon_spec.rb ├── twitter_spec.rb └── vk_spec.rb ├── spec_helper.rb └── support └── custom_matchers.rb /.gitignore: -------------------------------------------------------------------------------- 1 | ## MAC OS 2 | .DS_Store 3 | 4 | ## TEXTMATE 5 | *.tmproj 6 | tmtags 7 | 8 | ## EMACS 9 | *~ 10 | \#* 11 | .\#* 12 | 13 | ## VIM 14 | *.swp 15 | 16 | ## PROJECT::GENERAL 17 | coverage 18 | rdoc 19 | pkg 20 | 21 | ## PROJECT::SPECIFIC 22 | .idea 23 | doc 24 | .yardoc 25 | .bundle 26 | Gemfile.lock -------------------------------------------------------------------------------- /.ruby-gemset: -------------------------------------------------------------------------------- 1 | page_rankr 2 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.2.3 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | rvm: 2 | - 2.0.0 3 | - 2.1.5 4 | - 2.2.0 5 | sudo: false 6 | cache: bundler 7 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## Version 4.6.1 4 | * Loosens version requirement for public_suffix (Hopefully a version 2 never comes out, so I don't have to hear about it again.) 5 | 6 | ## Version 4.6.0 7 | * Bumps public_suffix 8 | * Support IDN addresses 9 | * Change alexa to support subdomains 10 | * Resctructure tests 11 | 12 | ## Version 4.5.0 13 | * Bumps to public_suffix Gem to 1.5.1 14 | * Deprecates support for Ruby < 2.0 15 | 16 | ## Version 4.4.1 17 | * Fixes Alexa US to use correct rank 18 | 19 | ## Version 4.4.0 20 | * Adds social signals for google, linked_in, pinterest, stumble_upon, twitter, and vk 21 | 22 | ## Version 4.3.0 23 | * Add Page Authority and Domain Authority ranks 24 | 25 | ## Version 4.2.1 26 | * Fix Yahoo trackers xpath 27 | * Require newer version of public_suffix_service 28 | 29 | ## Version 4.2.0 30 | * Added Moz Rank and Page Authority metrics. 31 | 32 | ## Version 4.1.1 33 | * Fix issue where Google Rank tracker did not pass options to request. 34 | 35 | ## Version 4.1.0 36 | * Add Alexa Country rank. 37 | 38 | ## Version 4.0.0 39 | * Fix for Google pagerank check. Query parts were omitted which made the some pages get the same PR as the domain. 40 | * Switch from Typheous to HTTParty to avoid memory leaks and have better support on Windows. 41 | 42 | ## Version 3.2.1 43 | * Fix issue where tracker calls proxy with class name rather than name defined on class instance. 44 | 45 | ## Version 3.2.0 46 | * Added proxy service 47 | * Removed Compete rank tracker, because there is no way to get it without a key now 48 | * Fixed google backlinks and indexes 49 | 50 | ## Version 3.1.2 51 | * Fix issue with URI parse in 1.9.3 52 | 53 | ## Version 3.1.1 54 | * Fix google backlinks and indexes 55 | 56 | ## Version 3.1.0 57 | * Add yahoo index back 58 | * Fix yahoo and google backlinks and indexes 59 | * Improve PageRankr::Site to support different levels of specificity 60 | 61 | ## Version 3.0.2 62 | * Update gem dependencies 63 | 64 | ## Version 3.0.1 65 | * Improve PageRankr::Site 66 | 67 | ## Version 3.0.0 68 | * Refactor 69 | * Move the logic for the typhoeus request out of the individual trackers in Tracker to hide the complexity. 70 | * Create Tracker to encapsulate the common logic in Backlink, Tracker, and Rank. 71 | * Have each file declare it's dependencies, so that it is simple to use a la carte. 72 | * Fix google backlink and index. The search API is deprecated and the new API is annoying to setup, so webscraping has been brought back. 73 | * Make requires consistent. 74 | * API Breakages 75 | * Tracker was renamed to Trackers and a new Tracker file was created that represents a different object. 76 | 77 | ## Version 2.0.4 78 | * Fix google page rank url 79 | 80 | ## Version 2.0.3 81 | * Fix Compete scraper 82 | 83 | ## Version 2.0.2 84 | * Update public_suffix_service gem 85 | 86 | ## Version 2.0.1 87 | * Alexa sometimes returns result for the incorrect site. In this case, the results returned are ignored. 88 | 89 | ## Version 2.0.0 90 | * URL validation 91 | * Parallel requests = way faster! 92 | * Not tracked returns nil 93 | * Alexa US and Global are treated as separate trackers and returned results are a single level hash. 94 | * Removed Altavista and AllTheWeb because they now direct to yahoo. 95 | * Changed some classes to modules so that it wasn't necessary to specify them when opening the class. 96 | 97 | ## Version 1.7.1 98 | * Catches exception thrown when doing compete rank lookup with url not in the form "google.com". 99 | 100 | ## Version 1.7.0 101 | * Merged in additions from iteration labs to add compete rank tracker and domain indexes. 102 | 103 | ## Version 1.6.0 104 | 105 | * Added ability to get global alexa rank instead of just us alexa rank. 106 | 107 | ## Version 1.5.1 108 | 109 | * Added json gem requirement for rubies < 1.9 110 | 111 | ## Version 1.5.0 112 | 113 | * Use googles api to retrieve backlinks. 114 | * Changed workflow for building gems. 115 | 116 | ## Version 1.4.3 117 | 118 | * Fixed google backlink lookup where odd invalid urls were getting high results. For example, "gaybuttfuckers". Thanks to Zach Elko. 119 | 120 | ## Version 1.4.2 121 | 122 | * Fixed bug where sites not tracked by google were returning nil instead of -1. 123 | 124 | ## Version 1.4.1 125 | 126 | * Broken 127 | 128 | ## Version 1.4.0 129 | 130 | * Made it easier to get at the list of supported trackers. 131 | * Refactoring 132 | 133 | ## Version 1.3.0 134 | 135 | * Lots of refactoring. Should be much easier to extend and temporarily fix if needed. 136 | 137 | ## Version 1.2.0 138 | 139 | * Changed backlinks method with no search engines specified to use all of them 140 | * Changed ranks method with no search engines specified to use all of them 141 | * Added alias rank for ranks 142 | * Added alias backlink for backlinks 143 | 144 | ## Version 1.1.0 145 | 146 | * Fixed google xpath for backlinks 147 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gemspec 4 | 5 | group :development do 6 | gem 'pry-byebug' 7 | end 8 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 blatyo 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /PageRankr.gemspec: -------------------------------------------------------------------------------- 1 | require File.expand_path("../lib/page_rankr/version", __FILE__) 2 | 3 | Gem::Specification.new do |s| 4 | s.name = "PageRankr" 5 | s.version = PageRankr::VERSION 6 | s.platform = Gem::Platform::RUBY 7 | s.authors = ["Allen Madsen"] 8 | s.email = ["blatyo@gmail.com"] 9 | s.license = 'MIT' 10 | s.homepage = "http://github.com/blatyo/page_rankr" 11 | s.summary = "Easy way to retrieve Google Page Rank, Alexa Rank, backlink counts, index counts and different types of social signals" 12 | s.description = "Easy way to retrieve Google Page Rank, Alexa Rank, backlink counts, index counts and different types of social signals" 13 | 14 | s.required_rubygems_version = ">= 1.3.6" 15 | s.add_development_dependency "rake" 16 | s.add_development_dependency "rspec", ">= 2.6.0" 17 | s.add_development_dependency "bundler", ">= 1.0.0" 18 | s.add_development_dependency "fuubar", ">= 0.0.1" 19 | s.add_development_dependency "vcr", ">= 2.9.3" 20 | s.add_development_dependency "webmock" 21 | 22 | s.add_runtime_dependency "nokogiri", ">= 1.4.1" 23 | s.add_runtime_dependency "json", ">= 1.4.6" 24 | s.add_runtime_dependency "public_suffix", "~> 1.0" 25 | s.add_runtime_dependency "httparty", ">= 0.9.0" 26 | s.add_runtime_dependency "jsonpath", ">= 0.4.2" 27 | s.add_runtime_dependency "addressable" 28 | 29 | s.files = `git ls-files`.split("\n") 30 | s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") 31 | s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact 32 | s.require_paths = ["lib"] 33 | end 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PageRankr [![Build Status](https://api.travis-ci.org/blatyo/page_rankr.png)](http://travis-ci.org/blatyo/page_rankr) 2 | 3 | Provides an easy way to retrieve Google Page Rank, Alexa Rank, backlink counts, index counts and different types of social signals. 4 | 5 | __This project is abandoned. If you'd like to take ownership of this project, let me know.__ 6 | 7 | _Note: Version ~> 2.0 and ~> 3.0 used typheous internally which caused memory leak issues and failures on windows. 4.0.0 changes the implementation to use a Net::HTTP based library for better compatability._ 8 | 9 | _Note: Version >= 4.1.0 no longer actively maintains compatibility with Ruby 1.8.X. It will probably still work for the time being._ 10 | 11 | _Note: Version >= 4.2.0 no longer actively maintains compatibility with Ruby < 1.9.3. It will probably still work, but you may need to specify older versions for gems this library depends on in your Gemfile._ 12 | 13 | _Note: Version >= 4.5.0 no longer actively maintains compatibility with Ruby < 2.0._ 14 | 15 | Check out a little [web app][1] I wrote up that uses it or look at the [source][2]. 16 | 17 | [1]: http://isitpopular.heroku.com 18 | [2]: https://github.com/blatyo/is_it_popular 19 | 20 | ## Get it! 21 | 22 | ``` bash 23 | gem install PageRankr 24 | ``` 25 | 26 | ## Gemfile 27 | 28 | ``` ruby 29 | gem 'PageRankr' 30 | ``` 31 | 32 | ## Use it! 33 | 34 | ``` ruby 35 | require 'page_rankr' 36 | ``` 37 | 38 | ### Backlinks 39 | 40 | Backlinks are the result of doing a search with a query like "link:www.google.com". The number of returned results indicates how many sites point to that url. If a site is not tracked then `nil` is returned. 41 | 42 | ``` ruby 43 | PageRankr.backlinks('www.google.com', :google, :bing) #=> {:google=>161000, :bing=>208000000} 44 | PageRankr.backlinks('www.google.com', :yahoo) #=> {:yahoo=>256300062} 45 | ``` 46 | 47 | If you don't specify a search engine, then all of them are used. 48 | 49 | ``` ruby 50 | # this 51 | PageRankr.backlinks('www.google.com') 52 | #=> {:google=>23000, :bing=>215000000, :yahoo=>250522337, :alexa=>727036} 53 | 54 | # is equivalent to 55 | PageRankr.backlinks('www.google.com', :google, :bing, :yahoo, :alexa) 56 | #=> {:google=>23000, :bing=>215000000, :yahoo=>250522337, :alexa=>727036} 57 | ``` 58 | 59 | You can also use the alias `backlink` instead of `backlinks`. 60 | 61 | Valid search engines are: `:google, :bing, :yahoo, :alexa` (altavista and alltheweb now redirect to yahoo). To get this list you can do: 62 | 63 | ``` ruby 64 | PageRankr.backlink_trackers #=> [:alexa, :bing, :google, :yahoo] 65 | ``` 66 | 67 | ### Indexes 68 | 69 | Indexes are the result of doing a search with a query like "site:www.google.com". The number of returned results indicates how many pages of a domain are indexed by a particular search engine. If the site is not indexed `nil` is returned. 70 | 71 | ``` ruby 72 | PageRankr.indexes('www.google.com', :google) #=> {:google=>4860000} 73 | PageRankr.indexes('www.google.com', :bing) #=> {:bing=>2120000} 74 | ``` 75 | 76 | If you don't specify a search engine, then all of them are used. 77 | 78 | ``` ruby 79 | # this 80 | PageRankr.indexes('www.google.com') 81 | #=> {:bing=>2120000, :google=>4860000, :yahoo => 4863000} 82 | 83 | # is equivalent to 84 | PageRankr.indexes('www.google.com', :google, :bing, :yahoo) 85 | #=> {:bing=>2120000, :google=>4860000, :yahoo => 4863000} 86 | ``` 87 | 88 | You can also use the alias `index` instead of `indexes`. 89 | 90 | Valid search engines are: `:google, :bing, :yahoo`. To get this list you can do: 91 | 92 | ``` ruby 93 | PageRankr.index_trackers #=> [:bing, :google, :yahoo] 94 | ``` 95 | 96 | ### Ranks 97 | 98 | Ranks are ratings assigned to specify how popular a site is. The most famous example of this is the google page rank. 99 | 100 | ``` ruby 101 | PageRankr.ranks('www.google.com', :google) #=> {:google=>10} 102 | ``` 103 | 104 | If you don't specify a rank provider, then all of them are used. 105 | 106 | ``` ruby 107 | PageRankr.ranks('www.google.com', :alexa_us, :alexa_global, :google, :moz_rank, :page_authority) 108 | #=> {:alexa_us=>1, :alexa_global=>1, :alexa_country=>1, :google=>10, :moz_rank => 8, :page_authority => 97} 109 | 110 | # this also gives the same result 111 | PageRankr.ranks('www.google.com') 112 | #=> {:alexa_us=>1, :alexa_global=>1, :alexa_country=>1, :google=>9, :moz_rank=>8, :domain_authority=>100, :page_authority=>96} 113 | ``` 114 | 115 | You can also use the alias `rank` instead of `ranks`. 116 | 117 | Valid rank trackers are: `:alexa_country, :alexa_global, :alexa_us, :google, :moz_rank, :page_authority`. To get this you can do: 118 | 119 | ``` ruby 120 | PageRankr.rank_trackers #=> [:alexa_us, :alexa_global, :alexa_country, :google, :moz_rank, :domain_authority, :page_authority] 121 | ``` 122 | 123 | Alexa ranks are descending where 1 is the most popular. 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 nil. 124 | 125 | ### Socials 126 | 127 | Social signals are a somewhat oversimplified way of telling how popular a site or page currently is. 128 | 129 | ``` ruby 130 | PageRankr.socials('www.google.com', :linked_in) #=> {:linked_in=>1001} 131 | ``` 132 | 133 | If you don't specify a social tracker, then all of them are used. 134 | 135 | ``` ruby 136 | PageRankr.socials('www.google.com', :google, :linked_in, :pinterest, :stumbled_upon, :twitter, :vk) 137 | #=> {:google=>10000, :linked_in=>1001, :pinterest=>75108, :stumple_upon=>255078, :twitter=>21933764, :vk=>3725} 138 | 139 | # this also gives the same result 140 | PageRankr.socials('www.google.com') 141 | #=> {:google=>10000, :linked_in=>1001, :pinterest=>75108, :stumble_upon=>255078, :twitter=>21933764, :vk=>3725} 142 | ``` 143 | 144 | Valid social trackers are: `:google, :linked_in, :pinterest, :stumble_upon, :twitter, :vk`. To get this you can do: 145 | 146 | ``` ruby 147 | PageRankr.social_trackers #=> [:google, :linked_in, :pinterest, :stumble_upon, :twitter, :vk] 148 | ``` 149 | 150 | 151 | ## Use it a la carte! 152 | 153 | From versions >= 3, everything should be usable in a much more a la carte manner. If all you care about is google page rank (which I speculate is common) you can get that all by itself: 154 | 155 | ``` ruby 156 | require 'page_rankr/ranks/google' 157 | 158 | tracker = PageRankr::Ranks::Google.new("myawesomesite.com") 159 | tracker.run #=> 2 160 | ``` 161 | 162 | Also, once a tracker has run three values will be accessible from it: 163 | 164 | ``` ruby 165 | # The value extracted. Tracked is aliased to rank for PageRankr::Ranks, backlink for PageRankr::Backlinks, and index for PageRankr::Indexes. 166 | tracker.tracked #=> 2 167 | 168 | # The value extracted with the jsonpath, xpath, or regex before being cleaned. 169 | tracker.raw #=> "2" 170 | 171 | # The body of the response 172 | tracker.body #=> "..." 173 | ``` 174 | 175 | ## Rate limiting and proxies 176 | 177 | One of the annoying things about each of these services is that they really don't like you scraping data from them. In order to deal with this issue, they throttle traffic from a single machine. The simplest way to get around this is to use proxy machines to make the requests. 178 | 179 | In PageRankr >= 3.2.0, this is much simpler. The first thing you'll need is a proxy service. Two are provided [here](https://github.com/blatyo/page_rankr/tree/master/lib/page_rankr/proxy_services). A proxy service must define a `proxy` method that takes two arguments. It should return a string like `http://user:password@192.168.1.1:50501`. 180 | 181 | Once you have a proxy service, you can tell PageRankr to use it. For example: 182 | 183 | ``` ruby 184 | PageRankr.proxy_service = PageRankr::ProxyServices::Random.new([ 185 | 'http://user:password@192.168.1.1:50501', 186 | 'http://user:password@192.168.1.2:50501' 187 | ]) 188 | ``` 189 | 190 | Once PageRankr knows about your proxy service, any request that is made will ask for a proxy from the proxy service. It does this by calling the `proxy` method. When it calls the `proxy` method, it passed the name of the tracker (e.g. `:ranks_google`) and the site that is being looked up. Hopefully, this information is sufficient for you to build a much smarter proxy service than the ones provided (pull requests welcome!). 191 | 192 | ## Fix it! 193 | 194 | If you ever find something is broken it should now be much easier to fix it with version >= 1.3.0. For example, if the xpath used to lookup a backlink is broken, just override the method for that class to provide the correct xpath. 195 | 196 | ``` ruby 197 | module PageRankr 198 | class Backlinks 199 | class Bing 200 | def xpath 201 | "//my/new/awesome/@xpath" 202 | end 203 | end 204 | end 205 | end 206 | ``` 207 | 208 | ## Extend it! 209 | 210 | If you ever come across a site that provides a rank or backlinks you can hook that class up to automatically be use with PageRankr. PageRankr does this by looking up all the classes namespaced under Backlinks, Indexes, and Ranks. 211 | 212 | ``` ruby 213 | require 'page_rankr/backlink' 214 | 215 | module PageRankr 216 | class Backlinks 217 | class Foo 218 | include Backlink 219 | 220 | # This method is required 221 | def url 222 | "http://example.com/" 223 | end 224 | 225 | # This method specifies the parameters for the url. It is optional, but likely required for the class to be useful. 226 | def params 227 | {:q => tracked_url} 228 | end 229 | 230 | # You can use a method named either xpath, jsonpath, or regex with the appropriate query type 231 | def xpath 232 | "//backlinks/text()" 233 | end 234 | 235 | # Optionally, you could override the clean method if the current implementation isn't sufficient 236 | # def clean(backlink_count) 237 | # #do some of my own cleaning 238 | # super(backlink_count) # strips non-digits and converts it to an integer or nil 239 | # end 240 | end 241 | end 242 | end 243 | 244 | PageRankr::Backlinks::Foo.new("myawesomesite.com").run #=> 3 245 | PageRankr.backlinks("myawesomesite.com", :foo)[:foo] #=> 3 246 | ``` 247 | 248 | Then, just make sure you require the class and PageRankr and whenever you call PageRankr.backlinks it'll be able to use your class. 249 | 250 | ## Note on Patches/Pull Requests 251 | 252 | * Fork the project. 253 | * Make your feature addition or bug fix. 254 | * Add tests for it. This is important so I don't break it in a future version unintentionally. 255 | * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) 256 | * Send me a pull request. Bonus points for topic branches. 257 | 258 | ## TODO Version 5 259 | * Detect request throttling 260 | 261 | ## Shout Out 262 | Gotta give credit where credits due! 263 | 264 | Original inspiration from: 265 | 266 | * [PageRankSharp](https://github.com/alexmipego/PageRankSharp) 267 | * [Google Page Range Lookup/](http://snipplr.com/view/18329/google-page-range-lookup/) 268 | * [AJAX PR Checker](http://www.sitetoolcenter.com/free-website-scripts/ajax-pr-checker.php) 269 | 270 | ## Copyright 271 | 272 | Copyright (c) 2010 Allen Madsen. See LICENSE for details. 273 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'bundler' 2 | Bundler::GemHelper.install_tasks 3 | 4 | require 'rspec/core/rake_task' 5 | RSpec::Core::RakeTask.new(:spec) 6 | 7 | task :default => :spec 8 | 9 | desc "Open an irb session preloaded with this library" 10 | task :console do 11 | sh "irb -rubygems -I lib -r page_rankr.rb" 12 | end -------------------------------------------------------------------------------- /lib/PageRankr.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../page_rankr', __FILE__) -------------------------------------------------------------------------------- /lib/page_rankr.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path("../page_rankr/backlinks", __FILE__) 2 | require File.expand_path("../page_rankr/ranks", __FILE__) 3 | require File.expand_path("../page_rankr/indexes", __FILE__) 4 | require File.expand_path("../page_rankr/proxy_services", __FILE__) 5 | require File.expand_path("../page_rankr/socials", __FILE__) 6 | 7 | module PageRankr 8 | class MethodRequired < StandardError; end 9 | class DomainInvalid < StandardError; end 10 | class SupportedComponentsInvalid < StandardError; end 11 | 12 | class << self 13 | attr_accessor :proxy_service 14 | 15 | def backlinks(site, *search_engines) 16 | Backlinks.new.lookup(Site.new(site), *search_engines) 17 | end 18 | alias_method :backlink, :backlinks 19 | 20 | def backlink_trackers 21 | Backlinks.new.backlink_trackers 22 | end 23 | 24 | def ranks(site, *rank_trackers) 25 | Ranks.new.lookup(Site.new(site), *rank_trackers) 26 | end 27 | alias_method :rank, :ranks 28 | 29 | def rank_trackers 30 | Ranks.new.rank_trackers 31 | end 32 | 33 | def indexes(site, *index_trackers) 34 | Indexes.new.lookup(Site.new(site), *index_trackers) 35 | end 36 | alias_method :index, :indexes 37 | 38 | def index_trackers 39 | Indexes.new.index_trackers 40 | end 41 | 42 | def socials(site, *social_trackers) 43 | Socials.new.lookup(Site.new(site), *social_trackers) 44 | end 45 | alias_method :social, :socials 46 | 47 | def social_trackers 48 | Socials.new.social_trackers 49 | end 50 | end 51 | end -------------------------------------------------------------------------------- /lib/page_rankr/backlink.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../tracker', __FILE__) 2 | 3 | module PageRankr 4 | module Backlink 5 | include Tracker 6 | 7 | alias_method :backlink, :tracked 8 | 9 | def clean(raw) 10 | cleaned_content = super(raw) 11 | return nil if cleaned_content.nil? || cleaned_content.zero? 12 | cleaned_content 13 | end 14 | end 15 | end -------------------------------------------------------------------------------- /lib/page_rankr/backlinks.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path("../trackers", __FILE__) 2 | require File.expand_path("../backlinks/bing", __FILE__) 3 | require File.expand_path("../backlinks/google", __FILE__) 4 | require File.expand_path("../backlinks/yahoo", __FILE__) 5 | 6 | module PageRankr 7 | class Backlinks 8 | include Trackers 9 | 10 | alias_method :backlink_trackers, :site_trackers 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lib/page_rankr/backlinks/bing.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../backlink', __FILE__) 2 | 3 | module PageRankr 4 | class Backlinks 5 | class Bing 6 | include Backlink 7 | 8 | def url 9 | "http://www.bing.com/search" 10 | end 11 | 12 | def params 13 | {:q => "inbody:#{tracked_url}"} 14 | end 15 | 16 | def xpath 17 | "//span[@class='sb_count']/text()" 18 | end 19 | 20 | def clean(backlink_count) 21 | super(backlink_count.gsub('1-10', '')) 22 | end 23 | 24 | def name 25 | :backlinks_bing 26 | end 27 | end 28 | end 29 | end -------------------------------------------------------------------------------- /lib/page_rankr/backlinks/google.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../backlink', __FILE__) 2 | 3 | module PageRankr 4 | class Backlinks 5 | class Google 6 | include Backlink 7 | 8 | def url 9 | "http://www.google.com/search" 10 | end 11 | 12 | def params 13 | {:q => "link:#{tracked_url}"} 14 | end 15 | 16 | def xpath 17 | "//div[@id='resultStats']/text()" 18 | end 19 | 20 | def name 21 | :backlinks_google 22 | end 23 | end 24 | end 25 | end -------------------------------------------------------------------------------- /lib/page_rankr/backlinks/yahoo.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../backlink', __FILE__) 2 | 3 | module PageRankr 4 | class Backlinks 5 | class Yahoo 6 | include Backlink 7 | 8 | def url 9 | "http://search.yahoo.com/search" 10 | end 11 | 12 | def params 13 | {:p => "inbody:#{tracked_url}"} 14 | end 15 | 16 | def xpath 17 | "//div[@class='compPagination']/span/text()" 18 | end 19 | 20 | def name 21 | :backlinks_yahoo 22 | end 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /lib/page_rankr/index.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../tracker', __FILE__) 2 | 3 | module PageRankr 4 | module Index 5 | include Tracker 6 | 7 | alias_method :index, :tracked 8 | 9 | def clean(raw) 10 | cleaned_content = super(raw) 11 | return nil if cleaned_content.nil? || cleaned_content.zero? 12 | cleaned_content 13 | end 14 | end 15 | end -------------------------------------------------------------------------------- /lib/page_rankr/indexes.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path("../trackers", __FILE__) 2 | require File.expand_path("../indexes/bing", __FILE__) 3 | require File.expand_path("../indexes/google", __FILE__) 4 | require File.expand_path("../indexes/yahoo", __FILE__) 5 | 6 | module PageRankr 7 | class Indexes 8 | include Trackers 9 | 10 | alias_method :index_trackers, :site_trackers 11 | end 12 | end -------------------------------------------------------------------------------- /lib/page_rankr/indexes/bing.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../index', __FILE__) 2 | 3 | module PageRankr 4 | class Indexes 5 | class Bing 6 | include Index 7 | 8 | def url 9 | "http://www.bing.com/search" 10 | end 11 | 12 | def params 13 | {:q => "site:#{tracked_url}"} 14 | end 15 | 16 | def xpath 17 | "//span[@class='sb_count']/text()" 18 | end 19 | 20 | def clean(backlink_count) 21 | super(backlink_count.gsub('1-10', '')) 22 | end 23 | 24 | def name 25 | :indexes_bing 26 | end 27 | end 28 | end 29 | end -------------------------------------------------------------------------------- /lib/page_rankr/indexes/google.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../index', __FILE__) 2 | 3 | module PageRankr 4 | class Indexes 5 | class Google 6 | include Index 7 | 8 | def url 9 | "http://www.google.com/search" 10 | end 11 | 12 | def params 13 | {:q => "site:#{tracked_url}"} 14 | end 15 | 16 | def xpath 17 | "//div[@id='resultStats']/text()" 18 | end 19 | 20 | def name 21 | :indexes_google 22 | end 23 | end 24 | end 25 | end -------------------------------------------------------------------------------- /lib/page_rankr/indexes/yahoo.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../index', __FILE__) 2 | 3 | module PageRankr 4 | class Indexes 5 | class Yahoo 6 | include Index 7 | 8 | def url 9 | "http://search.yahoo.com/search" 10 | end 11 | 12 | def params 13 | {:p => "site:#{tracked_url}"} 14 | end 15 | 16 | def xpath 17 | "//div[@class='compPagination']/span/text()" 18 | end 19 | 20 | def name 21 | :indexes_yahoo 22 | end 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /lib/page_rankr/proxy_services.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path("../proxy_services/random", __FILE__) 2 | require File.expand_path("../proxy_services/round_robin", __FILE__) 3 | 4 | module ProxyServices 5 | end -------------------------------------------------------------------------------- /lib/page_rankr/proxy_services/random.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | 3 | module PageRankr 4 | module ProxyServices 5 | class Random 6 | def initialize(proxies) 7 | @proxies = proxies 8 | end 9 | 10 | def proxy(name, site) 11 | @proxies[rand(@proxies.length)] 12 | end 13 | end 14 | end 15 | end -------------------------------------------------------------------------------- /lib/page_rankr/proxy_services/round_robin.rb: -------------------------------------------------------------------------------- 1 | module PageRankr 2 | module ProxyServices 3 | class RoundRobin 4 | def initialize(proxies) 5 | @proxies = proxies 6 | @index = 0 7 | end 8 | 9 | def proxy(name, site) 10 | @proxies[@index].tap do 11 | @index = (@index + 1) % @proxies.length 12 | end 13 | end 14 | end 15 | end 16 | end -------------------------------------------------------------------------------- /lib/page_rankr/rank.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../tracker', __FILE__) 2 | 3 | module PageRankr 4 | module Rank 5 | include Tracker 6 | 7 | alias_method :rank, :tracked 8 | end 9 | end -------------------------------------------------------------------------------- /lib/page_rankr/ranks.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path("../trackers", __FILE__) 2 | require File.expand_path("../ranks/alexa_us", __FILE__) 3 | require File.expand_path("../ranks/alexa_global", __FILE__) 4 | require File.expand_path("../ranks/alexa_country", __FILE__) 5 | require File.expand_path("../ranks/google", __FILE__) 6 | require File.expand_path('../ranks/moz_rank', __FILE__) 7 | require File.expand_path('../ranks/domain_authority', __FILE__) 8 | require File.expand_path('../ranks/page_authority', __FILE__) 9 | 10 | module PageRankr 11 | class Ranks 12 | include Trackers 13 | 14 | alias_method :rank_trackers, :site_trackers 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /lib/page_rankr/ranks/alexa_country.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../rank', __FILE__) 2 | 3 | module PageRankr 4 | class Ranks 5 | class AlexaCountry 6 | include Rank 7 | 8 | def url 9 | "http://data.alexa.com/data" 10 | end 11 | 12 | def params 13 | {:cli => 10, :dat => "snbamz", :url => tracked_url} 14 | end 15 | 16 | # Alexa may sometimes return a result for the incorrect site and thus it is necessary to check if 17 | # the results returned are for the site we want. 18 | # 19 | # For example, slocourts.net returns results for ca.gov, presumably because www.slocourts.ca.gov redirects 20 | # to slocourts.net. Clearly something is wrong with how Alexa handles this case and so in the event this 21 | # happens we treat the results as if there were no results. 22 | def xpath 23 | "//country/@rank" 24 | end 25 | 26 | def supported_components 27 | [:subdomain] 28 | end 29 | 30 | def name 31 | :ranks_alexa_country 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/page_rankr/ranks/alexa_global.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../rank', __FILE__) 2 | 3 | module PageRankr 4 | class Ranks 5 | class AlexaGlobal 6 | include Rank 7 | 8 | def url 9 | "http://data.alexa.com/data" 10 | end 11 | 12 | def params 13 | {:cli => 10, :dat => "snbamz", :url => tracked_url} 14 | end 15 | 16 | # Alexa may sometimes return a result for the incorrect site and thus it is necessary to check if 17 | # the results returned are for the site we want. 18 | # 19 | # For example, slocourts.net returns results for ca.gov, presumably because www.slocourts.ca.gov redirects 20 | # to slocourts.net. Clearly something is wrong with how Alexa handles this case and so in the event this 21 | # happens we treat the results as if there were no results. 22 | def xpath 23 | "//popularity/@text" 24 | end 25 | 26 | def supported_components 27 | [:subdomain] 28 | end 29 | 30 | def name 31 | :ranks_alexa_global 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/page_rankr/ranks/alexa_us.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../rank', __FILE__) 2 | 3 | module PageRankr 4 | class Ranks 5 | class AlexaUs 6 | include Rank 7 | 8 | def url 9 | "http://data.alexa.com/data" 10 | end 11 | 12 | def params 13 | {:cli => 10, :dat => "snbamz", :url => tracked_url} 14 | end 15 | 16 | # Alexa may sometimes return a result for the incorrect site and thus it is necessary to check if 17 | # the results returned are for the site we want. 18 | # 19 | # For example, slocourts.net returns results for ca.gov, presumably because www.slocourts.ca.gov redirects 20 | # to slocourts.net. Clearly something is wrong with how Alexa handles this case and so in the event this 21 | # happens we treat the results as if there were no results. 22 | def xpath 23 | "//country[@code='US']/@rank" 24 | end 25 | 26 | def supported_components 27 | [:subdomain] 28 | end 29 | 30 | def name 31 | :ranks_alexa_us 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/page_rankr/ranks/domain_authority.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../rank', __FILE__) 2 | 3 | module PageRankr 4 | class Ranks 5 | class DomainAuthority 6 | include Rank 7 | 8 | def url 9 | 'https://moz.com/researchtools/ose/api/urlmetrics' 10 | end 11 | 12 | def params 13 | {:site => tracked_url} 14 | end 15 | 16 | def jsonpath 17 | 'data.authority.domain_authority' 18 | end 19 | 20 | def supported_components 21 | [:subdomain, :path, :query] 22 | end 23 | 24 | def name 25 | :ranks_domain_authority 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/page_rankr/ranks/google.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../rank', __FILE__) 2 | require File.expand_path('../google/checksum', __FILE__) 3 | 4 | module PageRankr 5 | class Ranks 6 | class Google 7 | include Rank 8 | 9 | def initialize(site, options = {}) 10 | @site = PageRankr::Site(site) 11 | @checksum = Checksum.generate("info:#{tracked_url}") 12 | 13 | super(site, options) 14 | end 15 | 16 | def supported_components 17 | [:subdomain, :path, :query] 18 | end 19 | 20 | def url 21 | "http://toolbarqueries.google.com/tbr" 22 | end 23 | 24 | def params 25 | {:client => "navclient-auto", :ch => @checksum, :features => "Rank", :q => "info:#{tracked_url}"} 26 | end 27 | 28 | def regex 29 | /Rank_\d+:\d+:(\d+)/ 30 | end 31 | 32 | def name 33 | :ranks_google 34 | end 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /lib/page_rankr/ranks/google/checksum.rb: -------------------------------------------------------------------------------- 1 | module PageRankr 2 | class Ranks 3 | class Google 4 | class Checksum 5 | class << self 6 | def generate(site) 7 | bytes = byte_array(site) 8 | length = bytes.length 9 | a = b = 0x9E3779B9 10 | c = 0xE6359A60 11 | 12 | k, len = 0, length 13 | while(len >= 12) 14 | a, b, c = mix(*shift(a, b, c, k, bytes)) 15 | k += 12 16 | len -= 12 17 | end 18 | 19 | c = c + length 20 | 21 | c = mix(*toss(a, b, c, bytes, len, k))[2] 22 | "6" + c.to_s 23 | end 24 | 25 | private 26 | 27 | def byte_array(site) 28 | bytes = [] 29 | site.each_byte {|b| bytes << b} 30 | bytes 31 | end 32 | 33 | # Need to keep numbers in the unsigned int 32 range 34 | def m(v) 35 | v % 0x100000000 36 | end 37 | 38 | def shift(a, b, c, k, bytes) 39 | a = m(a + bytes[k + 0] + (bytes[k + 1] << 8) + (bytes[k + 2] << 16) + (bytes[k + 3] << 24)) 40 | b = m(b + bytes[k + 4] + (bytes[k + 5] << 8) + (bytes[k + 6] << 16) + (bytes[k + 7] << 24)) 41 | c = m(c + bytes[k + 8] + (bytes[k + 9] << 8) + (bytes[k + 10] << 16) + (bytes[k + 11] << 24)) 42 | 43 | [a, b, c] 44 | end 45 | 46 | def mix(a, b, c) 47 | a, b, c = m(a), m(b), m(c) 48 | 49 | a = m(a-b-c) ^ m(c >> 13) 50 | b = m(b-c-a) ^ m(a << 8) 51 | c = m(c-a-b) ^ m(b >> 13) 52 | 53 | a = m(a-b-c) ^ m(c >> 12) 54 | b = m(b-c-a) ^ m(a << 16) 55 | c = m(c-a-b) ^ m(b >> 5) 56 | 57 | a = m(a-b-c) ^ m(c >> 3) 58 | b = m(b-c-a) ^ m(a << 10) 59 | c = m(c-a-b) ^ m(b >> 15) 60 | 61 | [a, b, c] 62 | end 63 | 64 | def toss(a, b, c, bytes, len, k) 65 | case len 66 | when 9..11 67 | c = c + (bytes[k+len-1] << ((len % 8) * 8)) 68 | when 5..8 69 | b = b + (bytes[k+len-1] << ((len % 5) * 8)) 70 | when 1..4 71 | a = a + (bytes[k+len-1] << ((len - 1) * 8)) 72 | else 73 | return [a, b, c] 74 | end 75 | toss(a, b, c, bytes, len-1, k) 76 | end 77 | end 78 | end 79 | end 80 | end 81 | end -------------------------------------------------------------------------------- /lib/page_rankr/ranks/moz_rank.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../rank', __FILE__) 2 | 3 | module PageRankr 4 | class Ranks 5 | class MozRank 6 | include Rank 7 | 8 | def url 9 | 'http://bagics.com/moz-rank.html' 10 | end 11 | 12 | def params 13 | {:domain => tracked_url} 14 | end 15 | 16 | def xpath 17 | '//*[@id="resId"]' 18 | end 19 | 20 | def supported_components 21 | [:subdomain, :path, :query] 22 | end 23 | 24 | def name 25 | :ranks_moz_rank 26 | end 27 | end 28 | end 29 | end -------------------------------------------------------------------------------- /lib/page_rankr/ranks/page_authority.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../rank', __FILE__) 2 | 3 | module PageRankr 4 | class Ranks 5 | class PageAuthority 6 | include Rank 7 | 8 | def url 9 | 'https://moz.com/researchtools/ose/api/urlmetrics' 10 | end 11 | 12 | def params 13 | {site: tracked_url} 14 | end 15 | 16 | def jsonpath 17 | 'data.authority.page_authority' 18 | end 19 | 20 | def supported_components 21 | [:subdomain, :path, :query] 22 | end 23 | 24 | def name 25 | :ranks_page_authority 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/page_rankr/request.rb: -------------------------------------------------------------------------------- 1 | require 'httparty' 2 | 3 | module PageRankr 4 | class Request 5 | def initialize(tracker, options) 6 | @tracker = tracker 7 | @options = options 8 | end 9 | 10 | def perform 11 | method = tracker.method 12 | url = tracker.url 13 | 14 | response = HTTParty.send(method, url, construct_options(tracker)) 15 | yield response.body if block_given? 16 | end 17 | 18 | private 19 | attr_reader :tracker 20 | 21 | def construct_options(tracker) 22 | proxy = tracker.proxy 23 | params = tracker.params if tracker.respond_to?(:params) 24 | 25 | options = default_options 26 | options.merge!({ 27 | :http_proxyaddr => proxy.host, 28 | :http_proxyport => proxy.port, 29 | :http_proxyuser => proxy.user, 30 | :http_proxypass => proxy.password 31 | }) if proxy 32 | options.merge!({:query => params}) if params 33 | options.merge!(@options) 34 | end 35 | 36 | def default_options 37 | { 38 | :headers => { 39 | 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, like Gecko) Version/5.1.6 Safari/534.56.5' 40 | } 41 | } 42 | end 43 | end 44 | end -------------------------------------------------------------------------------- /lib/page_rankr/site.rb: -------------------------------------------------------------------------------- 1 | require 'public_suffix' 2 | require 'delegate' 3 | require 'addressable/uri' 4 | 5 | module PageRankr 6 | class Site 7 | COMPONENTS = [:scheme, :subdomain, :domain, :port, :path, :query, :fragment] 8 | 9 | def initialize(site) 10 | site = "http://#{site}" unless site =~ /:\/\// 11 | @uri = Addressable::URI.parse(site) 12 | @domain = PublicSuffix.parse(@uri.host || "") 13 | 14 | @domain.valid? or raise DomainInvalid, "The domain provided is invalid.1" 15 | rescue PublicSuffix::DomainInvalid, Addressable::URI::InvalidURIError 16 | raise DomainInvalid, "The domain provided is invalid." 17 | end 18 | 19 | def scheme 20 | @uri.scheme 21 | end 22 | 23 | def domain 24 | @domain.domain 25 | end 26 | 27 | def subdomain 28 | @domain.subdomain or domain 29 | end 30 | 31 | def port 32 | @uri.port 33 | end 34 | 35 | def path 36 | @uri.path 37 | end 38 | 39 | def query 40 | @uri.query 41 | end 42 | 43 | def fragment 44 | @uri.fragment 45 | end 46 | 47 | def url(supported_components = [:domain]) 48 | components = COMPONENTS & supported_components #get ordered list 49 | 50 | unless components.include?(:subdomain) ^ components.include?(:domain) 51 | raise SupportedComponentsInvalid, "Either subdomain or domain should be set as a supported component, not both." 52 | end 53 | 54 | components.inject("") do |url, component| 55 | url + case component 56 | when :scheme 57 | scheme and "#{scheme}://" or "" 58 | when :domain 59 | domain 60 | when :subdomain 61 | subdomain 62 | when :port 63 | port == @uri.default_port and "" or ":#{port}" 64 | when :path 65 | path or "" 66 | when :query 67 | query and "?#{query}" or "" 68 | when :fragment 69 | fragment and "##{fragment}" or "" 70 | end 71 | end 72 | end 73 | end 74 | 75 | class << self 76 | def Site(site) 77 | site.respond_to?(:url) ? site : Site.new(site) 78 | end 79 | end 80 | end 81 | -------------------------------------------------------------------------------- /lib/page_rankr/social.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../social', __FILE__) 2 | 3 | module PageRankr 4 | module Social 5 | include Tracker 6 | 7 | alias_method :social, :tracked 8 | end 9 | end -------------------------------------------------------------------------------- /lib/page_rankr/socials.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path("../trackers", __FILE__) 2 | require File.expand_path("../socials/facebook", __FILE__) 3 | require File.expand_path("../socials/google", __FILE__) 4 | require File.expand_path("../socials/linkedin", __FILE__) 5 | require File.expand_path("../socials/pinterest", __FILE__) 6 | require File.expand_path("../socials/stumble_upon", __FILE__) 7 | require File.expand_path("../socials/twitter", __FILE__) 8 | require File.expand_path("../socials/vk", __FILE__) 9 | 10 | module PageRankr 11 | class Socials 12 | include Trackers 13 | 14 | alias_method :social_trackers, :site_trackers 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /lib/page_rankr/socials/facebook.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../social', __FILE__) 2 | 3 | module PageRankr 4 | class Socials 5 | class Facebook 6 | include Social 7 | 8 | def url 9 | 'http://graph.facebook.com' 10 | end 11 | 12 | def params 13 | {:id => tracked_url} 14 | end 15 | 16 | def jsonpath 17 | 'shares' 18 | end 19 | 20 | def supported_components 21 | [:subdomain, :path, :query, :scheme] 22 | end 23 | 24 | def name 25 | :socials_facebook 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/page_rankr/socials/google.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../social', __FILE__) 2 | 3 | module PageRankr 4 | class Socials 5 | class Google 6 | include Social 7 | 8 | def url 9 | # Yandex supplies Google +1 counts in a convenient matter without need for an API key 10 | 'http://share.yandex.ru/gpp.xml' 11 | end 12 | 13 | def params 14 | {:url => tracked_url} 15 | end 16 | 17 | def regex 18 | /(\d+)/ 19 | end 20 | 21 | def supported_components 22 | [:subdomain, :path, :scheme] 23 | end 24 | 25 | def name 26 | :socials_google 27 | end 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/page_rankr/socials/linkedin.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../social', __FILE__) 2 | 3 | module PageRankr 4 | class Socials 5 | class LinkedIn 6 | include Social 7 | 8 | def url 9 | 'https://www.linkedin.com/countserv/count/share' 10 | end 11 | 12 | def params 13 | {:url => tracked_url, :callback => '_', :format => 'json'} 14 | end 15 | 16 | def jsonpath 17 | 'count' 18 | end 19 | 20 | def supported_components 21 | [:subdomain, :path, :query] 22 | end 23 | 24 | def name 25 | :socials_linked_in 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/page_rankr/socials/pinterest.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../social', __FILE__) 2 | 3 | module PageRankr 4 | class Socials 5 | class Pinterest 6 | include Social 7 | 8 | def url 9 | 'http://api.pinterest.com/v1/urls/count.json' 10 | end 11 | 12 | def params 13 | {:url => tracked_url, :callback => '_'} 14 | end 15 | 16 | def regex 17 | /(\d+)/ 18 | end 19 | 20 | def supported_components 21 | [:subdomain, :path, :scheme] 22 | end 23 | 24 | def name 25 | :socials_pinterest 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/page_rankr/socials/stumble_upon.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../social', __FILE__) 2 | 3 | module PageRankr 4 | class Socials 5 | class StumbleUpon 6 | include Social 7 | 8 | def url 9 | 'http://www.stumbleupon.com/services/1.01/badge.getinfo' 10 | end 11 | 12 | def params 13 | {:url => tracked_url} 14 | end 15 | 16 | def jsonpath 17 | 'result.views' 18 | end 19 | 20 | def supported_components 21 | [:subdomain, :path, :query] 22 | end 23 | 24 | def name 25 | :socials_stumble_upon 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/page_rankr/socials/twitter.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../social', __FILE__) 2 | 3 | module PageRankr 4 | class Socials 5 | class Twitter 6 | include Social 7 | 8 | def url 9 | 'http://urls.api.twitter.com/1/urls/count.json' 10 | end 11 | 12 | def params 13 | {:url => tracked_url} 14 | end 15 | 16 | def jsonpath 17 | 'count' 18 | end 19 | 20 | def supported_components 21 | [:subdomain, :path, :query] 22 | end 23 | 24 | def name 25 | :socials_twitter 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/page_rankr/socials/vk.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../social', __FILE__) 2 | 3 | module PageRankr 4 | class Socials 5 | class Vk 6 | include Social 7 | 8 | def url 9 | 'http://vk.com/share.php' 10 | end 11 | 12 | def params 13 | {:url => tracked_url, :act => 'count'} 14 | end 15 | 16 | def regex 17 | /, (\d+)/ 18 | end 19 | 20 | def supported_components 21 | [:subdomain, :path, :scheme] 22 | end 23 | 24 | def name 25 | :socials_vk 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/page_rankr/tracker.rb: -------------------------------------------------------------------------------- 1 | require 'nokogiri' 2 | require 'json' 3 | require 'jsonpath' 4 | require 'uri' 5 | require File.expand_path('../site', __FILE__) 6 | require File.expand_path('../request', __FILE__) 7 | 8 | module PageRankr 9 | module Tracker 10 | attr_accessor :tracked 11 | attr_accessor :raw 12 | attr_accessor :body 13 | 14 | def initialize(site, options = {}) 15 | @site = PageRankr::Site(site) 16 | @options = options 17 | 18 | # Initialize proxy, so threads don't need to synchronize the proxy service. 19 | proxy 20 | end 21 | 22 | def url 23 | raise PageRankr::MethodRequired, "A url method defining the url to the service with the value you wish to extract must be defined." 24 | end 25 | 26 | def tracked_url 27 | @site.url(supported_components) 28 | end 29 | 30 | def supported_components 31 | [:subdomain] 32 | end 33 | 34 | def method 35 | :get 36 | end 37 | 38 | def proxy 39 | @proxy ||= URI.parse(PageRankr.proxy_service.proxy(name, @site)) if PageRankr.proxy_service 40 | end 41 | 42 | def run 43 | PageRankr::Request.new(self, @options).perform do |body| 44 | self.body = body 45 | self.raw = content(body) 46 | self.tracked = clean(raw) 47 | end 48 | 49 | tracked 50 | end 51 | 52 | def content(body) 53 | if respond_to? :xpath 54 | Nokogiri::HTML(body).at(xpath) 55 | elsif respond_to? :jsonpath 56 | JsonPath.new(jsonpath).first(JSON.parse(body)) 57 | elsif respond_to? :regex 58 | body =~ regex ? $1 : nil 59 | else 60 | raise PageRankr::MethodRequired, "A method for extracting the value must be defined. Either xpath, jsonpath, or regex." 61 | end.to_s 62 | end 63 | 64 | def clean(content) 65 | cleaned_content = content.to_s.gsub(/\D/, '') 66 | 67 | if cleaned_content.strip == '' 68 | nil 69 | else 70 | cleaned_content.to_i 71 | end 72 | end 73 | 74 | def name 75 | raise PageRankr::MethodRequired, "name is undefined for #{self.class.name}" 76 | end 77 | end 78 | end -------------------------------------------------------------------------------- /lib/page_rankr/trackers.rb: -------------------------------------------------------------------------------- 1 | require 'thread' 2 | 3 | module PageRankr 4 | module Trackers 5 | attr_accessor :site_trackers 6 | 7 | def initialize 8 | @site_trackers = self.class.constants.collect{|tracker| symbol_for(tracker)} 9 | end 10 | 11 | def lookup(site, *trackers) 12 | trackers = site_trackers if trackers.empty? 13 | 14 | tracked = trackers.map do |tracker| 15 | name, klass = constant_name(tracker), self.class 16 | 17 | next unless klass.const_defined? name 18 | 19 | [ 20 | tracker, 21 | build_thread(tracker, klass.const_get(name), site) 22 | ] 23 | end.each do |_, thread| 24 | thread.join 25 | end.map do |tracker, thread| 26 | [tracker, thread.value] 27 | end 28 | 29 | Hash[tracked] 30 | end 31 | 32 | private 33 | 34 | def build_thread(tracker, instance, site) 35 | Thread.new(tracker, instance, site) do |t, i, s| 36 | i.new(s).run 37 | end 38 | end 39 | 40 | def symbol_for(klass) 41 | word = klass.to_s.dup 42 | word.gsub!(/([A-Z]+)([A-Z][a-z])/){|match| "#{$1}_#{$2}" } 43 | word.gsub!(/([a-z\d])([A-Z])/){|match| "#{$1}_#{$2}" } 44 | word.tr!("-", "_") 45 | word.downcase! 46 | word.to_sym 47 | end 48 | 49 | def constant_name(sym) 50 | sym.to_s.split('_').collect{|str| str.capitalize}.join 51 | end 52 | end 53 | end -------------------------------------------------------------------------------- /lib/page_rankr/version.rb: -------------------------------------------------------------------------------- 1 | module PageRankr 2 | VERSION = "4.6.1" 3 | end 4 | -------------------------------------------------------------------------------- /out.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blatyo/page_rankr/9d7de0c7df9dd15a9650f177dfda5ac82744a2bb/out.html -------------------------------------------------------------------------------- /spec/backlinks/bing_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Backlinks::Bing do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | # currently matches suggested results 18 | it{is_expected.to be_number < 2} 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /spec/backlinks/google_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Backlinks::Google do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | it{is_expected.to be_nil} 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/backlinks/yahoo_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Backlinks::Yahoo do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | # currently matches suggested results 18 | it{is_expected.to be_number < 2} 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Ranks_AlexaCountry/_run/with_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://data.alexa.com/data?cli=10&dat=snbamz&url=www.google.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Content-Type: 19 | - text/xml 20 | Date: 21 | - Tue, 15 Sep 2015 00:15:13 GMT 22 | Server: 23 | - nginx 24 | Content-Length: 25 | - '983' 26 | Connection: 27 | - keep-alive 28 | body: 29 | encoding: UTF-8 30 | string: "\r\n\r\n\r\n\r\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<OWNER NAME=\"aa\"/>\n</SD>\n<SD>\n<POPULARITY 41 | URL=\"google.com/\" TEXT=\"1\" SOURCE=\"panel\"/>\n<REACH RANK=\"1\"/>\n<RANK 42 | DELTA=\"+0\"/>\n<COUNTRY CODE=\"US\" NAME=\"United States\" RANK=\"1\"/>\n</SD>\n</ALEXA>" 43 | http_version: 44 | recorded_at: Tue, 15 Sep 2015 00:15:13 GMT 45 | recorded_with: VCR 2.9.3 46 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Ranks_AlexaCountry/_run/with_no_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://data.alexa.com/data?cli=10&dat=snbamz&url=please-dont-register-a-site-that-breaks-this-test.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Content-Type: 19 | - text/xml 20 | Date: 21 | - Tue, 15 Sep 2015 00:15:13 GMT 22 | Server: 23 | - nginx 24 | Content-Length: 25 | - '422' 26 | Connection: 27 | - keep-alive 28 | body: 29 | encoding: UTF-8 30 | string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\r\n<!-- Need more Alexa 31 | data? Find our APIs here: https://aws.amazon.com/alexa/ -->\r\n<ALEXA VER=\"0.9\" 32 | URL=\"please-dont-register-a-site-that-breaks-this-test.com/\" HOME=\"0\" 33 | AID=\"=\" IDN=\"please-dont-register-a-site-that-breaks-this-test.com/\">\r\n<RLS 34 | PREFIX=\"http://\" more=\"0\">\n</RLS>\n<SD TITLE=\"A\" FLAGS=\"\" HOST=\"please-dont-register-a-site-that-breaks-this-test.com\">\n</SD>\n\n</ALEXA>" 35 | http_version: 36 | recorded_at: Tue, 15 Sep 2015 00:15:13 GMT 37 | recorded_with: VCR 2.9.3 38 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Ranks_AlexaGlobal/_run/with_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://data.alexa.com/data?cli=10&dat=snbamz&url=www.google.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Content-Type: 19 | - text/xml 20 | Date: 21 | - Tue, 15 Sep 2015 00:15:14 GMT 22 | Server: 23 | - nginx 24 | Content-Length: 25 | - '983' 26 | Connection: 27 | - keep-alive 28 | body: 29 | encoding: UTF-8 30 | string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\r\n<!-- Need more Alexa 31 | data? Find our APIs here: https://aws.amazon.com/alexa/ -->\r\n<ALEXA VER=\"0.9\" 32 | URL=\"google.com/\" HOME=\"0\" AID=\"=\" IDN=\"google.com/\">\r\n<RLS PREFIX=\"http://\" 33 | more=\"0\">\n<RL HREF=\"amazon.com/\" TITLE=\"Amazon.com\"/>\n<RL HREF=\"wikipedia.org/\" 34 | TITLE=\"Wikipedia\"/>\n<RL HREF=\"www.yahoo.com/\" TITLE=\"Yahoo!\"/>\n<RL 35 | HREF=\"youtube.com/\" TITLE=\"YouTube\"/>\n<RL HREF=\"yelp.com/\" TITLE=\"Yelp\"/>\n<RL 36 | HREF=\"statcounter.com/\" TITLE=\"StatCounter.com\"/>\n<RL HREF=\"myspace.com/\" 37 | TITLE=\"Myspace\"/>\n<RL HREF=\"linkedin.com/\" TITLE=\"LinkedIn\"/>\n<RL 38 | HREF=\"imdb.com/\" TITLE=\"The Internet Movie Database (imdb)\"/>\n<RL HREF=\"google.co.in/\" 39 | TITLE=\"Google India\"/>\n</RLS>\n<SD TITLE=\"A\" FLAGS=\"\" HOST=\"google.com\">\n<TITLE 40 | TEXT=\"Google \"/>\n<OWNER NAME=\"aa\"/>\n</SD>\n<SD>\n<POPULARITY 41 | URL=\"google.com/\" TEXT=\"1\" SOURCE=\"panel\"/>\n<REACH RANK=\"1\"/>\n<RANK 42 | DELTA=\"+0\"/>\n<COUNTRY CODE=\"US\" NAME=\"United States\" RANK=\"1\"/>\n</SD>\n</ALEXA>" 43 | http_version: 44 | recorded_at: Tue, 15 Sep 2015 00:15:15 GMT 45 | recorded_with: VCR 2.9.3 46 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Ranks_AlexaGlobal/_run/with_no_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://data.alexa.com/data?cli=10&dat=snbamz&url=please-dont-register-a-site-that-breaks-this-test.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Content-Type: 19 | - text/xml 20 | Date: 21 | - Tue, 15 Sep 2015 00:15:15 GMT 22 | Server: 23 | - nginx 24 | Content-Length: 25 | - '422' 26 | Connection: 27 | - keep-alive 28 | body: 29 | encoding: UTF-8 30 | string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\r\n<!-- Need more Alexa 31 | data? Find our APIs here: https://aws.amazon.com/alexa/ -->\r\n<ALEXA VER=\"0.9\" 32 | URL=\"please-dont-register-a-site-that-breaks-this-test.com/\" HOME=\"0\" 33 | AID=\"=\" IDN=\"please-dont-register-a-site-that-breaks-this-test.com/\">\r\n<RLS 34 | PREFIX=\"http://\" more=\"0\">\n</RLS>\n<SD TITLE=\"A\" FLAGS=\"\" HOST=\"please-dont-register-a-site-that-breaks-this-test.com\">\n</SD>\n\n</ALEXA>" 35 | http_version: 36 | recorded_at: Tue, 15 Sep 2015 00:15:15 GMT 37 | recorded_with: VCR 2.9.3 38 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Ranks_AlexaUs/_run/with_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://data.alexa.com/data?cli=10&dat=snbamz&url=www.google.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Content-Type: 19 | - text/xml 20 | Date: 21 | - Tue, 15 Sep 2015 00:15:15 GMT 22 | Server: 23 | - nginx 24 | Content-Length: 25 | - '983' 26 | Connection: 27 | - keep-alive 28 | body: 29 | encoding: UTF-8 30 | string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\r\n<!-- Need more Alexa 31 | data? Find our APIs here: https://aws.amazon.com/alexa/ -->\r\n<ALEXA VER=\"0.9\" 32 | URL=\"google.com/\" HOME=\"0\" AID=\"=\" IDN=\"google.com/\">\r\n<RLS PREFIX=\"http://\" 33 | more=\"0\">\n<RL HREF=\"amazon.com/\" TITLE=\"Amazon.com\"/>\n<RL HREF=\"wikipedia.org/\" 34 | TITLE=\"Wikipedia\"/>\n<RL HREF=\"www.yahoo.com/\" TITLE=\"Yahoo!\"/>\n<RL 35 | HREF=\"youtube.com/\" TITLE=\"YouTube\"/>\n<RL HREF=\"yelp.com/\" TITLE=\"Yelp\"/>\n<RL 36 | HREF=\"statcounter.com/\" TITLE=\"StatCounter.com\"/>\n<RL HREF=\"myspace.com/\" 37 | TITLE=\"Myspace\"/>\n<RL HREF=\"linkedin.com/\" TITLE=\"LinkedIn\"/>\n<RL 38 | HREF=\"imdb.com/\" TITLE=\"The Internet Movie Database (imdb)\"/>\n<RL HREF=\"google.co.in/\" 39 | TITLE=\"Google India\"/>\n</RLS>\n<SD TITLE=\"A\" FLAGS=\"\" HOST=\"google.com\">\n<TITLE 40 | TEXT=\"Google \"/>\n<OWNER NAME=\"aa\"/>\n</SD>\n<SD>\n<POPULARITY 41 | URL=\"google.com/\" TEXT=\"1\" SOURCE=\"panel\"/>\n<REACH RANK=\"1\"/>\n<RANK 42 | DELTA=\"+0\"/>\n<COUNTRY CODE=\"US\" NAME=\"United States\" RANK=\"1\"/>\n</SD>\n</ALEXA>" 43 | http_version: 44 | recorded_at: Tue, 15 Sep 2015 00:15:15 GMT 45 | recorded_with: VCR 2.9.3 46 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Ranks_AlexaUs/_run/with_no_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://data.alexa.com/data?cli=10&dat=snbamz&url=please-dont-register-a-site-that-breaks-this-test.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Content-Type: 19 | - text/xml 20 | Date: 21 | - Tue, 15 Sep 2015 00:15:15 GMT 22 | Server: 23 | - nginx 24 | Content-Length: 25 | - '422' 26 | Connection: 27 | - keep-alive 28 | body: 29 | encoding: UTF-8 30 | string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\r\n<!-- Need more Alexa 31 | data? Find our APIs here: https://aws.amazon.com/alexa/ -->\r\n<ALEXA VER=\"0.9\" 32 | URL=\"please-dont-register-a-site-that-breaks-this-test.com/\" HOME=\"0\" 33 | AID=\"=\" IDN=\"please-dont-register-a-site-that-breaks-this-test.com/\">\r\n<RLS 34 | PREFIX=\"http://\" more=\"0\">\n</RLS>\n<SD TITLE=\"A\" FLAGS=\"\" HOST=\"please-dont-register-a-site-that-breaks-this-test.com\">\n</SD>\n\n</ALEXA>" 35 | http_version: 36 | recorded_at: Tue, 15 Sep 2015 00:15:15 GMT 37 | recorded_with: VCR 2.9.3 38 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Ranks_DomainAuthority/_run/with_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://moz.com/researchtools/ose/api/urlmetrics?site=www.google.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Server: 19 | - openresty 20 | Date: 21 | - Mon, 14 Sep 2015 22:46:44 GMT 22 | Content-Type: 23 | - application/json; charset=utf-8 24 | Content-Length: 25 | - '388' 26 | Connection: 27 | - keep-alive 28 | Vary: 29 | - Accept-Encoding 30 | Cache-Control: 31 | - public, max-age=2592000 32 | Etag: 33 | - W/"184-70cce3fe" 34 | X-Response-Time: 35 | - 6.033ms 36 | Set-Cookie: 37 | - "___utmvaFIuocZF=pZi\x01owqr; path=/; Max-Age=900" 38 | - '___utmvbFIuocZF=OZb XgeOialS: Gtu; path=/; Max-Age=900' 39 | - ___utmvmFIuocZF=TXoKwTqtWRw; path=/; Max-Age=900 40 | - incap_ses_163_133232=4hUcGuFA1xKr4XA23RdDAlRO91UAAAAA0ZRJUCXlJX/7NMB47f2gag==; 41 | path=/; Domain=.moz.com 42 | - visid_incap_133232=VtUxXUItTBODKSDISQkgRFRO91UAAAAAQUIPAAAAAAD8I9a8Sh2mvcMV6EUFcScc; 43 | expires=Wed, 13 Sep 2017 08:26:24 GMT; path=/; Domain=.moz.com 44 | X-Iinfo: 45 | - 10-169986278-169986286 NNNN CT(45 47 0) RT(1442270804309 98) q(0 0 1 1) r(1 46 | 1) U5 47 | X-Cdn: 48 | - Incapsula 49 | body: 50 | encoding: UTF-8 51 | string: '{"meta":{"site":"http://www.google.com","requested_site":"http://www.google.com"},"data":{"spam_flags":[false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false],"spam_score":1,"authority":{"page_authority":97.4974451586309,"domain_authority":100},"page":{"just_discovered_links":146644,"linking_root_domains":915522,"inbound_links":75133768}}}' 52 | http_version: 53 | recorded_at: Mon, 14 Sep 2015 22:46:45 GMT 54 | recorded_with: VCR 2.9.3 55 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Ranks_DomainAuthority/_run/with_no_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://moz.com/researchtools/ose/api/urlmetrics?site=please-dont-register-a-site-that-breaks-this-test.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Server: 19 | - openresty 20 | Date: 21 | - Mon, 14 Sep 2015 22:46:45 GMT 22 | Content-Type: 23 | - application/json; charset=utf-8 24 | Content-Length: 25 | - '419' 26 | Connection: 27 | - keep-alive 28 | Vary: 29 | - Accept-Encoding 30 | Cache-Control: 31 | - public, max-age=2592000 32 | Etag: 33 | - W/"1a3-9dde57ca" 34 | X-Response-Time: 35 | - 319.883ms 36 | Set-Cookie: 37 | - "___utmvaFIuocZF=wsd\x01YNUr; path=/; Max-Age=900" 38 | - '___utmvbFIuocZF=gZc XNXOFalE: dtx; path=/; Max-Age=900' 39 | - ___utmvmFIuocZF=THamZBMugvr; path=/; Max-Age=900 40 | - incap_ses_163_133232=6eaOG/TqHgWr4XA23RdDAlVO91UAAAAA+qhScMrQqg3BqLlWHVjEkQ==; 41 | path=/; Domain=.moz.com 42 | - visid_incap_133232=VtUxXUItTBODKSDISQkgRFRO91UAAAAAQUIPAAAAAAD8I9a8Sh2mvcMV6EUFcScc; 43 | expires=Wed, 13 Sep 2017 08:26:24 GMT; path=/; Domain=.moz.com 44 | X-Iinfo: 45 | - 4-47997076-47997080 NNNN CT(46 48 0) RT(1442270804655 83) q(0 0 1 0) r(5 5) 46 | U5 47 | X-Cdn: 48 | - Incapsula 49 | body: 50 | encoding: UTF-8 51 | string: '{"meta":{"site":"http://please-dont-register-a-site-that-breaks-this-test.com","requested_site":"http://please-dont-register-a-site-that-breaks-this-test.com"},"data":{"spam_flags":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"spam_score":null,"authority":{"page_authority":1,"domain_authority":1},"page":{"just_discovered_links":0,"linking_root_domains":0,"inbound_links":0}}}' 52 | http_version: 53 | recorded_at: Mon, 14 Sep 2015 22:46:45 GMT 54 | recorded_with: VCR 2.9.3 55 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Ranks_Google/_run/with_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://toolbarqueries.google.com/tbr?ch=6340563836&client=navclient-auto&features=Rank&q=info:www.google.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Date: 19 | - Mon, 14 Sep 2015 22:48:49 GMT 20 | Pragma: 21 | - no-cache 22 | Expires: 23 | - Fri, 01 Jan 1990 00:00:00 GMT 24 | Cache-Control: 25 | - no-cache, must-revalidate 26 | Content-Type: 27 | - text/html; charset=ISO-8859-1 28 | P3p: 29 | - CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 30 | for more info." 31 | Server: 32 | - gws 33 | X-Xss-Protection: 34 | - 1; mode=block 35 | X-Frame-Options: 36 | - SAMEORIGIN 37 | Set-Cookie: 38 | - NID=71=kTGtQ1IqZuZWhoyxJOUkspDh_UBuf3k_wNZCNH48fhizm_Q5VqUlU559bfnbdahaKPOVhbil0dHT6ucsaLqCwLAphm0KFi5ujD4ZYu7s1vJ0K1bM4LF2Lqr2UROZ54q5; 39 | expires=Tue, 15-Mar-2016 22:48:49 GMT; path=/; domain=.google.com; HttpOnly 40 | - PREF=ID=1111111111111111:FF=0:TM=1442270929:LM=1442270929:V=1:S=cqgjcx1zCfeB7wRq; 41 | expires=Thu, 31-Dec-2015 16:02:17 GMT; path=/; domain=.google.com 42 | Accept-Ranges: 43 | - none 44 | Vary: 45 | - Accept-Encoding 46 | Transfer-Encoding: 47 | - chunked 48 | body: 49 | encoding: UTF-8 50 | string: | 51 | Rank_1:1:9 52 | http_version: 53 | recorded_at: Mon, 14 Sep 2015 22:48:49 GMT 54 | recorded_with: VCR 2.9.3 55 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Ranks_Google/_run/with_no_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://toolbarqueries.google.com/tbr?ch=63624986523&client=navclient-auto&features=Rank&q=info:please-dont-register-a-site-that-breaks-this-test.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Date: 19 | - Mon, 14 Sep 2015 22:48:49 GMT 20 | Pragma: 21 | - no-cache 22 | Expires: 23 | - Fri, 01 Jan 1990 00:00:00 GMT 24 | Cache-Control: 25 | - no-cache, must-revalidate 26 | Content-Type: 27 | - text/html; charset=ISO-8859-1 28 | P3p: 29 | - CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 30 | for more info." 31 | Server: 32 | - gws 33 | Content-Length: 34 | - '0' 35 | X-Xss-Protection: 36 | - 1; mode=block 37 | X-Frame-Options: 38 | - SAMEORIGIN 39 | Set-Cookie: 40 | - NID=71=G3F4fqx4te-5FRSqGqkW-BAM7X2grah41e6bAzWdKGSunS_j-TZ3yD2AZ7zymGaiTyVCIapK7-82fwwz2QxGe0PIIAv1ts95HWOcDC2I2HowKJz_uE5ZLLJJmWHU6JJh; 41 | expires=Tue, 15-Mar-2016 22:48:49 GMT; path=/; domain=.google.com; HttpOnly 42 | - PREF=ID=1111111111111111:FF=0:TM=1442270929:LM=1442270929:V=1:S=cqgjcx1zCfeB7wRq; 43 | expires=Thu, 31-Dec-2015 16:02:17 GMT; path=/; domain=.google.com 44 | body: 45 | encoding: UTF-8 46 | string: '' 47 | http_version: 48 | recorded_at: Mon, 14 Sep 2015 22:48:49 GMT 49 | recorded_with: VCR 2.9.3 50 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Ranks_MozRank/_run/with_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://bagics.com/moz-rank.html?domain=www.google.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Date: 19 | - Mon, 14 Sep 2015 22:49:44 GMT 20 | Content-Type: 21 | - text/html; charset=UTF-8 22 | Transfer-Encoding: 23 | - chunked 24 | Connection: 25 | - keep-alive 26 | Set-Cookie: 27 | - __cfduid=dbd3f1720b392f71e1d2339e8ddcf1ffc1442270975; expires=Tue, 13-Sep-16 28 | 22:49:35 GMT; path=/; domain=.bagics.com; HttpOnly 29 | X-Powered-By: 30 | - PHP/5.3.3 31 | Vary: 32 | - Accept-Encoding,User-Agent 33 | Cache-Control: 34 | - !binary |- 35 | 4oCccHVibGlj4oCd 36 | Server: 37 | - cloudflare-nginx 38 | Cf-Ray: 39 | - 225fa55bafa12501-ORD 40 | body: 41 | encoding: UTF-8 42 | string: "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html 43 | xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n<head>\n<title>Check 44 | MOZ Rank of Domain for FREE | Bagics.com | All In One SEO Companion\n\n\n\n\n\n
\n
\n
\n\n
\n

Check MOZ RANK of Domain.

\n

Here, You can quickly 71 | check the MOZ RANKof your favorite sites. Just put your domain name below 72 | and click CHECK button.

\n
\n
\nURL: \n\n
\n
\n8\n

Moz Rank

\nwww.google.com\n
\n
\n
\n
\n
\n

Copyright by Bagics

\n

©2012, 79 | All rights reserved.

\n
\n\n 89 | name=" 90 | http_version: 91 | recorded_at: Mon, 14 Sep 2015 22:49:44 GMT 92 | recorded_with: VCR 2.9.3 93 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Ranks_MozRank/_run/with_no_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://bagics.com/moz-rank.html?domain=please-dont-register-a-site-that-breaks-this-test.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Date: 19 | - Mon, 14 Sep 2015 22:49:54 GMT 20 | Content-Type: 21 | - text/html; charset=UTF-8 22 | Transfer-Encoding: 23 | - chunked 24 | Connection: 25 | - keep-alive 26 | Set-Cookie: 27 | - __cfduid=d71cc04e82e058d70cceca51b132c57e31442270984; expires=Tue, 13-Sep-16 28 | 22:49:44 GMT; path=/; domain=.bagics.com; HttpOnly 29 | X-Powered-By: 30 | - PHP/5.3.3 31 | Vary: 32 | - Accept-Encoding,User-Agent 33 | Cache-Control: 34 | - !binary |- 35 | 4oCccHVibGlj4oCd 36 | Server: 37 | - cloudflare-nginx 38 | Cf-Ray: 39 | - 225fa5971a002507-ORD 40 | body: 41 | encoding: UTF-8 42 | string: "\n\n\nCheck 44 | MOZ Rank of Domain for FREE | Bagics.com | All In One SEO Companion\n\n\n\n\n\n
\n
\n
\n\n
\n

Check MOZ RANK of Domain.

\n

Here, You can quickly 71 | check the MOZ RANKof your favorite sites. Just put your domain name below 72 | and click CHECK button.

\n
\n
\nURL: \n\n
\n
\n0\n

Moz Rank

\nplease-dont-register-a-site-that-breaks-this-test.com\n
\n
\n
\n
\n
\n

Copyright 79 | by Bagics

\n

©2012, All rights 80 | reserved.

\n
\n\n 90 | name=" 91 | http_version: 92 | recorded_at: Mon, 14 Sep 2015 22:49:54 GMT 93 | recorded_with: VCR 2.9.3 94 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Ranks_PageAuthority/_run/with_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://moz.com/researchtools/ose/api/urlmetrics?site=www.google.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Server: 19 | - openresty 20 | Date: 21 | - Mon, 14 Sep 2015 23:04:45 GMT 22 | Content-Type: 23 | - application/json; charset=utf-8 24 | Content-Length: 25 | - '388' 26 | Connection: 27 | - keep-alive 28 | Vary: 29 | - Accept-Encoding 30 | Cache-Control: 31 | - public, max-age=2592000 32 | Etag: 33 | - W/"184-70cce3fe" 34 | X-Response-Time: 35 | - 5.940ms 36 | Set-Cookie: 37 | - "___utmvaFIuocZF=AXa\x01Yews; path=/; Max-Age=900" 38 | - '___utmvbFIuocZF=iZt XGQOHalB: Qtw; path=/; Max-Age=900' 39 | - ___utmvmFIuocZF=eNKLQbaFuxT; path=/; Max-Age=900 40 | - incap_ses_163_133232=DWzmT9vozFr0t3c23RdDAoxS91UAAAAAQeS+2zFMf1AEYonETBKzjg==; 41 | path=/; Domain=.moz.com 42 | - visid_incap_133232=4+lMgAw0R+C+xS/iDjzH1YxS91UAAAAAQUIPAAAAAABGG4eDSiSch8Ik6yWjEaAg; 43 | expires=Wed, 13 Sep 2017 08:26:25 GMT; path=/; Domain=.moz.com 44 | X-Iinfo: 45 | - 7-97753726-97753802 NNNN CT(41 58 0) RT(1442271884141 464) q(0 0 1 1) r(1 46 | 1) U5 47 | X-Cdn: 48 | - Incapsula 49 | body: 50 | encoding: UTF-8 51 | string: '{"meta":{"site":"http://www.google.com","requested_site":"http://www.google.com"},"data":{"spam_flags":[false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false],"spam_score":1,"authority":{"page_authority":97.4974451586309,"domain_authority":100},"page":{"just_discovered_links":146644,"linking_root_domains":915522,"inbound_links":75133768}}}' 52 | http_version: 53 | recorded_at: Mon, 14 Sep 2015 23:04:45 GMT 54 | recorded_with: VCR 2.9.3 55 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Ranks_PageAuthority/_run/with_no_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://moz.com/researchtools/ose/api/urlmetrics?site=please-dont-register-a-site-that-breaks-this-test.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Server: 19 | - openresty 20 | Date: 21 | - Mon, 14 Sep 2015 23:04:46 GMT 22 | Content-Type: 23 | - application/json; charset=utf-8 24 | Content-Length: 25 | - '419' 26 | Connection: 27 | - keep-alive 28 | Vary: 29 | - Accept-Encoding 30 | Cache-Control: 31 | - public, max-age=2592000 32 | Etag: 33 | - W/"1a3-9dde57ca" 34 | X-Response-Time: 35 | - 5.589ms 36 | Set-Cookie: 37 | - "___utmvaFIuocZF=oig\x01cZwj; path=/; Max-Age=900" 38 | - '___utmvbFIuocZF=MZo XFoOtalp: ntG; path=/; Max-Age=900' 39 | - ___utmvmFIuocZF=HNTRujPiVzK; path=/; Max-Age=900 40 | - incap_ses_163_133232=3iaGR0tRmjb0t3c23RdDAo1S91UAAAAAX30DO07vh/Hvxin0R6hM3A==; 41 | path=/; Domain=.moz.com 42 | - visid_incap_133232=4+lMgAw0R+C+xS/iDjzH1YxS91UAAAAAQUIPAAAAAABGG4eDSiSch8Ik6yWjEaAg; 43 | expires=Wed, 13 Sep 2017 08:26:24 GMT; path=/; Domain=.moz.com 44 | X-Iinfo: 45 | - 6-71509493-71509550 NNNN CT(45 56 0) RT(1442271885237 489) q(0 0 1 0) r(1 46 | 1) U5 47 | X-Cdn: 48 | - Incapsula 49 | body: 50 | encoding: UTF-8 51 | string: '{"meta":{"site":"http://please-dont-register-a-site-that-breaks-this-test.com","requested_site":"http://please-dont-register-a-site-that-breaks-this-test.com"},"data":{"spam_flags":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"spam_score":null,"authority":{"page_authority":1,"domain_authority":1},"page":{"just_discovered_links":0,"linking_root_domains":0,"inbound_links":0}}}' 52 | http_version: 53 | recorded_at: Mon, 14 Sep 2015 23:04:46 GMT 54 | recorded_with: VCR 2.9.3 55 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Socials_Facebook/_run/with_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://graph.facebook.com/?id=http://www.google.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Access-Control-Allow-Origin: 19 | - "*" 20 | Content-Type: 21 | - text/javascript; charset=UTF-8 22 | X-Fb-Trace-Id: 23 | - BwcMxAxXvOM 24 | X-Fb-Rev: 25 | - '1935378' 26 | Etag: 27 | - '"9a569c8e2fa402c1aaf3842d190bd5cbdd91a2c4"' 28 | Pragma: 29 | - no-cache 30 | Cache-Control: 31 | - private, no-cache, no-store, must-revalidate 32 | Facebook-Api-Version: 33 | - v2.0 34 | Expires: 35 | - Sat, 01 Jan 2000 00:00:00 GMT 36 | X-Fb-Debug: 37 | - KPCbmUMgap1RPVCFiV1Hhxsrzd3S+KU2bv1HSa8+cry7/E89KfjBOLGAD0rD+KgmIJhNlsa3V5LBlY+D9IFQRQ== 38 | Date: 39 | - Mon, 14 Sep 2015 23:06:25 GMT 40 | Connection: 41 | - keep-alive 42 | Content-Length: 43 | - '80' 44 | body: 45 | encoding: UTF-8 46 | string: |- 47 | { 48 | "id": "http://www.google.com", 49 | "shares": 13236703, 50 | "comments": 1028 51 | } 52 | http_version: 53 | recorded_at: Mon, 14 Sep 2015 23:06:25 GMT 54 | recorded_with: VCR 2.9.3 55 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Socials_Facebook/_run/with_no_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://graph.facebook.com/?id=http://please-dont-register-a-site-that-breaks-this-test.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Access-Control-Allow-Origin: 19 | - "*" 20 | Content-Type: 21 | - text/javascript; charset=UTF-8 22 | X-Fb-Trace-Id: 23 | - BpeBrTl2KGx 24 | X-Fb-Rev: 25 | - '1935378' 26 | Etag: 27 | - '"084a2bbc7382540addc052eab83eb70ab32dd140"' 28 | Pragma: 29 | - no-cache 30 | Cache-Control: 31 | - private, no-cache, no-store, must-revalidate 32 | Facebook-Api-Version: 33 | - v2.0 34 | Expires: 35 | - Sat, 01 Jan 2000 00:00:00 GMT 36 | X-Fb-Debug: 37 | - xFW3ppjo0Z7nkLpAJnca8G1XRl8x7wxx1kns4aB+TO3YQXVHtW63dtq2Zk4tm5if+hcGNll6mMFNutFyqg1n9g== 38 | Date: 39 | - Mon, 14 Sep 2015 23:06:25 GMT 40 | Connection: 41 | - keep-alive 42 | Content-Length: 43 | - '75' 44 | body: 45 | encoding: UTF-8 46 | string: |- 47 | { 48 | "id": "http://please-dont-register-a-site-that-breaks-this-test.com" 49 | } 50 | http_version: 51 | recorded_at: Mon, 14 Sep 2015 23:06:25 GMT 52 | recorded_with: VCR 2.9.3 53 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Socials_Google/_run/with_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://share.yandex.ru/gpp.xml?url=http://www.google.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Server: 19 | - nginx/1.6.3 20 | Date: 21 | - Mon, 14 Sep 2015 23:07:02 GMT 22 | Content-Type: 23 | - text/javascript; charset=utf-8 24 | Transfer-Encoding: 25 | - chunked 26 | Connection: 27 | - keep-alive 28 | Cache-Control: 29 | - max-age=0, must-revalidate, proxy-revalidate, no-cache, no-store, private 30 | Expires: 31 | - Mon, 14 Sep 2015 23:07:02 GMT 32 | Pragma: 33 | - no-cache 34 | Set-Cookie: 35 | - yandexuid=3925476801442272022; domain=.yandex.ru; path=/; expires=Tue, 19 36 | Jan 2038 03:14:07 GMT 37 | body: 38 | encoding: UTF-8 39 | string: services.gplus.cb("10000"); 40 | http_version: 41 | recorded_at: Mon, 14 Sep 2015 23:07:02 GMT 42 | recorded_with: VCR 2.9.3 43 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Socials_Google/_run/with_no_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://share.yandex.ru/gpp.xml?url=http://please-dont-register-a-site-that-breaks-this-test.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Server: 19 | - nginx/1.6.3 20 | Date: 21 | - Mon, 14 Sep 2015 23:07:03 GMT 22 | Content-Type: 23 | - text/javascript; charset=utf-8 24 | Transfer-Encoding: 25 | - chunked 26 | Connection: 27 | - keep-alive 28 | Cache-Control: 29 | - max-age=0, must-revalidate, proxy-revalidate, no-cache, no-store, private 30 | Expires: 31 | - Mon, 14 Sep 2015 23:07:03 GMT 32 | Pragma: 33 | - no-cache 34 | Set-Cookie: 35 | - yandexuid=3954987571442272023; domain=.yandex.ru; path=/; expires=Tue, 19 36 | Jan 2038 03:14:07 GMT 37 | body: 38 | encoding: UTF-8 39 | string: services.gplus.cb("0"); 40 | http_version: 41 | recorded_at: Mon, 14 Sep 2015 23:07:03 GMT 42 | recorded_with: VCR 2.9.3 43 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Socials_LinkedIn/_run/with_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://www.linkedin.com/countserv/count/share?callback=_&format=json&url=www.google.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Server: 19 | - Apache-Coyote/1.1 20 | Content-Type: 21 | - application/json;charset=UTF-8 22 | Content-Length: 23 | - '74' 24 | Vary: 25 | - Accept-Encoding 26 | Date: 27 | - Mon, 14 Sep 2015 23:08:33 GMT 28 | X-Frame-Options: 29 | - sameorigin 30 | X-Content-Type-Options: 31 | - nosniff 32 | X-Xss-Protection: 33 | - 1; mode=block 34 | X-Li-Fabric: 35 | - prod-lva1 36 | Strict-Transport-Security: 37 | - max-age=0 38 | Pragma: 39 | - no-cache 40 | Expires: 41 | - Thu, 01 Jan 1970 00:00:00 GMT 42 | Cache-Control: 43 | - no-cache, no-store 44 | Connection: 45 | - keep-alive 46 | X-Li-Pop: 47 | - prod-lva1 48 | X-Li-Uuid: 49 | - LBOChNj6AxRA+7a4ySoAAA== 50 | Set-Cookie: 51 | - lidc="b=VB84:g=218:u=1:i=1442272113:t=1442358513:s=AQESPqpfsNryFNRa9R-iifvEPrvUs8NQ"; 52 | Expires=Tue, 15 Sep 2015 23:08:33 GMT; domain=.linkedin.com; Path=/ 53 | body: 54 | encoding: UTF-8 55 | string: '{"count":2712,"fCnt":"2,712","fCntPlusOne":"2,713","url":"www.google.com"}' 56 | http_version: 57 | recorded_at: Mon, 14 Sep 2015 23:08:33 GMT 58 | recorded_with: VCR 2.9.3 59 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Socials_LinkedIn/_run/with_no_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://www.linkedin.com/countserv/count/share?callback=_&format=json&url=please-dont-register-a-site-that-breaks-this-test.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Server: 19 | - Apache-Coyote/1.1 20 | Content-Type: 21 | - application/json;charset=UTF-8 22 | Content-Length: 23 | - '102' 24 | Vary: 25 | - Accept-Encoding 26 | Date: 27 | - Mon, 14 Sep 2015 23:08:34 GMT 28 | X-Frame-Options: 29 | - sameorigin 30 | X-Content-Type-Options: 31 | - nosniff 32 | X-Xss-Protection: 33 | - 1; mode=block 34 | X-Li-Fabric: 35 | - prod-lva1 36 | Strict-Transport-Security: 37 | - max-age=0 38 | Pragma: 39 | - no-cache 40 | Expires: 41 | - Thu, 01 Jan 1970 00:00:00 GMT 42 | Cache-Control: 43 | - no-cache, no-store 44 | Connection: 45 | - keep-alive 46 | X-Li-Pop: 47 | - prod-lva1 48 | X-Li-Uuid: 49 | - F5yZy9j6AxQQBm+FyioAAA== 50 | Set-Cookie: 51 | - lidc="b=VB84:g=218:u=1:i=1442272114:t=1442358514:s=AQFgFZf5aG4P_k6gTEFFZqhdq7qWwU1-"; 52 | Expires=Tue, 15 Sep 2015 23:08:34 GMT; domain=.linkedin.com; Path=/ 53 | body: 54 | encoding: UTF-8 55 | string: '{"count":0,"fCnt":"0","fCntPlusOne":"1","url":"please-dont-register-a-site-that-breaks-this-test.com"}' 56 | http_version: 57 | recorded_at: Mon, 14 Sep 2015 23:08:35 GMT 58 | recorded_with: VCR 2.9.3 59 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Socials_Pinterest/_run/with_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.pinterest.com/v1/urls/count.json?callback=_&url=http://www.google.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Accept-Ranges: 19 | - bytes 20 | Age: 21 | - '0' 22 | Cache-Control: 23 | - private 24 | Content-Type: 25 | - application/javascript 26 | Date: 27 | - Mon, 14 Sep 2015 23:09:12 GMT 28 | Expires: 29 | - Mon, 14 Sep 2015 23:24:12 GMT 30 | Via: 31 | - 1.1 varnish 32 | X-Pinterest-Rid: 33 | - '477570246177' 34 | X-Varnish: 35 | - '509056434' 36 | Content-Length: 37 | - '48' 38 | Connection: 39 | - keep-alive 40 | body: 41 | encoding: UTF-8 42 | string: _({"url":"http://www.google.com","count":75108}) 43 | http_version: 44 | recorded_at: Mon, 14 Sep 2015 23:09:12 GMT 45 | recorded_with: VCR 2.9.3 46 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Socials_Pinterest/_run/with_no_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.pinterest.com/v1/urls/count.json?callback=_&url=http://please-dont-register-a-site-that-breaks-this-test.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Accept-Ranges: 19 | - bytes 20 | Age: 21 | - '0' 22 | Cache-Control: 23 | - private 24 | Content-Type: 25 | - application/javascript 26 | Date: 27 | - Mon, 14 Sep 2015 23:09:12 GMT 28 | Expires: 29 | - Mon, 14 Sep 2015 23:24:12 GMT 30 | Via: 31 | - 1.1 varnish 32 | X-Pinterest-Rid: 33 | - '768050792038' 34 | X-Varnish: 35 | - '202220381' 36 | Content-Length: 37 | - '83' 38 | Connection: 39 | - keep-alive 40 | body: 41 | encoding: UTF-8 42 | string: _({"url":"http://please-dont-register-a-site-that-breaks-this-test.com","count":0}) 43 | http_version: 44 | recorded_at: Mon, 14 Sep 2015 23:09:12 GMT 45 | recorded_with: VCR 2.9.3 46 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Socials_StumbleUpon/_run/with_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://www.stumbleupon.com/services/1.01/badge.getinfo?url=www.google.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Server: 19 | - Apache 20 | P3p: 21 | - policyref="/w3c/p3p.xml", CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT 22 | DEM STA PRE COM NAV OTC NOI DSP COR" 23 | Vary: 24 | - Accept-Encoding 25 | Content-Type: 26 | - text/plain; charset=iso-8859-1 27 | Content-Length: 28 | - '521' 29 | Accept-Ranges: 30 | - bytes 31 | Date: 32 | - Mon, 14 Sep 2015 23:09:50 GMT 33 | Age: 34 | - '0' 35 | Connection: 36 | - keep-alive 37 | body: 38 | encoding: UTF-8 39 | string: '{"result":{"url":"http:\/\/www.google.com\/","in_index":true,"publicid":"2pI1xR","views":255199,"title":"Google","thumbnail":"http:\/\/cdn.stumble-upon.com\/mthumb\/31\/10031.jpg","thumbnail_b":"http:\/\/cdn.stumble-upon.com\/bthumb\/31\/10031.jpg","submit_link":"http:\/\/www.stumbleupon.com\/badge\/?url=http:\/\/www.google.com\/","badge_link":"http:\/\/www.stumbleupon.com\/badge\/?url=http:\/\/www.google.com\/","info_link":"http:\/\/www.stumbleupon.com\/url\/www.google.com\/"},"timestamp":1442272190,"success":true}' 40 | http_version: 41 | recorded_at: Mon, 14 Sep 2015 23:09:51 GMT 42 | recorded_with: VCR 2.9.3 43 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Socials_StumbleUpon/_run/with_no_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://www.stumbleupon.com/services/1.01/badge.getinfo?url=please-dont-register-a-site-that-breaks-this-test.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Server: 19 | - Apache 20 | P3p: 21 | - policyref="/w3c/p3p.xml", CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT 22 | DEM STA PRE COM NAV OTC NOI DSP COR" 23 | Vary: 24 | - Accept-Encoding 25 | Content-Type: 26 | - text/plain; charset=iso-8859-1 27 | Content-Length: 28 | - '140' 29 | Accept-Ranges: 30 | - bytes 31 | Date: 32 | - Mon, 14 Sep 2015 23:09:51 GMT 33 | Age: 34 | - '0' 35 | Connection: 36 | - keep-alive 37 | body: 38 | encoding: UTF-8 39 | string: '{"result":{"url":"http:\/\/please-dont-register-a-site-that-breaks-this-test.com\/","in_index":false},"timestamp":1442272191,"success":true}' 40 | http_version: 41 | recorded_at: Mon, 14 Sep 2015 23:09:51 GMT 42 | recorded_with: VCR 2.9.3 43 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Socials_Twitter/_run/with_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://urls.api.twitter.com/1/urls/count.json?url=www.google.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Cache-Control: 19 | - must-revalidate, max-age=900 20 | Content-Type: 21 | - application/json;charset=utf-8 22 | Expires: 23 | - Mon, 14 Sep 2015 23:25:19 GMT 24 | Last-Modified: 25 | - Mon, 14 Sep 2015 23:10:19 GMT 26 | Server: 27 | - tsa_b 28 | X-Connection-Hash: 29 | - 67137b015d08ab5c644ba9f20d2495c6 30 | X-Response-Time: 31 | - '4' 32 | Content-Length: 33 | - '52' 34 | Accept-Ranges: 35 | - bytes 36 | Date: 37 | - Mon, 14 Sep 2015 23:10:19 GMT 38 | Via: 39 | - 1.1 varnish 40 | Age: 41 | - '0' 42 | Connection: 43 | - keep-alive 44 | X-Served-By: 45 | - cache-tw-nyc1-cr1-9-TWNYC1 46 | X-Cache: 47 | - MISS 48 | X-Cache-Hits: 49 | - '0' 50 | Vary: 51 | - Accept-Encoding 52 | body: 53 | encoding: UTF-8 54 | string: '{"count":24663560,"url":"http:\/\/www.google.com\/"}' 55 | http_version: 56 | recorded_at: Mon, 14 Sep 2015 23:10:19 GMT 57 | recorded_with: VCR 2.9.3 58 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Socials_Twitter/_run/with_no_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://urls.api.twitter.com/1/urls/count.json?url=please-dont-register-a-site-that-breaks-this-test.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Cache-Control: 19 | - must-revalidate, max-age=900 20 | Content-Type: 21 | - application/json;charset=utf-8 22 | Expires: 23 | - Mon, 14 Sep 2015 23:25:19 GMT 24 | Last-Modified: 25 | - Mon, 14 Sep 2015 23:10:19 GMT 26 | Server: 27 | - tsa_b 28 | X-Connection-Hash: 29 | - 293701b2f24705addfec3f27ea2c84fe 30 | X-Response-Time: 31 | - '5' 32 | Content-Length: 33 | - '84' 34 | Accept-Ranges: 35 | - bytes 36 | Date: 37 | - Mon, 14 Sep 2015 23:10:19 GMT 38 | Via: 39 | - 1.1 varnish 40 | Age: 41 | - '0' 42 | Connection: 43 | - keep-alive 44 | X-Served-By: 45 | - cache-tw-nyc1-cr1-7-TWNYC1 46 | X-Cache: 47 | - MISS 48 | X-Cache-Hits: 49 | - '0' 50 | Vary: 51 | - Accept-Encoding 52 | body: 53 | encoding: UTF-8 54 | string: '{"count":0,"url":"http:\/\/please-dont-register-a-site-that-breaks-this-test.com\/"}' 55 | http_version: 56 | recorded_at: Mon, 14 Sep 2015 23:10:19 GMT 57 | recorded_with: VCR 2.9.3 58 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Socials_Vk/_run/with_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://vk.com/share.php?act=count&url=http://www.google.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Server: 19 | - Apache 20 | Date: 21 | - Mon, 14 Sep 2015 23:10:52 GMT 22 | Content-Type: 23 | - text/html; charset=windows-1251 24 | Content-Length: 25 | - '24' 26 | Connection: 27 | - keep-alive 28 | X-Powered-By: 29 | - PHP/3.17084 30 | Set-Cookie: 31 | - remixlang=3; expires=Sat, 10 Sep 2016 19:27:26 GMT; path=/; domain=.vk.com 32 | Pragma: 33 | - no-cache 34 | Cache-Control: 35 | - no-store 36 | body: 37 | encoding: UTF-8 38 | string: VK.Share.count(0, 4352); 39 | http_version: 40 | recorded_at: Mon, 14 Sep 2015 23:10:52 GMT 41 | recorded_with: VCR 2.9.3 42 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/PageRankr_Socials_Vk/_run/with_no_match/.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://vk.com/share.php?act=count&url=http://please-dont-register-a-site-that-breaks-this-test.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Server: 19 | - Apache 20 | Date: 21 | - Mon, 14 Sep 2015 23:10:52 GMT 22 | Content-Type: 23 | - text/html; charset=windows-1251 24 | Content-Length: 25 | - '21' 26 | Connection: 27 | - keep-alive 28 | X-Powered-By: 29 | - PHP/3.17084 30 | Set-Cookie: 31 | - remixlang=3; expires=Mon, 05 Sep 2016 03:14:50 GMT; path=/; domain=.vk.com 32 | Pragma: 33 | - no-cache 34 | Cache-Control: 35 | - no-store 36 | body: 37 | encoding: UTF-8 38 | string: VK.Share.count(0, 0); 39 | http_version: 40 | recorded_at: Mon, 14 Sep 2015 23:10:52 GMT 41 | recorded_with: VCR 2.9.3 42 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/alexa_ranks_edge_case_1.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://data.alexa.com/data?cli=10&dat=snbamz&url=slocourts.net 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Content-Type: 19 | - text/xml 20 | Date: 21 | - Mon, 14 Sep 2015 23:36:46 GMT 22 | Server: 23 | - nginx 24 | Content-Length: 25 | - '1304' 26 | Connection: 27 | - keep-alive 28 | body: 29 | encoding: UTF-8 30 | string: "\r\n\r\n\r\n\r\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n</SD>\n<SD>\n<POPULARITY URL=\"slocourts.net/\" 45 | TEXT=\"832124\" SOURCE=\"panel\"/>\n<REACH RANK=\"911408\"/>\n<RANK DELTA=\"+33334\"/>\n<COUNTRY 46 | CODE=\"US\" NAME=\"United States\" RANK=\"127410\"/>\n</SD>\n</ALEXA>" 47 | http_version: 48 | recorded_at: Mon, 14 Sep 2015 23:36:46 GMT 49 | - request: 50 | method: get 51 | uri: http://data.alexa.com/data?cli=10&dat=snbamz&url=slocourts.net 52 | body: 53 | encoding: US-ASCII 54 | string: '' 55 | headers: 56 | User-Agent: 57 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 58 | like Gecko) Version/5.1.6 Safari/534.56.5 59 | response: 60 | status: 61 | code: 200 62 | message: OK 63 | headers: 64 | Content-Type: 65 | - text/xml 66 | Date: 67 | - Mon, 14 Sep 2015 23:36:46 GMT 68 | Server: 69 | - nginx 70 | Content-Length: 71 | - '1304' 72 | Connection: 73 | - keep-alive 74 | body: 75 | encoding: UTF-8 76 | string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\r\n<!-- Need more Alexa 77 | data? Find our APIs here: https://aws.amazon.com/alexa/ -->\r\n<ALEXA VER=\"0.9\" 78 | URL=\"slocourts.net/\" HOME=\"0\" AID=\"=\" IDN=\"slocourts.net/\">\r\n<RLS 79 | PREFIX=\"http://\" more=\"0\">\n<RL HREF=\"courts.countyofventura.org/\" TITLE=\"Superior 80 | Court, Ventura\"/>\n<RL HREF=\"www.co.san-bernardino.ca.us/Courts\" TITLE=\"Superior 81 | Court, San Bernardino\"/>\n<RL HREF=\"www.co.riverside.ca.us/depts/courts\" 82 | TITLE=\"Superior Court Of California County Of Riverside\"/>\n<RL HREF=\"www.ci.sf.ca.us/courts\" 83 | TITLE=\"Superior Court, San Francisco\"/>\n<RL HREF=\"www.sbcourts.org/\" 84 | TITLE=\"Superior Court, Santa Barbara\"/>\n<RL HREF=\"www.stocktoncourt.org/courts\" 85 | TITLE=\"Superior Court, San Joaquin County\"/>\n<RL HREF=\"www.sonomasuperiorcourt.com/\" 86 | TITLE=\"Superior Court, Sonoma\"/>\n<RL HREF=\"www.solanocourts.com/\" TITLE=\"Superior 87 | Court, Solano\"/>\n<RL HREF=\"www.sccsuperiorcourt.org/\" TITLE=\"Superior 88 | Court, Santa Clara\"/>\n<RL HREF=\"www.sanmateocourt.org/\" TITLE=\"Superior 89 | Court, San Mateo\"/>\n</RLS>\n<SD TITLE=\"A\" FLAGS=\"\" HOST=\"slocourts.net\">\n<TITLE 90 | TEXT=\"Superior Court, San Luis Obispo\"/>\n</SD>\n<SD>\n<POPULARITY URL=\"slocourts.net/\" 91 | TEXT=\"832124\" SOURCE=\"panel\"/>\n<REACH RANK=\"911408\"/>\n<RANK DELTA=\"+33334\"/>\n<COUNTRY 92 | CODE=\"US\" NAME=\"United States\" RANK=\"127410\"/>\n</SD>\n</ALEXA>" 93 | http_version: 94 | recorded_at: Mon, 14 Sep 2015 23:36:46 GMT 95 | - request: 96 | method: get 97 | uri: http://data.alexa.com/data?cli=10&dat=snbamz&url=slocourts.net 98 | body: 99 | encoding: US-ASCII 100 | string: '' 101 | headers: 102 | User-Agent: 103 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 104 | like Gecko) Version/5.1.6 Safari/534.56.5 105 | response: 106 | status: 107 | code: 200 108 | message: OK 109 | headers: 110 | Content-Type: 111 | - text/xml 112 | Date: 113 | - Mon, 14 Sep 2015 23:36:46 GMT 114 | Server: 115 | - nginx 116 | Content-Length: 117 | - '1304' 118 | Connection: 119 | - keep-alive 120 | body: 121 | encoding: UTF-8 122 | string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\r\n<!-- Need more Alexa 123 | data? Find our APIs here: https://aws.amazon.com/alexa/ -->\r\n<ALEXA VER=\"0.9\" 124 | URL=\"slocourts.net/\" HOME=\"0\" AID=\"=\" IDN=\"slocourts.net/\">\r\n<RLS 125 | PREFIX=\"http://\" more=\"0\">\n<RL HREF=\"courts.countyofventura.org/\" TITLE=\"Superior 126 | Court, Ventura\"/>\n<RL HREF=\"www.co.san-bernardino.ca.us/Courts\" TITLE=\"Superior 127 | Court, San Bernardino\"/>\n<RL HREF=\"www.co.riverside.ca.us/depts/courts\" 128 | TITLE=\"Superior Court Of California County Of Riverside\"/>\n<RL HREF=\"www.ci.sf.ca.us/courts\" 129 | TITLE=\"Superior Court, San Francisco\"/>\n<RL HREF=\"www.sbcourts.org/\" 130 | TITLE=\"Superior Court, Santa Barbara\"/>\n<RL HREF=\"www.stocktoncourt.org/courts\" 131 | TITLE=\"Superior Court, San Joaquin County\"/>\n<RL HREF=\"www.sonomasuperiorcourt.com/\" 132 | TITLE=\"Superior Court, Sonoma\"/>\n<RL HREF=\"www.solanocourts.com/\" TITLE=\"Superior 133 | Court, Solano\"/>\n<RL HREF=\"www.sccsuperiorcourt.org/\" TITLE=\"Superior 134 | Court, Santa Clara\"/>\n<RL HREF=\"www.sanmateocourt.org/\" TITLE=\"Superior 135 | Court, San Mateo\"/>\n</RLS>\n<SD TITLE=\"A\" FLAGS=\"\" HOST=\"slocourts.net\">\n<TITLE 136 | TEXT=\"Superior Court, San Luis Obispo\"/>\n</SD>\n<SD>\n<POPULARITY URL=\"slocourts.net/\" 137 | TEXT=\"832124\" SOURCE=\"panel\"/>\n<REACH RANK=\"911408\"/>\n<RANK DELTA=\"+33334\"/>\n<COUNTRY 138 | CODE=\"US\" NAME=\"United States\" RANK=\"127410\"/>\n</SD>\n</ALEXA>" 139 | http_version: 140 | recorded_at: Mon, 14 Sep 2015 23:36:46 GMT 141 | recorded_with: VCR 2.9.3 142 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/failure_socials.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://graph.facebook.com/?id=http://please-dont-register-a-site-that-breaks-this-test.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Access-Control-Allow-Origin: 19 | - "*" 20 | Content-Type: 21 | - text/javascript; charset=UTF-8 22 | X-Fb-Trace-Id: 23 | - EdiCPc6YuAB 24 | X-Fb-Rev: 25 | - '1935378' 26 | Etag: 27 | - '"084a2bbc7382540addc052eab83eb70ab32dd140"' 28 | Pragma: 29 | - no-cache 30 | Cache-Control: 31 | - private, no-cache, no-store, must-revalidate 32 | Facebook-Api-Version: 33 | - v2.0 34 | Expires: 35 | - Sat, 01 Jan 2000 00:00:00 GMT 36 | X-Fb-Debug: 37 | - byHwyz7ArXEk1QvcdmvPCHwFHobCOzKI4i+ZyfQlQtNN5gqCcraLp0re+43tRwDqdPgOigyiZAjqFXKjrPg3Vw== 38 | Date: 39 | - Mon, 14 Sep 2015 23:36:49 GMT 40 | Connection: 41 | - keep-alive 42 | Content-Length: 43 | - '75' 44 | body: 45 | encoding: UTF-8 46 | string: |- 47 | { 48 | "id": "http://please-dont-register-a-site-that-breaks-this-test.com" 49 | } 50 | http_version: 51 | recorded_at: Mon, 14 Sep 2015 23:36:49 GMT 52 | - request: 53 | method: get 54 | uri: http://api.pinterest.com/v1/urls/count.json?callback=_&url=http://please-dont-register-a-site-that-breaks-this-test.com 55 | body: 56 | encoding: US-ASCII 57 | string: '' 58 | headers: 59 | User-Agent: 60 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 61 | like Gecko) Version/5.1.6 Safari/534.56.5 62 | response: 63 | status: 64 | code: 200 65 | message: OK 66 | headers: 67 | Accept-Ranges: 68 | - bytes 69 | Age: 70 | - '0' 71 | Cache-Control: 72 | - private 73 | Content-Type: 74 | - application/javascript 75 | Date: 76 | - Mon, 14 Sep 2015 23:36:49 GMT 77 | Expires: 78 | - Mon, 14 Sep 2015 23:51:49 GMT 79 | Via: 80 | - 1.1 varnish 81 | X-Pinterest-Rid: 82 | - '187793171777' 83 | X-Varnish: 84 | - '3024339373' 85 | Content-Length: 86 | - '83' 87 | Connection: 88 | - keep-alive 89 | body: 90 | encoding: UTF-8 91 | string: _({"url":"http://please-dont-register-a-site-that-breaks-this-test.com","count":0}) 92 | http_version: 93 | recorded_at: Mon, 14 Sep 2015 23:36:49 GMT 94 | - request: 95 | method: get 96 | uri: http://urls.api.twitter.com/1/urls/count.json?url=please-dont-register-a-site-that-breaks-this-test.com 97 | body: 98 | encoding: US-ASCII 99 | string: '' 100 | headers: 101 | User-Agent: 102 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 103 | like Gecko) Version/5.1.6 Safari/534.56.5 104 | response: 105 | status: 106 | code: 200 107 | message: OK 108 | headers: 109 | Cache-Control: 110 | - must-revalidate, max-age=900 111 | Content-Type: 112 | - application/json;charset=utf-8 113 | Expires: 114 | - Mon, 14 Sep 2015 23:46:34 GMT 115 | Last-Modified: 116 | - Mon, 14 Sep 2015 23:31:34 GMT 117 | Server: 118 | - tsa_b 119 | X-Connection-Hash: 120 | - 45ea144fb7182674ecd14c24e3c4fc9e 121 | X-Response-Time: 122 | - '15' 123 | Content-Length: 124 | - '84' 125 | Accept-Ranges: 126 | - bytes 127 | Date: 128 | - Mon, 14 Sep 2015 23:36:49 GMT 129 | Via: 130 | - 1.1 varnish 131 | Age: 132 | - '315' 133 | Connection: 134 | - keep-alive 135 | X-Served-By: 136 | - cache-tw-nyc1-cr1-7-TWNYC1 137 | X-Cache: 138 | - HIT 139 | X-Cache-Hits: 140 | - '1' 141 | Vary: 142 | - Accept-Encoding 143 | body: 144 | encoding: UTF-8 145 | string: '{"count":0,"url":"http:\/\/please-dont-register-a-site-that-breaks-this-test.com\/"}' 146 | http_version: 147 | recorded_at: Mon, 14 Sep 2015 23:36:49 GMT 148 | - request: 149 | method: get 150 | uri: http://www.stumbleupon.com/services/1.01/badge.getinfo?url=please-dont-register-a-site-that-breaks-this-test.com 151 | body: 152 | encoding: US-ASCII 153 | string: '' 154 | headers: 155 | User-Agent: 156 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 157 | like Gecko) Version/5.1.6 Safari/534.56.5 158 | response: 159 | status: 160 | code: 200 161 | message: OK 162 | headers: 163 | Server: 164 | - Apache 165 | P3p: 166 | - policyref="/w3c/p3p.xml", CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT 167 | DEM STA PRE COM NAV OTC NOI DSP COR" 168 | Vary: 169 | - Accept-Encoding 170 | Content-Type: 171 | - text/plain; charset=iso-8859-1 172 | Content-Length: 173 | - '140' 174 | Accept-Ranges: 175 | - bytes 176 | Date: 177 | - Mon, 14 Sep 2015 23:36:49 GMT 178 | Age: 179 | - '0' 180 | Connection: 181 | - keep-alive 182 | body: 183 | encoding: UTF-8 184 | string: '{"result":{"url":"http:\/\/please-dont-register-a-site-that-breaks-this-test.com\/","in_index":false},"timestamp":1442273809,"success":true}' 185 | http_version: 186 | recorded_at: Mon, 14 Sep 2015 23:36:49 GMT 187 | - request: 188 | method: get 189 | uri: http://vk.com/share.php?act=count&url=http://please-dont-register-a-site-that-breaks-this-test.com 190 | body: 191 | encoding: US-ASCII 192 | string: '' 193 | headers: 194 | User-Agent: 195 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 196 | like Gecko) Version/5.1.6 Safari/534.56.5 197 | response: 198 | status: 199 | code: 200 200 | message: OK 201 | headers: 202 | Server: 203 | - Apache 204 | Date: 205 | - Mon, 14 Sep 2015 23:36:49 GMT 206 | Content-Type: 207 | - text/html; charset=windows-1251 208 | Content-Length: 209 | - '21' 210 | Connection: 211 | - keep-alive 212 | X-Powered-By: 213 | - PHP/3.17085 214 | Set-Cookie: 215 | - remixlang=3; expires=Sat, 24 Sep 2016 03:53:05 GMT; path=/; domain=.vk.com 216 | Pragma: 217 | - no-cache 218 | Cache-Control: 219 | - no-store 220 | body: 221 | encoding: UTF-8 222 | string: VK.Share.count(0, 0); 223 | http_version: 224 | recorded_at: Mon, 14 Sep 2015 23:36:49 GMT 225 | - request: 226 | method: get 227 | uri: http://share.yandex.ru/gpp.xml?url=http://please-dont-register-a-site-that-breaks-this-test.com 228 | body: 229 | encoding: US-ASCII 230 | string: '' 231 | headers: 232 | User-Agent: 233 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 234 | like Gecko) Version/5.1.6 Safari/534.56.5 235 | response: 236 | status: 237 | code: 200 238 | message: OK 239 | headers: 240 | Server: 241 | - nginx/1.6.3 242 | Date: 243 | - Mon, 14 Sep 2015 23:36:49 GMT 244 | Content-Type: 245 | - text/javascript; charset=utf-8 246 | Transfer-Encoding: 247 | - chunked 248 | Connection: 249 | - keep-alive 250 | Cache-Control: 251 | - max-age=0, must-revalidate, proxy-revalidate, no-cache, no-store, private 252 | Expires: 253 | - Mon, 14 Sep 2015 23:36:49 GMT 254 | Pragma: 255 | - no-cache 256 | Set-Cookie: 257 | - yandexuid=2341241031442273809; domain=.yandex.ru; path=/; expires=Tue, 19 258 | Jan 2038 03:14:07 GMT 259 | body: 260 | encoding: UTF-8 261 | string: services.gplus.cb("0"); 262 | http_version: 263 | recorded_at: Mon, 14 Sep 2015 23:36:50 GMT 264 | - request: 265 | method: get 266 | uri: https://www.linkedin.com/countserv/count/share?callback=_&format=json&url=please-dont-register-a-site-that-breaks-this-test.com 267 | body: 268 | encoding: US-ASCII 269 | string: '' 270 | headers: 271 | User-Agent: 272 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 273 | like Gecko) Version/5.1.6 Safari/534.56.5 274 | response: 275 | status: 276 | code: 200 277 | message: OK 278 | headers: 279 | Server: 280 | - Apache-Coyote/1.1 281 | Content-Type: 282 | - application/json;charset=UTF-8 283 | Content-Length: 284 | - '102' 285 | Vary: 286 | - Accept-Encoding 287 | Date: 288 | - Mon, 14 Sep 2015 23:36:49 GMT 289 | X-Frame-Options: 290 | - sameorigin 291 | X-Content-Type-Options: 292 | - nosniff 293 | X-Xss-Protection: 294 | - 1; mode=block 295 | X-Li-Fabric: 296 | - prod-lva1 297 | Strict-Transport-Security: 298 | - max-age=0 299 | Pragma: 300 | - no-cache 301 | Expires: 302 | - Thu, 01 Jan 1970 00:00:00 GMT 303 | Cache-Control: 304 | - no-cache, no-store 305 | Connection: 306 | - keep-alive 307 | X-Li-Pop: 308 | - prod-lva1 309 | X-Li-Uuid: 310 | - WnZPhWP8AxRgvUhqzyoAAA== 311 | Set-Cookie: 312 | - lidc="b=VB84:g=218:u=1:i=1442273810:t=1442360210:s=AQGaF1iN0JqjkNzbJRaPO3Goha1RJ6lV"; 313 | Expires=Tue, 15 Sep 2015 23:36:50 GMT; domain=.linkedin.com; Path=/ 314 | body: 315 | encoding: UTF-8 316 | string: '{"count":0,"fCnt":"0","fCntPlusOne":"1","url":"please-dont-register-a-site-that-breaks-this-test.com"}' 317 | http_version: 318 | recorded_at: Mon, 14 Sep 2015 23:36:50 GMT 319 | - request: 320 | method: get 321 | uri: http://api.pinterest.com/v1/urls/count.json?callback=_&url=http://please-dont-register-a-site-that-breaks-this-test.com 322 | body: 323 | encoding: US-ASCII 324 | string: '' 325 | headers: 326 | User-Agent: 327 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 328 | like Gecko) Version/5.1.6 Safari/534.56.5 329 | response: 330 | status: 331 | code: 200 332 | message: OK 333 | headers: 334 | Accept-Ranges: 335 | - bytes 336 | Age: 337 | - '0' 338 | Cache-Control: 339 | - private 340 | Content-Type: 341 | - application/javascript 342 | Date: 343 | - Mon, 14 Sep 2015 23:36:50 GMT 344 | Expires: 345 | - Mon, 14 Sep 2015 23:51:50 GMT 346 | Via: 347 | - 1.1 varnish 348 | X-Pinterest-Rid: 349 | - '609055926048' 350 | X-Varnish: 351 | - '1849113406' 352 | Content-Length: 353 | - '83' 354 | Connection: 355 | - keep-alive 356 | body: 357 | encoding: UTF-8 358 | string: _({"url":"http://please-dont-register-a-site-that-breaks-this-test.com","count":0}) 359 | http_version: 360 | recorded_at: Mon, 14 Sep 2015 23:36:50 GMT 361 | recorded_with: VCR 2.9.3 362 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/success_socials.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.pinterest.com/v1/urls/count.json?callback=_&url=http://www.google.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 12 | like Gecko) Version/5.1.6 Safari/534.56.5 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Accept-Ranges: 19 | - bytes 20 | Age: 21 | - '1655' 22 | Cache-Control: 23 | - private 24 | Content-Type: 25 | - application/javascript 26 | Date: 27 | - Mon, 14 Sep 2015 23:36:47 GMT 28 | Expires: 29 | - Mon, 14 Sep 2015 23:24:12 GMT 30 | Via: 31 | - 1.1 varnish 32 | X-Pinterest-Rid: 33 | - '338406475226' 34 | X-Varnish: 35 | - 513672300 509056434 36 | Content-Length: 37 | - '48' 38 | Connection: 39 | - keep-alive 40 | body: 41 | encoding: UTF-8 42 | string: _({"url":"http://www.google.com","count":75108}) 43 | http_version: 44 | recorded_at: Mon, 14 Sep 2015 23:36:47 GMT 45 | - request: 46 | method: get 47 | uri: http://urls.api.twitter.com/1/urls/count.json?url=www.google.com 48 | body: 49 | encoding: US-ASCII 50 | string: '' 51 | headers: 52 | User-Agent: 53 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 54 | like Gecko) Version/5.1.6 Safari/534.56.5 55 | response: 56 | status: 57 | code: 200 58 | message: OK 59 | headers: 60 | Cache-Control: 61 | - must-revalidate, max-age=900 62 | Content-Type: 63 | - application/json;charset=utf-8 64 | Expires: 65 | - Mon, 14 Sep 2015 23:51:47 GMT 66 | Last-Modified: 67 | - Mon, 14 Sep 2015 23:36:47 GMT 68 | Server: 69 | - tsa_b 70 | X-Connection-Hash: 71 | - cb66cffe7fa43dbf90b1192189d730bf 72 | X-Response-Time: 73 | - '6' 74 | Content-Length: 75 | - '52' 76 | Accept-Ranges: 77 | - bytes 78 | Date: 79 | - Mon, 14 Sep 2015 23:36:47 GMT 80 | Via: 81 | - 1.1 varnish 82 | Age: 83 | - '0' 84 | Connection: 85 | - keep-alive 86 | X-Served-By: 87 | - cache-tw-nyc1-cr1-11-TWNYC1 88 | X-Cache: 89 | - MISS 90 | X-Cache-Hits: 91 | - '0' 92 | Vary: 93 | - Accept-Encoding 94 | body: 95 | encoding: UTF-8 96 | string: '{"count":24665189,"url":"http:\/\/www.google.com\/"}' 97 | http_version: 98 | recorded_at: Mon, 14 Sep 2015 23:36:47 GMT 99 | - request: 100 | method: get 101 | uri: http://graph.facebook.com/?id=http://www.google.com 102 | body: 103 | encoding: US-ASCII 104 | string: '' 105 | headers: 106 | User-Agent: 107 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 108 | like Gecko) Version/5.1.6 Safari/534.56.5 109 | response: 110 | status: 111 | code: 200 112 | message: OK 113 | headers: 114 | Access-Control-Allow-Origin: 115 | - "*" 116 | Content-Type: 117 | - text/javascript; charset=UTF-8 118 | X-Fb-Trace-Id: 119 | - ATI4Meh3P0m 120 | X-Fb-Rev: 121 | - '1935378' 122 | Etag: 123 | - '"f1ced55c7e36bb2189fe954b2c02cc026239b54c"' 124 | Pragma: 125 | - no-cache 126 | Cache-Control: 127 | - private, no-cache, no-store, must-revalidate 128 | Facebook-Api-Version: 129 | - v2.0 130 | Expires: 131 | - Sat, 01 Jan 2000 00:00:00 GMT 132 | X-Fb-Debug: 133 | - DTy6UWWN/SiLz6D+fkJvvW2XX2c7tP2MZhOqSuYPwM3s+YNUZ8R8xX3q6l0NF+1NlHS+sWeIIaRi2WHLh7mzmQ== 134 | Date: 135 | - Mon, 14 Sep 2015 23:36:47 GMT 136 | Connection: 137 | - keep-alive 138 | Content-Length: 139 | - '80' 140 | body: 141 | encoding: UTF-8 142 | string: |- 143 | { 144 | "id": "http://www.google.com", 145 | "shares": 13236803, 146 | "comments": 1028 147 | } 148 | http_version: 149 | recorded_at: Mon, 14 Sep 2015 23:36:47 GMT 150 | - request: 151 | method: get 152 | uri: http://www.stumbleupon.com/services/1.01/badge.getinfo?url=www.google.com 153 | body: 154 | encoding: US-ASCII 155 | string: '' 156 | headers: 157 | User-Agent: 158 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 159 | like Gecko) Version/5.1.6 Safari/534.56.5 160 | response: 161 | status: 162 | code: 200 163 | message: OK 164 | headers: 165 | Server: 166 | - Apache 167 | P3p: 168 | - policyref="/w3c/p3p.xml", CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT 169 | DEM STA PRE COM NAV OTC NOI DSP COR" 170 | Vary: 171 | - Accept-Encoding 172 | Content-Type: 173 | - text/plain; charset=iso-8859-1 174 | Content-Length: 175 | - '521' 176 | Accept-Ranges: 177 | - bytes 178 | Date: 179 | - Mon, 14 Sep 2015 23:36:47 GMT 180 | Age: 181 | - '0' 182 | Connection: 183 | - keep-alive 184 | body: 185 | encoding: UTF-8 186 | string: '{"result":{"url":"http:\/\/www.google.com\/","in_index":true,"publicid":"2pI1xR","views":255199,"title":"Google","thumbnail":"http:\/\/cdn.stumble-upon.com\/mthumb\/31\/10031.jpg","thumbnail_b":"http:\/\/cdn.stumble-upon.com\/bthumb\/31\/10031.jpg","submit_link":"http:\/\/www.stumbleupon.com\/badge\/?url=http:\/\/www.google.com\/","badge_link":"http:\/\/www.stumbleupon.com\/badge\/?url=http:\/\/www.google.com\/","info_link":"http:\/\/www.stumbleupon.com\/url\/www.google.com\/"},"timestamp":1442273807,"success":true}' 187 | http_version: 188 | recorded_at: Mon, 14 Sep 2015 23:36:47 GMT 189 | - request: 190 | method: get 191 | uri: https://www.linkedin.com/countserv/count/share?callback=_&format=json&url=www.google.com 192 | body: 193 | encoding: US-ASCII 194 | string: '' 195 | headers: 196 | User-Agent: 197 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 198 | like Gecko) Version/5.1.6 Safari/534.56.5 199 | response: 200 | status: 201 | code: 200 202 | message: OK 203 | headers: 204 | Server: 205 | - Apache-Coyote/1.1 206 | Content-Type: 207 | - application/json;charset=UTF-8 208 | Content-Length: 209 | - '74' 210 | Vary: 211 | - Accept-Encoding 212 | Date: 213 | - Mon, 14 Sep 2015 23:36:47 GMT 214 | X-Frame-Options: 215 | - sameorigin 216 | X-Content-Type-Options: 217 | - nosniff 218 | X-Xss-Protection: 219 | - 1; mode=block 220 | X-Li-Fabric: 221 | - prod-lva1 222 | Strict-Transport-Security: 223 | - max-age=0 224 | Pragma: 225 | - no-cache 226 | Expires: 227 | - Thu, 01 Jan 1970 00:00:00 GMT 228 | Cache-Control: 229 | - no-cache, no-store 230 | Connection: 231 | - keep-alive 232 | X-Li-Pop: 233 | - prod-lva1 234 | X-Li-Uuid: 235 | - f9Ls8GL8AxQAGPeq0CoAAA== 236 | Set-Cookie: 237 | - lidc="b=VB84:g=218:u=1:i=1442273807:t=1442360207:s=AQF2X3U14SFcDiFmoW541KuPQoZiZuIq"; 238 | Expires=Tue, 15 Sep 2015 23:36:47 GMT; domain=.linkedin.com; Path=/ 239 | body: 240 | encoding: UTF-8 241 | string: '{"count":2712,"fCnt":"2,712","fCntPlusOne":"2,713","url":"www.google.com"}' 242 | http_version: 243 | recorded_at: Mon, 14 Sep 2015 23:36:47 GMT 244 | - request: 245 | method: get 246 | uri: http://vk.com/share.php?act=count&url=http://www.google.com 247 | body: 248 | encoding: US-ASCII 249 | string: '' 250 | headers: 251 | User-Agent: 252 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 253 | like Gecko) Version/5.1.6 Safari/534.56.5 254 | response: 255 | status: 256 | code: 200 257 | message: OK 258 | headers: 259 | Server: 260 | - Apache 261 | Date: 262 | - Mon, 14 Sep 2015 23:36:47 GMT 263 | Content-Type: 264 | - text/html; charset=windows-1251 265 | Content-Length: 266 | - '24' 267 | Connection: 268 | - keep-alive 269 | X-Powered-By: 270 | - PHP/3.17085 271 | Set-Cookie: 272 | - remixlang=3; expires=Sun, 11 Sep 2016 12:05:29 GMT; path=/; domain=.vk.com 273 | Pragma: 274 | - no-cache 275 | Cache-Control: 276 | - no-store 277 | body: 278 | encoding: UTF-8 279 | string: VK.Share.count(0, 4352); 280 | http_version: 281 | recorded_at: Mon, 14 Sep 2015 23:36:47 GMT 282 | - request: 283 | method: get 284 | uri: http://share.yandex.ru/gpp.xml?url=http://www.google.com 285 | body: 286 | encoding: US-ASCII 287 | string: '' 288 | headers: 289 | User-Agent: 290 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 291 | like Gecko) Version/5.1.6 Safari/534.56.5 292 | response: 293 | status: 294 | code: 200 295 | message: OK 296 | headers: 297 | Server: 298 | - nginx/1.6.3 299 | Date: 300 | - Mon, 14 Sep 2015 23:36:47 GMT 301 | Content-Type: 302 | - text/javascript; charset=utf-8 303 | Transfer-Encoding: 304 | - chunked 305 | Connection: 306 | - keep-alive 307 | Cache-Control: 308 | - max-age=0, must-revalidate, proxy-revalidate, no-cache, no-store, private 309 | Expires: 310 | - Mon, 14 Sep 2015 23:36:47 GMT 311 | Pragma: 312 | - no-cache 313 | Set-Cookie: 314 | - yandexuid=9201727381442273807; domain=.yandex.ru; path=/; expires=Tue, 19 315 | Jan 2038 03:14:07 GMT 316 | body: 317 | encoding: UTF-8 318 | string: services.gplus.cb("10000"); 319 | http_version: 320 | recorded_at: Mon, 14 Sep 2015 23:36:48 GMT 321 | - request: 322 | method: get 323 | uri: http://urls.api.twitter.com/1/urls/count.json?url=www.google.com 324 | body: 325 | encoding: US-ASCII 326 | string: '' 327 | headers: 328 | User-Agent: 329 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 330 | like Gecko) Version/5.1.6 Safari/534.56.5 331 | response: 332 | status: 333 | code: 200 334 | message: OK 335 | headers: 336 | Cache-Control: 337 | - must-revalidate, max-age=900 338 | Content-Type: 339 | - application/json;charset=utf-8 340 | Expires: 341 | - Mon, 14 Sep 2015 23:51:47 GMT 342 | Last-Modified: 343 | - Mon, 14 Sep 2015 23:36:47 GMT 344 | Server: 345 | - tsa_b 346 | X-Connection-Hash: 347 | - cb66cffe7fa43dbf90b1192189d730bf 348 | X-Response-Time: 349 | - '6' 350 | Content-Length: 351 | - '52' 352 | Accept-Ranges: 353 | - bytes 354 | Date: 355 | - Mon, 14 Sep 2015 23:36:48 GMT 356 | Via: 357 | - 1.1 varnish 358 | Age: 359 | - '1' 360 | Connection: 361 | - keep-alive 362 | X-Served-By: 363 | - cache-tw-nyc1-cr1-11-TWNYC1 364 | X-Cache: 365 | - HIT 366 | X-Cache-Hits: 367 | - '1' 368 | Vary: 369 | - Accept-Encoding 370 | body: 371 | encoding: UTF-8 372 | string: '{"count":24665189,"url":"http:\/\/www.google.com\/"}' 373 | http_version: 374 | recorded_at: Mon, 14 Sep 2015 23:36:48 GMT 375 | - request: 376 | method: get 377 | uri: http://api.pinterest.com/v1/urls/count.json?callback=_&url=http://www.google.com 378 | body: 379 | encoding: US-ASCII 380 | string: '' 381 | headers: 382 | User-Agent: 383 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 384 | like Gecko) Version/5.1.6 Safari/534.56.5 385 | response: 386 | status: 387 | code: 200 388 | message: OK 389 | headers: 390 | Accept-Ranges: 391 | - bytes 392 | Age: 393 | - '0' 394 | Cache-Control: 395 | - private 396 | Content-Type: 397 | - application/javascript 398 | Date: 399 | - Mon, 14 Sep 2015 23:36:48 GMT 400 | Expires: 401 | - Mon, 14 Sep 2015 23:51:48 GMT 402 | Via: 403 | - 1.1 varnish 404 | X-Pinterest-Rid: 405 | - '860700798117' 406 | X-Varnish: 407 | - '3120031947' 408 | Content-Length: 409 | - '48' 410 | Connection: 411 | - keep-alive 412 | body: 413 | encoding: UTF-8 414 | string: _({"url":"http://www.google.com","count":75108}) 415 | http_version: 416 | recorded_at: Mon, 14 Sep 2015 23:36:48 GMT 417 | - request: 418 | method: get 419 | uri: https://www.linkedin.com/countserv/count/share?callback=_&format=json&url=www.google.com 420 | body: 421 | encoding: US-ASCII 422 | string: '' 423 | headers: 424 | User-Agent: 425 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 426 | like Gecko) Version/5.1.6 Safari/534.56.5 427 | response: 428 | status: 429 | code: 200 430 | message: OK 431 | headers: 432 | Server: 433 | - Apache-Coyote/1.1 434 | Content-Type: 435 | - application/json;charset=UTF-8 436 | Content-Length: 437 | - '74' 438 | Vary: 439 | - Accept-Encoding 440 | Date: 441 | - Mon, 14 Sep 2015 23:36:47 GMT 442 | X-Frame-Options: 443 | - sameorigin 444 | X-Content-Type-Options: 445 | - nosniff 446 | X-Xss-Protection: 447 | - 1; mode=block 448 | X-Li-Fabric: 449 | - prod-lva1 450 | Strict-Transport-Security: 451 | - max-age=0 452 | Pragma: 453 | - no-cache 454 | Expires: 455 | - Thu, 01 Jan 1970 00:00:00 GMT 456 | Cache-Control: 457 | - no-cache, no-store 458 | Connection: 459 | - keep-alive 460 | X-Li-Pop: 461 | - prod-lva1 462 | X-Li-Uuid: 463 | - UqM3HmP8AxTQMquZzyoAAA== 464 | Set-Cookie: 465 | - lidc="b=VB84:g=218:u=1:i=1442273808:t=1442360208:s=AQHSSdNuG8GY364XtQ8nliehwbn70DBA"; 466 | Expires=Tue, 15 Sep 2015 23:36:48 GMT; domain=.linkedin.com; Path=/ 467 | body: 468 | encoding: UTF-8 469 | string: '{"count":2712,"fCnt":"2,712","fCntPlusOne":"2,713","url":"www.google.com"}' 470 | http_version: 471 | recorded_at: Mon, 14 Sep 2015 23:36:48 GMT 472 | - request: 473 | method: get 474 | uri: http://www.stumbleupon.com/services/1.01/badge.getinfo?url=www.google.com 475 | body: 476 | encoding: US-ASCII 477 | string: '' 478 | headers: 479 | User-Agent: 480 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 481 | like Gecko) Version/5.1.6 Safari/534.56.5 482 | response: 483 | status: 484 | code: 200 485 | message: OK 486 | headers: 487 | Server: 488 | - Apache 489 | P3p: 490 | - policyref="/w3c/p3p.xml", CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT 491 | DEM STA PRE COM NAV OTC NOI DSP COR" 492 | Vary: 493 | - Accept-Encoding 494 | Content-Type: 495 | - text/plain; charset=iso-8859-1 496 | Content-Length: 497 | - '521' 498 | Accept-Ranges: 499 | - bytes 500 | Date: 501 | - Mon, 14 Sep 2015 23:36:48 GMT 502 | Age: 503 | - '0' 504 | Connection: 505 | - keep-alive 506 | body: 507 | encoding: UTF-8 508 | string: '{"result":{"url":"http:\/\/www.google.com\/","in_index":true,"publicid":"2pI1xR","views":255199,"title":"Google","thumbnail":"http:\/\/cdn.stumble-upon.com\/mthumb\/31\/10031.jpg","thumbnail_b":"http:\/\/cdn.stumble-upon.com\/bthumb\/31\/10031.jpg","submit_link":"http:\/\/www.stumbleupon.com\/badge\/?url=http:\/\/www.google.com\/","badge_link":"http:\/\/www.stumbleupon.com\/badge\/?url=http:\/\/www.google.com\/","info_link":"http:\/\/www.stumbleupon.com\/url\/www.google.com\/"},"timestamp":1442273808,"success":true}' 509 | http_version: 510 | recorded_at: Mon, 14 Sep 2015 23:36:48 GMT 511 | - request: 512 | method: get 513 | uri: http://vk.com/share.php?act=count&url=http://www.google.com 514 | body: 515 | encoding: US-ASCII 516 | string: '' 517 | headers: 518 | User-Agent: 519 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 520 | like Gecko) Version/5.1.6 Safari/534.56.5 521 | response: 522 | status: 523 | code: 200 524 | message: OK 525 | headers: 526 | Server: 527 | - Apache 528 | Date: 529 | - Mon, 14 Sep 2015 23:36:48 GMT 530 | Content-Type: 531 | - text/html; charset=windows-1251 532 | Content-Length: 533 | - '24' 534 | Connection: 535 | - keep-alive 536 | X-Powered-By: 537 | - PHP/3.17085 538 | Set-Cookie: 539 | - remixlang=3; expires=Tue, 13 Sep 2016 12:14:07 GMT; path=/; domain=.vk.com 540 | Pragma: 541 | - no-cache 542 | Cache-Control: 543 | - no-store 544 | body: 545 | encoding: UTF-8 546 | string: VK.Share.count(0, 4352); 547 | http_version: 548 | recorded_at: Mon, 14 Sep 2015 23:36:48 GMT 549 | - request: 550 | method: get 551 | uri: http://www.stumbleupon.com/services/1.01/badge.getinfo?url=www.google.com 552 | body: 553 | encoding: US-ASCII 554 | string: '' 555 | headers: 556 | User-Agent: 557 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 558 | like Gecko) Version/5.1.6 Safari/534.56.5 559 | response: 560 | status: 561 | code: 200 562 | message: OK 563 | headers: 564 | Server: 565 | - Apache 566 | P3p: 567 | - policyref="/w3c/p3p.xml", CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT 568 | DEM STA PRE COM NAV OTC NOI DSP COR" 569 | Vary: 570 | - Accept-Encoding 571 | Content-Type: 572 | - text/plain; charset=iso-8859-1 573 | Content-Length: 574 | - '521' 575 | Accept-Ranges: 576 | - bytes 577 | Date: 578 | - Mon, 14 Sep 2015 23:36:49 GMT 579 | Age: 580 | - '0' 581 | Connection: 582 | - keep-alive 583 | body: 584 | encoding: UTF-8 585 | string: '{"result":{"url":"http:\/\/www.google.com\/","in_index":true,"publicid":"2pI1xR","views":255199,"title":"Google","thumbnail":"http:\/\/cdn.stumble-upon.com\/mthumb\/31\/10031.jpg","thumbnail_b":"http:\/\/cdn.stumble-upon.com\/bthumb\/31\/10031.jpg","submit_link":"http:\/\/www.stumbleupon.com\/badge\/?url=http:\/\/www.google.com\/","badge_link":"http:\/\/www.stumbleupon.com\/badge\/?url=http:\/\/www.google.com\/","info_link":"http:\/\/www.stumbleupon.com\/url\/www.google.com\/"},"timestamp":1442273809,"success":true}' 586 | http_version: 587 | recorded_at: Mon, 14 Sep 2015 23:36:49 GMT 588 | - request: 589 | method: get 590 | uri: https://www.linkedin.com/countserv/count/share?callback=_&format=json&url=www.google.com 591 | body: 592 | encoding: US-ASCII 593 | string: '' 594 | headers: 595 | User-Agent: 596 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 597 | like Gecko) Version/5.1.6 Safari/534.56.5 598 | response: 599 | status: 600 | code: 200 601 | message: OK 602 | headers: 603 | Server: 604 | - Apache-Coyote/1.1 605 | Content-Type: 606 | - application/json;charset=UTF-8 607 | Content-Length: 608 | - '74' 609 | Vary: 610 | - Accept-Encoding 611 | Date: 612 | - Mon, 14 Sep 2015 23:36:48 GMT 613 | X-Frame-Options: 614 | - sameorigin 615 | X-Content-Type-Options: 616 | - nosniff 617 | X-Xss-Protection: 618 | - 1; mode=block 619 | X-Li-Fabric: 620 | - prod-lva1 621 | Strict-Transport-Security: 622 | - max-age=0 623 | Pragma: 624 | - no-cache 625 | Expires: 626 | - Thu, 01 Jan 1970 00:00:00 GMT 627 | Cache-Control: 628 | - no-cache, no-store 629 | Connection: 630 | - keep-alive 631 | X-Li-Pop: 632 | - prod-lva1 633 | X-Li-Uuid: 634 | - HdKTQmP8AxQwejmr0CoAAA== 635 | Set-Cookie: 636 | - lidc="b=VB84:g=218:u=1:i=1442273808:t=1442360208:s=AQHSSdNuG8GY364XtQ8nliehwbn70DBA"; 637 | Expires=Tue, 15 Sep 2015 23:36:48 GMT; domain=.linkedin.com; Path=/ 638 | body: 639 | encoding: UTF-8 640 | string: '{"count":2712,"fCnt":"2,712","fCntPlusOne":"2,713","url":"www.google.com"}' 641 | http_version: 642 | recorded_at: Mon, 14 Sep 2015 23:36:49 GMT 643 | - request: 644 | method: get 645 | uri: http://vk.com/share.php?act=count&url=http://www.google.com 646 | body: 647 | encoding: US-ASCII 648 | string: '' 649 | headers: 650 | User-Agent: 651 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 652 | like Gecko) Version/5.1.6 Safari/534.56.5 653 | response: 654 | status: 655 | code: 200 656 | message: OK 657 | headers: 658 | Server: 659 | - Apache 660 | Date: 661 | - Mon, 14 Sep 2015 23:36:49 GMT 662 | Content-Type: 663 | - text/html; charset=windows-1251 664 | Content-Length: 665 | - '24' 666 | Connection: 667 | - keep-alive 668 | X-Powered-By: 669 | - PHP/3.17085 670 | Set-Cookie: 671 | - remixlang=3; expires=Mon, 12 Sep 2016 04:01:41 GMT; path=/; domain=.vk.com 672 | Pragma: 673 | - no-cache 674 | Cache-Control: 675 | - no-store 676 | body: 677 | encoding: UTF-8 678 | string: VK.Share.count(0, 4352); 679 | http_version: 680 | recorded_at: Mon, 14 Sep 2015 23:36:49 GMT 681 | - request: 682 | method: get 683 | uri: http://share.yandex.ru/gpp.xml?url=http://www.google.com 684 | body: 685 | encoding: US-ASCII 686 | string: '' 687 | headers: 688 | User-Agent: 689 | - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.56.5 (KHTML, 690 | like Gecko) Version/5.1.6 Safari/534.56.5 691 | response: 692 | status: 693 | code: 200 694 | message: OK 695 | headers: 696 | Server: 697 | - nginx/1.6.3 698 | Date: 699 | - Mon, 14 Sep 2015 23:36:49 GMT 700 | Content-Type: 701 | - text/javascript; charset=utf-8 702 | Transfer-Encoding: 703 | - chunked 704 | Connection: 705 | - keep-alive 706 | Cache-Control: 707 | - max-age=0, must-revalidate, proxy-revalidate, no-cache, no-store, private 708 | Expires: 709 | - Mon, 14 Sep 2015 23:36:49 GMT 710 | Pragma: 711 | - no-cache 712 | Set-Cookie: 713 | - yandexuid=9824469191442273809; domain=.yandex.ru; path=/; expires=Tue, 19 714 | Jan 2038 03:14:07 GMT 715 | body: 716 | encoding: UTF-8 717 | string: services.gplus.cb("10000"); 718 | http_version: 719 | recorded_at: Mon, 14 Sep 2015 23:36:49 GMT 720 | recorded_with: VCR 2.9.3 721 | -------------------------------------------------------------------------------- /spec/indexes/bing_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Indexes::Bing do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | it{is_expected.to be_nil} 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/indexes/google_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Indexes::Google do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | it{is_expected.to be_nil} 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/indexes/yahoo_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Indexes::Yahoo do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | it{is_expected.to be_nil} 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/page_rankr_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr do 4 | describe "#rank_trackers" do 5 | subject{ PageRankr.rank_trackers } 6 | 7 | it{ is_expected.to include(:alexa_us) } 8 | it{ is_expected.to include(:alexa_global) } 9 | it{ is_expected.to include(:google) } 10 | it{ is_expected.to include(:moz_rank) } 11 | end 12 | 13 | describe "#backlink_trackers" do 14 | subject{ PageRankr.backlink_trackers } 15 | 16 | it{ is_expected.to include(:bing) } 17 | it{ is_expected.to include(:google) } 18 | it{ is_expected.to include(:yahoo) } 19 | end 20 | 21 | describe "#index_trackers" do 22 | subject{ PageRankr.index_trackers } 23 | 24 | it{ is_expected.to include(:google) } 25 | it{ is_expected.to include(:bing) } 26 | end 27 | 28 | describe "::Site" do 29 | [nil, '', 'batman.thedarkknight'].each do |value| 30 | it "raises an exception when given #{value.inspect}" do 31 | expect{PageRankr::Site(value)}.to raise_error(PageRankr::DomainInvalid) 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /spec/proxy_services/random_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::ProxyServices::Random do 4 | let(:proxies) do 5 | [ 6 | "user:password@192.168.1.1:50501", 7 | "bob:smith@127.0.0.1:3000" 8 | ] 9 | end 10 | let(:site){PageRankr::Site("http://www.google.com")} 11 | let(:name){:ranks_google} 12 | subject{PageRankr::ProxyServices::Random.new(proxies)} 13 | 14 | it{should respond_to(:proxy).with(2).arguments} 15 | 16 | it "should return a proxy from the list of proxies" do 17 | 10.times do 18 | expect(proxies).to include(subject.proxy(name, site)) 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /spec/proxy_services/round_robin_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::ProxyServices::RoundRobin do 4 | let(:proxies) do 5 | [ 6 | "user:password@192.168.1.1:50501", 7 | "bob:smith@127.0.0.1:3000" 8 | ] 9 | end 10 | let(:site){PageRankr::Site("http://www.google.com")} 11 | let(:name){:ranks_google} 12 | subject{PageRankr::ProxyServices::RoundRobin.new(proxies)} 13 | 14 | it{should respond_to(:proxy).with(2).arguments} 15 | 16 | it "should return the first proxy on the first call" do 17 | expect(subject.proxy(name, site)).to eq(proxies.first) 18 | end 19 | 20 | it "should return the second proxy on the second call" do 21 | subject.proxy(name, site) 22 | expect(subject.proxy(name, site)).to eq(proxies.last) 23 | end 24 | 25 | it "should return the first proxy on the third call" do 26 | subject.proxy(name, site) 27 | subject.proxy(name, site) 28 | expect(subject.proxy(name, site)).to eq(proxies.first) 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /spec/ranks/alexa_country_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Ranks::AlexaCountry do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | it{is_expected.to be_nil} 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/ranks/alexa_global_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Ranks::AlexaGlobal do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | it{is_expected.to be_nil} 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/ranks/alexa_us_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Ranks::AlexaUs do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | it{is_expected.to be_nil} 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/ranks/domain_authority_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Ranks::DomainAuthority do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | # always returns a result 18 | it{is_expected.to eq(1)} 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /spec/ranks/google/checksum_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | SAMPLES = { 4 | 'RDwuPEHIrgTSfjFwIrNQQWlBe' => '62055409506', 5 | 'EpQgoYSvBcBsgApYnXvimwbUumJeajtPwVpyK' => '63696758529', 6 | 'wNKCeCesYrBWVHOebbHYUXtYKUJsYZ' => '62499718143', 7 | 'WcuHBErnmnlobkoljovgcipTEoxNKNkozMyrBoHumbaIRlDTX' => '62990136296', 8 | 'zmZMVOZeOSAjllPQebawJvTyx' => '62600475104', 9 | 'zIhqWNkSWVDtGyZJNAhXrsxvr' => '61779137032', 10 | 'HUJRIlqBoPiacanILngyPhvvwLYUTzXrLPGfFBXL' => '63164171011', 11 | 'FmaqTt' => '63696846590', 12 | 'bbjjofINMufjVmSDbiYKuEErqjbYYdcrftUieapFlWzxoYsMGz' => '6428000023', 13 | 'ydczxaBUFUtKxKJIxDrPvqxBiaqYPv' => '6759338533', 14 | 'ccYqbRnRDPPDHVMsckdGnbpGAuPbUNIbETxP' => '63618603088', 15 | 'LMmlBvFBXGvMxkjBfNVBLqmaCr' => '62431570439', 16 | 'jjiEggColBhBYwuiePcDpBTQwwlvFzKwmp' => '62648705831', 17 | 'SMdamRDmvkJVeNTebaagEXxTXkSCnZiCkkVhnqHvdSAPtNfyr' => '6878476314', 18 | 'vOmJIIbRUvYjaNjssTuZXgRIOgoL' => '62170208114', 19 | 'BwaSRvqktWSqgEMltozGwmjvxVxVQCSyvWtsmyjwHCOLVUC' => '64152263835', 20 | 'YfgEaPPyBTjouR' => '61911140243', 21 | 'DgheQaizjMialWKddArxjAAabMmqRBecpWEITApW' => '6192924161', 22 | 'aLDGcvrIyQBcULWAfXPUf' => '64117571081', 23 | 'INZIhnvQsNRYBFTxMgVXa' => '6555275853', 24 | 'XUWkScxADSi' => '6350572650', 25 | 'spCHnLtDAsCZsknhvb' => '61624563975', 26 | 'zwMlYkrXxUXAfibWDzGhNZQkfQrUYRTWI' => '61602088851', 27 | 'VQOXivprmVdolPLVwHKOuYvTmioXZXGezRqtckeDn' => '62545550187', 28 | 'HZKigUSAFnrOLYlevkfnUfHfBgLTvlCJf' => '6769537725', 29 | 'AVNOlRWJWaFDDXftjswFgi' => '63208473934', 30 | 'LMIdcsdjebQzLFUNshdANQcIYVYuN' => '64007570819', 31 | 'srzhYNeleTqUfZs' => '62437029261', 32 | 'PRmyimgSzJxjSkiyAmdVcbSmCupU' => '61858587900', 33 | 'zDFRVUuKvN' => '63966306432', 34 | 'tTAAuluIGwiMKlpomnbFWbLQlhgjhncMIyWtvcJHVWbeoc' => '63823152059', 35 | 'eGwAubHVWzCqHdhZYuPlEkOKjQvPnEztyD' => '6495782915', 36 | 'bHCitHCtfRgUZcdnPMMjeMKIyByCoTbvpQmAh' => '6875882828', 37 | 'xbJKX' => '61447129925', 38 | 'rNXiXkmPFeZcHNNfiAuDnJLC' => '6411099889', 39 | 'wnOb' => '6466687088', 40 | 'bVNaQhWifmkUe' => '61080905374', 41 | 'NpXUdZY' => '6271405864', 42 | 'APJkWZOI' => '63718750842', 43 | 'OBwoI' => '64211141471', 44 | 'WJWBrvLPtPvzYWJZWXDyuRAFVKldUfukd' => '62941406460', 45 | 'yJmQUYAaUflHgOZIRLWTpwlYhrdwOZcvyYmqQYsnRGDmz' => '62977926381', 46 | 'FJDGohessfwGmSBsWAwdCmtiDjabJfAqGxZdDkXXDv' => '62678453226', 47 | 'UwBkNFMXRhAOtEgmHpPYdSIcEINvQPtSoHnBNExlXoeKtMxAgFzB' => '63584282177', 48 | 'BX' => '6816754104', 49 | 'ifcdHujBOWnTwzbNFuBuh' => '6150630468', 50 | 'nmkszzBXQIfK' => '63370482677', 51 | 'wdLFQxGR' => '6615323', 52 | 'kXxpmTyiLNJfYHlMwxWoMgaAjhIdCQga' => '6539671864', 53 | 'qbYyPjyqIhGxebMRjBGAACzFVoTsQRNwyECQelaGymV' => '61636842386', 54 | 'www.google.com' => '63801972318', 55 | 'https://github.com' => '61980590130', 56 | } 57 | 58 | 59 | describe PageRankr::Ranks::Google::Checksum do 60 | describe "#generate" do 61 | SAMPLES.each do |input, output| 62 | it "should generate #{output} as a checksum for #{input}" do 63 | expect(PageRankr::Ranks::Google::Checksum.generate(input)).to eq(output) 64 | end 65 | end 66 | end 67 | end 68 | -------------------------------------------------------------------------------- /spec/ranks/google_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Ranks::Google do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | it{is_expected.to be_nil} 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/ranks/moz_rank_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Ranks::MozRank do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | # always returns a result 18 | it{is_expected.to eq(0)} 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /spec/ranks/page_authority_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Ranks::PageAuthority do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | # always returns result 18 | it{is_expected.to eq(1)} 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /spec/site_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Site do 4 | describe "#scheme" do 5 | it "should set the scheme to http if no scheme is present" do 6 | expect(PageRankr::Site("www.google.com").scheme).to eq("http") 7 | end 8 | 9 | it "should use the scheme if it is provided" do 10 | expect(PageRankr::Site("https://www.google.com").scheme).to eq("https") 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/socials/facebook_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Socials::Facebook do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | it{is_expected.to be_nil} 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/socials/google_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Socials::Google do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | it{is_expected.to eq(0)} 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/socials/linkedin_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Socials::LinkedIn do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | it{is_expected.to eq(0)} 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/socials/pinterest_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Socials::Pinterest do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | it{is_expected.to eq(0)} 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/socials/stumble_upon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Socials::StumbleUpon do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | it{is_expected.to be_nil} 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/socials/twitter_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Socials::Twitter do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | it{is_expected.to eq(0)} 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/socials/vk_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PageRankr::Socials::Vk do 4 | describe '#run' do 5 | let(:tracker){described_class.new(site)} 6 | subject(:result){tracker.run} 7 | 8 | context 'with match', :vcr do 9 | let(:site){'http://www.google.com'} 10 | 11 | it{is_expected.to be_number > 0} 12 | end 13 | 14 | context 'with no match', :vcr do 15 | let(:site){'http://please-dont-register-a-site-that-breaks-this-test.com'} 16 | 17 | it{is_expected.to eq(0)} 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require File.join(File.dirname(__FILE__), '..', 'lib', 'page_rankr') 2 | require 'rspec' 3 | require 'fuubar' 4 | require 'vcr' 5 | require 'webmock' 6 | require 'pry' 7 | require 'support/custom_matchers' 8 | 9 | WebMock.allow_net_connect! 10 | 11 | VCR.configure do |c| 12 | c.cassette_library_dir = './spec/fixtures/vcr_cassettes' 13 | c.hook_into :webmock 14 | c.configure_rspec_metadata! 15 | end 16 | 17 | RSpec.configure do |c| 18 | c.formatter = Fuubar 19 | c.color = true 20 | end 21 | -------------------------------------------------------------------------------- /spec/support/custom_matchers.rb: -------------------------------------------------------------------------------- 1 | RSpec::Matchers.define :be_in do |expected| 2 | match do |actual| 3 | expected === actual 4 | end 5 | 6 | failure_message_for_should do |actual| 7 | "expected that #{actual} would be in #{expected}" 8 | end 9 | end 10 | 11 | RSpec::Matchers.define :be_number do 12 | match do |actual| 13 | actual.is_a?(Numeric) && actual.send(@symbol, @expected) 14 | end 15 | 16 | chain :>= do |expected| 17 | @symbol = :>= 18 | @expected = expected 19 | end 20 | 21 | chain :> do |expected| 22 | @symbol = :> 23 | @expected = expected 24 | end 25 | 26 | chain :< do |expected| 27 | @symbol = :< 28 | @expected = expected 29 | end 30 | 31 | chain :<= do |expected| 32 | @symbol = :<= 33 | @expected = expected 34 | end 35 | 36 | failure_message do |actual| 37 | "expected that #{actual.inspect} would be a number and #{@symbol} than #{@expected}" 38 | end 39 | end 40 | --------------------------------------------------------------------------------