]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/pbs.py
[extractor/youtube] Add hyperpipe instances (#6020)
[yt-dlp.git] / yt_dlp / extractor / pbs.py
index 0eabf9beee8306c1f46fdbd4a7b88c0ea5ce4b5b..5bdf561db9ef833e5651f459b63e29f2bee968ec 100644 (file)
@@ -1,6 +1,3 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 import re
 
 from .common import InfoExtractor
@@ -193,7 +190,7 @@ class PBSIE(InfoExtractor):
            # Article with embedded player (or direct video)
            (?:www\.)?pbs\.org/(?:[^/]+/){1,5}(?P<presumptive_id>[^/]+?)(?:\.html)?/?(?:$|[?\#]) |
            # Player
-           (?:video|player)\.pbs\.org/(?:widget/)?partnerplayer/(?P<player_id>[^/]+)/
+           (?:video|player)\.pbs\.org/(?:widget/)?partnerplayer/(?P<player_id>[^/]+)
         )
     ''' % '|'.join(list(zip(*_STATIONS))[0])
 
@@ -545,7 +542,7 @@ def _real_extract(self, url):
                 for vid_id in video_id]
             return self.playlist_result(entries, display_id)
 
-        info = None
+        info = {}
         redirects = []
         redirect_urls = set()
 
@@ -660,7 +657,9 @@ def extract_redirect_urls(info):
                     'protocol': 'http',
                 })
                 formats.append(f)
-        self._sort_formats(formats)
+        for f in formats:
+            if (f.get('format_note') or '').endswith(' AD'):  # Audio description
+                f['language_preference'] = -10
 
         rating_str = info.get('rating')
         if rating_str is not None: