[youtube] Use 'node is None' when checking if the video has automatic captions
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Mon, 21 Oct 2013 14:28:55 +0000 (16:28 +0200)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Mon, 21 Oct 2013 14:28:55 +0000 (16:28 +0200)
It had stopped working and it reports a FutureWarning

youtube_dl/extractor/youtube.py

index fb7c42830781bf4cbf3f3ba78547e6defe5b13c5..a88cba2b4d74d2f57d0b781ab8e608e693c1caa2 100644 (file)
@@ -1150,7 +1150,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
             list_page = self._download_webpage(list_url, video_id)
             caption_list = xml.etree.ElementTree.fromstring(list_page.encode('utf-8'))
             original_lang_node = caption_list.find('track')
-            if not original_lang_node or original_lang_node.attrib.get('kind') != 'asr' :
+            if original_lang_node is None or original_lang_node.attrib.get('kind') != 'asr' :
                 self._downloader.report_warning(u'Video doesn\'t have automatic captions')
                 return {}
             original_lang = original_lang_node.attrib['lang_code']