summaryrefslogtreecommitdiff
path: root/scripts/populate/api.py
blob: 5cc24d3f78ab8090f10475ad587860d5d2eb98f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import lyricsgenius
import parser
import os


genius = lyricsgenius.Genius(
    "0uSA9UFGsiO2WozVmbWPhyhOoVmUNuM3PXRt9rvWhptHBMgSO5CZBxGUMkwet5mv"
)


def download_albums(albums):
    [get_album_json(artist[0], album)
     for artist in albums for album in artist[1]]


def get_album_json(artist_name, album_name):
    if os.path.isfile(parser.getLink(album_name)):
        return

    album = genius.search_album(album_name, artist_name)
    album.save_lyrics()