coursera-dl: patch for python3>=3.9

This commit is contained in:
icp 2022-09-24 01:34:48 +05:30 committed by Andrew J. Hesford
parent d159357093
commit 88b3adc73e
2 changed files with 52 additions and 4 deletions

View file

@ -0,0 +1,48 @@
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

View file

@ -1,16 +1,16 @@
# Template file for 'coursera-dl'
pkgname=coursera-dl
version=0.11.5
revision=3
revision=4
build_style=python3-module
pycompile_module="coursera"
hostmakedepends="python3-setuptools"
depends="python3-attrs python3-setuptools python3-pyasn1 python3-ConfigArgParse
python3-BeautifulSoup4 python3-requests python3-six python3-keyring
python3-urllib3"
checkdepends="${depends} python3-keyrings-alt python3-mock python3-pytest-xdist"
short_desc="Script for downloading Coursera.org videos and naming them"
maintainer="Orphaned <orphan@voidlinux.org>"
license="LGPL-3.0-or-later"
homepage="https://github.com/coursera-dl/coursera-dl"
distfiles="${PYPI_SITE}/c/coursera-dl/coursera-dl-${version}.tar.gz"
checksum=66a84558dfcfcbdc487dcabcfc0d7c4a8569cc604b051b1d51bc95d52a369745
distfiles="https://github.com/coursera-dl/coursera-dl/archive/refs/tags/${version}.tar.gz"
checksum=27e382435084ec91ef89ab6c1d46f4756b708e4badf5307a8f18b9ad31971014