fix(export): strip session headers from exports and normalise merged keys

This commit is contained in:
imSp4rky
2026-09-23 11:19:26 -06:00
parent 30ea001cb3
commit ba819aa11e
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ def test_encrypted_ism_rung_gets_the_exported_keys(tmp_path: Path, monkeypatch:
export = export_tracks(tmp_path, parsed, ISM_URL) export = export_tracks(tmp_path, parsed, ISM_URL)
doc = json.loads(export.read_text(encoding="utf8")) doc = json.loads(export.read_text(encoding="utf8"))
doc["titles"][0]["keys"] = {"0" * 32: "ab" * 16} doc["titles"][0]["keys"] = {"1" * 32: "ab" * 16}
doc["titles"][0]["drm"] = [{"system": "playready"}] doc["titles"][0]["drm"] = [{"system": "playready"}]
export.write_text(json.dumps(doc), encoding="utf8") export.write_text(json.dumps(doc), encoding="utf8")
+2 -2
View File
@@ -3983,12 +3983,12 @@ class dl:
for kid, key in content_keys.items(): for kid, key in content_keys.items():
# a KID that already holds a different key must not be overwritten: # a KID that already holds a different key must not be overwritten:
# the reader rejects a file that disagrees with itself # the reader rejects a file that disagrees with itself
if pool.setdefault(kid.hex, key) != key: if pool.setdefault(kid.hex, key.lower()) != key.lower():
self.log.warning( self.log.warning(
f"KID {kid.hex} already has a different key in {export}, keeping the existing one" f"KID {kid.hex} already has a different key in {export}, keeping the existing one"
) )
else: else:
entry.keys[kid.hex] = key entry.add_key(kid.hex, key)
mediaexport.write(export, doc) mediaexport.write(export, doc)
Generated
+1 -1
View File
@@ -1077,7 +1077,7 @@ wheels = [
[[package]] [[package]]
name = "mediaexport" name = "mediaexport"
version = "0.1.0" version = "0.1.0"
source = { git = "https://github.com/unshackle-dl/mediaexport?branch=main#07893237199fc865bd5c63b6848235e4f6ef81c8" } source = { git = "https://github.com/unshackle-dl/mediaexport?branch=main#144edd7bcaa943ad0a5116c998734d9f24c41aae" }
[[package]] [[package]]
name = "more-itertools" name = "more-itertools"