Deployed 74856d2d with MkDocs version: 1.6.1

This commit is contained in:
2026-11-28 22:37:02 +00:00
parent 3a4a3f8471
commit d56c501138
14 changed files with 205 additions and 73 deletions
+2 -1
View File
@@ -3113,7 +3113,8 @@ flagged, banned, or downgraded.</p>
<h2 id="optional-event-hooks">Optional event hooks<a class="headerlink" href="#optional-event-hooks" title="Permanent link">&para;</a></h2>
<p>Override any of these to react to pipeline stages (all no-ops by default):
<code>on_segment_downloaded</code>, <code>on_track_downloaded</code>, <code>on_track_decrypted</code>,
<code>on_track_repacked</code>, <code>on_track_multiplex</code>. Also override <code>search()</code> to yield
<code>on_track_repacked</code>, <code>on_track_multiplex</code>. <code>on_track_downloaded</code> runs once per track, after
unshackle decrypted the <code>drm</code> of the track. Also override <code>search()</code> to yield
<code>SearchResult</code> objects for <code>unshackle search</code>.</p>
<div class="admonition warning">
<p class="admonition-title">Set <code>ANONYMOUS_SEARCH</code> only for a search that needs no account</p>
+24 -4
View File
@@ -3377,6 +3377,13 @@
<td><code>null</code></td>
<td>Your own login material, on a <code>--remote-only</code> server only. See <a href="#client-cache-on-a-remote-only-server">Client cache on a remote-only server</a>.</td>
</tr>
<tr>
<td><code>dl_params</code></td>
<td>object</td>
<td>no</td>
<td><code>null</code></td>
<td>The <code>dl</code> track selection, as on <a href="#post-apisessioncreate"><code>POST /api/session/create</code></a>.</td>
</tr>
</tbody>
</table>
<div class="tabbed-set tabbed-alternate" data-tabs="3:2"><input checked="checked" id="__tabbed_3_1" name="__tabbed_3" type="radio" /><input id="__tabbed_3_2" name="__tabbed_3" type="radio" /><div class="tabbed-labels"><label for="__tabbed_3_1">Request</label><label for="__tabbed_3_2">Response <code>200</code></label></div>
@@ -3648,6 +3655,11 @@ ignore it safely. See <a href="../../creating-a-service/#split-episodes">Split e
</tr>
<tr>
<td><code>400</code></td>
<td><code>INVALID_PARAMETERS</code></td>
<td>Invalid <code>dl</code> value, such as an unknown codec in <code>dl_params</code>.</td>
</tr>
<tr>
<td><code>400</code></td>
<td><code>INVALID_SERVICE</code></td>
<td>Unknown or disallowed service.</td>
</tr>
@@ -3820,7 +3832,7 @@ ignore it safely. See <a href="../../creating-a-service/#split-episodes">Split e
<tr>
<td><code>400</code></td>
<td><code>INVALID_PARAMETERS</code></td>
<td>Invalid <code>wanted</code> range.</td>
<td>Invalid <code>wanted</code> range, or an invalid <code>dl</code> value.</td>
</tr>
<tr>
<td><code>400</code></td>
@@ -4209,8 +4221,10 @@ ignore it safely. See <a href="../../creating-a-service/#split-episodes">Split e
<p><strong>Validation.</strong> Invalid values return <code>400 INVALID_PARAMETERS</code>. <code>vcodec</code>, <code>acodec</code> and <code>sub_format</code> take the same spellings as the CLI options of the same name (<code>unshackle dl --help</code> prints each list). The API and the CLI read one list, so they cannot disagree. <code>range</code> must be one of SDR/HDR10/HDR10P/VIVID/DV/HLG/HYBRID, and <code>HDR10+</code> and <code>HDR Vivid</code> are also valid. The bitrate, download worker, and download counts must be positive integers. You cannot combine <code>no_subs</code> with <code>subs_only</code>, or <code>no_audio</code> with <code>audio_only</code>. The server runs the same option checks as <code>unshackle dl</code>, so a request that <code>dl</code> would refuse returns <code>400</code> when you submit it, and the message names the <code>dl</code> option. The language fields (<code>lang</code>, <code>v_lang</code>, <code>a_lang</code>, <code>s_lang</code>, <code>forced_s_lang</code> and the <code>require_*</code> fields) must be arrays of strings: a single string such as <code>"en"</code> returns <code>400</code>. The server checks every other field with the type of its <code>dl</code> option. A <code>null</code> or an empty string gets the default from the table.</p>
<p><strong>Service options.</strong> A service's own CLI options travel in the same body. Send them in a nested
<code>service_params</code> object, or as flat top-level keys. When the body has <code>service_params</code>, the server
reads service options only from it, and every flat key is a <code>dl</code> value. Without it, a flat key that
is also a <code>dl</code> option, such as <code>quality</code> or <code>lang</code>, stays a <code>dl</code> value. An option you leave out
reads service options only from it, and every flat key is a <code>dl</code> value. A name in <code>service_params</code>
can be the option's flag, such as <code>zone</code> for <code>--zone</code>, or its parameter name. Without
<code>service_params</code>, a flat key that is also a <code>dl</code> option, such as <code>quality</code> or <code>lang</code>, stays a <code>dl</code>
value, and the server logs a warning when the service has an option of the same name. An option you leave out
takes the default declared on the service's <code>cli</code> command, so the job matches the equivalent <code>dl</code>
run. The server checks each service option against that option's type, and a value it refuses gets
<code>400 INVALID_PARAMETERS</code>. <code>profile</code> at the top level always means the credential
@@ -4247,6 +4261,7 @@ an HTTP caller would be remote code execution. You configure post-scripts only i
<li><code>credential</code> (<code>"user:pass"</code>) and <code>credentials</code> (a map): allowed only if <code>serve.allow_job_credentials</code> is truthy (off by default).</li>
</ul>
<p>On the server, unshackle merges the effective parameters in this order: defaults → <code>serve:</code> config overrides → service-specific defaults → your request body.</p>
<p>The server checks each <code>serve:</code> and <code>services.&lt;TAG&gt;.dl</code> value that a job uses with the rules of a request body. A bad value refuses the job with <code>400 INVALID_PARAMETERS</code>, and the message starts with the config block, for example <code>serve: workers must be a positive integer</code>. A value that your request body replaces is not checked.</p>
</div>
<table>
<thead>
@@ -4975,7 +4990,7 @@ Use <code>error_code</code> and <code>retryable</code> to decide what to do.</p>
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">&para;</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>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/&lt;sha1&gt;</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><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 or malformed value, and drops an unknown codec name.</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>
<p>The <code>proxy</code> value must be a full proxy URI, unless the operator gives your API key <code>server_proxy</code> in the <code>serve.users</code> config. Without <code>server_proxy</code>, a proxy URI gets <code>INVALID_PROXY</code> when its host is not a public address or is not a plain host name or IP address. Without <code>server_proxy</code>, the server does not resolve country codes with its own proxy providers. It rejects the request with <code>INVALID_PROXY</code> when no <code>proxy</code> is set and the reported <code>client_region</code> differs from the server's region. A request that reports no <code>client_region</code> is not blocked. Pass <code>proxy</code> with your own proxy, or <code>no_proxy</code> to accept the server's own connection. With <code>server_proxy</code>, the server resolves a country code and picks a proxy for your <code>client_region</code> itself. A Control D resolver, <code>controld://&lt;resolver&gt;@dns.controld.com</code>, counts as a full proxy URI: the server runs a forwarder for it and needs no Control D configuration of its own. A proxy URI needs an <code>http</code>, <code>https</code> or <code>socks</code> scheme: the server answers <code>INVALID_PROXY</code> to a <code>host:port</code> value, also with <code>server_proxy</code>.</p>
<div class="tabbed-set tabbed-alternate" data-tabs="20:1"><input checked="checked" id="__tabbed_20_1" name="__tabbed_20" type="radio" /><div class="tabbed-labels"><label for="__tabbed_20_1">Response <code>200</code></label></div>
@@ -5013,6 +5028,11 @@ the newlines must go out at once.</p>
</tr>
<tr>
<td><code>400</code></td>
<td><code>INVALID_PARAMETERS</code></td>
<td>Invalid <code>range_</code>, <code>vcodec</code>, <code>quality</code> or <code>dl_params</code> value.</td>
</tr>
<tr>
<td><code>400</code></td>
<td><code>INVALID_SERVICE</code></td>
<td>Unknown or disallowed service.</td>
</tr>
+3 -3
View File
@@ -3016,10 +3016,10 @@ object the dashboard shows as sent), and the track-selection hints <code>range_<
<code>EC3</code>), and <code>forced_subs</code> and <code>exact_lang</code> (booleans). The server gives these values to the
service in <code>ctx.parent.params</code>, never as service options, so a service option
with the same name, such as an own <code>--lang</code>, does not get them. The server uses
the <code>dl</code> default for each absent or malformed value: <code>lang</code> is <code>["orig"]</code>,
the <code>dl</code> default for each absent value: <code>lang</code> is <code>["orig"]</code>,
<code>v_lang</code>, <code>a_lang</code> and <code>acodec</code> are <code>[]</code>, and <code>forced_subs</code> and <code>exact_lang</code> are <code>false</code>. The
server drops an unknown codec name. An empty array is a valid value and stays
empty.</p>
server refuses a malformed value and an unknown codec or range name with
<code>INVALID_PARAMETERS</code>. An empty array is a valid value and stays empty.</p>
<p>The server does not forward the <code>dl</code> mode flags: <code>video_only</code>, <code>audio_only</code>,
<code>subs_only</code>, <code>chapters_only</code>, <code>list_</code>, <code>skip_dl</code>, <code>sub_format</code>,
<code>no_attachments</code>, <code>audio_description</code>, <code>audio_description_only</code> and
+4 -1
View File
@@ -3094,6 +3094,9 @@ and you gave no valid fallback. Always pass the title's original recorded
language. For HLS, <code>to_tracks</code> uses this fallback directly for the primary track,
because HLS variants carry no language.</p>
</div>
<p>DASH and HLS <code>to_tracks</code> skip a Representation or variant whose codec unshackle does not
know, and log one warning with its codec string. They raise <code>ValueError</code> only when they skip at
least one and no track is left.</p>
<h3 id="segment-filtering-hooks">Segment-filtering hooks<a class="headerlink" href="#segment-filtering-hooks" title="Permanent link">&para;</a></h3>
<ul>
<li><strong>HLS</strong>: set <code>track.OnSegmentFilter(segment)</code> to drop unwanted segments (ads/bumpers).
@@ -3148,7 +3151,7 @@ service to talk to the platform's license server. unshackle recognizes seven DRM
</tr>
<tr>
<td><code>ClearKeyCENC</code></td>
<td>W3C <code>org.w3.clearkey</code> over CENC</td>
<td>W3C <code>org.w3.clearkey</code> or W3C common PSSH over CENC</td>
<td>JSON KID request → JWK set; no CDM</td>
</tr>
<tr>