[dcn] improve season info extraction
authorremitamine <remitamine@gmail.com>
Sat, 31 Oct 2015 14:40:11 +0000 (15:40 +0100)
committerremitamine <remitamine@gmail.com>
Sat, 31 Oct 2015 14:40:11 +0000 (15:40 +0100)
youtube_dl/extractor/dcn.py

index 8b360a9d7ed381437ac47b7b6357983c9669bd3c..a9a5e94f53ef7d9c5eb7dd9799dfc80788d851bf 100644 (file)
@@ -210,16 +210,14 @@ class DCNSeasonIE(InfoExtractor):
             })
 
         show = self._download_json(request, show_id)
-        season_id = season_id or show['default_season']
-        season = {}
-        for _ in show['seasons']:
-            if _['id'] == season_id:
-                season = _
-                break
-        title = season.get('title_en') or season['title_ar']
-
-        entries = []
-        for video in show['videos']:
-            entries.append(self.url_result('http://www.dcndigital.ae/#/media/%s' % video['id'], 'DCNVideo'))
-
-        return self.playlist_result(entries, season_id, title)
+        if not season_id:
+            season_id = show['default_season']
+        for season in show['seasons']:
+            if season['id'] == season_id:
+                title = season.get('title_en') or season['title_ar']
+
+                entries = []
+                for video in show['videos']:
+                    entries.append(self.url_result('http://www.dcndigital.ae/#/media/%s' % video['id'], 'DCNVideo'))
+
+                return self.playlist_result(entries, season_id, title)