[Python] Is there a way to use pylast to get the top tracks?

Discussão em 'Python' iniciado por Stack, Março 11, 2025.

  1. Stack

    Stack Membro Participativo

    I need to use the pylast module and last.fm api to get the top tracks (https://www.last.fm/api/show/chart.getTopTracks) but I can't find how to do this in python.

    API_KEY = "my key"
    API_SECRET = "my secret"

    network = pylast.LastFMNetwork(api_key = API_KEY)

    print(network.chart_get_top_tracks())


    But the chart_get_top_tracks() method doesn't exist. how do I use this? If it helps, my end result will hopefully be a live Spotify playlist of the top 100 songs. It will hopefully update every 10 mins or so. I've got the playlist_add_items() working with Spotify and now all I need is to find a way to get the top 100 and use them both together.

    I tried pylast.LastFMNetwork(api_key = API_KEY).network.chart_get_top_tracks() and I was hoping for it to return 50 top tracks but this method is not the real one. Am I doing something completely wrong or do I just not know the method name?

    Continue reading...

Compartilhe esta Página