YoutubePlaylistIE: don't crash with empty lists (related #808)
[youtube-dl] / youtube_dl / InfoExtractors.py
index 3450f0d17e19d95d67645a50c79f0680b05379cc..967f6a1003ab9ca858d90d12ea762b0a13183d57 100755 (executable)
@@ -1723,12 +1723,11 @@ class YoutubePlaylistIE(InfoExtractor):
             if 'feed' not in response:
                 self._downloader.report_error(u'Got a malformed response from YouTube API')
                 return
+            playlist_title = response['feed']['title']['$t']
             if 'entry' not in response['feed']:
                 # Number of videos is a multiple of self._MAX_RESULTS
                 break
 
-            playlist_title = response['feed']['title']['$t']
-
             videos += [ (entry['yt$position']['$t'], entry['content']['src'])
                         for entry in response['feed']['entry']
                         if 'content' in entry ]