Closed NIkitabala closed 3 years ago
Genius.com doesn't offer to sort by least popularity. Using the library's search_artist()
is slow because it attempts to fetch the lyrics and song information. The library doesn't also offer to go through an artist's songs without getting their information yet. But you could do it yourself.
genius = Genius(token)
artist = genius.search_artist('Andy Shauf', max_songs=1)
page = 1
songs = []
while page:
request = genius.get_artist_songs(artist._id, sort='popularity', per_page=50, page=page)
songs.extend(request['songs'])
page = request['next_page']
least_popular_song = genius.search_song(songs[-1]['title'], artist.name)
print(least_popular_song.lyrics)
for song in reversed(songs):
print(song['title']
Is there any way to sort in a descending order?
I have
artist = genius.search_artist("Пошлая Молли", max_songs=9, sort="popularity")
But I want to make it in a descending order, so it will be like less popular ones first.