[nrk] Improve video id extraction
authorSergey M․ <dstftw@gmail.com>
Sat, 2 Jan 2021 23:44:28 +0000 (06:44 +0700)
committerSergey M․ <dstftw@gmail.com>
Sat, 2 Jan 2021 23:44:28 +0000 (06:44 +0700)
youtube_dl/extractor/nrk.py

index 61a7c9aad1d824ae9c4b054b76feb9a7d0c227c9..5f12b0d9e51f2cdf84b3f3e687acaa0281d4e196 100644 (file)
@@ -151,6 +151,8 @@ class NRKIE(NRKBaseIE):
         # known values for preferredCdn: akamai, iponly, minicdn and telenor
         manifest = call_playback_api('manifest', {'preferredCdn': 'akamai'})
 
+        video_id = try_get(manifest, lambda x: x['id'], compat_str) or video_id
+
         if manifest.get('playability') == 'nonPlayable':
             self._raise_error(manifest['nonPlayable'])
 
@@ -211,7 +213,7 @@ class NRKIE(NRKBaseIE):
         }
 
     def _real_extract(self, url):
-        video_id = self._match_id(url)
+        video_id = self._match_id(url).split('/')[-1]
         return self._extract_from_playback(video_id)