Skip to content

solo12345689/mxplayer-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MX Player API Client β€” mxplay

Python 3.8+ License No Dependencies Platform

Unofficial Python CLI client for Amazon MX Player (mxplayer.in).
No login, no signup, no API key required. Browse, search, and extract HLS/DASH stream URLs for movies, TV shows, and episodes β€” all anonymously with zero external dependencies.

python app.py home                              # Browse homepage sections
python app.py search "demon slayer"             # Search with full metadata
python app.py detail <id> tvshow                # Show details + first episode stream
python app.py stream <episode_id>               # Get HLS/DASH URLs
python app.py url "https://mxplayer.in/..."     # Extract from any page URL
python app.py interactive                       # Full interactive menu

Table of Contents


Features

  • No authentication required β€” works anonymously using a generated UUID, no login or signup needed
  • Homepage browsing β€” fetches all sections and items with full metadata, no artificial limits
  • Smart search β€” searches homepage sections first for detailed results with IDs/types/ratings; falls back to API suggestions
  • Content detail β€” fetch full metadata for episodes, movies, and seasons
  • TV show auto-resolution β€” detail <id> tvshow automatically resolves the first season and episode, returning HLS/DASH streams (bypasses the broken /detail/video?type=tvshow endpoint that returns statusCode: 1000)
  • Stream extraction β€” HLS (.m3u8) and DASH (.mpd) URLs for any playable content
  • Page URL support β€” paste any mxplayer.in URL and extract the stream directly
  • SEO resolver β€” resolves human-readable show/episode URL paths to internal content IDs
  • Anonymous user rotation β€” generate a new identity at any time with newid
  • Interactive mode β€” full menu-driven interface with keyboard navigation
  • Zero dependencies β€” uses only Python 3 standard library (urllib, json, uuid, typing)
  • Full ID display β€” content IDs are never truncated or shortened
  • All items shown β€” every item in every section is displayed, no caps

Installation

# No pip install needed β€” pure Python 3 stdlib
# Just download app.py and run it

git clone https://github.com/yourusername/mxplay.git
cd mxplay
python app.py --help

Requirements: Python 3.8+
Dependencies: None (uses only: json, sys, urllib.request, urllib.parse, uuid, typing)


Quick Start

# 1. Browse the homepage to populate the cache
python app.py home

# 2. Search for a show
python app.py search "rezero"

# 3. Get show details with first episode stream
python app.py detail 1421e25cae193ff678e0337ecf974b71 tvshow

# 4. Get stream directly from an episode ID
python app.py stream 8adb444072a4789a4cbcbe6c038d1529

# 5. Extract stream from any mxplayer.in URL
python app.py url "https://www.mxplayer.in/show/watch-rezero-starting-life-in-another-world/season-3/theatrical-malice-online-8adb444072a4789a4cbcbe6c038d1529"

# 6. Launch interactive mode
python app.py interactive

CLI Commands

1. home β€” Browse Homepage Sections

Fetches the MX Player homepage and displays every section and every item with full metadata.

python app.py home

Output:

======================================================================
  Section [1]  Popular Movies  (posters) β€” 12 items
======================================================================

  [1] [βœ“] John Wick: Chapter 4  [movie]
      ID: a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6
      Dur: 2h 49m  |  Lang: English  |  Genres: Action, Thriller
      Rating: 18/20

  [2] [ ] Re:Zero - Starting Life In Another World  [tvshow]
      ID: 1421e25cae193ff678e0337ecf974b71
      Dur: ?  |  Lang: Hindi, Japanese  |  Genres: Anime, Suspense, International Drama
      Rating: 16/20
      By: Muse Communication
      Tags: Anime, Hindi Dubbed, Suspense, International Drama
  • [βœ“] = has stream data (movie/episode β€” directly playable)
  • [ ] = container (tvshow/season β€” no direct stream, requires resolution)
  • Full IDs are shown (never truncated or shortened)
  • Run home first to populate the cache for search, detail tvshow, stream tvshow, item, and sections

2. search β€” Search Across All Sections

Searches through all homepage sections for matching items by title.

python app.py search "demon slayer"
python app.py search "rezero"
python app.py search "john wick"

How it works:

  1. Fetches the current homepage (or uses cached data)
  2. Searches all items across all sections by title (case-insensitive substring match)
  3. Displays full metadata: ID, type, duration, languages, genres, rating, publisher, stream snippet

Output:

  Matches for: rezero (1 results)
  ======================================================================

  [1] [ ] Re:Zero - Starting Life In Another World  [tvshow]
      ID: 1421e25cae193ff678e0337ecf974b71
      Dur: ?  |  Lang: Hindi, Japanese  |  Genres: Anime, Suspense, International Drama
      Rating: 16/20
      By: Muse Communication

Fallback: If no matches found in homepage sections, calls the /search/suggest API which returns text-only suggestions (no IDs or metadata):

  No exact matches in homepage for: rare show
  Suggestions from API:

    β€’ Rare Show Name
    β€’ Another Suggestion

  Tip: Run 'home' first, then search again for detailed results

3. detail β€” Get Content Detail by ID

Fetches detailed content metadata. Behavior changes depending on content type.

# Episode detail (raw API JSON)
python app.py detail 8adb444072a4789a4cbcbe6c038d1529 episode

# Movie detail
python app.py detail <movie_id> movie

# Season detail
python app.py detail <season_id> season

# TV Show detail β€” AUTO-RESOLVES first episode stream!
python app.py detail 1421e25cae193ff678e0337ecf974b71 tvshow

For episode, movie, season: Calls /detail/video?type={type}&id={id} and returns the raw JSON response with full metadata and stream URLs.

For tvshow: Uses a resolution chain instead of the broken /detail/video?type=tvshow endpoint:

  1. Cache lookup β€” finds the item in cached homepage data to get its webUrl
  2. SEO resolve β€” resolves the show page URL via SEO resolver to find season dependencies
  3. Season episodes β€” fetches the first season's episode list via /detail/tab/tvshowepisodes
  4. First episode stream β€” resolves the first episode URL and extracts HLS/DASH

Output:

======================================================================
  SHOW DETAILS β€” Re:Zero - Starting Life In Another World
======================================================================
  ID:           1421e25cae193ff678e0337ecf974b71
  Type:         tvshow
  Rating:       16/20
  Languages:    Hindi, Japanese
  Genres:       Anime, Suspense, International Drama
  Seasons:      3
  Episodes:     50
  Description:  A year after the battle in the Sanctuary...

  ── Season ──
  ID:           5461568c7d70d89bb61787f71b761eca
  Name:         Season 3
  Season No:    3

  ── First Episode ──
  ID:           8adb444072a4789a4cbcbe6c038d1529
  Title:        Theatrical Malice
  Episode No:   1
  Duration:     1h 30m
  URL:          https://www.mxplayer.in/show/watch-rezero/season-3/...
  ── Stream ──
  HLS:          https://d3sgzbosmwirao.cloudfront.net/video/.../master.m3u8
  DASH:         https://d3sgzbosmwirao.cloudfront.net/video/.../master.mpd
  Provider:     mxplay
  Video Hash:   abc123...
  Download:     eligible=False, login=False

Note: Requires home to have been run first so the cache is populated. If the ID isn't in cache, the tool auto-fetches the homepage and retries.


4. stream β€” Extract HLS/DASH Stream URLs

Primary command for getting playable stream URLs.

# Default type is "episode"
python app.py stream 8adb444072a4789a4cbcbe6c038d1529

# Explicit type
python app.py stream 8adb444072a4789a4cbcbe6c038d1529 episode
python app.py stream <movie_id> movie

# TV show β€” auto-resolves first episode's stream
python app.py stream 1421e25cae193ff678e0337ecf974b71 tvshow

Output:

======================================================================
  STREAM DETAILS β€” Theatrical Malice
======================================================================
  ID:           8adb444072a4789a4cbcbe6c038d1529
  Type:         episode
  Duration:     1h 30m  (5430s)
  Languages:    Hindi, Japanese
  Genres:       International Drama, Web Series, Mystery, Suspense, Dubbed, Anime
  Rating:       0
  Release:      2024-10-01
  Description:  A year after the battle in the Sanctuary...

  ── Stream ──
  Provider:     mxplay
  Video Hash:   abc123...

  HLS URL:      https://d3sgzbosmwirao.cloudfront.net/video/.../master.m3u8
  HLS Base:     https://d3sgzbosmwirao.cloudfront.net/video/.../

  DASH URL:     https://d3sgzbosmwirao.cloudfront.net/video/.../master.mpd
  DASH Base:    https://d3sgzbosmwirao.cloudfront.net/video/.../

  Show:         Re:Zero - Starting Life In Another World
  Season:       Season 3
  Episode No:   1
  Episode:      Theatrical Malice
  Publisher:    Muse Communication

Supported stream sources (checked in priority order):

Source HLS Field DASH Field
Primary stream.hls.high / .base / .main stream.dash.high / .base / .main
Third Party stream.thirdParty.hlsUrl stream.thirdParty.dashUrl
ALTBalaji stream.altBalaji.hlsUrl stream.altBalaji.dashUrl
MX Play stream.mxplay.hls.high stream.mxplay.dash.high

Relative paths are automatically prefixed with https://d3sgzbosmwirao.cloudfront.net/.


5. url β€” Extract Stream from a Page Link

The easiest way to get a stream β€” just paste any mxplayer.in URL.

python app.py url "https://www.mxplayer.in/show/watch-rezero-starting-life-in-another-world/season-3/theatrical-malice-online-8adb444072a4789a4cbcbe6c038d1529"

python app.py url "https://www.mxplayer.in/detail/episode/fdbe24838023f11187378ff48639291c"

python app.py url "https://www.mxplayer.in/show/watch-demon-slayer-series-online-8f245ff90a4f7d0e11c2dd48b3de733d"

Resolution logic:

  1. If URL path starts with /detail/episode/ or /detail/season/ β€” extracts the ID and type directly, calls /detail/video
  2. Otherwise β€” sends the path through the SEO resolver (/v1/api/seo/get-url-details) which returns the content ID, type, title, and full metadata
  3. Then calls /detail/video with the resolved ID and type to get the stream URL

This command does NOT require the cache to be populated β€” it works independently.


6. browse β€” Browse by Genre

Browse content by genre filter.

python app.py browse
python app.py browse --genre <genre_filter_id>
python app.py browse --lang <language_filter_id>
python app.py browse --genre <id> --lang <id>

7. next β€” Get Next Episode in a Series

Fetches the next episode ID and metadata for a given episode.

python app.py next 8adb444072a4789a4cbcbe6c038d1529

Calls the /detail/nextVideo endpoint.


8. newid β€” Generate New Anonymous User ID

Rotates your anonymous identity. MX Player identifies anonymous users by a UUID sent as the userid parameter. If you encounter rate limiting or unexpected behavior, generate a new identity.

python app.py newid
# [*] New user ID: d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90

9. sections β€” List Homepage Section Names

Lists all section indices, names, styles, and item counts from the homepage cache.

python app.py sections

Output:

   1. Popular Movies                          posters        12 items
   2. Trending Now                            grid_vertical  25 items
   3. Anime Now in Hindi!                     grid_vertical  20 items
   4. New Releases                            landscape      15 items

10. item β€” Full Detail on a Cached Item

After running home, you can view every single field of cached items by section and item number.

# Show all items in section 2
python app.py item 2

# Show specific item 3 in section 2
python app.py item 2.3

Output includes:

  • ID, type, subtype, duration, rating, release date
  • Status code, web URL, share URL
  • Description, languages, genres, tags
  • Stream URLs (HLS/DASH if present), DRM protection, provider, video hash
  • Download eligibility (requireLogin, criteria, eligible)
  • Images (landscape, portrait, banners β€” up to 4)
  • Title/banner images
  • Cast members and directors
  • Publisher info with video/subscriber counts
  • First episode info (for tvshows)
  • Trailers with their own stream URLs
  • Season/episode counts
  • GIF preview URLs
  • Interactivity info

11. interactive β€” Interactive Menu Mode

Launch a full menu-driven interface with keyboard navigation.

python app.py interactive
# Or shorthand:
python app.py i
====================================================
  MX Player API β€” No Login Required
  User: 5ab7595d...
====================================================
  1) Home          β€” browse homepage sections
  2) Search        β€” search across all sections
  3) Detail        β€” get content detail by ID
  4) Stream URL    β€” extract video URL from page link
  5) Browse        β€” browse by genre
  6) Next Video    β€” get next episode in series
  7) New Identity  β€” generate new anonymous user ID
  8) Sections      β€” list homepage section names
  9) Item Detail   β€” full detail of an item (after Home)
  0) Quit

  >>

Typical workflow:

  1. 1 β†’ Home (populates cache)
  2. 8 β†’ Sections (see available section names)
  3. 2 β†’ Search β†’ enter "rezero" β†’ see the show with its full ID
  4. 3 β†’ Detail β†’ enter show ID β†’ type tvshow (resolves first episode stream)
  5. 9 β†’ Item Detail β†’ enter section number β†’ enter item number (full dump)
  6. 4 β†’ Stream URL β†’ paste mxplayer.in page URL (independent of cache)
  7. 7 β†’ New Identity (if rate limited)

Interactive Menu Walkthrough

Complete walkthrough: Finding and streaming a TV show from scratch.

$ python app.py i

====================================================
  MX Player API β€” No Login Required
  User: 5ab7595d...
====================================================
  1) Home          β€” browse homepage sections
  2) Search        β€” search across all sections
  3) Detail        β€” get content detail by ID
  4) Stream URL    β€” extract video URL from page link
  ...

  >> 1
  [Homepage loads with all sections and items]
  [Press Enter...]

  >> 8
   1. Popular Movies                          posters        12 items
   2. Trending Now                            grid_vertical  25 items
   3. Anime Now in Hindi!                     grid_vertical  20 items
   ...
  [Press Enter...]

  >> 2
  Query: rezero

  Matches for: rezero (1 results)
  [1] [ ] Re:Zero - Starting Life In Another World  [tvshow]
      ID: 1421e25cae193ff678e0337ecf974b71
      Dur: ?  |  Lang: Hindi, Japanese  |  Genres: Anime, Suspense, International Drama
      Rating: 16/20
      By: Muse Communication
  [Press Enter...]

  >> 3
  ID: 1421e25cae193ff678e0337ecf974b71
  Type [episode]: tvshow

  [*] Show: Re:Zero - Starting Life In Another World
  [*] SEO-resolving show page: /show/watch-rezero-series-online-1421e25cae...
  [*] Found: Season 3 (5461568c7d70d89bb61787f71b761eca)
  [*] First episode: Theatrical Malice (S3E1)

  SHOW DETAILS β€” Re:Zero - Starting Life In Another World
  ...
  ── First Episode ──
  HLS: https://d3sgzbosmwirao.cloudfront.net/video/.../master.m3u8
  DASH: https://d3sgzbosmwirao.cloudfront.net/video/.../master.mpd
  [Press Enter...]

From homepage to HLS stream in 3 commands.


How It Works β€” API Internals

1. Anonymous Identity

Every request includes a userid parameter β€” a randomly generated UUID v4. This identifies anonymous users without requiring any login or signup.

GET /v1/web/home/tab/...?userid=5ab7595d-8c4a-4cd1-aa4a-1b5e2e3f4a5b&...

Generated once per session (or until newid is run). Stored in the global _USER_ID variable.

Default parameters sent with every request:

Parameter Value Description
device-density 2 Screen density
platform com.mxplay.desktop Platform identifier
content-languages hi,en Preferred languages
kids-mode-enabled false Kids content filter
userid UUID v4 Anonymous identity

2. Homepage Sections API

GET /v1/web/home/tab/{tab_id}?pageSize=50&device-density=2&platform=com.mxplay.desktop&content-languages=hi,en&userid={uuid}

Default tab_id: 87c3ddc974dcf12294e9412bec44b097 (main Hindi browse tab)

Returns a JSON object with a data.sections array. Each section has:

{
  "name": "Popular Movies",
  "style": "posters",
  "id": "...",
  "webUrl": "/list/...",
  "next": "...",
  "items": [
    {
      "id": "1421e25cae193ff678e0337ecf974b71",
      "title": "Re:Zero - Starting Life In Another World",
      "type": "tvshow",
      "webUrl": "/show/watch-rezero-series-online-...",
      "stream": null,
      "duration": null,
      "languages": ["Hindi", "Japanese"],
      "genres": [{"id":"...","name":"Anime"},...],
      "rating": 16,
      "publisher": {"name": "Muse Communication"},
      "imageInfo": [...]
    }
  ]
}

Key insight: Items with type: "tvshow" or type: "season" are containers β€” they have stream: null and no duration. Items with type: "episode" or type: "movie" are playable and include a stream object with HLS/DASH URLs.

3. Content Detail API

GET /v1/web/detail/video?type={type}&id={id}&userid={uuid}&...
Type Works? Returns
episode βœ… Yes Full metadata + stream URLs
movie βœ… Yes Full metadata + stream URLs
season βœ… Yes Season metadata (no stream) + episode list
tvshow ❌ No statusCode: 1000, all fields null

The tvshow type returns HTTP 400 with statusCode: 1000 and completely null data β€” this is the API telling you "this is a container, not a playable item." This is not a bug in the tool. The tool bypasses this endpoint for tvshows entirely using the SEO Resolution Chain.

Response structure for episode/movie:

{
  "id": "8adb444072a4789a4cbcbe6c038d1529",
  "title": "Theatrical Malice",
  "type": "episode",
  "description": "...",
  "duration": 5430,
  "releaseDate": "2024-10-01T00:00:00.000Z",
  "languages": ["Hindi", "Japanese"],
  "genres": [{"id":"...","name":"International Drama"},...],
  "rating": 0,
  "statusCode": 1001,
  "subType": null,
  "stream": {
    "hls": {"high": "https://d3sgzbosmwirao.cloudfront.net/video/.../master.m3u8"},
    "dash": {"high": "https://d3sgzbosmwirao.cloudfront.net/video/.../master.mpd"},
    "videoHash": "...",
    "drmProtect": false,
    "provider": "mxplay",
    "aspectRatio": "16x9",
    "download": {...}
  },
  "imageInfo": [...],
  "publisher": {"id":"...","name":"Muse Communication"},
  "contributors": [...],
  "trailer": [...]
}

4. SEO Resolver

GET /v1/api/seo/get-url-details?url={path}&device-density=2&userid={uuid}&platform=...&content-languages=...

This is the most powerful endpoint in the MX Player API. It accepts any mxplayer.in URL path and returns:

  • Content ID (data.id) β€” the internal UUID
  • Content type (data.type) β€” episode, movie, tvshow, season
  • Full metadata β€” title, display_title, description, duration, episode_no
  • Dependencies (data.dependencies) β€” parent objects with URLs and IDs:
    • home β€” homepage section
    • category-home β€” category page
    • tvshow β€” parent show (for episodes)
    • season β€” parent season (for episodes) with season_no
  • Directors & Actors β€” with names and IDs
  • Genres β€” with IDs and names
  • Publisher β€” name and ID
  • Language pack β€” translated descriptions in multiple Indian languages
  • Redirect β€” canonical URL
  • Source β€” raw language list, release date, status

Example response (for an episode path):

{
  "successful": true,
  "data": {
    "id": "8adb444072a4789a4cbcbe6c038d1529",
    "type": "episode",
    "title": "Watch Re:Zero Season 3 Episode 1 Online free - Amazon MX Player",
    "display_title": "Re:Zero Season 3 Episode No. 1 | 2nd October 2024",
    "episode_no": 1,
    "duration": 5430,
    "dependencies": {
      "home": {"name": "Home", "url": "/"},
      "category-home": {"name": "Shows", "url": "/web-series"},
      "tvshow": {
        "url": "/show/watch-rezero-series-online-1421e25cae193ff678e0337ecf974b71",
        "id": "1421e25cae193ff678e0337ecf974b71",
        "name": "Re:Zero - Starting Life In Another World"
      },
      "season": {
        "url": "/show/watch-rezero/seasons/season-3-5461568c7d70d89bb61787f71b761eca",
        "id": "5461568c7d70d89bb61787f71b761eca",
        "name": "Season 3",
        "season_no": 3
      }
    },
    "source": {
      "language": ["hi", "ja"],
      "directors": [{"id":"...","name":"Masahiro Shinohara"},...],
      "actors": [{"id":"...","name":"YΓ»suke Kobayashi"},...],
      "publisher": {"id":"...","name":"Muse Communication"}
    }
  }
}

5. TV Show Resolution Chain

When you run detail <id> tvshow or stream <id> tvshow, the following chain executes. This avoids the broken /detail/video?type=tvshow endpoint:

STEP 1: Cache Lookup
_find_item_in_cache(show_id)
β†’ Returns cached homepage item with webUrl, title, basic info
β†’ Fallback: auto-fetch homepage if cache is empty

         β”‚
         β–Ό

STEP 2: SEO Resolve Show Page
_req_seo("/show/watch-rezero-series-online-1421e25cae...")
β†’ Returns show metadata with dependencies
β†’ Extracts dependencies.season (first season)

         β”‚
         β–Ό

STEP 3: Extract Season ID
dependencies.season.id = "5461568c7d70d89bb61787f71b761eca"
dependencies.season.name = "Season 3"
dependencies.season.season_no = 3

         β”‚
         β–Ό

STEP 4: Fetch Season Episodes
GET /detail/tab/tvshowepisodes?type=season&id={season_id}
β†’ Returns list of all episodes in the season
β†’ Takes the FIRST episode (index 0)

         β”‚
         β–Ό

STEP 5: First Episode β†’ SEO Resolve β†’ Fetch Stream
first_episode.webUrl β†’ SEO resolve β†’ get content ID + type
β†’ GET /detail/video?type=episode&id={ep_id}
β†’ Parse stream.hls and stream.dash for HLS/DASH URLs

6. Stream URL Parsing

The _parse_stream() function handles multiple stream container formats:

Order of precedence for HLS (first found is used):
1. stream.hls.high
2. stream.hls.base
3. stream.hls.main
4. stream.thirdParty.hlsUrl
5. stream.altBalaji.hlsUrl
6. stream.mxplay.hls.high

Order of precedence for DASH:
1. stream.dash.high
2. stream.dash.base
3. stream.dash.main
4. stream.thirdParty.dashUrl
5. stream.altBalaji.dashUrl
6. stream.mxplay.dash.high

URL normalization: Any relative path (not starting with http) is automatically prefixed with the CDN base URL:

https://d3sgzbosmwirao.cloudfront.net/{relative_path}

Additional metadata extracted from stream:

  • drmProtect β€” boolean indicating DRM protection
  • videoHash β€” unique content hash
  • provider β€” content source (mxplay, thirdParty, altBalaji)
  • aspectRatio β€” video aspect ratio (e.g., 16x9)
  • download β€” download eligibility info (requireLogin, criteria, eligible)

7. Cache System

The client maintains two in-memory caches, populated by the home command:

_LAST_HOME_ITEMS = {
    1: [item1, item2, ...],  # Section 1 items
    2: [item1, item2, ...],  # Section 2 items
}

_LAST_HOME_ID_MAP = {
    "1421e25cae193ff678e0337ecf974b71": { ... },  # Fast O(1) ID lookup
    "8adb444072a4789a4cbcbe6c038d1529": { ... },
}

Commands that use the cache:

Command Cache Usage
search Searches cached items for faster results
detail <id> tvshow Looks up show's webUrl for SEO resolution
stream <id> tvshow Same as above
item <sec>[.<item>] Displays cached items
sections Lists cached sections

Auto-population: If search or detail tvshow find an empty cache, they automatically call home() first.

Persistence: Cache is in-memory only β€” lost when the script exits. Run home again after restarting.


Function Reference

HTTP Layer

Function HTTP Method Endpoint Description
_req(path, query) GET {BASE_URL}{path} Generic API GET with default params
_req_seo(url_path) GET {SEO_URL}/get-url-details SEO resolver lookup
_req_post(path, data, query) POST {BASE_URL}{path} Generic API POST

Cache System

Function Description
_update_cache_from_home(data) Populates _LAST_HOME_ITEMS and _LAST_HOME_ID_MAP from homepage response
_find_item_in_cache(content_id) O(1) ID lookup using _LAST_HOME_ID_MAP dict

API Methods

Function API Call Description
home(tab_id) GET /home/tab/{tab_id} Fetch homepage sections with all items
search_suggest(query) GET /search/suggest Get text-only search suggestions
detail_video(id, type) GET /detail/video Get content detail + stream
detail_browse(genre, lang, page, size) GET /detail/browseItem Browse content by genre/language
next_video(id, type) GET /detail/nextVideo Get next episode metadata
season_episodes(season_id) GET /detail/tab/tvshowepisodes List all episodes in a season
related_shows(show_id) GET /detail/tab/tvshowrelated_shows Get related shows list
around_current_episodes(season_id, filter_id) GET /detail/tab/aroundcurrentepisodes Episodes around current position
add_watch_history(id, type, progress) POST /watch/history/add Mark watch progress

Stream Resolution

Function Description
_parse_stream(stream_dict) Parses raw stream dict β†’ normalized {hls, dash, drmProtect, ...}
_resolve_episode_path(path) SEO-resolves a URL path β†’ {id, type, title, dependencies, ...}
_resolve_show_path(path) SEO-resolves a show page β†’ {season, tvshow, languages, ...}
extract_stream_url(page_url) Full URL β†’ stream (uses SEO + detail APIs)
_build_stream_result(detail, id, type) Builds result dict from /detail/video API response
get_stream_for_tvshow(show_id) Show ID β†’ first episode stream (full 5-step chain)
get_show_info(content_id) Show ID β†’ show detail + season info + first episode stream
get_season_episodes_list(season_id) Season ID β†’ list of all episodes with streams
_find_season_for_show(show_id, show_web_url) Show β†’ first season via SEO + dependency resolution
_find_first_episode_for_season(season_id) Season β†’ first episode via tvshowepisodes API

Search

Function Description
search_all_sections(query) Searches all cached homepage items by title, returns full item dicts

Display

Function Description
print_item_full(item, idx) Prints ALL available fields for a single item (30+ fields)
print_home_sections(data) Prints all sections with all items, full metadata
print_search_results(items, query) Prints search results with metadata
print_show_info(result) Prints formatted show details + season + first episode stream
print_stream_info(result) Prints formatted stream URLs, show/season/episode info

CLI Commands

Function CLI Invocation Description
cmd_home() python app.py home Fetch and display homepage
cmd_search() python app.py search <q> Search sections + fallback
cmd_detail() python app.py detail <id> <type> Detail or auto-resolve tvshow
cmd_stream() python app.py stream <id> [type] Get HLS/DASH URLs
cmd_url() python app.py url <page_url> Extract from page URL
cmd_browse() python app.py browse [--genre] Browse by genre
cmd_next() python app.py next <id> Next episode
cmd_newid() python app.py newid Reset anonymous identity
cmd_sections() python app.py sections List section names
cmd_item() python app.py item <n>[.<m>] Full item detail from cache
cmd_interactive() python app.py interactive Interactive menu mode

Troubleshooting

detail <id> tvshow fails with "not found in cache"

[!] TV show ID 'xxx' not found in cache.
Tip: Run 'home' first, then try again

Fixes:

  1. Run home first to populate the cache
  2. Use search <name> which auto-populates the cache
  3. Use stream <id> tvshow instead (also auto-populates)
  4. Use url <page_url> with the show's page URL (no cache needed)

statusCode: 1000 when calling detail API

This is expected behavior from the MX Player API when you query a tvshow container directly. The tool never calls /detail/video?type=tvshow β€” it uses the SEO resolution chain instead. If you're seeing statusCode 1000, you might be running older code.

No stream URLs returned

Some content may be:

  • DRM-protected (drmProtect: true) β€” stream URL exists but may require a DRM license
  • Login-required (download.requireLogin: true) β€” some content needs authentication
  • Geo-restricted β€” MX Player OTT is primarily available in India

Check the stream object in the output for flags.

HTTP Error 429: Too Many Requests

You're being rate-limited.

python app.py newid

HTTP Error 400 on detail commands

You may be using an invalid ID or type combination. Verify:

  • The ID exists (use search or home to find valid IDs)
  • The type matches the content (tvshow IDs don't work with type=episode)

season_episodes returns empty list

Some shows may have empty seasons or the season ID may be incorrect. Try a different show or verify the ID is from the SEO dependencies.


FAQ

Q: Do I need an account or login?
A: No. The client works entirely anonymously using a generated UUID.

Q: Is this legal?
A: This tool accesses publicly available APIs that MX Player's web frontend itself uses. It does not bypass any authentication, DRM, or paywalls. Use it responsibly and respect MX Player's Terms of Service.

Q: Why does detail tvshow work differently?
A: The MX Player API simply doesn't support /detail/video?type=tvshow. It returns statusCode: 1000 with null data for show containers. The tool works around this by using the SEO resolver + season episodes API to get the first episode's stream.

Q: Can I get ALL episodes of a show?
A: Not directly from the CLI, but the underlying season_episodes() function fetches all episodes for a given season. You can call it from Python: get_season_episodes_list(season_id).

Q: How do I find season IDs?
A: Run detail <show_id> tvshow β€” it displays the first season's ID. Or SEO-resolve any episode URL from that show and check dependencies.season.id.

Q: Can I download videos?
A: This tool extracts stream URLs. Actual downloading requires a separate tool like ffmpeg, yt-dlp, or a media player. The HLS/m3u8 URLs can be played in VLC, MPV, or streamed with ffmpeg.

Q: The homepage tab ID doesn't work anymore?
A: The default tab ID 87c3ddc974dcf12294e9412bec44b097 may change if MX Player updates their app. You can discover new tab IDs by monitoring network requests from mxplayer.in in your browser's DevTools.

Q: Does this work outside India?
A: The API endpoints may respond differently based on geographic location. MX Player OTT content is primarily licensed for India. Some content may be geo-blocked.

Q: Can I change the language of results?
A: Edit the content-languages parameter in DEFAULT_PARAMS at the top of app.py. Default is "hi,en". Add more language codes as needed.


Disclaimer

⚠️ Legal & Ethical Use Only

This tool is for authorized security testing, educational purposes, and personal use only.

  • Only use on content you have legitimate access to
  • Respect MX Player's Terms of Service
  • Do not use for piracy, copyright infringement, or unauthorized redistribution
  • The authors are not responsible for any misuse of this tool

No Warranty. This software is provided "as is" without warranty of any kind. The API endpoints, data formats, and availability may change without notice. The authors assume no liability for any damages arising from the use of this software.

API Stability. MX Player's internal APIs are not public or documented. They may change, break, or require different parameters at any time. This tool is maintained on a best-effort basis.


License

MIT License

Copyright (c) 2026

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Built with Python 3 standard library β€” zero external dependencies, maximum portability.

About

😈 It's MX Player API Get All Data In JSON From MxPlayer

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages