You know those songs on Raaga, MusicIndiaOnline, etc? The ones you can listen to but can’t download?
Well, you can download them.
It’s always been possible to download these files. After all, that’s how you get to listen to them in the first place. What stopped you is security by obscurity. You didn’t know the location where the song was stored, but if you did, you could download them.
So how do you figure out the URL to download the file from?
Let’s take a look at MusicIndiaOnline first. When you click on a song, it pops up in a new window. You can’t figure out the address of that window because the address bar is hidden, but you can get it by hovering over the link before clicking, or by right-clicking and copying the link location. It’s always something like this:
http://www.musicindiaonline.com/p/x/FAfgqz0HzS.As1NMvHdW/
It always has the same structure: http://www.musicindiaonline.com/p/x/something/. Let’s call that the something the song’s key.
Now, what this page does is play a .SMIL file. An SMIL file is a text file that has a list of songs to play. This file is always stored at
http://www.musicindiaonline.com/g/r/FAfgqz0HzS.As1NMvHdW/play2.smil
(Notice that the key remains the same.) If you type this into your browser, you’ll get a text file that you can open in Notepad. You’ll find that it has a bunch of lines, two of which are interesting. There’s one that reads:
<meta name="base" content="http://205.134.247.2/QdZmq-LL/">
The content="…" part gives you the first part of the song’s address. Then there’s a line that reads:
<audio src="ra/film/…"/>
The src="…" part gives you the rest of the address. Putting the two together, you have the full URL at which to download the song.
Except, they’re a bit smart about it. These songs are meant to be played on RealPlayer, and not downloaded. So if you try to access the page using your browser, you get a 404 Page not found error. But if you typed the same page into RealPlayer, you can hear the song play.
To actually download the song, you need to fool the site into thinking that your browser is RealPlayer. So first, you need to get a good browser like Firefox. Then download the User Agent Switcher add-on. Change your user agent to "RMA/1.0 (compatible; RealMedia)" and try the same song: you should be able to download it.
Let me summarise:
- Right-click on the song you want to play, and copy the URL
- Extract the key. In the URL http://www.musicindiaonline.com/p/x/FAfgqz0HzS.As1NMvHdW/ the key is FAfgqz0HzS.As1NMvHdW
- Open http://www.musicindiaonline.com/g/r/<your_key>/play2.smil in your browser. Open it with Notepad
- Switch the user agent on your browser to "RMA/1.0 (compatible; RealMedia)"
- Put the content="…" and audio src="…" pieces together to form the URL
- Type the URL and save the file
I’ve automated this in my music search engine. So if you go to the Hindi, Tamil or any other online music page and click on the blue ball next to the song, you’ll see a menu with a download option. The download opens a Java program that does these steps for you and saves the song in your PC.
So now, you’re probably thinking:
- How did he figure this out?
- What about other sites?
- How does that Java program work?
- How do I listen to these on my iPod?
How did I figure this out?
Fiddler.
I believe a good measure of a tool’s power is it’s ability to be the one-word answer to a relatively broad question. For example, "Where can I find more about something?" "Google it." "How do I improve my pictures?" "Photoshop it".
Fiddler’s like that. "How do I find out what I’m downloading?" "Use Fiddler".
It’s a proxy you can install on your machine. It automatically configures your browsers when you run it. Thereafter, it tells you about all the HTTP requests that are being sent by your machine. So if you patiently walk through the logs, you’ll find all the URLs that MusicIndiaOnline or any other site uses, as well as the other headers (like User-Agent) that are needed to make it work.
What about other sites?
I’ll list a couple here.
Smashits:
- Right-click on the song you want to play, and copy the URL
- View the source and hunt for the URL fragment "player/ra/ondemand/launch_player.cfm?something". The key is is something.
- Open http://ww.smashits.com/player/ra/ondemand/playlist.asp?6;giftsToIndia1.rm;1,something in your browser, using Notepad
- Switch the user agent on your browser to "RMA/1.0 (compatible; RealMedia)"
- Type in what’s inside the src="…" in your browser and save the file
Oosai:
- Right-click on the song you want to play, and copy the URL
- View the source and hunt for the URL fragment onclick="setUsrlist(something)". The key is is something.
- Open http://www.oosai.com/oosai_plyr/playlist.cfm?sng_id=something in your browser, using Notepad
- Switch the user agent on your browser to "RMA/1.0 (compatible; RealMedia)"
- Type in the URL that you see in Notepad and save the file.
Try figuring out the others yourself.
How does the Java program work?
It does most of these steps automatically. The applet itself is fairly straightforward, and you can view it here. It takes two parameters: db, which indicates the server from which to download (M for MusicIndiaOnline, S for Smashits, etc.) and num, which is the key.
But in order for an applet to be able to download files from any site, and to be able to save this on your PC, it needs to be a signed applet. Since Sun offers a tool to sign JAR files, this wasn’t much of an issue.
There is one pending problem with Windows Vista, however. Signed applets can’t save files anywhere on Vista. They are saved in a special folder. This is being fixed, but until then, if you use Internet Explorer on Vista, you probably will be unable to find your saved files.
How do I listen to these on my iPod?
The saved files are in RealMedia format. Your best bet is to convert them to MP3 files using MediaCoder. Then transfer them using iTunes.