You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/home/j/test2.py", line 59, in
asyncio.run(main())
File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/base_events.py", line 686, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/j/test2.py", line 32, in main
manifest = await client.get_manifest(streams.url)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/j/Desktop/venv/lib/python3.12/site-packages/crunpyroll/methods/get_manifest.py", line 24, in get_manifest
return types.Manifest.parse(response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/j/Desktop/venv/lib/python3.12/site-packages/crunpyroll/types/manifest.py", line 47, in parse
template = aset["SegmentTemplate"]
~~~~^^^^^^^^^^^^^^^^^^^
KeyError: 'SegmentTemplate'
The call for this video returns a subtitle where the api assumes a video would be, in crunpyroll/types/manifest.py the comments below seems to fix the problem
defparse(cls, obj: str):
data= {}
data["plain"] =objdata["video_streams"] = []
data["audio_streams"] = []
data["content_protection"] = {}
manifest=xmltodict.parse(obj)
forasetinmanifest["MPD"]["Period"]["AdaptationSet"]:
# Use get.("", {}) for asets that are not video or audiotemplate=aset.get("SegmentTemplate", {})
fordrminaset.get("ContentProtection", []):
scheme_id_uri=drm.get("@schemeIdUri")
ifscheme_id_uri==WIDEVINE_UUID:
data["content_protection"]["widevine"] = {}
data["content_protection"]["widevine"]["pssh"] =drm["cenc:pssh"]
data["content_protection"]["widevine"]["key_id"] =drm["@cenc:default_KID"]
ifscheme_id_uri==PLAYREADY_UUID:
data["content_protection"]["playready"] = {}
data["content_protection"]["playready"]["pssh"] =drm["mspr:pro"]
# Subtitles are returned as a listifisinstance(aset["Representation"], list):
forreprinaset["Representation"]:
ifrepr.get("@mimeType").startswith("video"):
stream=ManifestVideoStream.parse(repr, template)
data["video_streams"].append(stream)
elifrepr.get("@mimeType").startswith("audio"):
stream=ManifestAudioStream.parse(repr, template)
data["audio_streams"].append(stream)
returncls(data)
https://www.crunchyroll.com/watch/G7PU4VJEJ/asteroid-blues
Code:
I took a look at the response but I am not entirely sure what to make of it, any help would be appreciated.
The text was updated successfully, but these errors were encountered: