Skip to content

Instantly share code, notes, and snippets.

@tbuehlmann
Created September 23, 2014 10:10
Show Gist options
  • Save tbuehlmann/b6990cb99295d430dbef to your computer and use it in GitHub Desktop.
Save tbuehlmann/b6990cb99295d430dbef to your computer and use it in GitHub Desktop.
require 'httparty'
require 'oga'
puts HTTParty::VERSION, Oga::VERSION
response = HTTParty.get('https://google.com')
document = Oga.parse_html(response.body)
0.13.1
0.1.1
/home/tobias/.gem/ruby/2.1.2/gems/oga-0.1.1/lib/oga/xml/parser.rb:86:in `on_error': Unexpected $end with value false on line 1: (Racc::ParseError)
=> 1: <!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="de" (more)
2: function _gjh(){!_gjuc()&&window.google&&google.x&&google.x({id:"GJH"},function( (more)
3: function ca(a,b,c){var d="on"+b;if(a.addEventListener)a.addEventListener(b,c,!1) (more)
4: document.getElementsByTagName("head")[0]).appendChild(c)},F=function(a){for(var (more)
5: p("trh",pa);p("tev",D);if(k.a("1")){var H=k.a("1"),qa=k.a(""),ra=k.a(""),sa=wind (more)
6: I.m="";I.l=[];H||x.push(["gl",{url:"//ssl.gstatic.com/gb/js/abc/glm_e7bb39a7e1a2 (more)
from /home/tobias/.gem/ruby/2.1.2/gems/oga-0.1.1/lib/oga/xml/parser.rb:45:in `yield_next_token'
from /home/tobias/.gem/ruby/2.1.2/gems/racc-1.4.12/lib/racc/parser.rb:331:in `_racc_yyparse_c'
from /home/tobias/.gem/ruby/2.1.2/gems/racc-1.4.12/lib/racc/parser.rb:331:in `yyparse'
from /home/tobias/.gem/ruby/2.1.2/gems/oga-0.1.1/lib/oga/xml/parser.rb:103:in `parse'
from /home/tobias/.gem/ruby/2.1.2/gems/oga-0.1.1/lib/oga/oga.rb:25:in `parse_html'
from oga_test.rb:7:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment