void-packages/srcpkgs/coursera-dl/patches/fix-upstream-issue-778.patch

49 lines
1.3 KiB
Diff

From c8796e567698be166cb15f54e095140c1a9b567e Mon Sep 17 00:00:00 2001
From: "Heino H. Gehlsen" <heino@gehlsen.dk>
Date: Sun, 27 Dec 2020 13:28:35 +0100
Subject: [PATCH] Fix AttributeError: 'HTMLParser' object has no attribute
'unescape'
https://github.com/coursera-dl/coursera-dl/pull/789
---
coursera/utils.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/coursera/utils.py b/coursera/utils.py
index 9ba577af..f271bb9f 100644
--- a/coursera/utils.py
+++ b/coursera/utils.py
@@ -21,7 +21,11 @@
import six
from six import iteritems
-from six.moves import html_parser
+if six.PY34:
+ import html
+else:
+ from six.moves import html_parser
+ html = html_parser.HTMLParser()
from six.moves.urllib.parse import ParseResult
from six.moves.urllib_parse import unquote_plus
@@ -98,8 +102,7 @@ def random_string(length):
def unescape_html(s):
- h = html_parser.HTMLParser()
- s = h.unescape(s)
+ s = html.unescape(s)
s = unquote_plus(s)
return unescape(s, HTML_UNESCAPE_TABLE)
@@ -114,8 +117,7 @@ def clean_filename(s, minimal_change=False):
"""
# First, deal with URL encoded strings
- h = html_parser.HTMLParser()
- s = h.unescape(s)
+ s = html.unescape(s)
s = unquote_plus(s)
# Strip forbidden characters