1

I'd like to download all mp3s from the blog pinchy&friends. I tried the script

for mp3 in "http://www.pinchyandfriends.com/dl.php?mp3=*.mp3"; do
    wget "http://www.pinchyandfriends.com/dl.php?mp3=${mp3}.mp3"
    sleep 5
done

But all that results in is an attempt to download the literal http://www.pinchyandfriends.com/dl.php?mp3=*.mp3. Am I misunderstanding something about the script I wrote and/or is there a better way to do what I'm attempting? Thanks in advance.

5
  • This won't work like this. A webpage is not a file-system where you can do globbing (using '*' and '?') from a single URL-String. You would need to download the html-file (with wget) from that URL and then follow the links from there which is non-trivial. You need to account for all kinds of links, like relative links and possibly also stuff loaded later with javascript.
    – MadMike
    Jan 14, 2014 at 9:30
  • Can you add why you want to do this by script? Maybe we can find you a easier alternative.
    – MadMike
    Jan 14, 2014 at 9:32
  • Thanks for the explanation about qlobbing. I see now what I was doing wrong. It looks like Krzysztof Rosiński solved my problem here: http://stackoverflow.com/questions/21109256/is-it-possible-to-download-all-mp3s-from-a-domain-or-url/21109556?noredirect=1#21109556 Jan 14, 2014 at 9:36
  • Grrr. You cross-poster!
    – don.joey
    Jan 14, 2014 at 10:37
  • That is an excellent answer you got on SO, though!
    – don.joey
    Jan 14, 2014 at 10:38

2 Answers 2

1

While don.joey's answer directly deals with your question about wget, it's worth noting that there are a plethora of browser plug-ins that can also do this for you. The ones I've used are linky, downloadThemAll, FlashGotand SnapLinksPlus.

That said, becoming proficient in curl and wget commands is never a bad thing. ;-)

1
  • I'd like to add jDownloader which has been a great tool for all my mass-downloading needs for some time. Also +1 for "becoming proficient in curl and wget commands"
    – MadMike
    Jan 14, 2014 at 9:41
0

Use

wget -r -P /save/location -A mp3 http://www.domain.com

Source

4
  • Since the default length is 5, won't this recurse? I think, it must be wget -r -l 2 -P /save/location -A mp3 http://www.domain.com.
    – nitishch
    Jan 14, 2014 at 9:06
  • When I run that, the only thing it attempts is a download of www.pinchyandfriends.com/index.html. It looks like the recursive search doesn't work as intended for some reason. Jan 14, 2014 at 9:27
  • I see what you mean. The links on the home page are js-based. Hmm. Not sure how to do this then.
    – don.joey
    Jan 14, 2014 at 10:36
  • I wanted to delete my post, but I'll keep it here for reference' sake. The accepted answer on this cross-post can be found on stackoverflow.com/questions/21109256/…‌​-from-a-domain-or-url/21109556?noredirect=1#21109556.
    – don.joey
    Jan 14, 2014 at 10:39

You must log in to answer this question.

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