You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

how to extract an mp3's url from m3u playlist (and download the file)?

Hi!

You might have seen this post in the Automator part of the forum... but I might have posted it in the wrong place (got no interest:( )

I've managed to get automator to retrieve (and save to hdd) an .m3u playlist from a radio's website that broadcasts a program I like in mp3.
inside this m3u playlist is the link to an actual mp3 file... both the m3u and the mp3 change every week.
If I drag the m3u to TextEdit it opens up and I can see the 3 lines of "source code" of which the last line is the full url of the mp3 file ( http://www .thatradiosurl.com/audio/show-shownumber.mp3)

My question is as follows: how do I get automator (or applescript) to 'extract' that url and save that file to my hard drive (so I can automatically add it to a playlist in itunes (and retrieve the show on my ipod at sync))??


I'll save the final workflow as an iCal event that will hopefully grab this show every week.

before you ask... no, that show is not available as a podcast! 🙂 I wish it were... I think they're a bit slow on catching up with the tech.

bear with me... I have very little (euphemism) knowledge of applescript.

thanks to all!
have a great day
d

pbg4_15"_1.67, Mac OS X (10.4.6)

Posted on May 30, 2006 5:23 AM

Reply
Question marked as Top-ranking reply

Posted on May 30, 2006 9:32 AM

Hi!

You might have seen this post in the Automator part
of the forum... but I might have posted it in the
wrong place (got no interest:( )

I've managed to get automator to retrieve (and save
to hdd) an .m3u playlist from a radio's website that
broadcasts a program I like in mp3.
inside this m3u playlist is the link to an actual mp3
file... both the m3u and the mp3 change every week.
If I drag the m3u to TextEdit it opens up and I can
see the 3 lines of "source code" of which the last
line is the full url of the mp3 file ( http://www
.thatradiosurl.com/audio/show-shownumber.mp3)


You already got the playlist into a text file, you have two options:
1. use Automator's 'Get Link URLs from Webpages' action to extract the URL. 'Get Link URLs from Webpages' is under Safari lib.
2. run Automator Python script from 'Get Link URLs from Webpages' in AppleScript. The script below with get your mp3 URLs:

set playlist_file to "/path/to/playlist/file.txt" -- change to your actual playlist file path
set _URLs to do shell script "/System/Library/Automator/Get\\ Link\\ URLs\\ from\\ Webpages.action/Contents/Resources/links file://" & quoted form of playlist_file

set mp3_URLs to ""
repeat with _URL in paragraphs of _URLs
if _URL contains ".mp3" then set mp3_URLs to mp3_URLs & _URL & (ASCII character 10)
end repeat

mp3_URLs is the list you want you extract.
1 reply
Question marked as Top-ranking reply

May 30, 2006 9:32 AM in response to dynamodave

Hi!

You might have seen this post in the Automator part
of the forum... but I might have posted it in the
wrong place (got no interest:( )

I've managed to get automator to retrieve (and save
to hdd) an .m3u playlist from a radio's website that
broadcasts a program I like in mp3.
inside this m3u playlist is the link to an actual mp3
file... both the m3u and the mp3 change every week.
If I drag the m3u to TextEdit it opens up and I can
see the 3 lines of "source code" of which the last
line is the full url of the mp3 file ( http://www
.thatradiosurl.com/audio/show-shownumber.mp3)


You already got the playlist into a text file, you have two options:
1. use Automator's 'Get Link URLs from Webpages' action to extract the URL. 'Get Link URLs from Webpages' is under Safari lib.
2. run Automator Python script from 'Get Link URLs from Webpages' in AppleScript. The script below with get your mp3 URLs:

set playlist_file to "/path/to/playlist/file.txt" -- change to your actual playlist file path
set _URLs to do shell script "/System/Library/Automator/Get\\ Link\\ URLs\\ from\\ Webpages.action/Contents/Resources/links file://" & quoted form of playlist_file

set mp3_URLs to ""
repeat with _URL in paragraphs of _URLs
if _URL contains ".mp3" then set mp3_URLs to mp3_URLs & _URL & (ASCII character 10)
end repeat

mp3_URLs is the list you want you extract.

how to extract an mp3's url from m3u playlist (and download the file)?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.