[utils] Handle HTMLParseError in extract_attributes (closes #13349)
[youtube-dl] / test / test_utils.py
index 41b094d89f7bf80bdd49d15dcf60f65d3b02ce23..2b93b360477f857b8fa693450d3c5375db5663cc 100644 (file)
@@ -916,6 +916,8 @@ class TestUtil(unittest.TestCase):
             supports_outside_bmp = False
         if supports_outside_bmp:
             self.assertEqual(extract_attributes('<e x="Smile &#128512;!">'), {'x': 'Smile \U0001f600!'})
+        # Malformed HTML should not break attributes extraction on older Python
+        self.assertEqual(extract_attributes('<mal"formed/>'), {})
 
     def test_clean_html(self):
         self.assertEqual(clean_html('a:\nb'), 'a: b')