mechanize_content 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/.rvmrc +1 -0
  2. data/Rakefile +5 -0
  3. data/lib/mechanize_content/image.rb +61 -0
  4. data/lib/mechanize_content/page.rb +115 -0
  5. data/lib/mechanize_content/util.rb +4 -31
  6. data/lib/mechanize_content/version.rb +1 -1
  7. data/lib/mechanize_content.rb +8 -168
  8. data/mechanize_content.gemspec +2 -1
  9. data/spec/cassettes/MechanizeContent.yml +33742 -0
  10. data/spec/cassettes/MechanizeContent_Image.yml +279 -0
  11. data/spec/mechanize_content/image_spec.rb +39 -0
  12. data/spec/mechanize_content/page_spec.rb +90 -0
  13. data/spec/mechanize_content_spec.rb +149 -0
  14. data/spec/spec_helper.rb +11 -1
  15. metadata +29 -45
  16. data/spec/fixtures/a-fistful-of-red-dead-redemption-ps3-for-a-few-dollars-less-on.html +0 -754
  17. data/spec/fixtures/another-world-15th-anniversary-edition-now-on-gog-com.html +0 -2416
  18. data/spec/fixtures/another_world_15th_anniversary_edition.html +0 -805
  19. data/spec/fixtures/cmp.html +0 -333
  20. data/spec/fixtures/episodes_from_liberty_city_now_coming_to_playstation_3_and_pc_this_april.html +0 -1593
  21. data/spec/fixtures/gdc_2010_rounds_off_indie_cove.html +0 -698
  22. data/spec/fixtures/google.html +0 -42
  23. data/spec/fixtures/gta-iv-episodes-from-liberty-city-sees-slight-delay-on-pc-and-ps3.html +0 -1012
  24. data/spec/fixtures/johnny.jpg +0 -0
  25. data/spec/fixtures/joystiq-xbox-usb-support-580.jpg +0 -0
  26. data/spec/fixtures/mutiny.html +0 -264
  27. data/spec/fixtures/nuff-said-good-old-games-gets-another-world-168150.html +0 -5492
  28. data/spec/fixtures/rock-band-3-out-this-holiday-will-revolutionize-genre.html +0 -1157
  29. data/spec/fixtures/rockband_facebook.html +0 -93
  30. data/spec/fixtures/spartan.html +0 -391
  31. data/spec/fixtures/techmeme.html +0 -2216
  32. data/spec/fixtures/time-warner-retail-egm.html +0 -49
  33. data/spec/fixtures/witcher.html +0 -458
  34. data/spec/fixtures/xbox-360-gaining-usb-storage-support-in-2010-update.html +0 -2462
  35. data/spec/mechanize-content_spec.rb +0 -202
@@ -1,42 +0,0 @@
1
- HTTP/1.1 301 Moved Permanently
2
- Location: http://www.google.com/
3
- Content-Type: text/html; charset=UTF-8
4
- Date: Fri, 23 Jul 2010 19:22:46 GMT
5
- Expires: Sun, 22 Aug 2010 19:22:46 GMT
6
- Cache-Control: public, max-age=2592000
7
- Server: gws
8
- Content-Length: 219
9
- X-XSS-Protection: 1; mode=block
10
-
11
- HTTP/1.1 302 Found
12
- Location: http://www.google.co.uk/
13
- Cache-Control: private
14
- Content-Type: text/html; charset=UTF-8
15
- Set-Cookie: PREF=ID=e65b03a7ec2a4945:TM=1279912966:LM=1279912966:S=BW9XKGs4MrQGTXYN; expires=Sun, 22-Jul-2012 19:22:46 GMT; path=/; domain=.google.com
16
- Set-Cookie: NID=37=gc1LR3s8jJ3RggPdZbxHdu8UjjDjShI316iXEXmiq3glMfFF-6OsbxmfAp1Qu4XrLntaDKRoz-7O9mjZvvorwuauE-Pqh3G0rp-pIl3kXyFyQFjkr0OyKCYvt9r27ahg; expires=Sat, 22-Jan-2011 19:22:46 GMT; path=/; domain=.google.com; HttpOnly
17
- Date: Fri, 23 Jul 2010 19:22:46 GMT
18
- Server: gws
19
- Content-Length: 221
20
- X-XSS-Protection: 1; mode=block
21
-
22
- HTTP/1.1 200 OK
23
- Date: Fri, 23 Jul 2010 19:22:46 GMT
24
- Expires: -1
25
- Cache-Control: private, max-age=0
26
- Content-Type: text/html; charset=ISO-8859-1
27
- Set-Cookie: PREF=ID=34021eee9ae863df:TM=1279912966:LM=1279912966:S=KENvqWio3v1-y1HM; expires=Sun, 22-Jul-2012 19:22:46 GMT; path=/; domain=.google.co.uk
28
- Set-Cookie: NID=37=smzd1HEOMX-r3PbA50slyMGtBtKAsNszMy3e85P1PsiPxPdXoLcNbEgtckDOpfSQcs6lME4FY8p0DXtTpOUspot-gHDS8k5WQn62UVLysZHmfVl601piYtjIOfnvUl4r; expires=Sat, 22-Jan-2011 19:22:46 GMT; path=/; domain=.google.co.uk; HttpOnly
29
- Server: gws
30
- X-XSS-Protection: 1; mode=block
31
- Transfer-Encoding: chunked
32
-
33
- <!doctype html><html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>Google</title><script>window.google={kEI:"BuxJTKTGMMrW4wb79Ni5DA",kEXPI:"23051,25254,25685,25698,25714",kCSI:{e:"23051,25254,25685,25698,25714",ei:"BuxJTKTGMMrW4wb79Ni5DA",expi:"23051,25254,25685,25698,25714"},ml:function(){},kHL:"en",time:function(){return(new Date).getTime()},log:function(b,d,c){var a=new Image,e=google,g=e.lc,f=e.li;a.onerror=(a.onload=(a.onabort=function(){delete g[f]}));g[f]=a;c=c||"/gen_204?atyp=i&ct="+b+"&cad="+d+"&zx="+google.time();a.src=c;e.li=f+1},lc:[],li:0,Toolbelt:{}};
34
- window.google.sn="webhp";window.google.timers={load:{t:{start:(new Date).getTime()}}};try{}catch(u){}window.google.jsrt_kill=1;
35
- var _gjwl=location;function _gjuc(){var e=_gjwl.href.indexOf("#");if(e>=0){var a=_gjwl.href.substring(e);if(a.indexOf("&q=")>0||a.indexOf("#q=")>=0){a=a.substring(1);if(a.indexOf("#")==-1){for(var c=0;c<a.length;){var d=c;if(a.charAt(d)=="&")++d;var b=a.indexOf("&",d);if(b==-1)b=a.length;var f=a.substring(d,b);if(f.indexOf("fp=")==0){a=a.substring(0,c)+a.substring(b,a.length);b=c}else if(f=="cad=h")return 0;c=b}_gjwl.href="/search?"+a+"&cad=h";return 1}}}return 0}function _gjp(){!(window._gjwl.hash&&
36
- window._gjuc())&&setTimeout(_gjp,500)};
37
- window._gjp && _gjp()</script><style id=gstyle>body{margin:0}#gog{padding:3px 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 td{padding:0}.ts{border-collapse:collapse}em{font-weight:bold;font-style:normal}.lst{width:496px}.tiah{width:458px}input{font-family:inherit}a.gb1,a.gb2,a.gb3,a.gb4{color:#11c !important}#gbar,#guser{font-size:13px;padding-top:1px !important}#gbar{height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}@media all{.gb1{height:22px;margin-right:.5em;vertical-align:top}#gbar{float:left}}a.gb1,a.gb4{color:#00c !important}body{background:#fff;color:black}input{-moz-box-sizing:content-box}a{color:#11c;text-decoration:none}a:hover,a:active{text-decoration:underline}.fl a{color:#4272db}a:visited{color:#551a8b}a.gb1,a.gb4{text-decoration:underline}a.gb3:hover{text-decoration:none}#ghead a.gb2:hover{color:#fff!important}.ds{display:-moz-inline-box}.ds{border-bottom:solid 1px #e7e7e7;border-right:solid 1px #e7e7e7;display:inline-block;margin:3px 0 4px;margin-left:4px}.sblc{padding-top:5px}.sblc a{display:block;margin:2px 0;margin-left:13px;font-size:11px;}.lsbb{background:#eee;border:solid 1px;border-color:#ccc #999 #999 #ccc;height:30px;display:block}.lsb{background:url(/images/srpr/nav_logo14.png) bottom;font:15px arial,sans-serif;border:none;color:#000;cursor:pointer;height:30px;margin:0;outline:0;vertical-align:top}.lsb:active{background:#ccc}.lst:focus{outline:none}.ftl,#fll a{margin:0 12px}#addlang a{padding:0 3px}.gac_v div{display:none}.gac_v .gac_v2,.gac_bt{display:block!important}</style><script>google.y={};google.x=function(e,g){google.y[e.id]=[e,g];return false};</script></head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload="document.f.q.focus();if(document.images)new Image().src='/images/srpr/nav_logo14.png'" ><textarea id=csi style=display:none></textarea><div id=ghead><div id=gbar><nobr><b class=gb1>Web</b> <a onclick=gbar.qs(this) href="http://www.google.co.uk/imghp?hl=en&tab=wi" class=gb1>Images</a> <a onclick=gbar.qs(this) href="http://video.google.co.uk/?hl=en&tab=wv" class=gb1>Videos</a> <a onclick=gbar.qs(this) href="http://maps.google.co.uk/maps?hl=en&tab=wl" class=gb1>Maps</a> <a onclick=gbar.qs(this) href="http://news.google.co.uk/nwshp?hl=en&tab=wn" class=gb1>News</a> <a onclick=gbar.qs(this) href="http://www.google.co.uk/prdhp?hl=en&tab=wf" class=gb1>Shopping</a> <a href="http://mail.google.com/mail/?hl=en&tab=wm" class=gb1>Gmail</a> <a href="http://www.google.co.uk/intl/en/options/" class=gb1 style="text-decoration:none"><u>more</u> &raquo;</a></nobr></div><div id=guser width=100%><nobr><span id=gbn class=gbi></span><span id=gbf class=gbf></span><span id=gbe><a href="/url?sa=p&pref=ig&pval=3&q=http://www.google.co.uk/ig%3Fhl%3Den%26source%3Diglk&usg=AFQjCNH9dUJQAsNWnO3XKq2EIPgFbczqlA" class=gb4>iGoogle</a> | </span><a href="/preferences?hl=en" class=gb4>Settings</a> | <a href="https://www.google.com/accounts/Login?hl=en&continue=http://www.google.co.uk/" class=gb4>Sign in</a></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div></div> <center><br clear=all id=lgpd><div id=lga><table cellpadding=0 cellspacing=0 border=0><tr><td align=right valign=bottom><img src=images/hp0.gif width=158 height=78 alt="Google"></td><td valign=bottom><img src=images/hp1.gif width=50 height=78 alt=""></td><td valign=bottom><img src=images/hp2.gif width=68 height=78 alt=""></td></tr><tr><td class=h align=right valign=top><b></b></td><td valign=top><img src=images/hp3.gif width=50 height=32 alt=""></td><td valign=top class=h><font color=#666666 style=font-size:16px><b>UK</b></font></td></tr></table><br></div><form action="/search" name=f><table cellpadding=0 cellspacing=0><tr valign=top><td width=25%>&nbsp;</td><td align=center nowrap><input name=hl type=hidden value=en><input name=source type=hidden value=hp><input type=hidden name=ie value="ISO-8859-1"><div class=ds style="height:32px;margin:4px 0"><input autocomplete="off" maxlength=2048 name=q class="lst" title="Google Search" value="" size=57 style="background:#fff;border:1px solid #ccc;border-bottom-color:#999;border-right-color:#999;color:#000;font:18px arial,sans-serif bold;height:25px;margin:0;padding:5px 8px 0 6px;vertical-align:top"></div><br style="line-height:0"><span class=ds><span class=lsbb><input name=btnG type=submit value="Google Search" class=lsb></span></span><span class=ds><span class=lsbb><input name=btnI type=submit value="I&#39;m Feeling Lucky" class=lsb></span></span></td><td nowrap width=25% align=left class=sblc><a href="/advanced_search?hl=en">Advanced Search</a><a href="/language_tools?hl=en">Language Tools</a></td></tr></table></form><div style="font-size:83%;min-height:3.5em"><br></div><div id=res></div><span id=footer><center id=fctr><div style="font-size:10pt"><div id=fll style="margin:19px auto 19px auto;text-align:center"><a href="/intl/en/ads/">Advertising&nbsp;Programmes</a><a href="/services/">Business Solutions</a><a href="/intl/en/about.html">About Google</a><a href="http://www.google.com/ncr">Go to Google.com</a></div><p id=shf0 style=display:none;behavior:url(#default#homePage)><font size=-1><a href="/aclk?sa=L&ai=C-EOFCetJTPGDJceu4gbipvnpBsX4n3yvu5nHCs2tk5cREAEgwVRQvpyhyfj_____AWC7BqoElQFP0KJWk3st_gZkFJygtBUZfBL9ZNO5N23xlbyz1Q9GaqRFhKJWYP3mW3JSPzlPIkR8wJg47cMmIx5Qn0KivOoaPEF9wVR8zA9SJ1jnC40nbLq4-5JdzV6akpW1vzLQSvjeb8fUmK3yiovAh1qjoYwW9tKfPmpzezBnE6NXVkDwLRJKcElZ8H0SK2hLnuQpTon9vX2CMg&num=1&sig=AGiWqtxoO9jus5oOzDTzGXam2iNSqCn9NQ&adurl=/mgyhp.html" onclick=xz()>Make Google my homepage</a></p><script>(function(){var a=document.getElementById("shf0"),b="http://www.google.co.uk/";try{a.isHomePage(b)||(a.style.display="block")}catch(z){}window.xz=function(){try{a.setHomePage(b);var c=new Image;c.src="/gen_204?mgmhp=shf0&ct=c&cd="+a.isHomePage(b);window.wy=c}catch(z){}}})();</script></div><p style="color:#767676;font-size:8pt">&copy; 2010 - <a href="/intl/en/privacy.html">Privacy</a></p></center></span> <div id=xjsd></div><div id=xjsi><script>if(google.y)google.y.first=[];if(google.y)google.y.first=[];google.dstr=[];google.rein=[];window.setTimeout(function(){var a=document.createElement("script");a.src="/extern_js/f/CgJlbhICdWsgACswRTgBLCswWjgCLCswDjgXLCswFzgHLCswJzgELCswPDgDLCswCjhxQB0sKzAlOMqIASwrMEA4EiwrMEE4BSwrMBg4BSwrMCY4CyyAAheQAhQ/eGa7PEgbt-w.js";(document.getElementById("xjsd")||document.body).appendChild(a);if(google.timers&&google.timers.load.t)google.timers.load.t.xjsls=(new Date).getTime();},0);
38
- ;google.neegg=1;google.y.first.push(function(){var form=document.f||document.f||document.gs;google.ac.i(form,form.q,'','','',{o:1,sw:1});google.History&&google.History.initialize('/')});if(google.j&&google.j.en&&google.j.xi){window.setTimeout(google.j.xi,0);google.fade=null;}</script></div><script>(function(){
39
- var b,d,e,f;function g(a,c){if(a.removeEventListener){a.removeEventListener("load",c,false);a.removeEventListener("error",c,false)}else{a.detachEvent("onload",c);a.detachEvent("onerror",c)}}function h(a){f=(new Date).getTime();++d;a=a||window.event;var c=a.target||a.srcElement;g(c,h)}var i=document.getElementsByTagName("img");b=i.length;d=0;for(var j=0,k;j<b;++j){k=i[j];if(k.complete||typeof k.src!="string"||!k.src)++d;else if(k.addEventListener){k.addEventListener("load",h,false);k.addEventListener("error",
40
- h,false)}else{k.attachEvent("onload",h);k.attachEvent("onerror",h)}}e=b-d;function l(){google.timers.load.t.ol=(new Date).getTime();google.timers.load.t.iml=f;google.kCSI.imc=d;google.kCSI.imn=b;google.kCSI.imp=e;google.report&&google.report(google.timers.load,google.kCSI)}if(window.addEventListener)window.addEventListener("load",l,false);else if(window.attachEvent)window.attachEvent("onload",l);google.timers.load.t.prt=(f=(new Date).getTime());
41
- })();
42
- </script>