algonquin has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,
I am trying to screen-scrape by using WWW:Mechanize. When I get to a page that has different frames.

$agent->get("http://some-web-site/"); $agent->follow_link( url_regex => qr/blablabla/i ); my $stream = HTML::TokeParser->new(\$agent->{content});

returns the source from frame that I'm not interested in. How can I get to a specific frame? Thanks.

20040923 Edit by Corion: Added formatting

Replies are listed 'Best First'.
Re: Web page with frames
by tachyon (Chancellor) on Sep 24, 2004 at 10:56 UTC

    The main frame contains HTML like: <frame name="good_stuff" src="blah.htm"> so just parse it and go and get http://somesite.com/blah.htm for the good stuff.

    cheers

    tachyon

      The link is pointing to a java script, what do I do then? Thanks for your help.

        RTFS is what you do. The javascript function with either be inline with the HTML or in an included .js file. Find it. Read it. Replicate what it does. That will alomst certainly be a redirect like window.location = '.....' more or less.

        cheers

        tachyon

Re: Web page with frames
by ggg (Scribe) on Sep 24, 2004 at 22:14 UTC
    Frames are a pain on more levels that that! I wish they could be banned!
    ggg