[utils] Skip invalid/non HTML entities (Closes #7518)
[youtube-dl] / youtube_dl / utils.py
index d39f313a41802f38f91418e12cc89dcd798b0286..b7013a6aaef400633d45ac33c4a7fcb949802be7 100644 (file)
@@ -396,7 +396,11 @@ def _htmlentity_transform(entity):
             numstr = '0%s' % numstr
         else:
             base = 10
-        return compat_chr(int(numstr, base))
+        # See https://github.com/rg3/youtube-dl/issues/7518
+        try:
+            return compat_chr(int(numstr, base))
+        except ValueError:
+            pass
 
     # Unknown entity in name, return its literal representation
     return ('&%s;' % entity)