-
Notifications
You must be signed in to change notification settings - Fork 0
/
lyrics.py
29 lines (25 loc) · 844 Bytes
/
lyrics.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import lyricsgenius
# generate an api key and paste it
# https://genius.com/api-clients
genius = lyricsgenius.Genius("api-key-here")
def save_lyrics(songs, artist_name, album_name):
for i in range(len(songs
)):
song_title = songs[i]
song = genius.search_song(song_title, artist_name)
lyrics = song.lyrics
with open('songs/{}/{}_{}_{}.txt'.format('_'.join(artist_name.split(' ')), i+1, album_name, '-'.join(''.join(song_title.split('\'')).split(' '))), 'w') as f:
f.writelines(lyrics.split('\\n'))
if __name__ == '__main__':
songs = [
'the box',
'down below',
'project dreams',
'die young',
'boom boom room',
'high fashion',
'roll dice',
'war baby',
'every season'
]
save_lyrics(songs, 'roddy ricch', '')