mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-04 06:55:09 +00:00
Deployed 0536056e with MkDocs version: 1.6.1
This commit is contained in:
@@ -2659,7 +2659,11 @@ accepted URL/ID formats and options there.</p>
|
||||
<code>is_widevine_cdm()</code> / <code>is_playready_cdm()</code> from <code>unshackle.core.cdm.detect</code>
|
||||
to classify it. These work correctly for local <em>and</em> remote CDMs, so never
|
||||
hand-roll an <code>isinstance</code> check. Services often pick a device profile or
|
||||
manifest endpoint based on which DRM the CDM speaks.</p>
|
||||
manifest endpoint based on which DRM the CDM speaks. A service whose DRM
|
||||
plugin licenses locally puts only the plugin data on the track: unshackle
|
||||
licenses it at the licence step. To pick streams by the device, read the
|
||||
device with <code>ctx.obj.cdm_for("<plugin id>")</code>.
|
||||
<code>ctx.obj.cdm_for</code> is <code>None</code> where nothing licenses, for example in a search.</p>
|
||||
</div>
|
||||
<h3 id="authenticate-optional-login"><code>authenticate</code>: optional login<a class="headerlink" href="#authenticate-optional-login" title="Permanent link">¶</a></h3>
|
||||
<p>Override to log in with cookies and/or credentials. <strong>Call <code>super().authenticate()</code>
|
||||
|
||||
@@ -3813,7 +3813,7 @@ ignore it safely. See <a href="../../creating-a-service/#split-episodes">Split e
|
||||
</div>
|
||||
</div>
|
||||
<p>The server sorts tracks by bitrate, descending. Episodes the server cannot get go into <code>unavailable_episodes</code>, rather than failing the whole request. Track objects here do <strong>not</strong> include a download <code>url</code>. Only the remote session endpoints give segment URLs.</p>
|
||||
<p>The <code>drm</code> array on a track is a list of <code>{type, pssh?, kids?, content_keys?, license_url?}</code> objects.</p>
|
||||
<p>The <code>drm</code> array on a track is a list of <code>{type, pssh?, kids?, content_keys?, license_url?}</code> objects. Only a <code>widevine</code>, <code>playready</code> or <code>clearkeycenc</code> entry carries <code>content_keys</code>.</p>
|
||||
<p>Every track carries the same fields as a local track: <code>is_original_lang</code>, <code>name</code>, <code>needs_repack</code>, <code>edition</code>, <code>note</code>, and <code>data</code>. <code>name</code> is the name the service set, or null. <code>note</code> is display text the service set, such as an encoding profile, or null: <code>--list</code> shows it, but the filename and the mux do not use it. <code>track_name</code> is the name <code>--list</code> shows and the mux writes to an audio or subtitle track: <code>name</code> when the service set one, else the name of the language (English, or in the language itself when the server sets <code>muxing.track_names: native</code>, or no name when it sets <code>none</code>), then the server's <code>muxing.original_label</code> on an original-language track, then the SDH, CC, Forced or Descriptive label. <code>bitrate</code> is in kb/s, and <code>bitrate_bps</code> gives the exact bits/s. <code>data</code> holds the part of the service-set <code>track.data</code> that fits in JSON, without the <code>hls</code>, <code>dash</code>, and <code>ism</code> parser keys. Audio keeps <code>is_original</code> and <code>atmos</code> for clients that read them, and adds the exact <code>joc</code> object count. Audio <code>bit_depth</code> and <code>sample_rate</code> (Hz) are integers, or null when the manifest and the service do not give them.</p>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -5019,7 +5019,7 @@ Use <code>error_code</code> and <code>retryable</code> to decide what to do.</p>
|
||||
<p>A slow response is not gzip-compressed. Gzip output cannot start before the body is ready, and
|
||||
the newlines must go out at once.</p>
|
||||
<h3 id="post-apisessioncreate"><code>POST /api/session/create</code><a class="headerlink" href="#post-apisessioncreate" title="Permanent link">¶</a></h3>
|
||||
<p>Make a remote session for a service and title. Authentication runs asynchronously in the background. This call returns immediately with <code>status: "authenticating"</code>, and you then poll the prompt endpoint. The body accepts <code>service</code> and <code>title_id</code> (both required). It also accepts a broad set of optional keys, because the body allows <code>additionalProperties</code>. These are <code>session_id</code>, <code>credentials</code> (<code>{username, password, extra?}</code>), <code>cookies</code> (base64 of zlib-compressed Netscape cookie file), <code>proxy</code>, <code>no_proxy</code>, <code>profile</code>, <code>cache</code> (map of forwarded cache files, keyed by the file path relative to the service cache directory with <code>/</code> separators and no <code>.json</code> suffix, so a nested key such as <code>session_web/<sha1></code> lands in a subdirectory), <code>client_region</code>, <code>proxy_region</code>, <code>cdm_type</code>, <code>range_</code>, <code>vcodec</code>, <code>quality</code>, <code>best_available</code>, <code>dl_params</code>, <code>client</code>, and any service CLI options. <code>proxy_region</code> is the country code the client resolved <code>proxy</code> from; the server matches it against its own accounts. <code>client</code> is a freeform object the dashboard shows as sent (the CLI puts <code>version</code>, <code>code_hash</code>, <code>platform</code> and a redacted <code>argv</code> in it); the server ignores it above 4096 bytes of JSON.</p>
|
||||
<p>Make a remote session for a service and title. Authentication runs asynchronously in the background. This call returns immediately with <code>status: "authenticating"</code>, and you then poll the prompt endpoint. The body accepts <code>service</code> and <code>title_id</code> (both required). It also accepts a broad set of optional keys, because the body allows <code>additionalProperties</code>. These are <code>session_id</code>, <code>credentials</code> (<code>{username, password, extra?}</code>), <code>cookies</code> (base64 of zlib-compressed Netscape cookie file), <code>proxy</code>, <code>no_proxy</code>, <code>profile</code>, <code>cache</code> (map of forwarded cache files, keyed by the file path relative to the service cache directory with <code>/</code> separators and no <code>.json</code> suffix, so a nested key such as <code>session_web/<sha1></code> lands in a subdirectory), <code>client_region</code>, <code>proxy_region</code>, <code>cdm_type</code>, <code>range_</code>, <code>vcodec</code>, <code>quality</code>, <code>best_available</code>, <code>dl_params</code>, <code>plugins</code>, <code>client</code>, and any service CLI options. <code>plugins</code> maps the id of each DRM plugin that the client loads to <code>{version, device?}</code>; <code>device</code> holds the plain values of the device attributes that the plugin names in <code>device_facts</code>. The server refuses a title with a track of a plugin that is not in <code>plugins</code> (or a body with no <code>plugins</code>) on <code>POST /api/session/{id}/tracks</code> with <code>DRM_ERROR</code>, and gives <code>device</code> to the service only in a remote session that the client's device licenses. A <code>plugins</code> value over 16384 bytes of JSON, or of another shape, gets <code>INVALID_INPUT</code>. <code>proxy_region</code> is the country code the client resolved <code>proxy</code> from; the server matches it against its own accounts. <code>client</code> is a freeform object the dashboard shows as sent (the CLI puts <code>version</code>, <code>code_hash</code>, <code>platform</code> and a redacted <code>argv</code> in it); the server ignores it above 4096 bytes of JSON.</p>
|
||||
<p><code>session_id</code> is the ID that you give the remote session, so that you can delete it before this call answers. It must be the canonical text of a version 4 UUID. Without it, the server makes the ID. A remote session with your ID ends when you send no request for it and open no channel within 150s of the create. A second create with the same ID from the same API key and IP ends the first one if the first one has not answered, and replaces its remote session when the new one is stored. A second create that fails leaves that remote session open.</p>
|
||||
<p><code>dl_params</code> is an object with the <code>dl</code> track selection: <code>lang</code>, <code>v_lang</code>, <code>a_lang</code> and <code>s_lang</code> (arrays of language strings), <code>acodec</code> (an array of audio codec names or <code>dl -a</code> aliases such as <code>ddp</code>), and <code>forced_subs</code> and <code>exact_lang</code> (booleans). The service reads these values from <code>ctx.parent.params</code>. The server uses the <code>dl</code> default for each absent value. It refuses a malformed value, an unknown codec, range or vcodec name, and a height of 0 or less with <code>INVALID_PARAMETERS</code>. The flat <code>range_</code>, <code>vcodec</code>, <code>quality</code>, <code>best_available</code> and <code>generate_dv</code> keys are <code>dl</code> values on this route. On the list and search routes they are <code>dl</code> values only when the body has <code>service_params</code>.</p>
|
||||
<p>Service CLI options also travel in a nested <code>service_params</code> object. When the body has <code>service_params</code>, the server reads service options only from it, and a flat key with the same name stays a <code>dl</code> value. <code>profile</code> at the top level always means the credentials profile, never a service's own <code>--profile</code> option.</p>
|
||||
@@ -5479,7 +5479,7 @@ A slow answer arrives as a <a href="#slow-responses">slow response</a>.</p>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>drm_type</code></td>
|
||||
<td><code>widevine</code> (default) or <code>playready</code>. In server-CDM mode the server's <code>cdm</code> mapping for the service decides the DRM system and the response <code>drm_type</code> names the system that licensed. A mapping with a device for each system takes the system of the device the remote session loaded. With no mapping, the client's value decides when the track carries that system; else a system the track carries decides, PlayReady first. The tracks response <code>server_cdm_type</code> names the system the same order gives for the title's tracks. A track whose DRM is a whole-file cipher takes <code>clearkeyctr</code> with no <code>pssh</code>: the service on the server licenses it. A MonaLisa track takes <code>monalisa</code> with no <code>pssh</code> and <code>mode</code> <code>server_cdm</code>: the server answers in <code>keys</code> with the content key that its service extracted, and only in a session that uses the server CDM.</td>
|
||||
<td><code>widevine</code> (default), <code>playready</code>, or the id of a DRM plugin that both peers load. In server-CDM mode the server's <code>cdm</code> mapping for the service decides the DRM system and the response <code>drm_type</code> names the system that licensed. A mapping with a device for each system takes the system of the device the remote session loaded. With no mapping, the client's value decides when the track carries that system; else a system the track carries decides, PlayReady first. The tracks response <code>server_cdm_type</code> names the system the same order gives for the title's tracks. A track whose DRM is a whole-file cipher takes <code>clearkeyctr</code> with no <code>pssh</code>: the service on the server licenses it. A track of a DRM plugin that licenses locally takes the plugin id with no <code>pssh</code> and <code>mode</code> <code>server_cdm</code>: the server answers in <code>keys</code> with the content key from a server vault or from a licence of its own plugin device, only in a session that uses the server CDM, and only under the licence cap (<code>SERVER_CDM_CAPPED</code> above it).</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>mode</code></td>
|
||||
|
||||
@@ -2808,6 +2808,12 @@ See <a href="../../../reference/configuration/drm/"><code>cdm</code></a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="admonition note">
|
||||
<p class="admonition-title">A DRM type that the client does not know</p>
|
||||
<p>The client rebuilds the DRM of each track from the track list of the server. When the server
|
||||
sends a DRM <code>type</code> that the client does not know, the client stops the title with one
|
||||
<code>DRM_ERROR</code> line that names the type. Update the client to the version of the server.</p>
|
||||
</div>
|
||||
<div class="admonition note">
|
||||
<p class="admonition-title">A height limit on the server CDM</p>
|
||||
<p>An API key with <code>server_cdm_max_height</code> gets the server CDM only up to that height. The
|
||||
session create response tells the client who licenses the session in <code>server_cdm</code> and gives
|
||||
@@ -3066,8 +3072,10 @@ session when the new one is stored, and the server answers the ID of another API
|
||||
<code>credentials</code>, <code>cookies</code> (base64 of zlib-compressed Netscape cookie file), <code>proxy</code>,
|
||||
<code>no_proxy</code>, <code>profile</code>, <code>cache</code> (a map of <code>filename → base64(zlib(bytes))</code>),
|
||||
<code>client_region</code>, <code>server_cdm</code> (<code>false</code> when the user picked the local CDM), <code>cdm_type</code>, <code>cdm_security_level</code>, <code>cdm_relay</code> (<code>true</code> when the client
|
||||
answers CDM calls), <code>cdm_system_id</code> and <code>cdm_device_type</code> (Widevine only), <code>service_config</code>
|
||||
(the identity config keys the service lists in <code>client_config</code>), <code>client</code> (a freeform identity
|
||||
answers CDM calls; a plugin <code>cdm_type</code> gets no relay), <code>cdm_system_id</code> and <code>cdm_device_type</code> (Widevine only), <code>service_config</code>
|
||||
(the identity config keys the service lists in <code>client_config</code>), <code>plugins</code> (the version of each DRM plugin of the
|
||||
client and the values of the plugin device attributes that the plugin names in <code>device_facts</code>; see
|
||||
<a href="../endpoints/#post-apisessioncreate">endpoints</a>), <code>client</code> (a freeform identity
|
||||
object the dashboard shows as sent), and the track-selection hints <code>range_</code>, <code>vcodec</code>,
|
||||
<code>quality</code>, <code>best_available</code>, <code>generate_dv</code>, plus arbitrary service CLI options
|
||||
(<code>additionalProperties: true</code>).</p>
|
||||
|
||||
@@ -3219,7 +3219,7 @@ least one and no track is left.</p>
|
||||
</ul>
|
||||
<h2 id="drm-hooks">DRM hooks<a class="headerlink" href="#drm-hooks" title="Permanent link">¶</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 seven DRM systems:</p>
|
||||
service to talk to the platform's license server. unshackle recognizes six DRM classes:</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -3250,14 +3250,9 @@ service to talk to the platform's license server. unshackle recognizes seven DRM
|
||||
<td>content key fetched directly from a URI; no CDM, no challenge</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>MonaLisa</code></td>
|
||||
<td>Proprietary WASM DRM</td>
|
||||
<td>keys extracted locally; no license server. Without <code>tool_path</code>, core uses <code>bbtsdecrypt</code> per segment, else its built-in decrypter (<code>core/drm/bbts.py</code>) per segment. <code>command_builder</code> sets the command of the decryption backend, and <code>segment_decrypt=False</code> runs it once on the merged file. Over <code>--remote</code> only the KID goes to the client, and the server sends the content key under the server CDM. An export also holds only the KID as its DRM, never the tool or the command. One process extracts the keys of one ticket at a time, because the wasmtime bindings are not thread-safe</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>BlowfishStripe</code></td>
|
||||
<td>Blowfish CBC stripe cipher</td>
|
||||
<td>the service gives the per-track key; no CDM, no license server</td>
|
||||
<td><code>CustomDRM</code></td>
|
||||
<td>a system that a DRM plugin adds</td>
|
||||
<td><code>CustomDRM("<plugin id>", kids=..., data=...)</code>. For a plugin that holds its key, put the key in <code>data</code>. For a plugin that licenses locally, put only the data the plugin reads: unshackle licenses it at the licence step. The plugin decrypts. Its README names the <code>data</code> it reads</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>ClearKeyCTR</code></td>
|
||||
|
||||
Reference in New Issue
Block a user