I'm trying to use wget to download the mp3 files from https://musicforprogramming.net/ . As you can see, there is a link to each track page (e.g. https://musicforprogramming.net/?twentythree) from the home page, and a link to the mp3 file on each track page (e.g. https://datashat.net/music_for_programming_23-panda_magic.mp3).

I thought this command would download all of the mp3 files for me:

wget -r --no-parent --accept mp3,MP3 -nd https://musicforprogramming.net/

But it seems to ignore them, and only scan through the html pages without downloading any.

What should I do to have wget download all ~50 mp3 files that are linked there?

1 Answer 1


I believe by default wget will stick to the current domain only. So if the files were hosted on musicforprogramming.net it'd download them.

Use -D to pass a list of accepted domains:

(As pointed out in the comments by Hugh Grigg, you also need --span-hosts

wget -r --no-parent --accept mp3,MP3 -nd -D datashat.net,musicforprogramming.net --span-hosts https://musicforprogramming.net/

  • Note, this still doesn't technically work, because the site appears to be doing something clever to block downloaders. May 22, 2018 at 13:05
  • It seems to require a combination of this and --span-hosts.
    – MHG
    May 22, 2018 at 13:23
  • @HughGrigg葛修远 thanks, that works so I'll update my answer!. May 22, 2018 at 15:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .