summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-06-12 01:50:32 +0700
committerSergey M․ <dstftw@gmail.com>2017-06-12 01:50:32 +0700
commit72b409559c984bb116015ada55acd38120b24cc0 (patch)
treef8a75d0a2d3b6c9b1d029396803a953b30b19b3f
parent534863e057b155cd71035f05600444c2be62ca95 (diff)
downloadyoutube-dl-72b409559c984bb116015ada55acd38120b24cc0.tar.gz
youtube-dl-72b409559c984bb116015ada55acd38120b24cc0.tar.xz
youtube-dl-72b409559c984bb116015ada55acd38120b24cc0.zip
[compat] Introduce compat_HTMLParseError
-rw-r--r--youtube_dl/compat.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py
index 39527117f..bbc499eda 100644
--- a/youtube_dl/compat.py
+++ b/youtube_dl/compat.py
@@ -2322,6 +2322,19 @@ try:
 except ImportError:  # Python 2
     from HTMLParser import HTMLParser as compat_HTMLParser
 
+try:  # Python 2
+    from HTMLParser import HTMLParseError as compat_HTMLParseError
+except ImportError:  # Python <3.4
+    try:
+        from html.parser import HTMLParseError as compat_HTMLParseError
+    except ImportError:  # Python >3.4
+
+        # HTMLParseError has been deprecated in Python 3.3 and removed in
+        # Python 3.5. Introducing dummy exception for Python >3.5 for compatible
+        # and uniform cross-version exceptiong handling
+        class compat_HTMLParseError(Exception):
+            pass
+
 try:
     from subprocess import DEVNULL
     compat_subprocess_get_DEVNULL = lambda: DEVNULL