My Python knowledge is little better the yours I'm afraid Zeno_, but I do have a Perl script that I've used in the past to save a pdf file to my computer from a url, and I suspect it would also work for ePub files.
Hope this helps.
WmFS
#===========================================
# DownloadPDF.pl
#===========================================
# Set $file to name of the output file
# Set $url to remote file
#===========================================
use LWP::UserAgent;
$file = "The Perl Review (March 2002).pdf";
$url = "https://www.theperlreview.com/Issues/The_Perl_Review_0_1.pdf";
$ua = LWP::UserAgent->new;
$req = HTTP::Request->new(GET => $url);
$res = $ua->request($req);
if ($res->is_success)
{
open OUTFILE, ">" . $file;
$record = $res->content;
print OUTFILE $record;
close OUTFILE;
}
else
{
print "Failed to download $url\n";
$record = $res->content;
print $record;
}
Last edited by wmfs; 06-28-2012 at 09:15 AM.
|