How to Use the Short Drama API in Python

This is a complete Python walkthrough of the DramaAPI short drama API. You will install the official SDK (or skip it and use requests), search a single provider such as ReelShort, page through every episode, fetch HLS and MP4 stream URLs, read subtitle tracks, and handle the one error case that matters. If you have been searching for a ReelShort API for Python or a DramaBox API that does not involve decompiling an APK, this is the shortest path.

Prerequisites

  • Python 3.8 or newer.
  • A free API key (7 days, 1,000 requests; paid plans from $15/month in crypto).

Every request to https://dramaapi.live must carry the header X-API-Key: YOUR_KEY. The SDK adds it for you.

Option A: install the SDK

pip install dramaapi
from dramaapi import DramaAPI

api = DramaAPI('YOUR_KEY')

The client exposes six methods that map one-to-one onto the REST endpoints: search, home, detail, episodes, iterEpisodes and play. Each returns the parsed JSON as a plain dict.

Option B: no dependency beyond requests

If you would rather not add a package, a tiny wrapper is all you need:

import requests

BASE = 'https://dramaapi.live'
HEADERS = {'X-API-Key': 'YOUR_KEY'}

def get(path, **params):
    r = requests.get(BASE + path, headers=HEADERS, params=params, timeout=30)
    return r.status_code, r.json()

The rest of this guide shows the SDK call first and the raw path beside it so you can follow along with either.

Search one provider

Per-provider search lives under the provider slug. To search ReelShort for English titles:

# SDK
hits = api.search('billionaire', lang='en')['results']          # all providers
reelshort_hits = [h for h in hits if h['provider'] == 'reelshort']

# raw: provider-scoped endpoint
status, data = get('/reelshort/api/v1/search', keyword='billionaire', lang='en')
for item in data['results']:
    print(item['id'], item['title'], item['totalEpisodes'])

Every result has id, provider, title, thumbnail and totalEpisodes. Browsing without a keyword works too: api.home('reelshort', lang='en', page=1) hits GET /reelshort/api/v1/home?lang=en&page=1 and returns the same results shape. For one title's full metadata call api.detail('reelshort', series_id), which returns {'status': True, 'drama': {...}} with description, language and totalEpisodes.

Paginate episodes with iterEpisodes

The episodes endpoint is paged: GET /{provider}/api/v1/episodes/{seriesId}?page=1 returns episodes, page, totalEpisodes and a hasMore flag. The SDK's iterEpisodes is a generator that walks every page for you:

series_id = reelshort_hits[0]['id']

for ep in api.iterEpisodes('reelshort', series_id):
    print(ep['number'], ep['season'], ep['title'])

With plain requests the same loop looks like this:

def iter_episodes(provider, series_id):
    page = 1
    while True:
        status, data = get(f'/{provider}/api/v1/episodes/{series_id}', page=page)
        for ep in data['episodes']:
            yield ep
        if not data.get('hasMore'):
            break
        page += 1

for ep in iter_episodes('reelshort', series_id):
    print(ep['number'], ep['title'])

The number field is what you pass to the play endpoint; season is 1 for almost every short drama.

Get the stream URL (HLS or MP4)

Play is the endpoint everyone is actually after. It returns a signed media URL plus the container type:

# SDK
play = api.play('reelshort', series_id, 1)

# raw
status, play = get(f'/reelshort/api/v1/play/{series_id}/1')

print(play['kind'])       # 'hls' or 'mp4'
print(play['streamUrl'])  # https://.../index.m3u8  or  https://....mp4

kind is hls (an m3u8 playlist) for most providers. DramaBox and NetShort return mp4, which you can hand straight to any video element or download with requests. Stream URLs are signed and expire, so call play right before you start playback and do not persist the URL. If you want to inspect an m3u8 short drama playlist, fetch it like any other text file:

if play['kind'] == 'hls':
    playlist = requests.get(play['streamUrl'], timeout=30).text
    print(playlist.splitlines()[:5])

Player integration tips for both formats are in How to Get Short-Drama Stream URLs.

Read the subtitles array

When a provider ships captions, the play response includes a subtitles list of WebVTT tracks. DramaWave offers up to 31 languages, WeTV up to 12, DramaNova 6 and MoboReels 1. Providers without captions omit the field entirely, so use .get:

play = api.play('dramawave', dw_series_id, 1)

for track in play.get('subtitles', []):
    print(track['lang'], track['url'])   # e.g. 'en' https://....vtt

# pick English if available
en = next((t for t in play.get('subtitles', []) if t['lang'] == 'en'), None)
if en:
    vtt = requests.get(en['url'], timeout=30).text

Subtitle URLs are signed the same way as stream URLs and expire with them.

Handle the 503 no-source case

Occasionally an episode has no playable source at the moment: the upstream platform is down, the title was pulled, or the episode is not yet available. DramaAPI signals this with HTTP 503 and a body of {"status": false, "error": "..."}. Check status before touching streamUrl:

def safe_play(provider, series_id, number):
    code, data = get(f'/{provider}/api/v1/play/{series_id}/{number}')
    if code == 503 or not data.get('status'):
        print('no source right now:', data.get('error'))
        return None
    return data

result = safe_play('reelshort', series_id, 1)
if result:
    print(result['streamUrl'])

A sensible strategy is to skip the episode, try the next one, or search the same title on another provider through the global search endpoint.

Putting it together

from dramaapi import DramaAPI

api = DramaAPI('YOUR_KEY')

hits = api.search('revenge', lang='en')['results']
pick = hits[0]
print('Playing', pick['title'], 'from', pick['provider'])

for ep in api.iterEpisodes(pick['provider'], pick['id']):
    play = api.play(pick['provider'], pick['id'], ep['number'])
    if not play.get('status'):
        print(ep['number'], 'unavailable')
        continue
    subs = [t['lang'] for t in play.get('subtitles', [])]
    print(ep['number'], play['kind'], play['streamUrl'][:60], subs)
    break   # remove to walk the whole series

The SDK code lives in the public DramaAPI GitHub repository, and the same methods exist in the JavaScript package if you later move to Node. Field-by-field definitions are in the API reference.

Next steps

More guides