From: William James Date: 2006-03-01T20:18:39+09:00 Subject: Re: Getting data from html-ish like crap. spam_monkey wrote: > Hi, > I wanted to learn something, and choosed ruby, > since it looked awesome, and can't say it isn't. > I am not expierienced programmer (tried some > Pascal, then PHP), and decided to do something > small, but usefull. Let's get straight into the > problem. > > At the url: > https://www.knightonlineworld.com/index.php?pg=rankings&sub=2&radServer=1&clanid=12199 > I've got something similar to html (at least > it's not table based, but still damn ugly code > there) with online statistics. > > I don't want to parse that one, i just want to > 'crop that crap' and retrive informations from > data inside one element a div with an > id="bleet". There are tables in there, but seems > impossible to navigate there. > > I am really suck at strings :( > > > Quatrina # i want this > 52 # > Shaman # > 563 # and this one > # preferable everything :P > > I would want to hash that data, to have it > usefull in future (aiming a rails app in > future), but selecting two columns in each row, > located in the last table in the id'ed element > placed in not-well-made document looks > impossible for me. I don't even know where to > start, and it's FAR away from the things i > wanted to do (counting numbers*, assinging > additional data). > > > All i've done already is getting the document: > > > require 'uri' > > require 'net/http' > > > > trg = "https://www.knightonlineworld.com/index.php?pg=rankings&sub=2&radServer=1&clanid=12199" > > puts 'processing' + cel + " :\n" > > > > r = Net::HTTP.get_response(URI.parse(trg).host, URI.parse(trg).path) > > > > puts r.body r.body does not contain "Quatrina".