Skip to content

Latest commit

 

History

249 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GaanaPy

An unofficial JSON API for Gaana, an Indian music streaming service. Built with FastAPI.

Usage

Start the server (see Local Development), then open the interactive docs:

http://127.0.0.1:8000/docs

Endpoints

All endpoints return JSON. List endpoints accept an optional limit (1–100, default 10). Artist tracks also accepts page (1–1000, default 1).

Endpoint Description Required
GET /songs/search?query= Search songs query
GET /songs/info?seokey= Song details seokey
GET /albums/search?query= Search albums query
GET /albums/similar/?album_id= Similar albums album_id (numeric)
GET /albums/info?seokey= Album details (includes tracks) seokey
GET /artists/search?query= Search artists query
GET /artists/tracks/?artist_id= Tracks by an artist artist_id (numeric)
GET /artists/info?seokey= Artist details (with top tracks) seokey
GET /artists/similar?artist_id= Similar artists artist_id
GET /trending?language= Trending tracks language
GET /newreleases?language= New releases language
GET /charts Top chart playlists
GET /playlists/info?seokey= Playlist details (with tracks) seokey
GET /health Health check

Language

English, Hindi, Punjabi, Tamil, Telugu etc. Case-sensitive.

Finding a seokey

A seokey is the URL-friendly identifier from a Gaana page:

https://gaana.com/song/tyler-herro        → tyler-herro
https://gaana.com/album/tyler-herro       → tyler-herro
https://gaana.com/artist/jack-harlow      → jack-harlow
https://gaana.com/playlist/gaana-dj-...   → gaana-dj-gaana-international-top-50

Search results also return seokey, artist_seokeys, and album_seokey.

Finding an artist ID

Artist IDs are numeric. Get them from search results:

GET /songs/search?query=tyler herro
→ [{ "artist_ids": "817522", ... }]

Examples

curl "http://127.0.0.1:8000/songs/search?query=tyler+herro&limit=5"
curl "http://127.0.0.1:8000/songs/info?seokey=tyler-herro"
curl "http://127.0.0.1:8000/albums/info?seokey=tyler-herro"
curl "http://127.0.0.1:8000/albums/similar/?album_id=3487503&limit=5"
curl "http://127.0.0.1:8000/artists/info?seokey=jack-harlow&limit=5&page=1"
curl "http://127.0.0.1:8000/artists/tracks/?artist_id=817522&limit=5&page=1"
curl "http://127.0.0.1:8000/artists/similar?artist_id=817522"
curl "http://127.0.0.1:8000/trending?language=English"
curl "http://127.0.0.1:8000/newreleases?language=English"
curl "http://127.0.0.1:8000/charts"
curl "http://127.0.0.1:8000/playlists/info?seokey=gaana-dj-gaana-international-top-50"

Similar albums and artist tracks require numeric IDs. Results depend on Gaana's live catalog and the headers accepted by its current website endpoints.

Discovery endpoints

GET /albums/similar/ requires a numeric Gaana album_id and returns normalized album records. The album must exist in Gaana's current catalog; otherwise the API returns a 404 no-results response.

GET /artists/tracks/ requires a numeric artist_id and returns a paginated object containing tracks and total. Use limit for the number of tracks per page and page to select the page. Track records include the same metadata and stream_urls fields as /songs/search/.

These endpoints depend on Gaana's live catalog and current website request headers, so results may change or be unavailable for individual IDs.

Example response

[
  {
    "seokey": "tyler-herro",
    "title": "Tyler Herro",
    "artists": "Jack Harlow",
    "artist_seokeys": "jack-harlow",
    "artist_ids": "817522",
    "album": "Tyler Herro",
    "album_id": "3487503",
    "duration": "156",
    "language": "English",
    "genres": "Hip Hop",
    "is_explicit": true,
    "images": {
      "urls": {
        "large_artwork": "https://.../size_l.jpg",
        "medium_artwork": "https://.../size_m.jpg",
        "small_artwork": "https://.../size_s.jpg"
      }
    },
    "stream_urls": {
      "urls": {
        "very_high_quality": "https://.../320.mp4.master.m3u8?...",
        "high_quality": "https://.../128.mp4.master.m3u8?...",
        "medium_quality": "https://.../64.mp4.master.m3u8?...",
        "low_quality": "https://.../16.mp4.master.m3u8?..."
      }
    }
  }
]

Local Development

git clone https://github.com/ZingyTomato/GaanaPy
cd GaanaPy

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

python3 -m uvicorn app:app --reload

Open http://127.0.0.1:8000/docs.

Tests

pip install pytest pytest-asyncio
python3 -m pytest tests/ -v

Docker

services:
  gaanapy:
    image: zingytomato/gaanapy:main
    container_name: gaanapy
    ports:
      - "8000:8000"
    restart: unless-stopped

Contributing

Open an issue for bugs or suggestions.