good point Brian.

To explain really quickly what I did here is the hpricot line:

(doc/"div#profile_stats/p/p").inner_text.match(/^Last Visit: (\w+)/)[1]


I search for a div with id profile_stats, then inside it, I look for a <p>,
inside it I look for another <p>, extract the inner text and apply a simple
regexp to extract the text you want.

Hpricot is awesome ;)

-Matt


On 1/16/08, Brian Chapados <[EMAIL PROTECTED]> wrote:
>
>
> > I've gotten as far as loading the file with:
> >
> >  doc = Hpricot(open("some_page.html"))
> >
> > but its not obvious what to do from there.  Appreciate any help
> > speeding up my learning curve.
>
> The [showcase] and [tutorials] on the [Hpricot wiki] are excellent
> resources if you want to understand how Matt came up that code.
>
> [Hpricot wiki]: http://code.whytheluckystiff.net/hpricot/wiki
> [showcase]:
> http://code.whytheluckystiff.net/hpricot/wiki/AnHpricotShowcase
> [tutorials]:
> http://code.whytheluckystiff.net/hpricot/wiki/HpricotTutorials
> >
>


-- 
            --------
http://railsontherun.com

--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---

Reply via email to