As a homework i need to make a webapp that will play an mp3 file and the user has to guess the name of the song or the band in a certain time.
My question is where can i get this songs? Is there any website that offers mp3's and an api from which i can get songs along with the band and the name? It doesn't have to be the whole song, in fact it will 开发者_如何学Pythonbe better if it's just a part of it and also it should be free as it's just for a homework.LE: they must be available internationally as I'm not from USA
Napster provides a free API:
Napster Web Services
The free API only allows 30 second previews, which you said is exactly what you want.
I'd use their chart list function to get popular songs then serve them up.
One possibility is Amazon.com--they have short clips of gazillions of songs, and it might be possible to pick & play them using Amazon's web services API. Here is a page with info on their MP3 Clips Widget, which might get you started. Good luck, and enjoy!
If it's just for homework, it should be fine to use only a few mp3, so you could use your own ripped CDs if you have any.
If not, then you can use some of the free music that's online such as e.g. the free clips at http://www.jonathancoulton.com/store/downloads/
I don't know of a web site that has an API for getting the metadata, but you can use the ID3 tags in the mp3 to get the info you need. There are simple command-line tools that can extract that information and you can then put it in a database for your web app (or you could just have the web app call those tools itself).
精彩评论