[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

mechnize redirected url

akanksha.baid

8/4/2006 7:02:00 AM

I am using mechanize to scrape and I know that mechanize goes to the
url a browser would redirect me to. However is there some way to
capture what this new url is?

ex: abcd.com ----------------redirected to --------------------->
xyz.com
how can I use mechnize to find xyz.com given abcd.com?

Thanks!
-A

1 Answer

Alex Young

8/4/2006 9:46:00 AM

0

akanksha wrote:
> I am using mechanize to scrape and I know that mechanize goes to the
> url a browser would redirect me to. However is there some way to
> capture what this new url is?
>
> ex: abcd.com ----------------redirected to --------------------->
> xyz.com
> how can I use mechnize to find xyz.com given abcd.com?
>
> Thanks!
> -A
>
>
I think I'm right in saying that:

agent = WWW::Mechanize.new
page = agent.get('http://abc...)
puts page.uri.to_s
#=> "http://xyz...

Could be wrong, though. Give it a try.

--
Alex