def get_lyric(singer, song): API = AZlyrics('google', accuracy=0.5) API.artist = singer API.title = song API.getLyrics() return API.lyrics
def text(self): logger.info(f'Retrieving lyrics: {self.title}') api = AZlyrics() api.artist = self.title.artist api.title = self.title.title api.getLyrics() return api.lyrics
def all_songs(self): if self.cached_all_songs is None: logger.info(f'Retrieving all songs by: {self.name}') api = AZlyrics() api.artist = self.name all_songs = api.getSongs() logger.info(f'Retrieved {len(all_songs)} songs') self.cached_all_songs = [ Song.entitled(songs.model.SongTitle(self.name, song)) for song in all_songs.keys() ] return self.cached_all_songs
from azapi import AZlyrics # Names should be passed corrrectly # If you can't remember, use google or duckduckgo # AZlyrics('google') api = AZlyrics() api.artist = 'Taylor Swift' api.title = 'Blank Space' api.getLyrics(save=True)
az_api = AZlyrics('google') if az_se == '2': az_api = AZlyrics('duckduckgo') print('You can either get the song with the song title and artist ' 'name, or you can search via lyrics.') print() print('If you don\'t remember the name of the artist, you can ' 'search by title only.') print('If you want to search by lyrics, put the lyrics in the ' 'title field') artist_name = input('Type in the name of the artist: ') song_title = input('Type in the title of the song: ') az_api.artist = artist_name az_api.title = song_title lyrics = az_api.getLyrics(save=False).strip() filename = (az_api.artist + ' - ' + az_api.title + '.txt') if Path('in/').exists(): basepath = Path('in/') else: os.mkdir('in') if Path('in/').exists(): basepath = Path('in/') with open(basepath / filename, 'w', encoding='utf-8') as export: export.write(lyrics)
from azapi import AZlyrics api = AZlyrics('duckduckgo') # Mis-typing "Meghan Trainor" and "All about the bass" api.artist = 'Mehgan trenor' api.title = 'about this bass' # Using search to get correct artist and title Lyrics = api.getLyrics() print(Lyrics)
from azapi import AZlyrics api = AZlyrics('google') # Kanye is in the format of "West" in AZLyrics database # Here we search for his name to fetch the correct url api.artist = 'Kanye west' songs = api.getSongs() for song in songs: print(song, songs[song]['year'])
from azapi import AZlyrics import pprint api = AZlyrics() api.artist = 'Ed Sheeran' songs = api.getSongs() pprint.pprint(songs, indent=5)