dubdubdub 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,6 +2,7 @@ source "http://rubygems.org"
2
2
 
3
3
  gem 'rest-client'
4
4
  gem 'nokogiri'
5
+ gem 'mechanize'
5
6
 
6
7
  # Add dependencies to develop your gem here.
7
8
  # Include everything needed to run rake, tests, features, etc.
data/Gemfile.lock CHANGED
@@ -3,6 +3,8 @@ GEM
3
3
  specs:
4
4
  coderay (1.0.8)
5
5
  diff-lcs (1.1.3)
6
+ domain_name (0.5.4)
7
+ unf (~> 0.0.3)
6
8
  fakeweb (1.3.0)
7
9
  git (1.2.5)
8
10
  jeweler (1.8.4)
@@ -11,9 +13,20 @@ GEM
11
13
  rake
12
14
  rdoc
13
15
  json (1.7.5)
16
+ mechanize (2.5.1)
17
+ domain_name (~> 0.5, >= 0.5.1)
18
+ mime-types (~> 1.17, >= 1.17.2)
19
+ net-http-digest_auth (~> 1.1, >= 1.1.1)
20
+ net-http-persistent (~> 2.5, >= 2.5.2)
21
+ nokogiri (~> 1.4)
22
+ ntlm-http (~> 0.1, >= 0.1.1)
23
+ webrobots (~> 0.0, >= 0.0.9)
14
24
  method_source (0.8.1)
15
25
  mime-types (1.19)
26
+ net-http-digest_auth (1.2.1)
27
+ net-http-persistent (2.8)
16
28
  nokogiri (1.5.5)
29
+ ntlm-http (0.1.1)
17
30
  pry (0.9.10)
18
31
  coderay (~> 1.0.5)
19
32
  method_source (~> 0.8)
@@ -32,7 +45,11 @@ GEM
32
45
  diff-lcs (~> 1.1.2)
33
46
  rspec-mocks (2.8.0)
34
47
  slop (3.3.3)
48
+ unf (0.0.5)
49
+ unf_ext
50
+ unf_ext (0.0.5)
35
51
  vcr (2.3.0)
52
+ webrobots (0.0.13)
36
53
 
37
54
  PLATFORMS
38
55
  ruby
@@ -41,6 +58,7 @@ DEPENDENCIES
41
58
  bundler
42
59
  fakeweb (~> 1.3.0)
43
60
  jeweler (~> 1.8.4)
61
+ mechanize
44
62
  nokogiri
45
63
  pry
46
64
  rest-client
data/dubdubdub.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "dubdubdub"
8
- s.version = "0.1.1"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Hu"]
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
  "spec/dubdubdub_spec.rb",
31
31
  "spec/spec_helper.rb",
32
32
  "spec/support/vcr.rb",
33
+ "spec/vcr/browse/basic.yml",
33
34
  "spec/vcr/crawl/basic.yml",
34
35
  "spec/vcr/follow_url/alias_link.yml",
35
36
  "spec/vcr/follow_url/base.yml",
@@ -57,6 +58,7 @@ Gem::Specification.new do |s|
57
58
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
58
59
  s.add_runtime_dependency(%q<rest-client>, [">= 0"])
59
60
  s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
61
+ s.add_runtime_dependency(%q<mechanize>, [">= 0"])
60
62
  s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
61
63
  s.add_development_dependency(%q<vcr>, ["~> 2.3.0"])
62
64
  s.add_development_dependency(%q<fakeweb>, ["~> 1.3.0"])
@@ -66,6 +68,7 @@ Gem::Specification.new do |s|
66
68
  else
67
69
  s.add_dependency(%q<rest-client>, [">= 0"])
68
70
  s.add_dependency(%q<nokogiri>, [">= 0"])
71
+ s.add_dependency(%q<mechanize>, [">= 0"])
69
72
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
70
73
  s.add_dependency(%q<vcr>, ["~> 2.3.0"])
71
74
  s.add_dependency(%q<fakeweb>, ["~> 1.3.0"])
@@ -76,6 +79,7 @@ Gem::Specification.new do |s|
76
79
  else
77
80
  s.add_dependency(%q<rest-client>, [">= 0"])
78
81
  s.add_dependency(%q<nokogiri>, [">= 0"])
82
+ s.add_dependency(%q<mechanize>, [">= 0"])
79
83
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
80
84
  s.add_dependency(%q<vcr>, ["~> 2.3.0"])
81
85
  s.add_dependency(%q<fakeweb>, ["~> 1.3.0"])
@@ -1,5 +1,6 @@
1
1
  require 'net/http'
2
2
  require 'nokogiri'
3
+ require 'mechanize'
3
4
 
4
5
  class DubDubDub::Client
5
6
  attr_accessor :proxy_host, :proxy_port, :proxy_user, :proxy_password
@@ -53,6 +54,14 @@ class DubDubDub::Client
53
54
  RestClient::Resource.new(url, options)
54
55
  end
55
56
 
57
+ # Returns a Mechanize instance (agent)
58
+ def mechanize
59
+ agent = Mechanize.new
60
+ agent.set_proxy(proxy_host, proxy_port) if proxy?
61
+
62
+ agent
63
+ end
64
+
56
65
  # Perform a GET request
57
66
  def get(url, *args)
58
67
  rest_client_resource(url).get(*args)
@@ -68,13 +77,18 @@ class DubDubDub::Client
68
77
  rest_client_resource(url).delete(*args)
69
78
  end
70
79
 
71
- # Helper method to crawl by using a GET request
80
+ # Helper method to crawl by using a GET request via RestClient
72
81
  def crawl(url, *args)
73
82
  response = get(url, *args)
74
83
 
75
84
  Nokogiri::HTML(response.body)
76
85
  end
77
86
 
87
+ # Helper method to browse by using a GET request via Mechanize
88
+ def browse(url, *args)
89
+ mechanize.get(url, *args)
90
+ end
91
+
78
92
  # Follow a url to the end until it can no longer go any further
79
93
  # Even if it times out, it will return the url that it times out on!
80
94
  def follow_url(url, options = {}, &block)
data/lib/dubdubdub.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  class DubDubDub
2
2
  # Version
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.0"
4
4
 
5
5
  attr_accessor :client
6
6
 
@@ -3,6 +3,7 @@
3
3
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
4
4
  require 'rest-client'
5
5
  require 'nokogiri'
6
+ require 'mechanize'
6
7
 
7
8
  describe DubDubDub do
8
9
  let(:www) { DubDubDub.new }
@@ -42,6 +43,19 @@ describe DubDubDub do
42
43
  end
43
44
  end
44
45
 
46
+ describe '#mechanize' do
47
+ it "returns a Mechanize agent" do
48
+ www.mechanize.should be_a Mechanize
49
+ end
50
+
51
+ it "returns a proxied Mechanize agent if proxied" do
52
+ www.proxy = "localhost:8000"
53
+ agent = www.mechanize
54
+ agent.proxy_addr.should == "localhost"
55
+ agent.proxy_port.should == 8000
56
+ end
57
+ end
58
+
45
59
  describe '#get' do
46
60
  it "makes a GET request using RestClient and returns a response", vcr: { cassette_name: "get/basic", record: :once } do
47
61
  response = www.get "http://www.google.com"
@@ -66,6 +80,13 @@ describe DubDubDub do
66
80
  end
67
81
  end
68
82
 
83
+ describe '#browse' do
84
+ it "performs a GET request with Mechanize and returns a Mechanize::Page", vcr: { cassette_name: "browse/basic", record: :once } do
85
+ page = www.browse "http://www.google.com"
86
+ page.should be_a Mechanize::Page
87
+ end
88
+ end
89
+
69
90
  describe '#follow_url' do
70
91
  it "follows url to the end", vcr: { cassette_name: "follow_url/base", record: :once } do
71
92
  www.follow_url("http://say.ly/TCc1CEp").should == "http://www.whosay.com/TomHanks/photos/148406"
@@ -0,0 +1,179 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://www.google.com/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - Mechanize/2.5.1 Ruby/1.9.3p125 (http://github.com/tenderlove/mechanize/)
14
+ accept-encoding:
15
+ - gzip,deflate,identity
16
+ accept-charset:
17
+ - ISO-8859-1,utf-8;q=0.7,*;q=0.7
18
+ accept-language:
19
+ - en-us,en;q=0.5
20
+ host:
21
+ - www.google.com
22
+ connection:
23
+ - keep-alive
24
+ keep-alive:
25
+ - 300
26
+ response:
27
+ status:
28
+ code: 200
29
+ message: OK
30
+ headers:
31
+ date:
32
+ - Mon, 03 Dec 2012 22:41:48 GMT
33
+ expires:
34
+ - '-1'
35
+ cache-control:
36
+ - private, max-age=0
37
+ content-type:
38
+ - text/html; charset=ISO-8859-1
39
+ set-cookie:
40
+ - PREF=ID=9a90e309935277a9:FF=0:TM=1354574508:LM=1354574508:S=79gB6Wev1P19-uPj;
41
+ expires=Wed, 03-Dec-2014 22:41:48 GMT; path=/; domain=.google.com
42
+ - NID=66=jYHQ3jVXKxjVwtJKnbOUUqmClhtt-MUFtuNDQ1U1OTUL2OGG9H3STv0RP6yjzZXtlE1s9XKFLCKyMFTW9PLTyGPHAB9SiERgHOooD8uJBlQfEui2Xf-JyWZZZpv6qUHn;
43
+ expires=Tue, 04-Jun-2013 22:41:48 GMT; path=/; domain=.google.com; HttpOnly
44
+ p3p:
45
+ - CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657
46
+ for more info."
47
+ server:
48
+ - gws
49
+ x-xss-protection:
50
+ - 1; mode=block
51
+ x-frame-options:
52
+ - SAMEORIGIN
53
+ transfer-encoding:
54
+ - chunked
55
+ body:
56
+ encoding: US-ASCII
57
+ string: ! '<!doctype html><html itemscope="itemscope" itemtype="http://schema.org/WebPage"><head><meta
58
+ content="Search the world''s information, including webpages, images, videos
59
+ and more. Google has many special features to help you find exactly what you''re
60
+ looking for." name="description"><meta content="noodp" name="robots"><meta
61
+ itemprop="image" content="/images/google_favicon_128.png"><title>Google</title><script>(function(){
62
+
63
+ window.google={kEI:"rCq9UKDoJs-yiAKDi4HoBQ",getEI:function(a){for(var b;a&&(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return
64
+ b||google.kEI},https:function(){return"https:"==window.location.protocol},kEXPI:"17259,39523,39977,40363,4000116,4000473,4000565,4000945,4000955,4001372,4001417,4001456,4001569,4001855,4001933,4001966,4002000,4002036,4002155,4002161,4002240,4002274,4002348,4002359,4002391,4002436,4002460,4002466,4002484,4002510,4002562,4002710,4002733,4002788",kCSI:{e:"17259,39523,39977,40363,4000116,4000473,4000565,4000945,4000955,4001372,4001417,4001456,4001569,4001855,4001933,4001966,4002000,4002036,4002155,4002161,4002240,4002274,4002348,4002359,4002391,4002436,4002460,4002466,4002484,4002510,4002562,4002710,4002733,4002788",ei:"rCq9UKDoJs-yiAKDi4HoBQ"},authuser:0,ml:function(){},kHL:"en",time:function(){return(new
65
+ Date).getTime()},log:function(a,
66
+
67
+ b,c,j){var d=new Image,f=google.lc,e=google.li,g="";d.onerror=d.onload=d.onabort=function(){delete
68
+ f[e]};f[e]=d;!c&&-1==b.search("&ei=")&&(g="&ei="+google.getEI(j));c=c||"/gen_204?atyp=i&ct="+a+"&cad="+b+g+"&zx="+google.time();a=/^http:/i;a.test(c)&&google.https()?(google.ml(Error("GLMM"),!1,{src:c}),delete
69
+ f[e]):(d.src=c,google.li=e+1)},lc:[],li:0,Toolbelt:{},y:{},x:function(a,b){google.y[a.id]=[a,b];return!1}};})();
70
+
71
+ window.google.sn="webhp";window.google.timers={};window.google.startTick=function(a,b){window.google.timers[a]={t:{start:(new
72
+ Date).getTime()},bfr:!(!b)}};window.google.tick=function(a,b,c){if(!window.google.timers[a])google.startTick(a);window.google.timers[a].t[b]=c||(new
73
+ Date).getTime()};google.startTick("load",true);try{}catch(u){}
74
+
75
+ var _gjwl=location;function _gjuc(){var a=_gjwl.href.indexOf("#");if(0<=a&&(a=_gjwl.href.substring(a),0<a.indexOf("&q=")||0<=a.indexOf("#q=")))if(a=a.substring(1),-1==a.indexOf("#")){for(var
76
+ d=0;d<a.length;){var b=d;"&"==a.charAt(b)&&++b;var c=a.indexOf("&",b);-1==c&&(c=a.length);b=a.substring(b,c);if(0==b.indexOf("fp="))a=a.substring(0,d)+a.substring(c,a.length),c=d;else
77
+ if("cad=h"==b)return 0;d=c}_gjwl.href="/search?"+a+"&cad=h";return 1}return
78
+ 0}
79
+
80
+ function _gjp(){(!window._gjwl.hash||!window._gjuc())&&setTimeout(_gjp,500)};
81
+
82
+ window._gjp&&_gjp();</script><style>#gbar,#guser{font-size:13px;padding-top:1px
83
+ !important;}#gbar{height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px
84
+ solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}@media
85
+ all{.gb1{height:22;margin-right:.5em;vertical-align:top}#gbar{float:left}}a.gb1,a.gb4{text-decoration:underline
86
+ !important}a.gb1,a.gb4{color:#00c !important}.gbi .gb4{color:#dd8e27 !important}.gbf
87
+ .gb4{color:#900 !important}</style><style id="gstyle">body{margin:0;overflow-y:scroll}#gog{padding:3px
88
+ 8px 0}td{line-height:.8em}.gac_m td{line-height:17px}form{margin-bottom:20px}body,td,a,p,.h{font-family:arial,sans-serif}.h{color:#36c;font-size:20px}.q{color:#00c}.ts
89
+ td{padding:0}.ts{border-collapse:collapse}em{font-weight:bold;font-style:normal}.lst{height:25px;width:496px}.gsfi,.lst{font:18px
90
+ arial,sans-serif}.gsfs{font:17px arial,sans-serif}.ds{display:-moz-inline-box;display:inline-block;margin:3px
91
+ 0 4px;margin-left:4px}input{font-family:inherit}a.gb1,a.gb2,a.gb3,a.gb4{color:#11c
92
+ !important}body{background:#fff;color:black}a{color:#11c;text-decoration:none}a:hover,a:active{text-decoration:underline}.fl
93
+ a{color:#36c}a:visited{color:#551a8b}a.gb1,a.gb4{text-decoration:underline}a.gb3:hover{text-decoration:none}#ghead
94
+ a.gb2:hover{color:#fff!important}.sblc{padding-top:5px}.sblc a{display:block;margin:2px
95
+ 0;margin-left:13px;font-size:11px;}.lsbb{background:#eee;border:solid 1px;border-color:#ccc
96
+ #999 #999 #ccc;height:30px;display:block}.ftl,#fll a{display:inline-block;margin:0
97
+ 12px}.lsb{background:url(/images/srpr/nav_logo80.png) 0 -258px repeat-x;border:none;color:#000;cursor:pointer;height:30px;margin:0;outline:0;font:15px
98
+ arial,sans-serif;vertical-align:top}.lsb:active{background:#ccc}.lst:focus{outline:none}#addlang
99
+ a{padding:0 3px}.gac_v div{display:none}.gac_v .gac_v2,.gac_bt{display:block!important}table.gssb_c{z-index:986 }.nbcl{background:url(/images/srpr/nav_logo80.png)
100
+ no-repeat ;height:px;width:px}</style><script></script> </head><body dir="ltr"
101
+ bgcolor="#fff"><script>(function(){var src=''/images/srpr/nav_logo80.png'';var
102
+ iesg=false;document.body.onload = function(){window.n && window.n();if (document.images){new
103
+ Image().src=src;}
104
+
105
+ if (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbqf.q.focus();}
106
+
107
+ }
108
+
109
+ })();</script><textarea id="csi" style="display:none"></textarea><div id="mngb"><div
110
+ id=gbar><nobr><b class=gb1>Search</b> <a class=gb1 href="http://www.google.com/imghp?hl=en&tab=wi">Images</a>
111
+ <a class=gb1 href="http://maps.google.com/maps?hl=en&tab=wl">Maps</a> <a class=gb1
112
+ href="https://play.google.com/?hl=en&tab=w8">Play</a> <a class=gb1 href="http://www.youtube.com/?tab=wy">YouTube</a>
113
+ <a class=gb1 href="http://news.google.com/nwshp?hl=en&tab=wn">News</a> <a
114
+ class=gb1 href="https://mail.google.com/mail/?tab=wm">Gmail</a> <a class=gb1
115
+ href="https://drive.google.com/?tab=wo">Drive</a> <a class=gb1 style="text-decoration:none"
116
+ href="http://www.google.com/intl/en/options/"><u>More</u> &raquo;</a></nobr></div><div
117
+ id=guser width=100%><nobr><span id=gbn class=gbi></span><span id=gbf class=gbf></span><span
118
+ id=gbe></span><a href="http://www.google.com/history/optout?hl=en" class=gb4>Web
119
+ History</a> | <a href="/preferences?hl=en" class=gb4>Settings</a> | <a target=_top
120
+ id=gb_70 href="https://accounts.google.com/ServiceLogin?hl=en&continue=http://www.google.com/"
121
+ class=gb4>Sign in</a></nobr></div><div class=gbh style=left:0></div><div class=gbh
122
+ style=right:0></div></div><iframe name="wgjf" style="display:none"></iframe><center><br
123
+ clear="all" id="lgpd"><div id="lga"><img alt="Google" height="95" src="/intl/en_ALL/images/srpr/logo1w.png"
124
+ width="275" id="hplogo" onload="window.lol&&lol()" style="padding:28px 0 14px"><br><br></div><form
125
+ action="/search" name="f"><table cellpadding="0" cellspacing="0"><tr valign="top"><td
126
+ width="25%">&nbsp;</td><td align="center" nowrap="nowrap"><input name="ie"
127
+ value="ISO-8859-1" type="hidden"><input value="en" name="hl" type="hidden"><input
128
+ name="source" type="hidden" value="hp"><div class="ds" style="height:32px;margin:4px
129
+ 0"><input autocomplete="off" class="lst" value="" title="Google Search" maxlength="2048"
130
+ name="q" size="57" style="color:#000;margin:0;padding:5px 8px 0 6px;vertical-align:top"></div><br
131
+ style="line-height:0"><span class="ds"><span class="lsbb"><input class="lsb"
132
+ value="Google Search" name="btnG" type="submit"></span></span><span class="ds"><span
133
+ class="lsbb"><input class="lsb" value="I''m Feeling Lucky" name="btnI" type="submit"
134
+ onclick="if(this.form.q.value)this.checked=1; else top.location=''/doodles/''"></span></span></td><td
135
+ class="fl sblc" align="left" nowrap="nowrap" width="25%"><a href="/advanced_search?hl=en&amp;authuser=0">Advanced
136
+ search</a><a href="/language_tools?hl=en&amp;authuser=0">Language tools</a></td></tr></table><input
137
+ type="hidden" id="gbv" name="gbv" value="1"></form><div id="gac_scont"></div><div
138
+ style="font-size:83%;min-height:3.5em"><br><div id="prm"><font id="hpplink"
139
+ size="-1" style="behavior:url(#default#userdata)"><span style="color:red"></span>Love
140
+ the free and open Internet? <a href="https://www.google.com/takeaction/?utm_source=google&amp;utm_medium=hpp&amp;utm_campaign=12032012freeandopen_en"
141
+ onclick="google.promos&&google.promos.link&& google.promos.link.cl()">Tell
142
+ the world''s governments</a> to keep it that way.</font><br><br><br><script
143
+ type="text/javascript">(function(){var d={promos:{}};d.promos.localStorage={};d.promos.localStorage.isLocalstorageSupported=function(){try{return"object"==typeof
144
+ window.localStorage}catch(a){return!1}};d.promos.localStorage.getPersistData=function(a){a=window.localStorage.getItem(a);return!a?"":a.toString()};d.promos.localStorage.setPersistData=function(a,b){window.localStorage.setItem(a,b)};d.promos.localStorage.removePersistData=function(a){window.localStorage.removeItem(a)};google.promos||(google.promos={});google.promos.ActionType={ACCEPT:"a",CANCEL:"c",DISMISS:"d",CLICK:"h",IMPRESSION:"i",NO_THANKS:"n",X_BUTTON:"x",MGMHP_ACCEPT:"ma",MGMHP_CANCEL:"mc",MGMHP_IMPRESSION:"mi",MGMHPPD_ACCEPT:"pa",MGMHPPD_CANCEL:"pc",MGMHPPD_IMPRESSION:"pi",MGMHPPD_NO_THANKS:"pn",MGMHPPD_NO_BUTTON:"px",MGMHPPD_DISMISS:"pd",PUSHDOWN_ACCEPT:"gpa",PUSHDOWN_IMPRESSION:"gpi",PUSHDOWN_NO_THANKS:"gpn",PUSHDOWN_NO_BUTTON:"gpx",PUSHDOWN_DISMISS:"gpd"};google.promos.sl=function(a,b,c,e){a=[c,"id="+a,"loc="+google.sn];a.push("oi=promoslinger");e&&a.push(e);google.log(b,a.join("&"))};google.promos.si=function(a,b,c,e){0.01>Math.random()&&google.promos.sl(a,b,e?e:google.promos.ActionType.IMPRESSION,c)};google.promos.spd=function(a,b,c){if(d.promos.localStorage.isLocalstorageSupported())d.promos.localStorage.setPersistData(b,c);else
145
+ if(a)try{a.setAttribute(b,c),a.save(a.id)}catch(e){google.ml(e,!1,{cause:"PERSIST_DATA_FAIL"})}};google.promos.gpd=function(a,b){if(d.promos.localStorage.isLocalstorageSupported())return
146
+ d.promos.localStorage.getPersistData(b);if(a)try{return a.load(a.id),a.getAttribute(b)}catch(c){google.ml(c,!1,{cause:"PERSIST_DATA_FAIL"})}return""};google.promos.rpd=function(a,b){if(d.promos.localStorage.isLocalstorageSupported())d.promos.localStorage.removePersistData(b);else
147
+ if(a)try{a.load(a.id),a.removeAttribute(b),a.save(a.id)}catch(c){google.ml(c,!1,{cause:"PERSIST_DATA_FAIL"})}};google.promos.aeh=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)};})();</script><script
148
+ type="text/javascript">(function(){var c,e,g=0,h;google.promos.link||(google.promos.link={});google.promos.link.getExtraLogData_=function(b){var
149
+ a=document.getElementById(h);if(a){var f=e+"_upccb",d=parseInt(google.promos.gpd(a,f)||0,10);d++;g++;google.promos.spd(a,f,d);a=[["upcc",g].join("="),["upccb",d].join("=")];b&&a.push(b);return
150
+ a.join("&")}};google.promos.link.cl=function(b){try{google.promos.sl(e,c,google.promos.ActionType.CLICK,google.promos.link.getExtraLogData_(b))}catch(a){google.ml(a,!1,{cause:c+"_CL"})}};google.promos.link.init=function(b,a,f){try{e=b,c=a,h=f,google.promos.si(e,c)}catch(d){google.ml(d,!1,{cause:c+"_INIT"})}};})();</script><script>(function(){var
151
+ sourceWebappPromoID=1579001;var payloadType=3;google.promos.link.init(sourceWebappPromoID,payloadType,''hpplink'');})();</script></div></div><span
152
+ id="footer"><div style="font-size:10pt"><div id="fll" style="margin:19px auto;text-align:center"><a
153
+ href="/intl/en/ads/">Advertising&nbsp;Programs</a><a href="/services/">Business
154
+ Solutions</a><a href="https://plus.google.com/116899029375914044550" rel="publisher">+Google</a><a
155
+ href="/intl/en/about.html">About Google</a></div></div><p style="color:#767676;font-size:8pt">&copy;
156
+ 2012 - <a href="/intl/en/policies/">Privacy & Terms</a></p></span></center><div
157
+ id=xjsd></div><div id=xjsi><script>if(google.y)google.y.first=[];(function(){var
158
+ b;function c(a){window.setTimeout(function(){var d=document.createElement("script");d.src=a;document.getElementById("xjsd").appendChild(d)},0)}google.dljp=function(a){b=a;google.xjsi||(google.xjsu=a,c(b))};google.dlj=c;})();
159
+
160
+ if(!google.xjs){google.dstr=[];google.rein=[];window._=window._||{};window._._DumpException=function(e){throw
161
+ e};if(google.timers&&google.timers.load.t){google.timers.load.t.xjsls=new
162
+ Date().getTime();}google.dljp(''/xjs/_/js/hp/sb_he,pcc/rt\x3dj/ver\x3dekMxmVjFIzI.en_US./d\x3d1/sv\x3d1/rs\x3dAItRSTM0lksRtI2VxMWJM1mGGSAc7V2OnQ'');google.xjs=1;}google.pmc={sb:{"agen":false,"cgen":true,"client":"heirloom-hp","dh":true,"ds":"","eqch":true,"fl":true,"host":"google.com","jsonp":true,"msgs":{"lcky":"I\u0026#39;m
163
+ Feeling Lucky","lml":"Learn more","oskt":"Input tools","psrc":"This search
164
+ was removed from your \u003Ca href=\"/history\"\u003EWeb History\u003C/a\u003E","psrl":"Remove","sbit":"Search
165
+ by image","srch":"Google Search"},"ovr":{"l":1,"ms":1},"pq":"","qcpw":false,"scd":10,"sce":5,"stok":"ZxezwTCmL2zmnPiVKrUDkBOYbso"},pcc:{}};google.y.first.push(function(){if(google.med){google.med(''init'');google.initHistory();google.med(''history'');}google.History&&google.History.initialize(''/'');google.hs&&google.hs.init&&google.hs.init()});if(google.j&&google.j.en&&google.j.xi){window.setTimeout(google.j.xi,0);}</script></div><script>(function(){var
166
+ b,c,d,e;function g(a,f){a.removeEventListener?(a.removeEventListener("load",f,!1),a.removeEventListener("error",f,!1)):(a.detachEvent("onload",f),a.detachEvent("onerror",f))}function
167
+ h(a){e=(new Date).getTime();++c;a=a||window.event;a=a.target||a.srcElement;g(a,h)}var
168
+ j=document.getElementsByTagName("img");b=j.length;
169
+
170
+ for(var k=c=0,l;k<b;++k)l=j[k],l.complete||"string"!=typeof l.src||!l.src?++c:l.addEventListener?(l.addEventListener("load",h,!1),l.addEventListener("error",h,!1)):(l.attachEvent("onload",h),l.attachEvent("onerror",h));d=b-c;
171
+
172
+ function m(){if(google.timers.load.t){google.timers.load.t.ol=(new Date).getTime();google.timers.load.t.iml=e;google.kCSI.imc=c;google.kCSI.imn=b;google.kCSI.imp=d;void
173
+ 0!==google.stt&&(google.kCSI.stt=google.stt);google.csiReport&&google.csiReport()}}window.addEventListener?window.addEventListener("load",m,!1):window.attachEvent&&window.attachEvent("onload",m);google.timers.load.t.prt=e=(new
174
+ Date).getTime();})();
175
+
176
+ </script></body></html>'
177
+ http_version: '1.1'
178
+ recorded_at: Mon, 03 Dec 2012 22:41:48 GMT
179
+ recorded_with: VCR 2.3.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dubdubdub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: mechanize
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: rspec
48
64
  requirement: !ruby/object:Gem::Requirement
@@ -160,6 +176,7 @@ files:
160
176
  - spec/dubdubdub_spec.rb
161
177
  - spec/spec_helper.rb
162
178
  - spec/support/vcr.rb
179
+ - spec/vcr/browse/basic.yml
163
180
  - spec/vcr/crawl/basic.yml
164
181
  - spec/vcr/follow_url/alias_link.yml
165
182
  - spec/vcr/follow_url/base.yml
@@ -189,7 +206,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
189
206
  version: '0'
190
207
  segments:
191
208
  - 0
192
- hash: 1241475245500893694
209
+ hash: -1273812053448365973
193
210
  required_rubygems_version: !ruby/object:Gem::Requirement
194
211
  none: false
195
212
  requirements: