Skip to main content

An unofficial Python wrapper for Jiosaavn.

Project description

🎶 jiosaavnpy: Unofficial JioSaavn API Client

Python Version License PyPI Version

A Python 3 library for accessing JioSaavn's music catalog through their unofficial API. This library emulates JioSaavn web client requests without requiring authentication.

📖 Table Of Contents

✨ Features

🔍 Search Capabilities

  • Songs: Search for songs with customizable result limits.
  • Albums: Search for albums with customizable result limits.
  • Artists: Search for artists with customizable result limits.
  • Playlists: Search for playlists with customizable result limits.

📊 Entity Information

  • Song Details: Get comprehensive track information.
  • Album Information: Retrieve album metadata and track listings.
  • Artist Profiles: Access artist details, top songs, and albums.
  • Playlist Contents: Fetch playlist metadata and track lists.

🎵 Audio Streaming

  • Multiple quality options (48kbps to 320kbps).
  • Direct streaming URLs for all tracks.
  • Thumbnail images in various resolutions (50x50, 150x150, 500x500).

📋 Requirements

  • Python 3.7 or higher.
  • Internet connection for API requests.

🔨 Installation

pip install jiosaavnpy

🚀 Quick Start

from jiosaavnpy import JioSaavn

# Initialize the client
jio = JioSaavn()

# Search for songs
results = jio.search_songs("Never gonna give you up", limit=5)
print(results[0]['title'])  # "Never Gonna Give You Up"
print(results[0]['primary_artists'])  # "Rick Astley"

📖 Usage Examples

Searching for Songs

from jiosaavnpy import JioSaavn

def search_songs_example():
    """Search for songs and display results."""
    jio = JioSaavn()
    
    query = input("Enter song name: ")
    results = jio.search_songs(query, limit=10)
    
    for i, song in enumerate(results, 1):
        print(f"{i}. {song['title']} - {song['primary_artists']}")
    return results

# Run the example
songs = search_songs_example()

Getting Song Information

from jiosaavnpy import JioSaavn

def get_song_details():
    """Retrieve detailed information about a specific song."""
    jio = JioSaavn()
    
    # Use track_id from search results
    track_id = "e0kCEwoC"  # Never Gonna Give You Up
    song_info = jio.song_info(track_id)
    
    print(f"Title: {song_info['title']}")
    print(f"Artist: {song_info['primary_artists']}")
    print(f"Album: {song_info['album_name']}")
    print(f"Duration: {song_info['duration']} seconds")
    print(f"Year: {song_info['release_year']}")
    
    return song_info

# Run the example
details = get_song_details()

Working with Albums

from jiosaavnpy import JioSaavn

def explore_album():
    """Search for albums and get detailed information."""
    jio = JioSaavn()
    
    # Search for albums
    albums = jio.search_albums("Whenever You Need Somebody", limit=3)
    
    if albums:
        album_id = albums[0]['album_id']
        album_details = jio.album_info(album_id)
        
        print(f"Album: {album_details['album_name']}")
        print(f"Artist: {album_details['primary_artists']}")
        print(f"Tracks: {len(album_details['tracks'])}")
        
        # List all tracks
        for track in album_details['tracks']:
            print(f"  - {track['title']}")

# Run the example
explore_album()

Check out examples for more usage examples.

📚 API Reference

Search Methods

search_songs(search_query, limit=5)

Search for songs by name, artist, or lyrics.

Parameters:

  • search_query (str): Search term for songs.
  • limit (int, optional): Number of results to return (default: 5).

Returns: List of song dictionaries with metadata.

search_albums(search_query, limit=5)

Search for albums by name or artist.

Parameters:

  • search_query (str): Search term for albums.
  • limit (int, optional): Number of results to return (default: 5).

Returns: List of album dictionaries.

search_artists(search_query, limit=5)

Search for artists by name.

Parameters:

  • search_query (str): Artist name to search for.
  • limit (int, optional): Number of results to return (default: 5).

Returns: List of artist dictionaries.

search_playlists(search_query, limit=5)

Search for playlists by name or description.

Parameters:

  • search_query (str): Playlist name to search for.
  • limit (int, optional): Number of results to return (default: 5).

Returns: List of playlist dictionaries.

Information Methods

song_info(track_id)

Get detailed information about a specific song.

Parameters:

  • track_id (str): Unique identifier for the track

Returns: Dictionary with comprehensive song information

album_info(album_id)

Get detailed information about a specific album.

Parameters:

  • album_id (str): Unique identifier for the album

Returns: Dictionary with album information and track list

artist_info(artist_token, song_limit=5, album_limit=5)

Get detailed information about a specific artist.

Parameters:

  • artist_token (str): Unique identifier for the artist
  • song_limit (int, optional): Number of top songs to include (default: 5)
  • album_limit (int, optional): Number of top albums to include (default: 5)

Returns: Dictionary with artist information, top songs, and albums

playlist_info(playlist_id)

Get detailed information about a specific playlist.

Parameters:

  • playlist_id (str): Unique identifier for the playlist

Returns: Dictionary with playlist information and track list

Other Methods

similar_songs(track_id)

Get related songs based on its track_id.

Parameters:

  • track_id (str): Unique identifier for the track.

get_home(language)

Get detailed home page data (new trending, top playlists & albums, charts) based on the language.

Parameters:

  • language (str): The language to return home data in. Example: english, tamil (Case Sensitive!)

Returns: Dictionary with home page data.

📋 Response Format

Song Object

{
  "track_id": "e0kCEwoC",
  "title": "Never Gonna Give You Up",
  "primary_artists": "Rick Astley",
  "primary_artists_ids": "512102",
  "album_name": "Whenever You Need Somebody",
  "album_id": "26553699",
  "duration": "213",
  "release_year": "1987",
  "track_language": "english",
  "play_count": "199567",
  "is_explicit": false,
  "thumbnails": {
    "quality": {
      "50x50": "https://c.saavncdn.com/...",
      "150x150": "https://c.saavncdn.com/...",
      "500x500": "https://c.saavncdn.com/..."
    }
  },
  "stream_urls": {
    "low_quality": "https://aac.saavncdn.com/...48.mp4",
    "medium_quality": "https://aac.saavncdn.com/...96.mp4",
    "high_quality": "https://aac.saavncdn.com/...160.mp4",
    "very_high_quality": "https://aac.saavncdn.com/...320.mp4"
  }
}

⚠️ Important Notes

  • Unofficial API: This library uses JioSaavn's internal API endpoints and is not officially supported.
  • Geographic Restrictions: Non-English tracks may not be available when accessed from non-Indian IP addresses.
  • Rate Limits: There are no known rate limits as of now (?).

🤝 Contributing

Contributions are welcome! There may be certain endpoints which have not been fully covered yet.

Project details


Download files

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

Source Distribution

jiosaavnpy-0.1.3.tar.gz (35.1 kB view details)

Uploaded Source

Built Distribution

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

jiosaavnpy-0.1.3-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

Details for the file jiosaavnpy-0.1.3.tar.gz.

File metadata

  • Download URL: jiosaavnpy-0.1.3.tar.gz
  • Upload date:
  • Size: 35.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for jiosaavnpy-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6b78aa8662be6e8f365a0a4483f8062bff809d05cb10caadaa8688eaa7369bbf
MD5 5482deb3c4db13ceb2a5d4d432fb7d6a
BLAKE2b-256 8620622ce475b712bbc8df1eadd929477769c23bdb93d5f8cdea217c6ecc4573

See more details on using hashes here.

File details

Details for the file jiosaavnpy-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: jiosaavnpy-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 37.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for jiosaavnpy-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4632349fb0d390b37e29d0afdc2a2fea22c1fa6c7d2fee9c9f09fd0a41280bdd
MD5 a87b49232f1b50e74784cb0b25f290c8
BLAKE2b-256 68f22152e54aac2a3d2e56a56a2cf45efb1e3e2b8fa72ae17ba5e56a27462058

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page