Category Archives: Search

How to use cURL to download multiple MP3s/Photos/Videos at once

In response to my previous post about cURL as a swiss army knife for web pages, a number of people have asked my about real example to use pattern based downloading of cURL, so here is a small post about that.

Disclaimer: Please note that this is for educational purpose only and illegal use is not recommended or endorsed by me.

Now, the real part:

Let’s say you wanted to download multiple files, text, data, mp3 or videos etc. Take an example of MP3 sngs for new hindi movie Delhi Belly. These songs are available on multiple sites including one URL here.

Again note, that downloading songs from this or any other site may be against local & any other applicable laws based upon where you reside.

Here are the steps

1) Open the URL.

2) You would find that the download URL is something like http://link1.songspk.pk/song1.php?songid=8520  for the first song. and the download URL for the last song is something like http://link1.songspk.pk/song1.php?songid=8529

3) Now, if you wanted to use cURL pattern base download use, you can do something like:

curl -L http://link1.songspk.pk/song1.php?songid=85{20,21,22,23,24,25,26,27,28,29} -O

-L option is to follow redirect, in case, the server is throwing some intermediate redirect.

-O option is to save them as local files rather than sending it to STDOUT.

4) This would download all files one by one and it would have having typing each file individually, handling redirects, and then saving them to local files.

5) After that you may need to rename all of them as MP3s, s you can run ren * *.mp3 (on windows) or mv * *.mp3 (on UNIX).

Happy cURL ing …

for any questions or doubts, please post in comments.

EDIT: songs.pk has moved to songspk.pk after the old domain was banned.