in reply to perl script to capture streaming audio

While you can do it with perl, I swear by The Right Tool for The Right Job.

However, it's a bit unclear as to what you want to do. If you want to get a streamed file that's about one hour long, you can do this:

curl -f -r 0-58982400 -O "http://url"

This will get the first 58982400 bytes of the file, which is roughly one hour of sound at 128kbps (ie 128*60*60*1024/8 - adjust as you see fit). If you want the transfer to run for one hour (or 3600 seconds), do this:

curl -f -m 3600 -O "http://url"

cURL is most likely installed on your system. If not, it's freely available for most platforms at curl.haxx.se

The -f option makes sure that it doesn't write a file if there's an error (who wants empty files anyway?), and the -O option tells it to save the file with the same name as on the server. Alternately, you can use -o "filename.mp3" for a specific filename. In case the server wants a referer, use -e "http://server/". There are many more switches, so have a gander at the manpage... Good luck! And have a great yule! =)

Edit: Fixed idiotic error. Bits != bytes.

Replies are listed 'Best First'.
Re: Re: perl script to capture streaming audio
by Anonymous Monk on Dec 21, 2002 at 05:19 UTC
    this is very good ... i have installed it on my linux box but am having problems with it (installation is fine but don't know how to use it).. the url i am trying to capture the streaming audio is:
    http://www.wjse.com/wmplayer.asp
    and i checked the html source and can see that the file with the audio is :
    http://www.wjse.com/jseaudio.asx
    can you please help me out ... thanks

      Ah. Now this is bordering on probably being against the DMCA, but I'm not in America, so I don't mind. ;)

      One thing you can try is just curling the url to stdout to see what's in it. This might look really weird if it's binary, but in this case it's not.

      % curl http://www.wjse.com/jseaudio.asx <asx version = "3.0"> <title>WJSE Live Stream For Dial-up Connections</title> <entry> <BANNER HREF = "http://wjse.com/images/wmbanners/lavalife120x30.g +if" /> <ref href = "mmst://corp.wjse.com/audio"/> </entry> </asx>

      It's the part with the ref tag that you want. But the mmst protocol isn't supported by cURL. I believe it's propietary to some company. Probably MS ;).

      I haven't tried it myself, but I've been led to believe that asfrecorder will do the job.

      So much for discussing perl eh? - I didn't find anything but XML::ASX which doesn't do what we need here.

      Hi,

      This is beginning to look more lile a what is my favorite stream player poll. But looking at your link, I would say mplayer.


      ---------------------------
      Dr. Mark Ceulemans
      Senior Consultant
      IT Masters, Belgium