google_scraper_gem 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 125b38db6e9a7aa8b6a3a3e4a2c3f92237f2e4ff
4
- data.tar.gz: 02eef0d5b5068fd9a8e07a91c9a727d1d7a04f00
3
+ metadata.gz: 277c49c5bcf1ef1089cc6d5ecdac41d99406d284
4
+ data.tar.gz: c6c612b686fd655435d155d97a9612b0bda4a95c
5
5
  SHA512:
6
- metadata.gz: f82fb3df775b6a2fc67258f46b8bed175115a149bb6abd91cea9792f2be33d2d103d6511e3a37a40f1546bb31b7a8db5069f0cd945d469b9e34e26636d269532
7
- data.tar.gz: 3e94e63de93cec94137470016e13aa3e47a532d56cfc11527d95c8606cfeb66563fc093ca8ca9a669d52387addf1ce9034b413d1c257ba76cb80d0bbe1f26932
6
+ metadata.gz: 5dd8033aca597b6436745f79d63fb8a565ae49208aef48d8ad24bebaad48880112abf933fc2545a024d09f8ef95e2fb3fc08351b663f1b72a08642f0656b9e21
7
+ data.tar.gz: 41f9e164681290fd8b59b32156107e6a53c663577c027cb90ad3a2372588cf32cf54fc48ecc4e054871f9477ced52ad5590a5c5c5011e524b964f9ffd3514342
@@ -1,3 +1,3 @@
1
1
  module GoogleScraperGem
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -3,7 +3,7 @@ require 'mechanize'
3
3
  require 'nokogiri'
4
4
 
5
5
  class GoogleScraper
6
- BASE_URL = "http://www.google"
6
+ BASE_URL = "http://www.google.com"
7
7
  SEARCH = "/search?q="
8
8
  CSS_SELECTOR = "li[@class='g'] > div.rc > h3.r > a"
9
9
  RANK_LIMIT = 100 # Stop looking for the target URL after 100 results
@@ -18,14 +18,14 @@ class GoogleScraper
18
18
  # @mech.set_proxy proxy[:host], proxy[:port], proxy[:username], proxy[:password]
19
19
  end
20
20
 
21
- # @return Rank of URL for keyword in google.locale
22
- def checkRank(keyword, url, locale = '.com')
21
+ # @return Rank of URL for keyword in google.com for the specified locale and language
22
+ def checkRank(keyword, url, locale = 'us', language = 'en')
23
23
  results = []
24
24
 
25
25
  rank_count = 0
26
26
  page_num = 1
27
27
 
28
- uri = BASE_URL + locale + SEARCH + URI.encode(keyword)
28
+ uri = BASE_URL + SEARCH + URI.encode(keyword) + "&gl=#{locale}&lr=lang_#{language}"
29
29
 
30
30
  page = @mech.get(uri)
31
31
  while rank_count < RANK_LIMIT
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_scraper_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Han Chang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-05 00:00:00.000000000 Z
11
+ date: 2013-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler