[infoq] Avoid crash if the page has no `mp3Form`
authorgudata <gudata@users.noreply.github.com>
Fri, 19 Aug 2022 20:00:21 +0000 (23:00 +0300)
committerGitHub <noreply@github.com>
Fri, 19 Aug 2022 20:00:21 +0000 (21:00 +0100)
* proposed fix for issue #31131, aligns with yt-dlp

Co-authored-by: dirkf <fieldhouse@gmx.net>
youtube_dl/extractor/infoq.py

index 0a70a1fb442bfff5fe17fe2dadca2269aa9378e3..60b02b69958ed11beec09ab46810e777f9dfc878 100644 (file)
@@ -1,6 +1,9 @@
 # coding: utf-8
 
 from __future__ import unicode_literals
+from ..utils import (
+    ExtractorError,
+)
 
 from ..compat import (
     compat_b64decode,
@@ -90,7 +93,11 @@ class InfoQIE(BokeCCBaseIE):
         }]
 
     def _extract_http_audio(self, webpage, video_id):
-        fields = self._form_hidden_inputs('mp3Form', webpage)
+        try:
+            fields = self._form_hidden_inputs('mp3Form', webpage)
+        except ExtractorError:
+            fields = {}
+
         http_audio_url = fields.get('filename')
         if not http_audio_url:
             return []