in reply to Re: Need help with WWW::Mechanize and Chrome cookies
in thread Need help with WWW::Mechanize and Chrome cookies

The WMC works interactively with the chrome browser. The login info is loaded from the cookie and the target page is reached.
  • Comment on Re^2: Need help with WWW::Mechanize and Chrome cookies

Replies are listed 'Best First'.
Re^3: Need help with WWW::Mechanize and Chrome cookies
by bakiperl (Beadle) on Jul 09, 2021 at 11:33 UTC
    I also wonder why this code in WMC
    my $file_map = $mech->saveResources_future( target_file => 'this_page.html', target_dir => 'this_page_files/', wanted => sub { $_[0]->{url} =~ m!^https?:!i }, )->get();
    downloads the files in these two links
    <link rel="stylesheet" href="css/file.css" type="text/css" /> <img id="logo" src="/images/image.gif" alt="" title="" />
    But not this one
    <a class="txt" href="file.txt"> Text File </a>

      The latter is a hyperlink to another page/resource, you would never want the 'Save Complete page' method to follow links like that, it's not what it's for. Saving the same page in a browser will not save hyperlink targets.

        In this case, is there a different approach to download the hyperlink targets from within WMC?
Re^3: Need help with WWW::Mechanize and Chrome cookies
by Anonymous Monk on Jul 09, 2021 at 11:45 UTC
    Heh. You said this is busted
    WWW::Mechanize->new( cookie_jar => $cookie_jar, );

    you said its not picking up cookie and sending it. But the code does no checking of sent cookies. So how?