From aaron at tenderlovemaking.com Thu Oct 2 19:48:12 2008
From: aaron at tenderlovemaking.com (Aaron Patterson)
Date: Thu, 2 Oct 2008 16:48:12 -0700
Subject: [Mechanize-users] [ANN] mechanize 0.8.4 Released
Message-ID: <20081002234812.GB26812@mac-mini>
mechanize version 0.8.4 has been released!
*
*
The Mechanize library is used for automating interaction with websites.
Mechanize automatically stores and sends cookies, follows redirects,
can follow links, and submit forms. Form fields can be populated and
submitted. Mechanize also keeps track of the sites that you have visited as
a history.
Changes:
### 0.8.4
* Bug Fixes:
* Setting the port number on the host header.
* Fixing Authorization headers for picky servers
*
*
--
Aaron Patterson
http://tenderlovemaking.com/
From cschaller at gmail.com Fri Oct 31 11:50:04 2008
From: cschaller at gmail.com (Cindy Schaller)
Date: Fri, 31 Oct 2008 10:50:04 -0500
Subject: [Mechanize-users] Mechanize/Hpricot -- Strings parsing question
Message-ID: <68C23615CF00485794B58C75FDBA5D89@CSWeb1>
Hello.
I am new to Hpricot and Mechanize, but so far I am loving it.
I am trying to parse out some text inside of an HTML page and hoped that I
could get some advice from this group.
I have the following code:
Wii Game for Sale
American Idol
Ad #: 12345
I want to get each line as a separate value to insert into a database. What
is the best way to get each line? Can I use the HTML tags in some way as
the beginning and ends of the strings to get the values in between?
Thanks!!
Cindy
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From aaron.patterson at gmail.com Fri Oct 31 12:16:27 2008
From: aaron.patterson at gmail.com (Aaron Patterson)
Date: Fri, 31 Oct 2008 09:16:27 -0700
Subject: [Mechanize-users] Mechanize/Hpricot -- Strings parsing question
In-Reply-To: <68C23615CF00485794B58C75FDBA5D89@CSWeb1>
References: <68C23615CF00485794B58C75FDBA5D89@CSWeb1>
Message-ID: <6959e1680810310916h16caf31bu700a3efcf229f38a@mail.gmail.com>
Hi Cindy,
On Fri, Oct 31, 2008 at 8:50 AM, Cindy Schaller wrote:
> Hello.
>
>
>
> I am new to Hpricot and Mechanize, but so far I am loving it.
>
>
>
> I am trying to parse out some text inside of an HTML page and hoped that I
> could get some advice from this group.
>
>
>
> I have the following code:
>
>
>
>
>
> Wii Game for Sale
>
> American Idol
>
> Ad #: 12345
>
>
Assuming you have already been able to find the "strong" tag, I would
do something like this:
strong_tag.inner_text.split(/
]*>/).map { |x| x.strip }
Hope that helps.
--
Aaron Patterson
http://tenderlovemaking.com/
From cschaller at gmail.com Fri Oct 31 17:23:08 2008
From: cschaller at gmail.com (Cindy Schaller)
Date: Fri, 31 Oct 2008 16:23:08 -0500
Subject: [Mechanize-users] Mechanize/Hpricot -- Strings parsing question
In-Reply-To: <6959e1680810310916h16caf31bu700a3efcf229f38a@mail.gmail.com>
References: <68C23615CF00485794B58C75FDBA5D89@CSWeb1>
<6959e1680810310916h16caf31bu700a3efcf229f38a@mail.gmail.com>
Message-ID: <3E30929AF7A14E92BC9CCD10ECFF18F9@CSWeb1>
Thanks Aaron.
That worked great.
Now I know that this is going to show my lack of Ruby knowledge, but I'm
still learning.
How can I parse the same set of HTML, but only get the first 2 lines and not
the third line.
My current code is this:
listing.inner_text.split(/
]*>/).map { |x| x.strip }
THANKS!!!
-----Original Message-----
From: mechanize-users-bounces at rubyforge.org
[mailto:mechanize-users-bounces at rubyforge.org] On Behalf Of Aaron Patterson
Sent: Friday, October 31, 2008 11:16 AM
To: Ruby Mechanize Users List
Subject: Re: [Mechanize-users] Mechanize/Hpricot -- Strings parsing question
Hi Cindy,
On Fri, Oct 31, 2008 at 8:50 AM, Cindy Schaller wrote:
> Hello.
>
>
>
> I am new to Hpricot and Mechanize, but so far I am loving it.
>
>
>
> I am trying to parse out some text inside of an HTML page and hoped that I
> could get some advice from this group.
>
>
>
> I have the following code:
>
>
>
>
>
> Wii Game for Sale
>
> American Idol
>
> Ad #: 12345
>
>
Assuming you have already been able to find the "strong" tag, I would
do something like this:
strong_tag.inner_text.split(/
]*>/).map { |x| x.strip }
Hope that helps.
--
Aaron Patterson
http://tenderlovemaking.com/
_______________________________________________
Mechanize-users mailing list
Mechanize-users at rubyforge.org
http://rubyforge.org/mailman/listinfo/mechanize-users