[nrk] Fix age limit extraction
authorSergey M․ <dstftw@gmail.com>
Sat, 2 Jan 2021 23:51:21 +0000 (06:51 +0700)
committerSergey M․ <dstftw@gmail.com>
Sat, 2 Jan 2021 23:51:21 +0000 (06:51 +0700)
youtube_dl/extractor/nrk.py

index 520206534bc5990efbdd2a876124d73e5479ce13..d023de7f77330ab1c594901b27aa095c7205aa5a 100644 (file)
@@ -204,6 +204,9 @@ class NRKIE(NRKBaseIE):
                 'height': int_or_none(image.get('pixelHeight')),
             })
 
+        age_limit = int_or_none(try_get(
+            data, lambda x: x['legalAge']['body']['rating']['code']))
+
         return {
             'id': video_id,
             'title': title,
@@ -211,6 +214,7 @@ class NRKIE(NRKBaseIE):
             'description': description,
             'duration': duration,
             'thumbnails': thumbnails,
+            'age_limit': age_limit,
             'formats': formats,
         }