Click here to Skip to main content
Click here to Skip to main content
Technical Blog

Lyrister - Song Lyrics Scrapper

, 18 May 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
Song Lyrics scrapper in python using BeautifulSoup

Introduction

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 at https://github.com/PsychoCoderHC/Lyrister.

I hope I have taken care of most things that may cause you problems.

Note

In order to successfully run and execute this app, you must have installed BeautifulSoup package, else it won't run. Please read the README on github repository about how to install them.

How to Use?

On the terminal, run the following and follow the instructions that follow:

Code

python lyrister.py

You 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/ carnivallyric

Example 2

Here we download the song Carnival Of Rust by "Poets Of Fall". Since we have not provided the song name with space, there is no problem.

Code

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 you 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 won't 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.

[Image: gkHR8qU.png?1]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Psycho_Coder
Student
India India
My name is Animesh Shaw, Currently I am pursuing B. Tech in Computer Science. My Screen name is Psycho_Coder. I am active in many Security or Ethical Hacking forums. I love programming and exploring the depths of Computer Science.
 
Programming Languages know : C, C++,Java, Python and PHP.
 
You can even contact me on the following :-
 
1, CS - Computer Science Lovers : https://www.facebook.com/CSComputerScienceLovers. Please like it.
 
2. CS(Computer Science) Lovers : https://www.facebook.com/groups/csloversforever/
My facebook group to discuss programming. You can join this group if you are serious about computer science and programming.
 
3. You can mail me at psychocoder@outlook.com
 

My Interests :
 
I have great interests in the following topics in Computer Science :-
 
1. Programming Language Concepts and Methodologies.
2. Computational Linguistics.
3. Cryptography.
 
Github Profile : https://github.com/PsychoCoderHC
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web03 | 2.8.141015.1 | Last Updated 18 May 2014
Article Copyright 2014 by Psycho_Coder
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid