![]() |
|
Lyrister - Song Lyrics Scrapper - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Python (https://sinister.ly/Forum-Python) +--- Thread: Lyrister - Song Lyrics Scrapper (/Thread-Lyrister-Song-Lyrics-Scrapper) |
Lyrister - Song Lyrics Scrapper - Psycho_Coder - 05-14-2014 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/AnimeshShaw/Lyrister I 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:- Code: python lyrister.pyYou have the option of giving command line arguments as the parameters. The following format is to be followed :- Code: 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. Code: python lyrister.py carnival /home/psychocoder/ carnivallyricExample 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. Code: python lyrister.py "carnival of rust" /home/psychocoder/ CarnivalOfRustIf 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. ![]() RE: Lyrister - Song Lyrics Scrapper - Psycho_Coder - 10-01-2014 Source Code Repo link fixed. RE: Lyrister - Song Lyrics Scrapper - L0aD1nG - 10-01-2014 The worst thing for me was to modify the indents, as the copy paste didn't auto indent... :Laughing: There is one more problem that request module is external?? If you are online answer me please mate I really want to try this out! RE: Lyrister - Song Lyrics Scrapper - ShawnReynolds - 10-01-2014 How do I use it? Do I use python's terminal, or something like Command Prompt? RE: Lyrister - Song Lyrics Scrapper - Deque - 10-01-2014 (10-01-2014, 07:47 PM)ShawnReynolds Wrote: How do I use it? Do I use python's terminal, or something like Command Prompt? Read the first post. There is a whole section with step-by-step instruction how to use it. RE: Lyrister - Song Lyrics Scrapper - ShawnReynolds - 10-01-2014 (10-01-2014, 08:23 PM)Deque Wrote:(10-01-2014, 07:47 PM)ShawnReynolds Wrote: How do I use it? Do I use python's terminal, or something like Command Prompt? I did, but I do not know whether to use Python's terminal or the Command Prompt terminal, as I have never done anything with Python before. RE: Lyrister - Song Lyrics Scrapper - L0aD1nG - 10-01-2014 (10-01-2014, 08:24 PM)ShawnReynolds Wrote:(10-01-2014, 08:23 PM)Deque Wrote:(10-01-2014, 07:47 PM)ShawnReynolds Wrote: How do I use it? Do I use python's terminal, or something like Command Prompt? Either python terminal, or via cmd go to pythonXX folder type: Code: python.exe <path to the script location> <then what Psycho_Coder told you to type>RE: Lyrister - Song Lyrics Scrapper - L0aD1nG - 10-01-2014 Just tried it out, solved the requests module problem (install via pip suite). This is a script that I am going to use my whole life probably! Thanks to @Psycho_Coder and his great mind/ideas! It works like a charm! Cheers! |