Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins.ard_mediathek: No playable streams found on this URL #4687

Closed
4 tasks done
tmatthews5511 opened this issue Jul 29, 2022 · 3 comments · Fixed by #4703
Closed
4 tasks done

plugins.ard_mediathek: No playable streams found on this URL #4687

tmatthews5511 opened this issue Jul 29, 2022 · 3 comments · Fixed by #4703
Labels
plugin issue A Plugin does not work correctly

Comments

@tmatthews5511
Copy link

tmatthews5511 commented Jul 29, 2022

Checklist

Streamlink version

Latest build from the master branch

Description

The ARD (German Public TV) seems not to be working at the moment with Streamlink.

It gives a 'error: No playable streams found on this URL: https://www.ardmediathek.de/daserste/live/Y3JpZDovL2Rhc2Vyc3RlLmRlL0xpdmVzdHJlYW0tRGFzRXJzdGU'

Debug log

[cli][debug] OS:         Linux-5.10.0-15-amd64-x86_64-with-glibc2.31
[cli][debug] Python:     3.9.2
[cli][debug] Streamlink: 0.0.0+unknown
[cli][debug] Dependencies:
[cli][debug]  PySocks: 1.7.1
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 4.8.0
[cli][debug]  pycountry: 22.3.5
[cli][debug]  pycryptodome: 3.14.1
[cli][debug]  requests: 2.27.1
[cli][debug]  websocket-client: 1.3.1
[cli][debug]  importlib-metadata: 4.11.3
[cli][debug] Arguments:
[cli][debug]  url=https://www.ardmediathek.de/daserste/live/Y3JpZDovL2Rhc2Vyc3RlLmRlL0xpdmVzdHJlYW0tRGFzRXJzdGU
[cli][debug]  stream=['720p']
[cli][debug]  --loglevel=debug
[cli][debug]  --output=blah.mp4
[cli][debug]  --http-proxy=socks5h://xxx.xxxd@xxxx.dynv6.net:8200
[cli][info] Found matching plugin ard_mediathek for URL https://www.ardmediathek.de/daserste/live/Y3JpZDovL2Rhc2Vyc3RlLmRlL0xpdmVzdHJlYW0tRGFzRXJzdGU
error: No playable streams found on this URL: https://www.ardmediathek.de/daserste/live/Y3JpZDovL2Rhc2Vyc3RlLmRlL0xpdmVzdHJlYW0tRGFzRXJzdGU
@tmatthews5511 tmatthews5511 added the plugin issue A Plugin does not work correctly label Jul 29, 2022
@bastimeyer bastimeyer changed the title ARD (German public tv): No playable streams found on this URL plugins.ard_mediathek: No playable streams found on this URL Jul 29, 2022
@bastimeyer
Copy link
Member

The response of the initial HTTP request seems to be empty now, so the plugin can't find the stream URL. Not sure yet why.

<script id="fetchedContextValue" type="application/json">
    null
</script>

The same request gets made by their site though and proper JSON data is included. That means that most likely some headers are missing.


A couple of live streams on ard_mediathek appear to be static now:

Others are hosed on Akamai and are probably not static:

@bastimeyer
Copy link
Member

Had a second look at the plugin and managed to fix the JSON data retrieval and validation, so that the correct stream URLs get found. That would be the diff (not submitting a PR yet):

diff --git a/src/streamlink/plugins/ard_mediathek.py b/src/streamlink/plugins/ard_mediathek.py
index c2c51c14..5cc1cdfd 100644
--- a/src/streamlink/plugins/ard_mediathek.py
+++ b/src/streamlink/plugins/ard_mediathek.py
@@ -33,14 +33,20 @@ class ARDMediathek(Plugin):
     def _get_streams(self):
         data_json = self.session.http.get(self.url, schema=validate.Schema(
             validate.parse_html(),
-            validate.xml_findtext(".//script[@id='fetchedContextValue'][@type='application/json']"),
+            validate.xml_findtext(".//script[@id='fetchedContextValue2'][@type='application/json']"),
             validate.any(None, validate.all(
                 validate.parse_json(),
-                {str: dict},
-                validate.transform(lambda obj: list(obj.items())),
-                validate.filter(lambda item: item[0].startswith("https://api.ardmediathek.de/page-gateway/pages/")),
-                validate.any(validate.get((0, 1)), [])
-            ))
+                [list],
+                validate.filter(lambda item: (
+                    len(item) == 2
+                    and type(item[0]) is str
+                    and type(item[1]) is dict
+                    and item[0].startswith("https://api.ardmediathek.de/page-gateway/pages/")
+                )),
+                validate.get((0, 1)),
+                {"data": dict},
+                validate.get("data"),
+            )),
         ))
         if not data_json:
             return

However, all the static streams I've listed earlier have a separate HLS audio playlist, and instead of using MPEG-TS containers for the audio segments, ADTS containers are used for the AAC audio data, and somehow this causes problems when muxing the two streams into the output.

From what it looks like, the audio stream alone is causing issues when trying to play it on the fly. Saving it and playing it back afterwards works though. @back-to, do you have any idea?

Video: https://mcdn.daserste.de/daserste/de/master_1920p_5000.m3u8
Audio: https://mcdn.daserste.de/daserste/de/master_audio1_128.m3u8

@bastimeyer
Copy link
Member

bastimeyer commented Jul 30, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin issue A Plugin does not work correctly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants