Trying to automate some site crawling and especially file downloading using perl & Firefox::Marionette.
This is the short example code (for the file download).
#!/usr/bin/env perl
use 5.014;
use warnings;
use Firefox::Marionette();
use Path::Tiny;
my $ff = Firefox::Marionette->new();
#my $ff = Firefox::Marionette->new(
# visible => 1
#);
#my $dwl = 'https://www.curseforge.com/wow/addons/dazaralor-totems/download/2610166/file'; # direct download link (not work correctly)
my $dwl = 'https://www.curseforge.com/wow/addons/dazaralor-totems/download/2610166'; # download link, leading to redirect page
$ff->go($dwl);
while(!$ff->downloads()) { sleep 1 }
while($ff->downloading()) { sleep 1 }
foreach my $p ($ff->downloads()) {
say $p;
path($p)->copy('./toto.zip');
}
$ff->quit;
Running the script, it hangs. So, tried the visible => 1
to get real window, and the script hangs because waiting for confirmation of the open/save dialog as in the bellow picture:
After clicking OK, the file is downloaded.
The question is, how to bypass the confirmation dialog, to be possible to run the script in headless mode without manual clicking.
Also, any other method how to download files from the above site is welcomed, it is behind cloudflare so i failed to using some basic LWP
.