[facebook] Report a more meaningful message if the video cannot be accessed (closes...
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sun, 27 Oct 2013 11:09:46 +0000 (12:09 +0100)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sun, 27 Oct 2013 11:09:46 +0000 (12:09 +0100)
youtube_dl/extractor/facebook.py

index 62881da31e2a3c3f3d56342c32d6695de94ad543..aa2525f175600e86434a789d2cf58a49c1362ed4 100644 (file)
@@ -100,7 +100,12 @@ class FacebookIE(InfoExtractor):
         AFTER = '.forEach(function(variable) {swf.addVariable(variable[0], variable[1]);});'
         m = re.search(re.escape(BEFORE) + '(.*?)' + re.escape(AFTER), webpage)
         if not m:
-            raise ExtractorError(u'Cannot parse data')
+            m_msg = re.search(r'class="[^"]*uiInterstitialContent[^"]*"><div>(.*?)</div>', webpage)
+            if m_msg is not None:
+                err_msg = u'The video is not available, Facebook said: "%s"' % m_msg.group(1)
+            else:
+                err_msg = u'Cannot parse data'
+            raise ExtractorError(err_msg)
         data = dict(json.loads(m.group(1)))
         params_raw = compat_urllib_parse.unquote(data['params'])
         params = json.loads(params_raw)