mirror of https://github.com/devine-dl/devine.git
Prepare DRM on URL tracks if they already have DRM
Previously it would only prepare the DRM, if it had to find DRM from the init data. Now it prepares DRM if already pre-provided with DRM objects.
This commit is contained in:
parent
d73256f1b3
commit
8337162991
|
@ -790,13 +790,20 @@ class dl:
|
||||||
# the service might not have explicitly defined the `drm` property
|
# the service might not have explicitly defined the `drm` property
|
||||||
# try find widevine DRM information from the init data of URL
|
# try find widevine DRM information from the init data of URL
|
||||||
try:
|
try:
|
||||||
drm = Widevine.from_track(track, service.session)
|
track.drm = [Widevine.from_track(track, service.session)]
|
||||||
except Widevine.Exceptions.PSSHNotFound:
|
except Widevine.Exceptions.PSSHNotFound:
|
||||||
# it might not have Widevine DRM, or might not have found the PSSH
|
# it might not have Widevine DRM, or might not have found the PSSH
|
||||||
self.log.warning("No Widevine PSSH was found for this track, is it DRM free?")
|
self.log.warning("No Widevine PSSH was found for this track, is it DRM free?")
|
||||||
else:
|
|
||||||
track.drm = [drm]
|
if track.drm:
|
||||||
|
drm = track.drm[0] # just use the first supported DRM system for now
|
||||||
|
if isinstance(drm, Widevine):
|
||||||
|
# license and grab content keys
|
||||||
|
if not prepare_drm:
|
||||||
|
raise ValueError("prepare_drm func must be supplied to use Widevine DRM")
|
||||||
prepare_drm(drm)
|
prepare_drm(drm)
|
||||||
|
else:
|
||||||
|
drm = None
|
||||||
|
|
||||||
asyncio.run(aria2c(
|
asyncio.run(aria2c(
|
||||||
uri=track.url,
|
uri=track.url,
|
||||||
|
@ -808,8 +815,7 @@ class dl:
|
||||||
|
|
||||||
track.path = save_path
|
track.path = save_path
|
||||||
|
|
||||||
if track.drm:
|
if drm:
|
||||||
drm = track.drm[0] # just use the first supported DRM system for now
|
|
||||||
drm.decrypt(save_path)
|
drm.decrypt(save_path)
|
||||||
track.drm = None
|
track.drm = None
|
||||||
if callable(track.OnDecrypted):
|
if callable(track.OnDecrypted):
|
||||||
|
|
Loading…
Reference in New Issue