From d83fe1f86a792aff0d42fb7adcaa76e2ad6394bc Mon Sep 17 00:00:00 2001 From: wawxxjm Date: Mon, 9 Dec 2019 18:49:24 -0500 Subject: [PATCH 1/3] added some tests --- youtube_dl/extractor/academicearth.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/academicearth.py b/youtube_dl/extractor/academicearth.py index 34095501c..73adc76aa 100644 --- a/youtube_dl/extractor/academicearth.py +++ b/youtube_dl/extractor/academicearth.py @@ -8,7 +8,7 @@ from .common import InfoExtractor class AcademicEarthCourseIE(InfoExtractor): _VALID_URL = r'^https?://(?:www\.)?academicearth\.org/playlists/(?P[^?#/]+)' IE_NAME = 'AcademicEarth:Course' - _TEST = { + _TESTS = [{ 'url': 'http://academicearth.org/playlists/laws-of-nature/', 'info_dict': { 'id': 'laws-of-nature', @@ -16,7 +16,23 @@ class AcademicEarthCourseIE(InfoExtractor): 'description': 'Introduce yourself to the laws of nature with these free online college lectures from Yale, Harvard, and MIT.', }, 'playlist_count': 3, - } + }, { + 'url': "https://academicearth.org/playlists/first-day-of-freshman-year/", + 'info_dict': { + 'id': 'first-day-of-freshman-year', + 'title': 'FIRST DAY OF FRESHMAN YEAR', + 'description': 'Relive the first day of your freshman year with a series of first lectures from introductory college courses at MIT, Yale, and Stanford.' + }, + 'playlist_count': 3, + }, { + 'url': 'https://academicearth.org/playlists/financial-crisis', + 'info_dict': { + 'id': 'financial-crisis', + 'title': 'UNDERSTANDING THE FINANCIAL CRISIS', + 'description': 'Expert perspectives on the Financial Crisis and how to manage it.' + }, + 'playlist_count': 7, + }] def _real_extract(self, url): playlist_id = self._match_id(url) From 76bfb7fa2121dcf356dc2936a2837170298d76b1 Mon Sep 17 00:00:00 2001 From: wawxxjm Date: Mon, 9 Dec 2019 20:21:53 -0500 Subject: [PATCH 2/3] changed md5 to sha256 --- test/test_download.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test_download.py b/test/test_download.py index ebe820dfc..7204c67f6 100644 --- a/test/test_download.py +++ b/test/test_download.py @@ -56,9 +56,9 @@ class YoutubeDL(youtube_dl.YoutubeDL): return super(YoutubeDL, self).process_info(info_dict) -def _file_md5(fn): +def _file_sha256(fn): with open(fn, 'rb') as f: - return hashlib.md5(f.read()).hexdigest() + return hashlib.sha256(f.read()).hexdigest() defs = gettestcases() @@ -223,9 +223,9 @@ def generator(test_case, tname): 'Expected %s to be at least %s, but it\'s only %s ' % (tc_filename, format_bytes(expected_minsize), format_bytes(got_fsize))) - if 'md5' in tc: - md5_for_file = _file_md5(tc_filename) - self.assertEqual(tc['md5'], md5_for_file) + if 'sha256' in tc: + sha256_for_file = _file_sha256(tc_filename) + self.assertEqual(tc['sha256'], sha256_for_file) # Finally, check test cases' data again but this time against # extracted data from info JSON file written during processing info_json_fn = os.path.splitext(tc_filename)[0] + '.info.json' From c90fa54a5f12a66a7b9e5cdda13f8c6ee4a268ba Mon Sep 17 00:00:00 2001 From: wawxxjm Date: Mon, 9 Dec 2019 20:24:59 -0500 Subject: [PATCH 3/3] added examples for #20454 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 01f975958..93f26f031 100644 --- a/README.md +++ b/README.md @@ -312,6 +312,8 @@ Alternatively, refer to the [developer instructions](#developer-instructions) fo ## Workarounds: --encoding ENCODING Force the specified encoding (experimental) + example: youtube-dl --encoding UTF-8 [URL] + youtube-dl --encoding ASCII [URL] --no-check-certificate Suppress HTTPS certificate validation --prefer-insecure Use an unencrypted connection to retrieve information about the video. (Currently