Skip to main content

https://scrutinizer-ci.com/g/dotX12/ShazamIO/ https://scrutinizer-ci.com/g/dotX12/ShazamIO/ https://scrutinizer-ci.com/g/dotX12/ShazamIO/ https://badge.fury.io/py/shazamio https://pepy.tech/project/shazamio https://pepy.tech/project/shazamio https://github.com/dotX12/ShazamIO/blob/master/LICENSE.txt

🎵 Is a FREE asynchronous library from reverse engineered Shazam API written in Python 3.8+ with asyncio and aiohttp. Includes all the methods that Shazam has, including searching for a song by file.


💿 Installation

💲 pip install shazamio

💻 Example

🔎🎵 Recognize track

Recognize a track based on a file

import asyncio
from shazamio import Shazam


async def main():
  shazam = Shazam()
  # out = await shazam.recognize_song('dora.ogg') # slow and deprecated, don't use this!
  out = await shazam.recognize('dora.ogg')  # rust version, use this!
  print(out)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
👨‍🎤 About artist

Retrieving information from an artist profile
https://www.shazam.com/artist/43328183/nathan-evans

import asyncio
from shazamio import Shazam, Serialize


async def main():
  shazam = Shazam()
  artist_id = 43328183
  about_artist = await shazam.artist_about(artist_id)
  serialized = Serialize.artist(about_artist)

  print(about_artist)  # dict
  print(serialized)  # serialized from dataclass factory

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
🎵📄 About track

Get track information
https://www.shazam.com/track/552406075/ale-jazz

import asyncio
from shazamio import Shazam, Serialize


async def main():
  shazam = Shazam()
  track_id = 552406075
  about_track = await shazam.track_about(track_id=track_id)
  serialized = Serialize.track(data=about_track)

  print(about_track)  # dict
  print(serialized)  # serialized from dataclass factory

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
🎵⌛ Track listenings count

Returns the number of times a particular song has been played
https://www.shazam.com/track/559284007/rampampam

import asyncio
from shazamio import Shazam


async def main():
  # Example: https://www.shazam.com/track/559284007/rampampam

  shazam = Shazam()
  track_id = 559284007
  count = await shazam.listening_counter(track_id=track_id)
  print(count)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
🎶💬 Similar songs

Similar songs based song id
https://www.shazam.com/track/546891609/2-phu%CC%81t-ho%CC%9Bn-kaiz-remix

import asyncio
from shazamio import Shazam


async def main():
  shazam = Shazam()
  track_id = 546891609
  related = await shazam.related_tracks(track_id=track_id, limit=5, offset=2)
  # ONLY №3, №4 SONG
  print(related)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
🔎👨‍🎤 Search artists

Search all artists by prefix

import asyncio
from shazamio import Shazam, Serialize


async def main():
  shazam = Shazam()
  artists = await shazam.search_artist(query='Lil', limit=5)
  for artist in artists['artists']['hits']:
      serialized = Serialize.artist(data=artist)
      print(serialized)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
🔎🎶 Search tracks

Search all tracks by prefix

import asyncio
from shazamio import Shazam


async def main():
  shazam = Shazam()
  tracks = await shazam.search_track(query='Lil', limit=5)
  print(tracks)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
🔝🎶👨‍🎤 Top artist tracks

Get the top songs according to Shazam
https://www.shazam.com/artist/201896832/kizaru

import asyncio
from shazamio import Shazam, Serialize
from shazamio.schemas.artists import ArtistQuery
from shazamio.schemas.enums import ArtistView


async def main():
  shazam = Shazam()
  artist_id = 1081606072

  about_artist = await shazam.artist_about(
      artist_id,
      query=ArtistQuery(
          views=[
              ArtistView.TOP_SONGS,
          ],
      ),
  )
  serialized = Serialize.artist_v2(about_artist)
  for i in serialized.data[0].views.top_songs.data:
      print(i.attributes.name)


loop = asyncio.get_event_loop_policy().get_event_loop()
loop.run_until_complete(main())
🔝🎶🏙️ Top tracks in city

Retrieving information from an artist profile
https://www.shazam.com/charts/top-50/russia/moscow

import asyncio
from shazamio import Shazam, Serialize


async def main():
  shazam = Shazam()
  top_ten_moscow_tracks = await shazam.top_city_tracks(country_code='RU', city_name='Moscow', limit=10)
  print(top_ten_moscow_tracks)
  # ALL TRACKS DICT
  for track in top_ten_moscow_tracks['tracks']:
      serialized = Serialize.track(data=track)
      # SERIALIZE FROM DATACLASS FACTORY
      print(serialized)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
🔝🎶🏳️‍🌈 Top tracks in country

Get the best tracks by country code
https://www.shazam.com/charts/discovery/netherlands

import asyncio
from shazamio import Shazam, Serialize


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)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
🔝🎶🏳️‍🌈🎸 Top tracks in country by genre

The best tracks by a genre in the country
https://www.shazam.com/charts/genre/spain/hip-hop-rap

import asyncio
from shazamio import Shazam, GenreMusic


async def main():
  shazam = Shazam()
  top_spain_rap = await shazam.top_country_genre_tracks(
      country_code='ES',
      genre=GenreMusic.HIP_HOP_RAP,
      limit=4
  )
  print(top_spain_rap)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
🔝🎶🌏🎸 Top tracks in world by genre

Get world tracks by certain genre
https://www.shazam.com/charts/genre/world/rock

import asyncio
from shazamio import Shazam, Serialize, GenreMusic


async def main():
  shazam = Shazam()
  top_rock_in_the_world = await shazam.top_world_genre_tracks(genre=GenreMusic.ROCK, limit=10)

  for track in top_rock_in_the_world['tracks']:
      serialized_track = Serialize.track(data=track)
      print(serialized_track.spotify_url)


loop = asyncio.get_event_loop()
loop.run_until_complete(main())
🔝🎶🌏Top tracks in world

Get the best tracks from all over the world
https://www.shazam.com/charts/top-200/world

import asyncio
from shazamio import Shazam, Serialize


async def main():
  shazam = Shazam()
  top_world_tracks = await shazam.top_world_tracks(limit=10)
  print(top_world_tracks)
  for track in top_world_tracks['tracks']:
      serialized = Serialize.track(track)
      print(serialized)

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

How to use data serialization

Open Code
import asyncio
from shazamio import Shazam, Serialize


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())
Open photo: What song information looks like (Dict)
Open photo: what song information looks like (Custom serializer)

Agree, thanks to the serializer, you no longer need to manually select the necessary data from the dictionary. Now the serializer contains the most necessary information about an artist or a track.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shazamio-0.8.1.tar.gz (26.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shazamio-0.8.1-py3-none-any.whl (36.3 kB view details)

Uploaded Python 3

File details

Details for the file shazamio-0.8.1.tar.gz.

File metadata

  • Download URL: shazamio-0.8.1.tar.gz
  • Upload date:
  • Size: 26.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Linux/6.11.0-1015-azure

File hashes

Hashes for shazamio-0.8.1.tar.gz
Algorithm Hash digest
SHA256 5d60222735ccda4d792fd7dfe3faafaa65d15fa15b6a63de87115fb1a155b5fc
MD5 6d7fa131e33184dcc01a07622a39b058
BLAKE2b-256 2f6631ecae67c373421db10f250a83d80653d6908f7d95080c46816102bd1fda

See more details on using hashes here.

File details

Details for the file shazamio-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: shazamio-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 36.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Linux/6.11.0-1015-azure

File hashes

Hashes for shazamio-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ac4823dc9a8abd0b57455a3b29340c1fc090286bab0d8cc06eb862d7626691d0
MD5 4dffe3660d396cf38536f8c7a81aa9b1
BLAKE2b-256 05b6d7881361b565bc4736916532fcaf58e91eae8db338b2869b50636fbd8602

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.8.1 This release

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0.1

2 files

0.4.0.0

2 files

0.3.1.1

2 files

0.3.1.0

2 files

0.3.0.0

2 files

0.2.2.0

2 files

0.2.1.0

2 files

0.2.0.0

2 files

0.1.1.1

2 files

0.1.1.0

2 files

0.1.0.1

2 files

0.1.0

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page