shazamio / ShazamIO

🎵 Is a free asynchronous library from reverse engineered Shazam API written in Python 3.8+ with asyncio and aiohttp.
MIT License
521 stars 76 forks source link

Serializer is not working #118

Open IftixorInTouch opened 4 months ago

IftixorInTouch commented 4 months ago

async def main(): shazam = Shazam() top_five_track_from_amsterdam = await shazam.top_country_tracks('NL', 5) for track in top_five_track_from_amsterdam['tracks']: serialized = Serialize.track(data=track) print(serialized.title) loop = asyncio.get_event_loop() loop.run_until_complete(main())

Error:

for track in top_five_track_from_amsterdam['tracks']: KeyError: 'tracks'

dotX12 commented 4 months ago

async def main(): shazam = Shazam() top_five_track_from_amsterdam = await shazam.top_country_tracks('NL', 5) for track in top_five_track_from_amsterdam['tracks']: serialized = Serialize.track(data=track) print(serialized.title) loop = asyncio.get_event_loop() loop.run_until_complete(main())

Error:

for track in top_five_track_from_amsterdam['tracks']: KeyError: 'tracks'

Hello!

import asyncio
from shazamio import Shazam, Serialize

async def main():
    shazam = Shazam()
    top_five_track_from_amsterdam = await shazam.top_country_tracks("NL", 100)
    tracks = Serialize.playlists(top_five_track_from_amsterdam)
    print(tracks)

    for track in top_five_track_from_amsterdam["data"]:
        serialized = Serialize.playlist(data=track)
        print(serialized)

loop = asyncio.get_event_loop_policy().get_event_loop()
loop.run_until_complete(main())

There are problems in the readme documentation, there is simply not enough time to update it. See the examples file, the code is always up to date.