Hello Everyone,
Today I will share a little snippet I wrote to get scrap or download lyrics of your favorite songs and save on your harddrive as .txt files.
I have used python 2.7.4 for this and have used the BeautifulSoup python package for web requests
You can get the code here :
https://github.com/PsychoCoderHC/LyristerI hope I have taken care of most things that may cause you problems.
How to Use ?On the terminal run the following and follow the instructions that follow:-
python lyrister.py
You have the option of giving command line arguments as the parameters. The following format is to be followed :-
python lyrister.py <name-of-song> <path-of-directory> <filename>
It takes three parameters. The first parameter is the name of the song for which you want to download the lyrics. Please note that if you intend to write the song name with spaces then use double quotes and your directory path must end with separator.
Example 1:
Here we download the song Carnival by Natalie Merchant. Since we have not provided the song name with space there is no problem.
python lyrister.py carnival /home/psychocoder/ carnivallyric
Example 2:
Here we download the song Carnival Of Rust by "Poets Of Fall". Since we have provided the song name with space there won't be any problem.
python lyrister.py "carnival of rust" /home/psychocoder/ CarnivalOfRust
If a file with the same name exists in the directory then it won't let to save the song and will ask you to try another name to download the lyric.
If you want to save the file in some directory which doesn't have write permission then you wont be able to save the lyrics.
These checking have been done already and I hope the rest you can understand by yourself. I have given a good description for every step in the code itself and also how to resolve the errors. I hope you enjoy.