From b704fc1a686b1928bbd65aeea45f97dc579c78c5 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Thu, 25 Mar 2021 04:31:25 +0530 Subject: [PATCH] Revert commit 8562218 [ard] improve clip id extraction https://github.com/ytdl-org/youtube-dl/commit/8562218350a79d4709da8593bb0c538aa0824acf This was merged incorrectly --- yt_dlp/extractor/ard.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/yt_dlp/extractor/ard.py b/yt_dlp/extractor/ard.py index 352308797..12a7cfb54 100644 --- a/yt_dlp/extractor/ard.py +++ b/yt_dlp/extractor/ard.py @@ -413,12 +413,6 @@ class ARDBetaMediathekIE(ARDMediathekBaseIE): # playlist of type 'sammlung' 'url': 'https://www.ardmediathek.de/ard/sammlung/team-muenster/5JpTzLSbWUAK8184IOvEir/', 'only_matching': True, - }, { - 'url': 'https://www.ardmediathek.de/video/coronavirus-update-ndr-info/astrazeneca-kurz-lockdown-und-pims-syndrom-81/ndr/Y3JpZDovL25kci5kZS84NzE0M2FjNi0wMWEwLTQ5ODEtOTE5NS1mOGZhNzdhOTFmOTI/', - 'only_matching': True, - }, { - 'url': 'https://www.ardmediathek.de/ard/player/Y3JpZDovL3dkci5kZS9CZWl0cmFnLWQ2NDJjYWEzLTMwZWYtNGI4NS1iMTI2LTU1N2UxYTcxOGIzOQ/tatort-duo-koeln-leipzig-ihr-kinderlein-kommet', - 'only_matching': True, }] def _ARD_load_playlist_snipped(self, playlist_id, display_id, client, mode, pageNumber): @@ -518,7 +512,13 @@ class ARDBetaMediathekIE(ARDMediathekBaseIE): return self.playlist_result(entries, playlist_title=display_id) def _real_extract(self, url): - video_id = self._match_id(url) + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('video_id') + display_id = mobj.group('display_id') + if display_id: + display_id = display_id.rstrip('/') + if not display_id: + display_id = video_id if mobj.group('mode') in ('sendung', 'sammlung'): # this is a playlist-URL @@ -529,9 +529,9 @@ class ARDBetaMediathekIE(ARDMediathekBaseIE): player_page = self._download_json( 'https://api.ardmediathek.de/public-gateway', - video_id, data=json.dumps({ + display_id, data=json.dumps({ 'query': '''{ - playerPage(client: "ard", clipId: "%s") { + playerPage(client:"%s", clipId: "%s") { blockedByFsk broadcastedOn maturityContentRating @@ -561,7 +561,7 @@ class ARDBetaMediathekIE(ARDMediathekBaseIE): } } } -}''' % video_id, +}''' % (mobj.group('client'), video_id), }).encode(), headers={ 'Content-Type': 'application/json' })['data']['playerPage'] @@ -586,6 +586,7 @@ class ARDBetaMediathekIE(ARDMediathekBaseIE): r'\(FSK\s*(\d+)\)\s*$', description, 'age limit', default=None)) info.update({ 'age_limit': age_limit, + 'display_id': display_id, 'title': title, 'description': description, 'timestamp': unified_timestamp(player_page.get('broadcastedOn')),