Deployed 87b58190 with MkDocs version: 1.6.1

This commit is contained in:
2026-12-05 03:00:15 +00:00
parent 56cac92f20
commit 6ed040a6dd
44 changed files with 17665 additions and 13063 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+241 -163
View File
@@ -13,10 +13,10 @@
<link rel="canonical" href="https://docs.unshackle.dev/dev/rest-api/errors/">
<link rel="prev" href="../remote-sessions/">
<link rel="prev" href="../job-lifecycle/">
<link rel="next" href="../../../reference/api/service/">
<link rel="next" href="../remote-sessions/">
@@ -347,28 +347,6 @@
<li class="md-tabs__item">
<a href="../../../reference/api/service/" class="md-tabs__link">
API Reference
</a>
</li>
</ul>
</div>
</nav>
@@ -614,6 +592,8 @@
@@ -886,6 +866,171 @@
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3_9" >
<div class="md-nav__link md-nav__container">
<a href="../" class="md-nav__link ">
<span class="md-ellipsis">
Server
</span>
</a>
<label class="md-nav__link " for="__nav_3_9" id="__nav_3_9_label" tabindex="0">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_3_9_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3_9">
<span class="md-nav__icon md-icon"></span>
Server
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../authentication/" class="md-nav__link">
<span class="md-ellipsis">
Authentication
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../dashboard/" class="md-nav__link">
<span class="md-ellipsis">
Dashboard
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../guide/remote-sessions/" class="md-nav__link">
<span class="md-ellipsis">
Remote Sessions
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
@@ -1078,7 +1223,7 @@
<span class="md-ellipsis">
Output & Naming
Output & Naming Options
@@ -1162,7 +1307,7 @@
<span class="md-ellipsis">
Key Vaults
Key Vault Options
@@ -1282,6 +1427,8 @@
@@ -1400,14 +1547,6 @@
@@ -1436,9 +1575,8 @@
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_3" checked>
<div class="md-nav__link md-nav__container">
<a href="../" class="md-nav__link ">
<label class="md-nav__link" for="__nav_5_3" id="__nav_5_3_label" tabindex="">
<span class="md-ellipsis">
@@ -1452,14 +1590,8 @@
</a>
<label class="md-nav__link " for="__nav_5_3" id="__nav_5_3_label" tabindex="">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_3_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_5_3">
@@ -1473,8 +1605,6 @@
<ul class="md-nav__list" data-md-scrollfix>
@@ -1488,35 +1618,7 @@
<span class="md-ellipsis">
Quick Start
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../authentication/" class="md-nav__link">
<span class="md-ellipsis">
Authentication
REST API Quick Start
@@ -1590,62 +1692,6 @@
<li class="md-nav__item">
<a href="../dashboard/" class="md-nav__link">
<span class="md-ellipsis">
Dashboard
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../remote-sessions/" class="md-nav__link">
<span class="md-ellipsis">
Remote Sessions
</span>
</a>
</li>
@@ -1872,9 +1918,29 @@
</ul>
</nav>
<li class="md-nav__item">
<a href="../remote-sessions/" class="md-nav__link">
<span class="md-ellipsis">
Remote Session Protocol
</span>
</a>
</li>
@@ -1886,9 +1952,10 @@
</li>
@@ -1911,25 +1978,28 @@
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" >
<label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_4" >
<label class="md-nav__link" for="__nav_5_4" id="__nav_5_4_label" tabindex="">
<span class="md-ellipsis">
API Reference
Python API
@@ -1940,12 +2010,12 @@
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_6">
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_4_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_4">
<span class="md-nav__icon md-icon"></span>
API Reference
Python API
</label>
@@ -2097,6 +2167,14 @@
</li>
</ul>
</nav>
</li>
</ul>
</nav>
@@ -2307,7 +2385,7 @@ that carries a machine-readable <strong>error code</strong>, a human-readable <s
matching <strong>HTTP status</strong>. This page documents that format and catalogues every error
code the server can send.</p>
<p>If you write a client against the API, read this page alongside the endpoint
reference. Each endpoint lists the specific codes it raises, and this page gives the
reference. The section of each endpoint names the specific codes it raises, and this page gives the
meanings of those codes.</p>
<div class="admonition note">
<p class="admonition-title">Where this comes from</p>
@@ -2405,7 +2483,7 @@ stable across releases.</p>
<div class="language-text highlight"><pre><span></span><code><span id="__span-1-1"><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a>Error ref 7f3a2c: SERVICE_ERROR 422 POST /api/session/&lt;id&gt;/license service=EXAMPLE user=alice: Licence request failed: ...
</span></code></pre></div>
<p>Search the server log for <code>Error ref &lt;ref&gt;</code>. The handler's traceback, when there is one,
is directly above that line. The <a href="../dashboard/">developer dashboard</a> log view also shows it.</p>
is directly above that line. The <a href="../dashboard/">server dashboard</a> log view also shows it.</p>
<h3 id="the-details-object">The <code>details</code> object<a class="headerlink" href="#the-details-object" title="Permanent link">&para;</a></h3>
<p>When present, <code>details</code> carries extra context specific to the error. It is only
included when it is non-empty, so a client must treat a missing <code>details</code> as "no
@@ -2511,7 +2589,7 @@ while the server restarts.</p>
<tr>
<td><code>SESSION_NOT_FOUND</code></td>
<td>404</td>
<td>The remote-dl session does not exist or has expired.</td>
<td>The remote session does not exist or has expired.</td>
</tr>
<tr>
<td><code>TRACK_NOT_FOUND</code></td>
@@ -2536,7 +2614,7 @@ while the server restarts.</p>
<tr>
<td><code>DRM_ERROR</code></td>
<td>422</td>
<td>DRM or license acquisition failed.</td>
<td>DRM or licence acquisition failed.</td>
</tr>
<tr>
<td><code>RATE_LIMITED</code></td>
@@ -2713,9 +2791,9 @@ body that uses an integer <code>status</code> and no <code>error_code</code> or
(integer <code>status</code>, no <code>error_code</code>).</p>
</div>
<h2 id="late-failures-with-status-200">Late failures with status <code>200</code><a class="headerlink" href="#late-failures-with-status-200" title="Permanent link">&para;</a></h2>
<p>The remote session <code>titles</code>, <code>tracks</code> and <code>license</code> routes send status <code>200</code> and the headers
<p>The remote session <code>titles</code>, <code>tracks</code>, <code>segments</code> and <code>license</code> routes send status <code>200</code> and the headers
when the work takes longer than 30 seconds. They then send a newline every 30 seconds to keep
the connection open. See <a href="../endpoints/#slow-responses">Slow responses</a>. A failure after that
the connection open. See <a href="../remote-sessions/#slow-responses">Slow responses</a>. A failure after that
time arrives as the standard error body, but with status <code>200</code>. The body has no field for the
HTTP status that the error would otherwise have. <code>error_code</code> and <code>retryable</code> stay in the body.</p>
<div class="admonition warning">
@@ -2770,7 +2848,7 @@ debugging, never on a server reachable by untrusted clients.</p>
</ol>
<div class="admonition note">
<p class="admonition-title">Reference consumer</p>
<p>unshackle's own remote-download client treats any status of <code>400</code> or above as
<p>unshackle's own remote session client treats any status of <code>400</code> or above as
fatal, and a <code>200</code> body with <code>"status": "error"</code> and an <code>error_code</code> too: it logs
<code>Server error [&lt;error_code&gt;]: &lt;message&gt;</code> and exits. It retries a request once,
after one second, only when a <code>502</code>, <code>503</code> or <code>504</code> arrives with a body that is
@@ -2815,7 +2893,7 @@ handling.</p>
<nav class="md-footer__inner md-grid" aria-label="Footer" >
<a href="../remote-sessions/" class="md-footer__link md-footer__link--prev" aria-label="Previous: Remote Sessions">
<a href="../job-lifecycle/" class="md-footer__link md-footer__link--prev" aria-label="Previous: Job Lifecycle">
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
@@ -2825,20 +2903,20 @@ handling.</p>
Previous
</span>
<div class="md-ellipsis">
Remote Sessions
Job Lifecycle
</div>
</div>
</a>
<a href="../../../reference/api/service/" class="md-footer__link md-footer__link--next" aria-label="Next: Service">
<a href="../remote-sessions/" class="md-footer__link md-footer__link--next" aria-label="Next: Remote Session Protocol">
<div class="md-footer__title">
<span class="md-footer__direction">
Next
</span>
<div class="md-ellipsis">
Service
Remote Session Protocol
</div>
</div>
<div class="md-footer__button md-icon">
+288 -278
View File
@@ -13,10 +13,10 @@
<link rel="canonical" href="https://docs.unshackle.dev/dev/rest-api/">
<link rel="prev" href="../service-architecture/">
<link rel="prev" href="../../guide/troubleshooting/">
<link rel="next" href="quickstart/">
<link rel="next" href="authentication/">
@@ -27,7 +27,7 @@
<title>Overview - unshackle</title>
<title>Server Overview - unshackle</title>
@@ -82,7 +82,7 @@
<div data-md-component="skip">
<a href="#rest-api-overview" class="md-skip">
<a href="#server-overview" class="md-skip">
Skip to content
</a>
@@ -116,7 +116,7 @@
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Overview
Server Overview
</span>
</div>
@@ -283,10 +283,12 @@
<li class="md-tabs__item">
<li class="md-tabs__item md-tabs__item--active">
<a href="../../guide/downloading/" class="md-tabs__link">
@@ -327,12 +329,10 @@
<li class="md-tabs__item md-tabs__item--active">
<li class="md-tabs__item">
<a href="../creating-a-service/" class="md-tabs__link">
@@ -347,28 +347,6 @@
<li class="md-tabs__item">
<a href="../../reference/api/service/" class="md-tabs__link">
API Reference
</a>
</li>
</ul>
</div>
</nav>
@@ -596,6 +574,8 @@
@@ -614,26 +594,31 @@
<li class="md-nav__item md-nav__item--nested">
<li class="md-nav__item md-nav__item--active md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3" >
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3" checked>
<label class="md-nav__link" for="__nav_3" id="__nav_3_label" tabindex="0">
<label class="md-nav__link" for="__nav_3" id="__nav_3_label" tabindex="">
@@ -651,7 +636,7 @@
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false">
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_3">
<span class="md-nav__icon md-icon"></span>
@@ -886,6 +871,176 @@
<li class="md-nav__item md-nav__item--active md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3_9" checked>
<div class="md-nav__link md-nav__container">
<a href="./" class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
Server
</span>
</a>
<label class="md-nav__link md-nav__link--active" for="__nav_3_9" id="__nav_3_9_label" tabindex="">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_3_9_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_3_9">
<span class="md-nav__icon md-icon"></span>
Server
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="authentication/" class="md-nav__link">
<span class="md-ellipsis">
Authentication
</span>
</a>
</li>
<li class="md-nav__item">
<a href="dashboard/" class="md-nav__link">
<span class="md-ellipsis">
Dashboard
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../guide/remote-sessions/" class="md-nav__link">
<span class="md-ellipsis">
Remote Sessions
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
@@ -1078,7 +1233,7 @@
<span class="md-ellipsis">
Output & Naming
Output & Naming Options
@@ -1162,7 +1317,7 @@
<span class="md-ellipsis">
Key Vaults
Key Vault Options
@@ -1271,8 +1426,6 @@
@@ -1284,26 +1437,25 @@
<li class="md-nav__item md-nav__item--active md-nav__item--section md-nav__item--nested">
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5" checked>
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5" >
<label class="md-nav__link" for="__nav_5" id="__nav_5_label" tabindex="">
<label class="md-nav__link" for="__nav_5" id="__nav_5_label" tabindex="0">
@@ -1321,7 +1473,7 @@
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_5_label" aria-expanded="true">
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_5_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5">
<span class="md-nav__icon md-icon"></span>
@@ -1392,53 +1544,39 @@
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_3" >
<li class="md-nav__item md-nav__item--active md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_3" checked>
<div class="md-nav__link md-nav__container">
<a href="./" class="md-nav__link md-nav__link--active">
<label class="md-nav__link" for="__nav_5_3" id="__nav_5_3_label" tabindex="0">
<span class="md-ellipsis">
@@ -1452,16 +1590,10 @@
</a>
<label class="md-nav__link md-nav__link--active" for="__nav_5_3" id="__nav_5_3_label" tabindex="">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_3_label" aria-expanded="true">
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_3_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_3">
<span class="md-nav__icon md-icon"></span>
@@ -1473,8 +1605,6 @@
<ul class="md-nav__list" data-md-scrollfix>
@@ -1488,35 +1618,7 @@
<span class="md-ellipsis">
Quick Start
</span>
</a>
</li>
<li class="md-nav__item">
<a href="authentication/" class="md-nav__link">
<span class="md-ellipsis">
Authentication
REST API Quick Start
@@ -1593,14 +1695,14 @@
<li class="md-nav__item">
<a href="dashboard/" class="md-nav__link">
<a href="errors/" class="md-nav__link">
<span class="md-ellipsis">
Dashboard
Error Responses
@@ -1628,7 +1730,7 @@
<span class="md-ellipsis">
Remote Sessions
Remote Session Protocol
@@ -1642,55 +1744,20 @@
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="errors/" class="md-nav__link">
<span class="md-ellipsis">
Error Responses
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
@@ -1717,17 +1784,17 @@
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" >
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_4" >
<label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
<label class="md-nav__link" for="__nav_5_4" id="__nav_5_4_label" tabindex="0">
<span class="md-ellipsis">
API Reference
Python API
@@ -1738,12 +1805,12 @@
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_6">
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_4_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_4">
<span class="md-nav__icon md-icon"></span>
API Reference
Python API
</label>
@@ -1895,6 +1962,14 @@
</li>
</ul>
</nav>
</li>
</ul>
</nav>
@@ -2040,10 +2115,10 @@
</li>
<li class="md-nav__item">
<a href="#remote-download-sessions" class="md-nav__link">
<a href="#remote-sessions" class="md-nav__link">
<span class="md-ellipsis">
Remote-download sessions
Remote sessions
</span>
</a>
@@ -2097,20 +2172,19 @@
<h1 id="rest-api-overview">REST API Overview<a class="headerlink" href="#rest-api-overview" title="Permanent link">&para;</a></h1>
<p>unshackle ships with a built-in HTTP server. Alongside the command-line tool, you
can operate <code>unshackle serve</code> and drive the same download engine over a REST API:
searching services, listing titles and tracks, queueing downloads, watching live
progress, and browsing history, all as JSON over HTTP.</p>
<p>This page explains what the API is for, how to start the server, where it listens,
and how the endpoints are organised. Later pages cover each area in depth.</p>
<h1 id="server-overview">Server Overview<a class="headerlink" href="#server-overview" title="Permanent link">&para;</a></h1>
<p><code>unshackle serve</code> starts an HTTP server. The server can give the download engine of the
command-line tool as a REST API, and your CDM devices to other machines. The
<a href="#server-modes">server modes</a> select which of the two it gives.</p>
<p>This page is for the operator of the server. The other pages of this section tell you how
to set the <a href="authentication/">API keys</a>, how to watch the server from the
<a href="dashboard/">dashboard</a>, and how a <a href="../../guide/remote-sessions/"><code>dl --remote</code> client</a>
connects to it.</p>
<div class="admonition info">
<p class="admonition-title">Who this section is for</p>
<p>The REST API is for people who make automation, dashboards, or remote
clients on top of unshackle. If you only download the occasional title, the
<a href="../../guide/cli-reference/">command-line tool</a> does everything the API does
and is simpler to use. Reach for the API when you want a long-running service, a
job queue, or a web front-end.</p>
<p class="admonition-title">Pages for client developers</p>
<p>To write a client for the REST API, start with the <a href="quickstart/">REST API Quick Start</a>.
<a href="#where-to-go-next">Where to go next</a> lists the other client pages. To download a title,
you do not need the server: the <a href="../../guide/cli-reference/">command-line tool</a> is simpler.</p>
</div>
<h2 id="what-the-api-is-for">What the API is for<a class="headerlink" href="#what-the-api-is-for" title="Permanent link">&para;</a></h2>
<p>The server exposes the same capabilities as the <code>dl</code> command, but as discrete HTTP
@@ -2124,10 +2198,10 @@ calls you can script against:</p>
<li><strong>History and housekeeping</strong>: read the log of finished jobs, inspect the server's
effective (redacted) configuration, examine external tool versions, and clear caches
or temp files.</li>
<li><strong>Remote-download sessions</strong>: a thin local client can authenticate against a
service <em>on the server</em>, then pull titles, tracks, and segment info back, and proxy
<li><strong>Remote sessions</strong>: a thin local client can authenticate against a
service <em>on the server</em>, then pull titles, tracks, and segment info back, and relay
DRM licensing. This is how one machine with the credentials and CDMs can serve
downloads to another. See <a href="remote-sessions/">Remote Sessions</a>.</li>
downloads to another. See the <a href="remote-sessions/">remote session protocol</a>.</li>
</ul>
<p>Because every download runs as a queued job in a separate job worker process, the API is
well suited to running unattended: submit work, come back later, and read the result.</p>
@@ -2194,7 +2268,7 @@ how the <code>X-Secret-Key</code> header works.</p>
<tr>
<td><code>--remote-only</code></td>
<td>off</td>
<td>Expose only the remote-session subset of routes. Implies <code>--api-only</code>.</td>
<td>Expose only the <a href="remote-sessions/#routes">remote session routes</a>. Implies <code>--api-only</code>.</td>
</tr>
<tr>
<td><code>--debug-api</code></td>
@@ -2235,8 +2309,7 @@ This is the mode you get when you operate <code>unshackle serve</code> with no m
Authentication uses the single configured API key (or none, with <code>--no-key</code>).</p>
</div>
<div class="tabbed-block">
<p>The server mounts only the remote-session subset of routes (health, services, search,
and everything under <code>/api/session/*</code>). This mode implies <code>--api-only</code>, and the
<p>The server mounts only the <a href="remote-sessions/#routes">remote session routes</a>. This mode implies <code>--api-only</code>, and the
interactive Swagger UI is <strong>not</strong> mounted.</p>
</div>
<div class="tabbed-block">
@@ -2437,7 +2510,9 @@ request and response in full.</p>
</tr>
</tbody>
</table>
<h3 id="remote-download-sessions">Remote-download sessions<a class="headerlink" href="#remote-download-sessions" title="Permanent link">&para;</a></h3>
<h3 id="remote-sessions">Remote sessions<a class="headerlink" href="#remote-sessions" title="Permanent link">&para;</a></h3>
<p>The <code>/api/session/*</code>, <code>/api/tunnel</code> and <code>/api/tunnel/check</code> routes carry the remote sessions of
<code>dl --remote</code>. The <a href="remote-sessions/#routes">remote session protocol</a> lists each route.</p>
<table>
<thead>
<tr>
@@ -2448,86 +2523,21 @@ request and response in full.</p>
</thead>
<tbody>
<tr>
<td><code>POST</code></td>
<td><code>/api/session/create</code></td>
<td>Start a server-side, authenticated service session.</td>
</tr>
<tr>
<td><code>GET</code></td>
<td><code>/api/session/{session_id}</code></td>
<td>Remote session info and time-to-live.</td>
</tr>
<tr>
<td><code>DELETE</code></td>
<td><code>/api/session/{session_id}</code></td>
<td>Tear down a session.</td>
</tr>
<tr>
<td><code>GET</code></td>
<td><code>/api/session/{session_id}/titles</code></td>
<td>Titles for the session's title ID.</td>
<td><code>/api/remote/logins</code></td>
<td>The logins of a <a href="endpoints/#remote-services-relay">relayed</a> list call that wait on you.</td>
</tr>
<tr>
<td><code>POST</code></td>
<td><code>/api/session/{session_id}/tracks</code></td>
<td>Tracks (with URLs) for a chosen title.</td>
</tr>
<tr>
<td><code>POST</code></td>
<td><code>/api/session/{session_id}/segments</code></td>
<td>Per-track segment/download details.</td>
</tr>
<tr>
<td><code>POST</code></td>
<td><code>/api/session/{session_id}/segment_filter</code></td>
<td>Server-side HLS segment filter results for one track.</td>
</tr>
<tr>
<td><code>POST</code></td>
<td><code>/api/session/{session_id}/samples</code></td>
<td>Server-side cbcs sample decryption for one track.</td>
</tr>
<tr>
<td><code>POST</code></td>
<td><code>/api/session/{session_id}/license</code></td>
<td>Proxy or server-side DRM licensing.</td>
</tr>
<tr>
<td><code>POST</code></td>
<td><code>/api/session/{session_id}/keys</code></td>
<td>Store the content keys the client proved on a track.</td>
</tr>
<tr>
<td><code>POST</code></td>
<td><code>/api/session/{session_id}/keys/bad</code></td>
<td>Report a server-vault content key that did not decrypt.</td>
</tr>
<tr>
<td><code>GET</code></td>
<td><code>/api/session/{session_id}/channel</code></td>
<td>WebSocket of the remote session channel: prompts, CDM calls, logs, login state.</td>
</tr>
<tr>
<td><code>GET</code></td>
<td><code>/api/session/{session_id}/logs</code></td>
<td>Drain the service's server-side log output.</td>
</tr>
<tr>
<td><code>GET</code></td>
<td><code>/api/session/{session_id}/prompt</code></td>
<td>Poll for interactive auth status/prompt.</td>
</tr>
<tr>
<td><code>POST</code></td>
<td><code>/api/session/{session_id}/prompt</code></td>
<td>Submit an answer to an auth prompt.</td>
<td><code>/api/remote/logins/{login_id}/input</code></td>
<td>Answer the prompt of such a login.</td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="admonition-title">Remote-only routes</p>
<p>The health, services, search, and <code>/api/session/*</code> routes are the ones exposed
when the server runs with <code>--remote-only</code>. Everything else (downloads, jobs,
<p>A server that runs with <code>--remote-only</code> exposes only the
<a href="remote-sessions/#routes">remote session routes</a> and the dashboard routes. Everything else (downloads, jobs,
history, config, maintenance) is only available in the full or <code>--api-only</code> modes.</p>
</div>
<h2 id="authentication-in-one-line">Authentication in one line<a class="headerlink" href="#authentication-in-one-line" title="Permanent link">&para;</a></h2>
@@ -2543,7 +2553,7 @@ the full model, including per-key service allowlists.</p>
<h2 id="where-to-go-next">Where to go next<a class="headerlink" href="#where-to-go-next" title="Permanent link">&para;</a></h2>
<div class="grid cards">
<ul>
<li><strong><a href="quickstart/">Quick Start</a></strong>: start the server, set an API key, and operate your
<li><strong><a href="quickstart/">REST API Quick Start</a></strong>: start the server, set an API key, and operate your
first end-to-end download over the API.</li>
<li><strong><a href="authentication/">Authentication</a></strong>: the <code>X-Secret-Key</code> header, <code>--no-key</code>,
per-key service allowlists, and CORS.</li>
@@ -2551,8 +2561,8 @@ the full model, including per-key service allowlists.</p>
shape, endpoint by endpoint.</li>
<li><strong><a href="job-lifecycle/">Job Lifecycle</a></strong>: how a download moves from <code>queued</code> to a
terminal state, live progress, cancellation, and retries.</li>
<li><strong><a href="remote-sessions/">Remote Sessions</a></strong>: the <code>/api/session/*</code> flow for driving a
service from a thin remote client.</li>
<li><strong><a href="remote-sessions/">Remote Session Protocol</a></strong>: the routes, login states,
licensing modes and message shapes of a remote session.</li>
<li><strong><a href="errors/">Error Responses</a></strong>: the standard error envelope, error codes, and
their HTTP statuses.</li>
</ul>
@@ -2594,7 +2604,7 @@ the full model, including per-key service allowlists.</p>
<nav class="md-footer__inner md-grid" aria-label="Footer" >
<a href="../service-architecture/" class="md-footer__link md-footer__link--prev" aria-label="Previous: Service Architecture">
<a href="../../guide/troubleshooting/" class="md-footer__link md-footer__link--prev" aria-label="Previous: Troubleshooting">
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
@@ -2604,20 +2614,20 @@ the full model, including per-key service allowlists.</p>
Previous
</span>
<div class="md-ellipsis">
Service Architecture
Troubleshooting
</div>
</div>
</a>
<a href="quickstart/" class="md-footer__link md-footer__link--next" aria-label="Next: Quick Start">
<a href="authentication/" class="md-footer__link md-footer__link--next" aria-label="Next: Authentication">
<div class="md-footer__title">
<span class="md-footer__direction">
Next
</span>
<div class="md-ellipsis">
Quick Start
Authentication
</div>
</div>
<div class="md-footer__button md-icon">
+223 -145
View File
@@ -16,7 +16,7 @@
<link rel="prev" href="../endpoints/">
<link rel="next" href="../dashboard/">
<link rel="next" href="../errors/">
@@ -347,28 +347,6 @@
<li class="md-tabs__item">
<a href="../../../reference/api/service/" class="md-tabs__link">
API Reference
</a>
</li>
</ul>
</div>
</nav>
@@ -614,6 +592,8 @@
@@ -886,6 +866,171 @@
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3_9" >
<div class="md-nav__link md-nav__container">
<a href="../" class="md-nav__link ">
<span class="md-ellipsis">
Server
</span>
</a>
<label class="md-nav__link " for="__nav_3_9" id="__nav_3_9_label" tabindex="0">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_3_9_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3_9">
<span class="md-nav__icon md-icon"></span>
Server
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../authentication/" class="md-nav__link">
<span class="md-ellipsis">
Authentication
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../dashboard/" class="md-nav__link">
<span class="md-ellipsis">
Dashboard
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../guide/remote-sessions/" class="md-nav__link">
<span class="md-ellipsis">
Remote Sessions
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
@@ -1078,7 +1223,7 @@
<span class="md-ellipsis">
Output & Naming
Output & Naming Options
@@ -1162,7 +1307,7 @@
<span class="md-ellipsis">
Key Vaults
Key Vault Options
@@ -1282,6 +1427,8 @@
@@ -1400,14 +1547,6 @@
@@ -1436,9 +1575,8 @@
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_3" checked>
<div class="md-nav__link md-nav__container">
<a href="../" class="md-nav__link ">
<label class="md-nav__link" for="__nav_5_3" id="__nav_5_3_label" tabindex="">
<span class="md-ellipsis">
@@ -1452,14 +1590,8 @@
</a>
<label class="md-nav__link " for="__nav_5_3" id="__nav_5_3_label" tabindex="">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_3_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_5_3">
@@ -1473,8 +1605,6 @@
<ul class="md-nav__list" data-md-scrollfix>
@@ -1488,35 +1618,7 @@
<span class="md-ellipsis">
Quick Start
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../authentication/" class="md-nav__link">
<span class="md-ellipsis">
Authentication
REST API Quick Start
@@ -1836,10 +1938,10 @@
</li>
<li class="md-nav__item">
<a href="#secret-handling-in-serialized-jobs" class="md-nav__link">
<a href="#secret-handling-in-serialised-jobs" class="md-nav__link">
<span class="md-ellipsis">
Secret handling in serialized jobs
Secret handling in serialised jobs
</span>
</a>
@@ -1878,14 +1980,14 @@
<li class="md-nav__item">
<a href="../dashboard/" class="md-nav__link">
<a href="../errors/" class="md-nav__link">
<span class="md-ellipsis">
Dashboard
Error Responses
@@ -1913,7 +2015,7 @@
<span class="md-ellipsis">
Remote Sessions
Remote Session Protocol
@@ -1927,55 +2029,20 @@
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../errors/" class="md-nav__link">
<span class="md-ellipsis">
Error Responses
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
@@ -1994,25 +2061,28 @@
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" >
<label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_4" >
<label class="md-nav__link" for="__nav_5_4" id="__nav_5_4_label" tabindex="">
<span class="md-ellipsis">
API Reference
Python API
@@ -2023,12 +2093,12 @@
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_6">
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_4_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_4">
<span class="md-nav__icon md-icon"></span>
API Reference
Python API
</label>
@@ -2180,6 +2250,14 @@
</li>
</ul>
</nav>
</li>
</ul>
</nav>
@@ -2419,10 +2497,10 @@
</li>
<li class="md-nav__item">
<a href="#secret-handling-in-serialized-jobs" class="md-nav__link">
<a href="#secret-handling-in-serialised-jobs" class="md-nav__link">
<span class="md-ellipsis">
Secret handling in serialized jobs
Secret handling in serialised jobs
</span>
</a>
@@ -2949,12 +3027,12 @@ it repackages and muxes. A track counts as done when it reaches a terminal state
subprocess (escalating to <code>kill()</code> if it does not exit within 5 seconds), and raises
a cancellation so the task unwinds. The subprocess model is what makes this a clean,
immediate stop rather than a cooperative one. A job with the <code>remote</code> parameter first ends its
<a href="../remote-sessions/#when-the-client-ends-a-remote-session">remote session</a>, in at most 4
<a href="../../../guide/remote-sessions/#when-the-client-ends-a-remote-session">remote session</a>, in at most 4
seconds, and runs no post-script after the cancel.</li>
</ul>
<h3 id="secret-handling-in-serialized-jobs">Secret handling in serialized jobs<a class="headerlink" href="#secret-handling-in-serialized-jobs" title="Permanent link">&para;</a></h3>
<h3 id="secret-handling-in-serialised-jobs">Secret handling in serialised jobs<a class="headerlink" href="#secret-handling-in-serialised-jobs" title="Permanent link">&para;</a></h3>
<p>Job parameters may carry secrets: a raw <code>user:pass</code> credential, or a proxy URL with
embedded userinfo. Whenever the manager serializes a job (for an API response or the
embedded userinfo. Whenever the manager serialises a job (for an API response or the
history file), it masks the sensitive keys (<code>credential</code>, <code>credentials</code>, <code>password</code>,
<code>token</code>, <code>api_key</code>) and strips userinfo from proxy URLs. The manager also scrubs
free-text fields that a service might have leaked a secret into (<code>error_message</code>,
@@ -2966,7 +3044,7 @@ or logs them.</p>
<li><a href="../endpoints/">Endpoints</a>: the full request/response reference for every job endpoint.</li>
<li><a href="../errors/">Error Responses</a>: the error envelope, codes, and HTTP statuses a failed job reports.</li>
<li><a href="../authentication/">Authentication</a>: the <code>X-Secret-Key</code> header and per-key service allowlists that gate job creation and retry.</li>
<li><a href="../../../guide/downloading/">Downloading</a>: the equivalent options on the <code>dl</code> command line.</li>
<li><a href="../../../guide/cli-reference/#dl">CLI reference: <code>dl</code></a>: the equivalent options on the <code>dl</code> command line.</li>
</ul>
@@ -3022,13 +3100,13 @@ or logs them.</p>
<a href="../dashboard/" class="md-footer__link md-footer__link--next" aria-label="Next: Dashboard">
<a href="../errors/" class="md-footer__link md-footer__link--next" aria-label="Next: Error Responses">
<div class="md-footer__title">
<span class="md-footer__direction">
Next
</span>
<div class="md-ellipsis">
Dashboard
Error Responses
</div>
</div>
<div class="md-footer__button md-icon">
+232 -225
View File
@@ -13,10 +13,10 @@
<link rel="canonical" href="https://docs.unshackle.dev/dev/rest-api/quickstart/">
<link rel="prev" href="../">
<link rel="prev" href="../../service-architecture/">
<link rel="next" href="../authentication/">
<link rel="next" href="../endpoints/">
@@ -27,7 +27,7 @@
<title>Quick Start - unshackle</title>
<title>REST API Quick Start - unshackle</title>
@@ -116,7 +116,7 @@
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Quick Start
REST API Quick Start
</span>
</div>
@@ -347,28 +347,6 @@
<li class="md-tabs__item">
<a href="../../../reference/api/service/" class="md-tabs__link">
API Reference
</a>
</li>
</ul>
</div>
</nav>
@@ -614,6 +592,8 @@
@@ -886,6 +866,171 @@
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3_9" >
<div class="md-nav__link md-nav__container">
<a href="../" class="md-nav__link ">
<span class="md-ellipsis">
Server
</span>
</a>
<label class="md-nav__link " for="__nav_3_9" id="__nav_3_9_label" tabindex="0">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_3_9_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3_9">
<span class="md-nav__icon md-icon"></span>
Server
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../authentication/" class="md-nav__link">
<span class="md-ellipsis">
Authentication
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../dashboard/" class="md-nav__link">
<span class="md-ellipsis">
Dashboard
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../guide/remote-sessions/" class="md-nav__link">
<span class="md-ellipsis">
Remote Sessions
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
@@ -1078,7 +1223,7 @@
<span class="md-ellipsis">
Output & Naming
Output & Naming Options
@@ -1162,7 +1307,7 @@
<span class="md-ellipsis">
Key Vaults
Key Vault Options
@@ -1282,6 +1427,8 @@
@@ -1400,14 +1547,6 @@
@@ -1436,9 +1575,8 @@
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_3" checked>
<div class="md-nav__link md-nav__container">
<a href="../" class="md-nav__link ">
<label class="md-nav__link" for="__nav_5_3" id="__nav_5_3_label" tabindex="">
<span class="md-ellipsis">
@@ -1452,14 +1590,8 @@
</a>
<label class="md-nav__link " for="__nav_5_3" id="__nav_5_3_label" tabindex="">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_3_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_5_3">
@@ -1473,8 +1605,6 @@
<ul class="md-nav__list" data-md-scrollfix>
@@ -1497,7 +1627,7 @@
<span class="md-ellipsis">
Quick Start
REST API Quick Start
@@ -1515,7 +1645,7 @@
<span class="md-ellipsis">
Quick Start
REST API Quick Start
@@ -1608,10 +1738,10 @@
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#frequently-used-download-fields" class="md-nav__link">
<a href="#download-fields" class="md-nav__link">
<span class="md-ellipsis">
Frequently used download fields
Download fields
</span>
</a>
@@ -1693,34 +1823,6 @@
<li class="md-nav__item">
<a href="../authentication/" class="md-nav__link">
<span class="md-ellipsis">
Authentication
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../endpoints/" class="md-nav__link">
@@ -1778,14 +1880,14 @@
<li class="md-nav__item">
<a href="../dashboard/" class="md-nav__link">
<a href="../errors/" class="md-nav__link">
<span class="md-ellipsis">
Dashboard
Error Responses
@@ -1813,7 +1915,7 @@
<span class="md-ellipsis">
Remote Sessions
Remote Session Protocol
@@ -1827,55 +1929,20 @@
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../errors/" class="md-nav__link">
<span class="md-ellipsis">
Error Responses
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
@@ -1894,25 +1961,28 @@
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" >
<label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_4" >
<label class="md-nav__link" for="__nav_5_4" id="__nav_5_4_label" tabindex="">
<span class="md-ellipsis">
API Reference
Python API
@@ -1923,12 +1993,12 @@
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_6">
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_4_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_4">
<span class="md-nav__icon md-icon"></span>
API Reference
Python API
</label>
@@ -2080,6 +2150,14 @@
</li>
</ul>
</nav>
</li>
</ul>
</nav>
@@ -2175,10 +2253,10 @@
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#frequently-used-download-fields" class="md-nav__link">
<a href="#download-fields" class="md-nav__link">
<span class="md-ellipsis">
Frequently used download fields
Download fields
</span>
</a>
@@ -2268,7 +2346,7 @@
<h1 id="rest-api-quick-start">REST API Quick Start<a class="headerlink" href="#rest-api-quick-start" title="Permanent link">&para;</a></h1>
<p>Unshackle ships with a built-in REST API that exposes the same download engine you drive from the command line. The <code>unshackle serve</code> command serves it and lets you queue downloads, poll their progress, browse services, and manage history over HTTP instead of the terminal.</p>
<p>The full loop runs end to end: start the server, authenticate, submit a download job, and poll it to completion. The <code>curl</code> commands here come directly from the API routes.</p>
<div class="admonition note">
<div class="admonition info">
<p class="admonition-title">Who this page is for</p>
<p>This is a <strong>developer</strong> guide. It assumes you are comfortable with HTTP, JSON, and a tool like <code>curl</code>. If you only want to download something, the <a href="../../../">command line</a> is simpler. The REST API is meant for building tools, UIs, and automation on top of unshackle.</p>
</div>
@@ -2362,7 +2440,7 @@
<tr>
<td><code>--remote-only</code></td>
<td>off</td>
<td>Expose only the remote-session subset of routes</td>
<td>Expose only the remote session routes: <code>/api/health</code>, <code>/api/services</code>, <code>/api/search</code>, <code>/api/session/*</code>, <code>/api/tunnel</code> and <code>/api/tunnel/check</code>, and the dashboard routes when <code>serve.dashboard.key</code> is set</td>
</tr>
<tr>
<td><code>--caddy</code></td>
@@ -2472,80 +2550,9 @@
</span><span id="__span-15-4"><a id="__codelineno-15-4" name="__codelineno-15-4" href="#__codelineno-15-4"></a><span class="w"> </span>-d<span class="w"> </span><span class="s1">'{"service":"EXAMPLE","title_id":"12345","quality":[1080]}'</span><span class="w"> </span><span class="se">\</span>
</span><span id="__span-15-5"><a id="__codelineno-15-5" name="__codelineno-15-5" href="#__codelineno-15-5"></a><span class="w"> </span><span class="p">|</span><span class="w"> </span>python<span class="w"> </span>-c<span class="w"> </span><span class="s2">"import sys, json; print(json.load(sys.stdin)['job_id'])"</span><span class="k">)</span>
</span></code></pre></div>
<h3 id="frequently-used-download-fields">Frequently used download fields<a class="headerlink" href="#frequently-used-download-fields" title="Permanent link">&para;</a></h3>
<p>The request body accepts the full download parameter set. A few of the most useful:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Default</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>service</code></td>
<td>-</td>
<td>Service tag (required)</td>
</tr>
<tr>
<td><code>title_id</code></td>
<td>-</td>
<td>Title identifier (required)</td>
</tr>
<tr>
<td><code>profile</code></td>
<td><code>null</code></td>
<td>Named credential/cookie profile to use</td>
</tr>
<tr>
<td><code>quality</code></td>
<td><code>[]</code></td>
<td>Resolution(s), e.g. <code>[1080]</code>; empty means best available</td>
</tr>
<tr>
<td><code>vcodec</code></td>
<td><code>[]</code></td>
<td>Video codec, e.g. <code>"H265"</code></td>
</tr>
<tr>
<td><code>acodec</code></td>
<td><code>[]</code></td>
<td>Audio codec, e.g. <code>"EC3"</code></td>
</tr>
<tr>
<td><code>range</code></td>
<td><code>["SDR"]</code></td>
<td>Dynamic range: <code>SDR</code>, <code>HDR10</code>, <code>HDR10+</code>, <code>VIVID</code>, <code>DV</code>, <code>HLG</code>, <code>HYBRID</code></td>
</tr>
<tr>
<td><code>wanted</code></td>
<td><code>[]</code></td>
<td>Episodes to fetch, e.g. <code>["S01E01"]</code>, or music tracks, e.g. <code>["1-5"]</code>. Empty means all</td>
</tr>
<tr>
<td><code>lang</code></td>
<td><code>["orig"]</code></td>
<td>Video/audio language(s)</td>
</tr>
<tr>
<td><code>s_lang</code></td>
<td><code>["all"]</code></td>
<td>Subtitle language(s)</td>
</tr>
<tr>
<td><code>downloads</code></td>
<td><code>1</code></td>
<td>Number of tracks to download concurrently</td>
</tr>
<tr>
<td><code>proxy</code></td>
<td><code>null</code></td>
<td>Proxy URI or country code</td>
</tr>
</tbody>
</table>
<p>Validation is strict: invalid codecs, subtitle formats, dynamic-range names, non-positive counts, or flags that conflict (for example both <code>no_subs</code> and <code>subs_only</code>) come back as <code>400</code> with error code <code>INVALID_PARAMETERS</code>. See the full reference on the <a href="../endpoints/">download reference page</a> for every accepted field.</p>
<h3 id="download-fields">Download fields<a class="headerlink" href="#download-fields" title="Permanent link">&para;</a></h3>
<p>The request body takes every <code>dl</code> option. The <a href="../endpoints/#post-apidownload">request body table</a> gives the type, default and meaning of each field.</p>
<p>Validation is strict: invalid codecs, subtitle formats, dynamic-range names, non-positive counts, or flags that conflict (for example both <code>no_subs</code> and <code>subs_only</code>) come back as <code>400</code> with error code <code>INVALID_PARAMETERS</code>.</p>
<div class="admonition note">
<p class="admonition-title">Gated fields</p>
<p>The server refuses a per-request CDM (<code>cdm</code>) or inline credentials (<code>credential</code> / <code>credentials</code>) with <code>403 FORBIDDEN</code>, unless the server operator has explicitly opted in with <code>serve.cdm_overrides</code> and <code>serve.allow_job_credentials</code>. Both are off by default.</p>
@@ -2698,13 +2705,13 @@
<p>A retry reuses the original job's service, title, and parameters to enqueue a brand new job, and returns <code>202</code> with a fresh <code>job_id</code>. A retry works only on terminal jobs, and returns <code>409 CONFLICT</code> otherwise. A priority change works only on jobs still in the <code>queued</code> state.</p>
<hr />
<h2 id="beyond-a-single-download">Beyond a single download<a class="headerlink" href="#beyond-a-single-download" title="Permanent link">&para;</a></h2>
<p>The download loop above is the core of the API, but the same server exposes more:</p>
<p>The download flow above is the core of the API, but the same server exposes more:</p>
<ul>
<li><strong>Discovery</strong>: <code>POST /api/search</code> finds titles by query, and <code>POST /api/list-titles</code> / <code>POST /api/list-tracks</code> inspect what a title offers before you commit to downloading it. See <a href="../endpoints/">titles and tracks</a>.</li>
<li><strong>History</strong>: <code>GET /api/history</code> reads a persisted log of jobs that reached a terminal state (newest first), and <code>DELETE /api/history/{job_id}</code> removes a single entry. See <a href="../endpoints/">history</a>.</li>
<li><strong>Introspection</strong>: <code>GET /api/profiles</code> lists configured credential profiles per service, <code>GET /api/config</code> returns a redacted view of the effective server config, and <code>GET /api/env/check</code> reports which external binaries the machine has.</li>
<li><strong>Maintenance</strong>: <code>POST /api/maintenance/clear-cache</code>, <code>.../clear-temp</code>, and <code>.../refresh-services</code> do housekeeping (the server blocks the cache and temp clears with <code>409</code> while a download is active).</li>
<li><strong>Remote sessions</strong>: the <code>/api/session/*</code> endpoints drive the thin-client "remote download" flow, where the server authenticates and licenses on behalf of a local client. See <a href="../remote-sessions/">remote sessions</a>.</li>
<li><strong>Remote sessions</strong>: the routes that carry the remote sessions of <code>dl --remote</code>, where the server authenticates and licenses on behalf of a local client. See <a href="../remote-sessions/">remote sessions</a>.</li>
</ul>
<p>The interactive <strong>Swagger UI at <code>/api/docs/</code></strong> documents every route and lets you try them in the browser (send your <code>X-Secret-Key</code> there too).</p>
<hr />
@@ -2833,7 +2840,7 @@
<nav class="md-footer__inner md-grid" aria-label="Footer" >
<a href="../" class="md-footer__link md-footer__link--prev" aria-label="Previous: Overview">
<a href="../../service-architecture/" class="md-footer__link md-footer__link--prev" aria-label="Previous: Service Architecture">
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
@@ -2843,20 +2850,20 @@
Previous
</span>
<div class="md-ellipsis">
Overview
Service Architecture
</div>
</div>
</a>
<a href="../authentication/" class="md-footer__link md-footer__link--next" aria-label="Next: Authentication">
<a href="../endpoints/" class="md-footer__link md-footer__link--next" aria-label="Next: Endpoints">
<div class="md-footer__title">
<span class="md-footer__direction">
Next
</span>
<div class="md-ellipsis">
Authentication
Endpoints
</div>
</div>
<div class="md-footer__button md-icon">
File diff suppressed because it is too large Load Diff
+285 -412
View File
@@ -16,7 +16,7 @@
<link rel="prev" href="../creating-a-service/">
<link rel="next" href="../rest-api/">
<link rel="next" href="../rest-api/quickstart/">
@@ -347,28 +347,6 @@
<li class="md-tabs__item">
<a href="../../reference/api/service/" class="md-tabs__link">
API Reference
</a>
</li>
</ul>
</div>
</nav>
@@ -614,6 +592,8 @@
@@ -886,6 +866,171 @@
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3_9" >
<div class="md-nav__link md-nav__container">
<a href="../rest-api/" class="md-nav__link ">
<span class="md-ellipsis">
Server
</span>
</a>
<label class="md-nav__link " for="__nav_3_9" id="__nav_3_9_label" tabindex="0">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_3_9_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3_9">
<span class="md-nav__icon md-icon"></span>
Server
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../rest-api/authentication/" class="md-nav__link">
<span class="md-ellipsis">
Authentication
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../rest-api/dashboard/" class="md-nav__link">
<span class="md-ellipsis">
Dashboard
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../guide/remote-sessions/" class="md-nav__link">
<span class="md-ellipsis">
Remote Sessions
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
@@ -1078,7 +1223,7 @@
<span class="md-ellipsis">
Output & Naming
Output & Naming Options
@@ -1162,7 +1307,7 @@
<span class="md-ellipsis">
Key Vaults
Key Vault Options
@@ -1282,6 +1427,8 @@
@@ -1794,14 +1941,6 @@
@@ -1830,9 +1969,8 @@
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_3" >
<div class="md-nav__link md-nav__container">
<a href="../rest-api/" class="md-nav__link ">
<label class="md-nav__link" for="__nav_5_3" id="__nav_5_3_label" tabindex="">
<span class="md-ellipsis">
@@ -1846,14 +1984,8 @@
</a>
<label class="md-nav__link " for="__nav_5_3" id="__nav_5_3_label" tabindex="">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_3_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_3">
@@ -1867,8 +1999,6 @@
<ul class="md-nav__list" data-md-scrollfix>
@@ -1882,35 +2012,7 @@
<span class="md-ellipsis">
Quick Start
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../rest-api/authentication/" class="md-nav__link">
<span class="md-ellipsis">
Authentication
REST API Quick Start
@@ -1987,14 +2089,14 @@
<li class="md-nav__item">
<a href="../rest-api/dashboard/" class="md-nav__link">
<a href="../rest-api/errors/" class="md-nav__link">
<span class="md-ellipsis">
Dashboard
Error Responses
@@ -2022,7 +2124,7 @@
<span class="md-ellipsis">
Remote Sessions
Remote Session Protocol
@@ -2036,55 +2138,20 @@
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../rest-api/errors/" class="md-nav__link">
<span class="md-ellipsis">
Error Responses
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
@@ -2103,25 +2170,28 @@
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" >
<label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_4" >
<label class="md-nav__link" for="__nav_5_4" id="__nav_5_4_label" tabindex="">
<span class="md-ellipsis">
API Reference
Python API
@@ -2132,12 +2202,12 @@
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_6">
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_4_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_4">
<span class="md-nav__icon md-icon"></span>
API Reference
Python API
</label>
@@ -2289,6 +2359,14 @@
</li>
</ul>
</nav>
</li>
</ul>
</nav>
@@ -2736,63 +2814,9 @@ does the rest.</p>
Two kinds of members matter: <strong>class variables</strong> that give the details of the service, and
<strong>methods</strong> that the pipeline calls.</p>
<h3 id="class-variables">Class variables<a class="headerlink" href="#class-variables" title="Permanent link">&para;</a></h3>
<p>Declared at the top of your service class, these are static descriptors:</p>
<table>
<thead>
<tr>
<th>Class variable</th>
<th>Type</th>
<th>Purpose</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>ALIASES</code></td>
<td><code>tuple[str, ...]</code></td>
<td>Alternate tags the service answers to, in any case (resolved by <code>Services.get_tag</code>).</td>
</tr>
<tr>
<td><code>GEOFENCE</code></td>
<td><code>tuple[str, ...]</code></td>
<td>ISO region codes the service requires; empty means no geofence. unshackle treats the first entry as the "main region" for automatic proxy selection.</td>
</tr>
<tr>
<td><code>GEOBLOCK</code></td>
<td><code>tuple[str, ...]</code></td>
<td>ISO region codes where the service refuses to work; every other region is allowed. Use it for a service that works worldwide except in its home market.</td>
</tr>
<tr>
<td><code>VAULT_TAG</code></td>
<td><code>Optional[str]</code></td>
<td>Overrides the key-vault namespace; defaults to the service's own tag.</td>
</tr>
<tr>
<td><code>AUTH_METHODS</code></td>
<td><code>Optional[tuple[str, ...]]</code></td>
<td>Accepted auth methods (<code>"cookies"</code> / <code>"credentials"</code>). When <code>None</code>, the REST <code>/services</code> endpoint infers them from <code>authenticate()</code>.</td>
</tr>
<tr>
<td><code>ANONYMOUS_SEARCH</code></td>
<td><code>bool</code></td>
<td><code>search()</code> needs no login and no state from <code>authenticate()</code>. A search then skips the cookie load, <code>authenticate()</code> and the cookie save. Default <code>False</code>.</td>
</tr>
<tr>
<td><code>ANIME</code></td>
<td><code>bool</code></td>
<td>The catalogue is anime, so metadata lookups prefer AniList. A title's own <code>anime</code> flag overrides it.</td>
</tr>
<tr>
<td><code>METADATA_PROVIDER</code></td>
<td><code>Optional[str]</code></td>
<td>The metadata provider the catalogue resolves through, such as <code>"tmdb"</code>. Lookups try it first. It only reorders <code>metadata_providers</code> and never adds a provider the user left out. A title's own <code>metadata_provider</code> overrides it.</td>
</tr>
<tr>
<td><code>DAILY</code></td>
<td><code>bool</code></td>
<td>The catalogue is daily/date-based, so unshackle names episodes by air date. A title's own <code>daily</code> flag overrides it.</td>
</tr>
</tbody>
</table>
<p>Declared at the top of your service class, class variables such as <code>ALIASES</code>, <code>GEOFENCE</code> and
<code>NO_SUBTITLES</code> describe the service to the framework. The attributes table of
<a class="autorefs autorefs-internal" title="&lt;code class=&quot;doc-symbol doc-symbol-heading doc-symbol-class&quot;&gt;&lt;/code&gt; &lt;span class=&quot;doc doc-object-name doc-class-name&quot;&gt;Service&lt;/span&gt;" href="../../reference/api/service/#unshackle.core.service.Service"><code>Service</code></a> in the Service API gives each one, with its type and purpose.</p>
<h3 id="required-methods">Required methods<a class="headerlink" href="#required-methods" title="Permanent link">&para;</a></h3>
<p>These are abstract. A service will not load unless it defines all three:</p>
<ul>
@@ -2808,14 +2832,12 @@ Two kinds of members matter: <strong>class variables</strong> that give the deta
<li><strong><code>search()</code></strong>: raises <code>NotImplementedError</code> by default. Write it so that the
<code>search</code> command can operate. unshackle calls <code>authenticate()</code> first, unless the
service sets <code>ANONYMOUS_SEARCH</code>.</li>
<li><strong>DRM license hooks</strong>: <code>get_widevine_service_certificate</code>, <code>get_widevine_license</code>,
<code>get_playready_license</code> (delegates to Widevine by default), and
<code>get_clearkey_license</code> (returns <code>None</code> by default). See <a href="#drm-hooks">DRM hooks</a> below.</li>
<li><strong><code>request_input(prompt, qr=None)</code></strong>: prompts the user. It goes through the remote-dl input
<li><strong>Licence callbacks</strong>: see <a href="#drm-hooks">DRM hooks</a> below.</li>
<li><strong><code>request_input(prompt, qr=None)</code></strong>: prompts the user. It goes through the remote session input
bridge, the REST download job relay, or the rich console.</li>
<li><strong><code>wait_for_approval(message, check, timeout, interval=3.0, qr=None)</code></strong>: shows a message, then
calls <code>check</code> until it returns a value. Use it for a login that the user approves on
another device, such as a pair code. A remote-dl session shows the message as a log
another device, such as a pair code. A remote session shows the message as a log
line, and a REST download job shows it as the job's <code>notice</code>. Both methods take <code>qr</code>, the
text of a QR code to scan, and the terminal or UI that shows the user the message draws it.
When the login API gives only a PNG, <code>read_qr_image(data)</code> in <code>unshackle.core.console</code>
@@ -2826,49 +2848,9 @@ Two kinds of members matter: <strong>class variables</strong> that give the deta
</ul>
<h3 id="what-__init__-wires-up-for-you">What <code>__init__</code> wires up for you<a class="headerlink" href="#what-__init__-wires-up-for-you" title="Permanent link">&para;</a></h3>
<p>You rarely override <code>__init__</code>. The base constructor takes the Click context and sets
up the objects your methods rely on:</p>
<table>
<thead>
<tr>
<th>Attribute</th>
<th>What it is</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>self.config</code></td>
<td>The merged service config (see <a href="#request-and-http-session-objects">Request and HTTP session objects</a>).</td>
</tr>
<tr>
<td><code>self.log</code></td>
<td>A <code>logging.Logger</code> named after your class.</td>
</tr>
<tr>
<td><code>self.session</code></td>
<td>A ready-to-use HTTP session (headers, retries, and proxy applied). Send every request through it: with a proxy active, a request from service code that does not go through the proxy logs a warning. A separate HTTP session that goes direct on purpose sets <code>proxy_exempt = True</code>.</td>
</tr>
<tr>
<td><code>self.cache</code></td>
<td>A generic key/value <code>Cacher</code> namespaced to the service.</td>
</tr>
<tr>
<td><code>self.title_cache</code></td>
<td>A region- and account-aware <code>TitleCacher</code>.</td>
</tr>
<tr>
<td><code>self.cache_dir</code></td>
<td><code>config.directories.cache / &lt;ServiceName&gt;</code>.</td>
</tr>
<tr>
<td><code>self.credential</code></td>
<td>The active <code>Credential</code>, or <code>None</code> until authenticated.</td>
</tr>
<tr>
<td><code>self.track_request</code></td>
<td>A <code>TrackRequest</code> describing the requested codecs, ranges, and best-available flag (see below).</td>
</tr>
</tbody>
</table>
up the objects your methods rely on, such as <code>self.session</code>, <code>self.cache</code> and <code>self.track_request</code>.
The attributes table of <a class="autorefs autorefs-internal" title="&lt;code class=&quot;doc-symbol doc-symbol-heading doc-symbol-class&quot;&gt;&lt;/code&gt; &lt;span class=&quot;doc doc-object-name doc-class-name&quot;&gt;Service&lt;/span&gt;" href="../../reference/api/service/#unshackle.core.service.Service"><code>Service</code></a> lists each one.
<a href="#request-and-http-session-objects">Request and HTTP session objects</a> explains the main ones.</p>
<p>The constructor also resolves proxies: it reads <code>--proxy</code>, which <code>dl</code> and <code>search</code> have already
resolved through the per-service <code>proxy_map</code>, and, if <code>GEOFENCE</code> is set and you did not give an explicit proxy, does a live
IP check and auto-fetches a proxy to <code>GEOFENCE[0]</code> when it detects a geoblock. A
@@ -2879,12 +2861,16 @@ outside <code>GEOFENCE</code> logs a warning and the run continues.
See <a href="../../guide/proxies-and-vpn/">Proxies and VPN</a>.</p>
<div class="admonition note">
<p class="admonition-title"><code>TrackRequest</code></p>
<p><code>self.track_request</code> is a small dataclass built from the CLI: <code>codecs</code>
(from <code>--vcodec</code>, empty means "accept any"), <code>ranges</code> (from <code>--range</code>, default
<code>[Video.Range.SDR]</code>), <code>best_available</code>, and <code>generate_dv</code> (from <code>--generate-dv</code>).
Use it in <code>get_tracks</code> to decide which variants to fetch. A service that fetches
<p><code>self.track_request</code> is a <a class="autorefs autorefs-internal" title="&lt;code class=&quot;doc-symbol doc-symbol-heading doc-symbol-class&quot;&gt;&lt;/code&gt; &lt;span class=&quot;doc doc-object-name doc-class-name&quot;&gt;TrackRequest&lt;/span&gt;
&lt;span class=&quot;doc doc-labels&quot;&gt;
&lt;small class=&quot;doc doc-label doc-label-dataclass&quot;&gt;&lt;code&gt;dataclass&lt;/code&gt;&lt;/small&gt;
&lt;/span&gt;" href="../../reference/api/service/#unshackle.core.service.TrackRequest"><code>TrackRequest</code></a> built from the
CLI. Use it in <code>get_tracks</code> to decide which variants to fetch. A service that fetches
the HYBRID variants itself must also fetch HDR10P when <code>generate_dv</code> is set and
the title has no DV track, because unshackle prefers an HEVC HDR10+ base.</p>
the title has no DV track, because unshackle prefers an HEVC HDR10+ base.
<code>get_tracks_for_variants</code> does this for you.</p>
</div>
<h2 id="titles-and-the-title-hierarchy">Titles and the <code>Title</code> hierarchy<a class="headerlink" href="#titles-and-the-title-hierarchy" title="Permanent link">&para;</a></h2>
<p><code>get_titles()</code> returns a <strong>title collection</strong>, one of the <code>Titles_T</code> types. Each
@@ -2992,9 +2978,7 @@ copies them from the best selected lossless track (FLAC, ALAC or PCM) of the fir
If that changes the Quality row, <code>dl</code> shows the release header again. A lossy track
changes nothing.</p>
<p>A <code>Song</code> is an ordinary <code>Title</code> on the one generic download path. unshackle has no
music-specific service API and no separate music download loop. The
<code>GROUP_AUDIO_DOWNLOADS</code> flag, <code>get_music_track_options</code> and <code>get_music_collection_label</code>
no longer exist, and a music service does not need them.</p>
music-specific service API and no separate path for music.</p>
<p>Core picks the container of a <code>Song</code> from the codec in the downloaded file, so a music
service does not rename the track path. Read
<a href="../../guide/output-and-naming/#music-output-files">Music output files</a>.</p>
@@ -3105,8 +3089,8 @@ The value also goes to a <code>--remote</code> client. A track without it muxes
and <code>sdh</code>, and <code>forced</code> cannot combine with either. <code>Subtitle.Codec</code> includes <code>SubRip</code>
(SRT), <code>WebVTT</code> (VTT), <code>SubStationAlpha</code>/<code>SubStationAlphav4</code> (SSA/ASS),
<code>TimedTextMarkupLang</code> (TTML), <code>SAMI</code>, <code>SCC</code>, and the box-encapsulated DASH formats <code>fTTML</code>
(STPP) and <code>fVTT</code> (WVTT). Subtitles receive post-download normalization
(segment merging, WebVTT sanitization, format conversion, and optional SDH stripping),
(STPP) and <code>fVTT</code> (WVTT). Subtitles receive post-download normalisation
(segment merging, WebVTT sanitisation, format conversion, and optional SDH stripping),
all documented for users in <a href="../../guide/subtitles/">Subtitles</a>.</p>
<h3 id="chapters-and-attachments">Chapters and attachments<a class="headerlink" href="#chapters-and-attachments" title="Permanent link">&para;</a></h3>
<ul>
@@ -3211,33 +3195,33 @@ least one and no track is left.</p>
<li><strong>Segments</strong> of each format: unshackle inflates a segment body that is one whole gzip member
before the merge, up to a size limit. A CDN can send such a body with no <code>Content-Encoding</code>
header. Any other body stays as it is, such as AES-128 ciphertext that starts with the gzip magic.</li>
<li><strong>ISM</strong> has no list of segments and no init segments: the parser synthesizes segment URLs
<li><strong>ISM</strong> has no list of segments and no init segments: the parser synthesises segment URLs
from the <code>&lt;c&gt;</code> fragment timeline, and rebuilds a <code>moov</code>/<code>ftyp</code> init box from <code>CodecPrivateData</code>
(supported for AVC, HEVC, DV-over-HEVC, AAC, EC-3, and TTML). A track id covers the manifest
URL, so a title you build from one ISM manifest per codec or range keeps every variant:
<code>Tracks.add</code> no longer reads the second manifest's tracks as duplicates of the first.</li>
<code>Tracks.add</code> does not read the tracks of the second manifest as duplicates of the first.</li>
</ul>
<h2 id="drm-hooks">DRM hooks<a class="headerlink" href="#drm-hooks" title="Permanent link">&para;</a></h2>
<p>If a track carries DRM, the framework licenses and decrypts it, but it needs your
service to talk to the platform's license server. unshackle recognizes six DRM classes:</p>
service to talk to the platform's licence server. unshackle recognises six DRM classes:</p>
<table>
<thead>
<tr>
<th>DRM class</th>
<th>System</th>
<th>License flow</th>
<th>Licence flow</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Widevine</code></td>
<td>Widevine</td>
<td>CDM challenge → license server → content keys (<code>.wvd</code> device)</td>
<td>CDM challenge → licence server → content keys (<code>.wvd</code> device)</td>
</tr>
<tr>
<td><code>PlayReady</code></td>
<td>PlayReady</td>
<td>CDM challenge (WRM header) → license server → content keys (<code>.prd</code> device)</td>
<td>CDM challenge (WRM header) → licence server → content keys (<code>.prd</code> device)</td>
</tr>
<tr>
<td><code>ClearKeyCENC</code></td>
@@ -3257,7 +3241,7 @@ service to talk to the platform's license server. unshackle recognizes six DRM c
<tr>
<td><code>ClearKeyCTR</code></td>
<td>AES-128-CTR over a whole file</td>
<td>the service gives the IV and licenses the content key at the licence step; no CDM, no license server</td>
<td>the service gives the IV and licenses the content key at the licence step; no CDM, no licence server</td>
</tr>
</tbody>
</table>
@@ -3269,50 +3253,27 @@ decrypted with shaka-packager or mp4decrypt like Widevine.</p>
</div>
<h3 id="the-service-side-hooks">The service-side hooks<a class="headerlink" href="#the-service-side-hooks" title="Permanent link">&para;</a></h3>
<p>The framework supplies the CDM and the decryption backend. Your service gives the network
calls that must carry the CDM's challenge. Override the hooks that your platform
needs:</p>
<table>
<thead>
<tr>
<th>Hook</th>
<th>Return</th>
<th>Purpose</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>get_widevine_service_certificate(title, track, challenge)</code></td>
<td>cert bytes</td>
<td>Optional privacy-mode service certificate.</td>
</tr>
<tr>
<td><code>get_widevine_license(title, track, challenge)</code></td>
<td>license bytes</td>
<td>POST the Widevine challenge to the license server, return the response.</td>
</tr>
<tr>
<td><code>get_playready_license(title, track, challenge)</code></td>
<td>license</td>
<td>Same for PlayReady; defaults to delegating to Widevine.</td>
</tr>
<tr>
<td><code>get_clearkey_license(title, track, challenge)</code></td>
<td>dict / str / bytes / <code>None</code></td>
<td>For <code>ClearKeyCENC</code>; return <code>None</code> to let the framework POST to the manifest <code>Laurl</code>.</td>
</tr>
<tr>
<td><code>get_fairplay_bridge_license(title, track, challenge, drm_system)</code></td>
<td>license</td>
<td>Optional, not on the base class. Licenses a FairPlay-only HLS track; see <a href="#the-fairplay-bridge-hook">The FairPlay bridge hook</a>.</td>
</tr>
</tbody>
</table>
calls that must carry the CDM's challenge. Override the licence callbacks that your platform
needs: <code>get_widevine_service_certificate</code>, <code>get_widevine_license</code>, <code>get_playready_license</code> and
<code>get_clearkey_license</code>. Each one gets <code>challenge</code>, <code>title</code> and <code>track</code> as keyword arguments, and
returns the licence as the server gives it, without decoding it. The base <code>get_playready_license</code> calls
<code>get_widevine_license</code>, and the base <code>get_clearkey_license</code> returns <code>None</code>, so that the framework
POSTs the challenge to the manifest <code>Laurl</code>. The <a href="../../reference/api/service/">Service API</a> gives the
signature and the return type of each callback.</p>
<p>A licence callback can also declare optional keyword arguments. <code>get_widevine_license</code> can ask for
<code>pssh</code> and <code>session_id</code>. <code>get_playready_license</code> can ask for <code>pssh_b64</code> and <code>session_id</code>.
<code>session_id</code> is the open CDM session. A callback gets only the arguments that its signature declares.
When a <code>--remote</code> client licenses with its own CDM, the callback on the server gets <code>pssh</code> or
<code>pssh_b64</code> for the header that the client licenses, but no <code>session_id</code>.</p>
<p>You do not open CDM sessions or operate shaka-packager yourself. The <code>Widevine</code>/<code>PlayReady</code>
classes drive the CDM handshake and call the decryption backend. Your hook is only the
"send this challenge, give me back the license" step.</p>
classes drive the CDM handshake and call the decryption backend. Your callback is only the
"send this challenge, give me back the licence" step.</p>
<h3 id="the-fairplay-bridge-hook">The FairPlay bridge hook<a class="headerlink" href="#the-fairplay-bridge-hook" title="Permanent link">&para;</a></h3>
<p>unshackle has no FairPlay CDM and never sends a FairPlay challenge. For a FairPlay-only track it can send a PlayReady or Widevine challenge for the KIDs of the init segments to the licence server of the platform, which works only when that server issues the same content key to PlayReady or Widevine. The bridge runs only for a service that defines
<code>get_fairplay_bridge_license</code>. The base class does not define it.</p>
<p>unshackle has no FairPlay CDM and never sends a FairPlay challenge. For a FairPlay-only HLS track it can
send a PlayReady or Widevine challenge for the KIDs of the init segments to the licence server of the
platform. This works only when that server issues the same content key to PlayReady or Widevine. The
bridge runs only for a service that defines <code>get_fairplay_bridge_license</code>. The base class does not
define it.</p>
<div class="language-python highlight"><pre><span></span><code><span id="__span-4-1"><a id="__codelineno-4-1" name="__codelineno-4-1" href="#__codelineno-4-1"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_fairplay_bridge_license</span><span class="p">(</span>
</span><span id="__span-4-2"><a id="__codelineno-4-2" name="__codelineno-4-2" href="#__codelineno-4-2"></a> <span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">challenge</span><span class="p">:</span> <span class="nb">bytes</span><span class="p">,</span> <span class="n">title</span><span class="p">:</span> <span class="n">Title_T</span><span class="p">,</span> <span class="n">track</span><span class="p">:</span> <span class="n">AnyTrack</span><span class="p">,</span> <span class="n">drm_system</span><span class="p">:</span> <span class="nb">str</span>
</span><span id="__span-4-3"><a id="__codelineno-4-3" name="__codelineno-4-3" href="#__codelineno-4-3"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bytes</span> <span class="o">|</span> <span class="nb">str</span><span class="p">:</span>
@@ -3322,11 +3283,12 @@ classes drive the CDM handshake and call the decryption backend. Your hook is on
</span></code></pre></div>
<ul>
<li><code>drm_system</code> is <code>"playready"</code> or <code>"widevine"</code>. The hook must accept it.</li>
<li>The hook can also declare the arguments of the licence callback of that system: <code>pssh</code> for Widevine,
<code>pssh_b64</code> for PlayReady, and <code>session_id</code>. It gets only the arguments that it declares.</li>
<li>The hook can also declare the optional arguments of the licence callback of that system (see
<a href="#the-service-side-hooks">The service-side hooks</a>). It gets only the arguments that it declares.</li>
<li>The key IDs are on the DRM object of the track (<code>track.drm[0].kids</code>) when the hook runs. A service that
needs its own request shape builds the request in the hook.</li>
<li>The challenge of every other track goes to <code>get_playready_license</code> or <code>get_widevine_license</code>, as before.</li>
<li>The hook gets only the challenges of FairPlay-only tracks. The challenge of every other track goes to
<code>get_playready_license</code> or <code>get_widevine_license</code>.</li>
</ul>
<p>The DRM system of the challenge is the <code>drm_preference</code> of the track, else the system of the configured
CDM. For a licence server that issues the content key to one system only, set <code>drm_preference</code> on the
@@ -3335,23 +3297,13 @@ FairPlay-only tracks in <code>get_tracks()</code>:</p>
</span><span id="__span-5-2"><a id="__codelineno-5-2" name="__codelineno-5-2" href="#__codelineno-5-2"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">track</span><span class="o">.</span><span class="n">drm</span><span class="p">:</span>
</span><span id="__span-5-3"><a id="__codelineno-5-3" name="__codelineno-5-3" href="#__codelineno-5-3"></a> <span class="n">track</span><span class="o">.</span><span class="n">drm_preference</span> <span class="o">=</span> <span class="s2">"playready"</span>
</span></code></pre></div>
<p>Without the hook, no challenge goes to the licence server for a FairPlay-only track, and <code>dl</code> leaves
such a track out of the selection:</p>
<ul>
<li>After the selection and the deferred DRM load, <code>dl</code> checks each selected video and audio track that has
no DRM object. An HLS track costs one request for its media playlist. A DASH track is FairPlay-only when
its <code>ContentProtection</code> elements name only DRM systems that unshackle cannot license and its init segment
has no Widevine or PlayReady <code>pssh</code>.</li>
<li><code>dl</code> removes each FairPlay-only track and selects again, so the run takes the next best track that
licenses. It logs one line for each title: <code>Left out 2 FairPlay-only tracks: EXAMPLE has no FairPlay bridge hook</code>.</li>
<li>When a quality, range or codec flag matches only FairPlay-only tracks, the second selection skips the
title with its usual reason, and <code>--best-available</code> takes its usual fallback. When each selected video
or each selected audio track is FairPlay-only, <code>dl</code> skips the title.</li>
<li><code>--list</code> shows every track and checks none. An import is not checked, because its export holds the
content keys.</li>
<li>With the hook, <code>dl</code> still leaves out FairPlay-only DASH tracks, because the bridge works for HLS only.
The line then reads <code>Left out 1 FairPlay-only track: DASH has no FairPlay bridge</code>.</li>
</ul>
<p>The init segment (<code>EXT-X-MAP</code>) of the track must name a real key ID in its <code>tenc</code> box. When the <code>tenc</code>
key ID is all zeros and the playlist has one key URI, the <code>pssh</code> boxes of the init segment can name it.
unshackle never reads a key ID from the <code>skd://</code> URI.</p>
<p>Without the hook, <code>dl</code> leaves each FairPlay-only track out of the selection and takes the next best
track that licenses. It logs one line for each title:
<code>Left out 2 FairPlay-only tracks: EXAMPLE has no FairPlay bridge hook</code>. With the hook, <code>dl</code> still leaves
out FairPlay-only DASH tracks, because the bridge works for HLS only.</p>
<p>A licence server that does not issue the content key refuses the challenge, and can flag the device. Test
the route with a licence-only run (<code>--cdm-only --skip-dl</code>) before a service relies on it.</p>
<h3 id="decrypting-a-cbcs-file-yourself">Decrypting a cbcs file yourself<a class="headerlink" href="#decrypting-a-cbcs-file-yourself" title="Permanent link">&para;</a></h3>
@@ -3372,41 +3324,8 @@ to <code>None</code>, and after it your <code>on_track_downloaded</code> runs an
runs on the server: the client sends the samples through the <code>samples</code> route, so a decrypter
that needs a process on the server also works for a remote client.</p>
<h3 id="a-playlist-whose-key-tag-unshackle-cannot-license">A playlist whose key tag unshackle cannot license<a class="headerlink" href="#a-playlist-whose-key-tag-unshackle-cannot-license" title="Permanent link">&para;</a></h3>
<p>A media playlist can name only a key system that unshackle does not read, such as an <code>skd://</code> key
over cbcs media, while the licence server of the platform also issues the same content key over
PlayReady or Widevine. <code>HLS.download_track</code> licenses such a track when all of these conditions are true:</p>
<ul>
<li>The service has the <a href="#the-fairplay-bridge-hook">FairPlay bridge hook</a>.</li>
<li>The track has no DRM object.</li>
<li>Every <code>EXT-X-KEY</code> of its media playlist is <code>SAMPLE-AES</code> or <code>SAMPLE-AES-CTR</code> for a DRM system
unshackle cannot license, or <code>METHOD=NONE</code>. A segment under <code>METHOD=NONE</code> must have an init segment
that no encrypted segment uses: a decrypter that reads the encrypted init segment decrypts the clear
samples too. A tag with <code>KEYFORMAT="identity"</code>, or with no <code>KEYFORMAT</code>, names no DRM system: each
encrypted segment also needs a tag of a DRM system.</li>
<li>The <code>drm_preference</code> of the track, or else the configured CDM, is PlayReady or Widevine.</li>
<li>The init segment (<code>EXT-X-MAP</code>) of the track names a key ID in its <code>tenc</code> box. When the <code>tenc</code> key ID is all
zeros, the playlist must have one key URI, and each init segment under the key tag must give the same
key ID: its <code>tenc</code> key ID, or else the one key ID that its <code>pssh</code> boxes name. A clear init segment,
such as the one of a clear lead or tail, does not count. MPEG-TS media has no init segment.</li>
<li>The init segment does not change without an <code>EXT-X-DISCONTINUITY</code>.</li>
</ul>
<p>The download reads the key ID from the init segment, builds a DRM object for that DRM system with
<code>drm_stub</code>, and sends the challenge to the hook. Over <code>--remote</code> the tracks reply tells the client that
the service on the server has the hook. The server reads the same key ID at the licence step, accepts
the DRM object of the client and sends the challenge to the hook of its service. A server that cannot
read the key ID refuses the challenge. A licence that gives no content key stops the track before it
downloads a segment. With the server CDM, the batch licence names the key IDs that the server read, so an
answer without their content keys stops the track in the same way. A content key that does not decode
the downloaded track stops the track with an error, and unshackle keeps no output file.</p>
<p>unshackle reads one key ID from each init segment. So it licenses a playlist that changes its content key
correctly only when each content key has its own init segment with a real <code>tenc</code> key ID, after an
<code>EXT-X-DISCONTINUITY</code>. When the first key ID is real, the download also reads the <code>tenc</code> key ID of
each other init segment of the encrypted segments, and licenses each real key ID in its own licence step. A
PlayReady DRM object then has one header for each key ID, because the header of <code>drm_stub</code> holds
one key ID. A key ID that gets no content key stops the track before it downloads a segment. An
init segment that gives no real key ID does not count.</p>
<p>A service that must choose the DRM system itself, or one that knows the key ID, puts the DRM object
on the track:</p>
on the track and needs no <a href="#the-fairplay-bridge-hook">FairPlay bridge hook</a>:</p>
<ol>
<li>Read the key ID from the init segment of the encrypted segments. <code>HLS.get_track_kid_from_init</code> returns it
for the track, a reader of init segments (<code>HLS.init_reader(playlist, session)</code>) and that init segment.</li>
@@ -3416,24 +3335,16 @@ on the track:</p>
<li>Let your licence callback send the challenge to the server that issues that key.</li>
</ol>
<p><code>drm_stub</code> builds the header from the key ID alone, so this works with a licence server that goes
by the key ID, not with one that checks a header a packager signed. A platform can issue the
content key of one package of a title and refuse another. When a track carries a Widevine or PlayReady DRM
object and every <code>EXT-X-KEY</code> of its playlist is <code>SAMPLE-AES</code> or <code>SAMPLE-AES-CTR</code> for a key system
unshackle cannot license, or <code>METHOD=NONE</code> under the same condition, <code>HLS.drop_unsupported_keys</code> removes the
tags from the parsed playlist.
The download then licenses and decrypts the track with the DRM object of the track. This works for
one content key per track: the key changes of the playlist go with the tags. This limit also
applies to a DRM object that the download builds. Any other track stops with
<code>None of the key systems are supported</code> before it downloads a segment.</p>
<p>A DASH track with no DRM object stops with the same error when its init segment has an encrypted
sample entry. A DASH track with no init segment stops after the download when the file has one, and
unshackle deletes the file. A service sample decrypter turns off both checks.</p>
by the key ID, not with one that checks a header a packager signed. When every <code>EXT-X-KEY</code> of the
playlist names a key system that unshackle cannot license, unshackle ignores those tags and licenses
and decrypts the track with its DRM object, for one content key per track. Any other track that has
only such tags stops with <code>None of the key systems are supported</code> before it downloads a segment.</p>
<h3 id="how-unshackle-chooses-a-cdm-and-finds-keys">How unshackle chooses a CDM and finds keys<a class="headerlink" href="#how-unshackle-chooses-a-cdm-and-finds-keys" title="Permanent link">&para;</a></h3>
<p>CDM selection is config-driven: the <code>cdm</code> map resolves a service tag (and optionally the
<p>The CDM choice comes from config: the <code>cdm</code> map resolves a service tag (and optionally the
track quality or DRM type) to a device name, which <code>load_cdm</code> instantiates as a local
<code>.wvd</code>/<code>.prd</code> or a remote CDM. Before ever requesting a license, the framework tries an
in-process cache of content keys and the configured <strong>key vaults</strong>. Only unresolved KIDs
trigger an actual license request, and the framework writes newly licensed keys back to
<code>.wvd</code>/<code>.prd</code> or a remote CDM. Before ever requesting a licence, the framework tries an
in-process cache of content keys and the configured <strong>key vaults</strong>. The CDM makes a challenge only
for an unresolved KID, and the framework writes newly licensed keys back to
every vault. This is why the same content key is rarely re-licensed twice. Users configure
all of this in <a href="../../guide/drm-and-cdm/">DRM and CDM</a> and
<a href="../../guide/vaults/">Key vaults</a>. The <a href="../../reference/api/drm/">DRM API reference</a> gives
@@ -3464,8 +3375,8 @@ prepared, all derived from the Click context (<code>ctx</code>) that <code>dl</c
<li><strong><code>self.session</code></strong>: a <code>requests.Session</code> with <code>config.headers</code> applied, a retry policy
(<code>total=5</code>, backoff, retry on 429/5xx), and any resolved proxy already mounted. Pass this
HTTP session into the manifest parsers and DRM calls so headers, cookies, and proxies flow
everywhere. (unshackle also ships an rnet-based TLS-fingerprinting HTTP session that the
newer <code>session()</code> factory uses and that the <code>network</code> config key configures.)</li>
everywhere. To impersonate a browser TLS fingerprint, override <code>get_session()</code> to return an
rnet HTTP session from <code>session()</code> in <code>unshackle.core.session</code>, which the <code>network</code> config key configures.</li>
<li><strong><code>self.credential</code></strong>: the active <code>Credential</code> (<code>username:password[:extra]</code>), populated
by <code>authenticate</code>. unshackle uses its <code>sha1</code> as the account hash for cache keys. A login
with cookies only uses a hash of the path of its cookie file.</li>
@@ -3477,46 +3388,8 @@ prepared, all derived from the Click context (<code>ctx</code>) that <code>dl</c
to stale data within <code>title_cache_max_retention</code> when an API call fails, and <code>--no-cache</code>
bypasses it. If you put the cookies of a different account into the same cookie file, use
<code>--reset-cache</code> once.</li>
<li><strong><code>self.track_request</code></strong>: the <code>TrackRequest</code> describing what the user asked for
(codecs, ranges, best-available), for use inside <code>get_tracks</code>.</li>
</ul>
<div class="admonition example">
<p class="admonition-title">A minimal service skeleton</p>
<div class="language-python highlight"><span class="filename">services/EXMP/__init__.py</span><pre><span></span><code><span id="__span-6-1"><a id="__codelineno-6-1" name="__codelineno-6-1" href="#__codelineno-6-1"></a><span class="kn">from</span><span class="w"> </span><span class="nn">unshackle.core.service</span><span class="w"> </span><span class="kn">import</span> <span class="n">Service</span>
</span><span id="__span-6-2"><a id="__codelineno-6-2" name="__codelineno-6-2" href="#__codelineno-6-2"></a><span class="kn">from</span><span class="w"> </span><span class="nn">unshackle.core.manifests</span><span class="w"> </span><span class="kn">import</span> <span class="n">DASH</span>
</span><span id="__span-6-3"><a id="__codelineno-6-3" name="__codelineno-6-3" href="#__codelineno-6-3"></a><span class="kn">from</span><span class="w"> </span><span class="nn">unshackle.core.titles</span><span class="w"> </span><span class="kn">import</span> <span class="n">Movie</span><span class="p">,</span> <span class="n">Movies</span>
</span><span id="__span-6-4"><a id="__codelineno-6-4" name="__codelineno-6-4" href="#__codelineno-6-4"></a>
</span><span id="__span-6-5"><a id="__codelineno-6-5" name="__codelineno-6-5" href="#__codelineno-6-5"></a>
</span><span id="__span-6-6"><a id="__codelineno-6-6" name="__codelineno-6-6" href="#__codelineno-6-6"></a><span class="k">class</span><span class="w"> </span><span class="nc">EXMP</span><span class="p">(</span><span class="n">Service</span><span class="p">):</span>
</span><span id="__span-6-7"><a id="__codelineno-6-7" name="__codelineno-6-7" href="#__codelineno-6-7"></a> <span class="n">ALIASES</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"example"</span><span class="p">,)</span>
</span><span id="__span-6-8"><a id="__codelineno-6-8" name="__codelineno-6-8" href="#__codelineno-6-8"></a> <span class="n">GEOFENCE</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"us"</span><span class="p">,)</span>
</span><span id="__span-6-9"><a id="__codelineno-6-9" name="__codelineno-6-9" href="#__codelineno-6-9"></a>
</span><span id="__span-6-10"><a id="__codelineno-6-10" name="__codelineno-6-10" href="#__codelineno-6-10"></a> <span class="k">def</span><span class="w"> </span><span class="nf">get_titles</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Movies</span><span class="p">:</span>
</span><span id="__span-6-11"><a id="__codelineno-6-11" name="__codelineno-6-11" href="#__codelineno-6-11"></a> <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="sa">f</span><span class="s2">"https://api.example.com/title/</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">title</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span><span class="o">.</span><span class="n">json</span><span class="p">()</span>
</span><span id="__span-6-12"><a id="__codelineno-6-12" name="__codelineno-6-12" href="#__codelineno-6-12"></a> <span class="k">return</span> <span class="n">Movies</span><span class="p">([</span>
</span><span id="__span-6-13"><a id="__codelineno-6-13" name="__codelineno-6-13" href="#__codelineno-6-13"></a> <span class="n">Movie</span><span class="p">(</span>
</span><span id="__span-6-14"><a id="__codelineno-6-14" name="__codelineno-6-14" href="#__codelineno-6-14"></a> <span class="n">id_</span><span class="o">=</span><span class="n">data</span><span class="p">[</span><span class="s2">"id"</span><span class="p">],</span>
</span><span id="__span-6-15"><a id="__codelineno-6-15" name="__codelineno-6-15" href="#__codelineno-6-15"></a> <span class="n">service</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">,</span>
</span><span id="__span-6-16"><a id="__codelineno-6-16" name="__codelineno-6-16" href="#__codelineno-6-16"></a> <span class="n">name</span><span class="o">=</span><span class="n">data</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span>
</span><span id="__span-6-17"><a id="__codelineno-6-17" name="__codelineno-6-17" href="#__codelineno-6-17"></a> <span class="n">year</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"year"</span><span class="p">),</span>
</span><span id="__span-6-18"><a id="__codelineno-6-18" name="__codelineno-6-18" href="#__codelineno-6-18"></a> <span class="n">language</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"language"</span><span class="p">),</span>
</span><span id="__span-6-19"><a id="__codelineno-6-19" name="__codelineno-6-19" href="#__codelineno-6-19"></a> <span class="p">)</span>
</span><span id="__span-6-20"><a id="__codelineno-6-20" name="__codelineno-6-20" href="#__codelineno-6-20"></a> <span class="p">])</span>
</span><span id="__span-6-21"><a id="__codelineno-6-21" name="__codelineno-6-21" href="#__codelineno-6-21"></a>
</span><span id="__span-6-22"><a id="__codelineno-6-22" name="__codelineno-6-22" href="#__codelineno-6-22"></a> <span class="k">def</span><span class="w"> </span><span class="nf">get_tracks</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">title</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="s2">"Tracks"</span><span class="p">:</span>
</span><span id="__span-6-23"><a id="__codelineno-6-23" name="__codelineno-6-23" href="#__codelineno-6-23"></a> <span class="n">mpd_url</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="o">...</span><span class="p">)</span><span class="o">.</span><span class="n">json</span><span class="p">()[</span><span class="s2">"manifest"</span><span class="p">]</span>
</span><span id="__span-6-24"><a id="__codelineno-6-24" name="__codelineno-6-24" href="#__codelineno-6-24"></a> <span class="n">mpd</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">mpd_url</span><span class="p">)</span><span class="o">.</span><span class="n">text</span>
</span><span id="__span-6-25"><a id="__codelineno-6-25" name="__codelineno-6-25" href="#__codelineno-6-25"></a> <span class="k">return</span> <span class="n">DASH</span><span class="o">.</span><span class="n">from_text</span><span class="p">(</span><span class="n">mpd</span><span class="p">,</span> <span class="n">mpd_url</span><span class="p">)</span><span class="o">.</span><span class="n">to_tracks</span><span class="p">(</span><span class="n">language</span><span class="o">=</span><span class="n">title</span><span class="o">.</span><span class="n">language</span><span class="p">)</span>
</span><span id="__span-6-26"><a id="__codelineno-6-26" name="__codelineno-6-26" href="#__codelineno-6-26"></a>
</span><span id="__span-6-27"><a id="__codelineno-6-27" name="__codelineno-6-27" href="#__codelineno-6-27"></a> <span class="k">def</span><span class="w"> </span><span class="nf">get_chapters</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">title</span><span class="p">):</span>
</span><span id="__span-6-28"><a id="__codelineno-6-28" name="__codelineno-6-28" href="#__codelineno-6-28"></a> <span class="k">return</span> <span class="p">[]</span>
</span><span id="__span-6-29"><a id="__codelineno-6-29" name="__codelineno-6-29" href="#__codelineno-6-29"></a>
</span><span id="__span-6-30"><a id="__codelineno-6-30" name="__codelineno-6-30" href="#__codelineno-6-30"></a> <span class="k">def</span><span class="w"> </span><span class="nf">get_widevine_license</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">challenge</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span> <span class="n">track</span><span class="p">):</span>
</span><span id="__span-6-31"><a id="__codelineno-6-31" name="__codelineno-6-31" href="#__codelineno-6-31"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s2">"https://lic.example.com/wv"</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">challenge</span><span class="p">)</span><span class="o">.</span><span class="n">content</span>
</span></code></pre></div>
<p>The directory name (<code>EXMP</code>) must match the class name exactly. That stem is the
service tag. Put your service in one of the <code>directories.services</code> paths.</p>
</div>
<p><a href="../creating-a-service/#minimal-service-skeleton">Creating a Service</a> gives a complete minimal service.</p>
<h2 id="where-to-go-next">Where to go next<a class="headerlink" href="#where-to-go-next" title="Permanent link">&para;</a></h2>
<ul>
<li><strong><a href="../creating-a-service/">Creating a Service</a></strong>: a guided walkthrough that builds on this model.</li>
@@ -3579,13 +3452,13 @@ service tag. Put your service in one of the <code>directories.services</code> pa
<a href="../rest-api/" class="md-footer__link md-footer__link--next" aria-label="Next: Overview">
<a href="../rest-api/quickstart/" class="md-footer__link md-footer__link--next" aria-label="Next: REST API Quick Start">
<div class="md-footer__title">
<span class="md-footer__direction">
Next
</span>
<div class="md-ellipsis">
Overview
REST API Quick Start
</div>
</div>
<div class="md-footer__button md-icon">