Lex Williams
9/5/2008 6:31:00 PM
Adam Akhtar wrote:
> regarding mechanize, ive been tinkering with it and i want to knwo if
> after you grab a webpage you can access the page`s html rather than
> using the object returned from .get('...')
you can access mechanize's current page using :
agent.page.body ( or whatever method you want to call on it )
and you wouldn't need to store the current page
> i wrote a huge script which took me hours and uses regular expressions
> to scrape pages off ebay. It took me ages to write good regseps so i
> dont want to thorw them away. I however ran into a problem regarding
> logging into ebay so turned to mechanize. I basicaly want to login to
> ebay using mechanize and then use my own regexps on a grabbed pages
> html. Im not sure how to get that html though...
interesting_stuff = agent.page.body.scan(/#{regex here}/i)
You only need the #{} if you have the regex stored in a variable
> i checked the ruby core section for mechanize but its thin and the
> examples dont cover this situtation, they all presume you will use
> hrpicot etc.
>
> any one help me on this one?
mechanize has an examples and a guide section , which pretty much covers
anything you would need to do .
If you have further questions , ask and I will do my best to answer them