simple python script for downloading multiple files from a html/web page

python

I am a kind of person who downlaod lots of cool files from internet.And in vacation time, I just chill with my no internet days. so i used to download lots of Ebooks, Audio books, songs(mp3), videos , mostly i download from torrents or youtube where downloading is very simple.

But whenever i need a ebook, mp3 files i often need to download it from a website/webpage with tens and thousands of mp3 files in it which i downlaoded one by one. So i searched for a firefox addon and found one named “Download them all”. With this you can specify which kind file(“mp3/”jpg””) to download and select individually too.But still i lack the control over download because the page i used has so many other url so i need to filter it more to get it. or i need to download all and manually seperated. and most of all if i try downlaoding all file in one, my firefox often failed to downlaod  them all. it get struck somewhere.And so i thought of write a simple python sript to filter the thing and get specific urls for me .

Here it is, the below code will result a list of .mp3 url in the particular web page into a .txt file.Then i am using aria2c downloader to download them all. beleive me its the fastest downloader i have ever seen in my life.it even support torrents . just input the .txt that we generated i will download them all in a flash .

Code : urlgrabber.py

my python script has Beautifulsoap (bs4) depandancy you need to install it to run this .Here i have created the .txt file maually . so create a file and feed the path in the code i this case i created the file in my aria2c directory .Also feed the source html page url.

just do this. Note: i am using python3.56qobb1v

If everything ran properly and you populated the .txt file. just go to command prompt and navigate to aria2c and run this code

bbhfm94C:\Users\User2\Desktop\aria2-1.28.0-win-64bit-build1>aria2c -i FILENAME.txt

The files will be downloaded in the same directory from which you ran the code

Advertisements