aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_age_restriction.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2023-02-17 16:51:34 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2023-02-17 17:52:23 +0530
commit45b2ee6f4fae139892a1a4335c269dcbb6671497 (patch)
tree3cd8e7e643dc0576dcc8e9e87079f015588a06ec /test/test_age_restriction.py
parenta5387729696a5b33f53f60ef06f48e45663b12dd (diff)
downloadhypervideo-pre-45b2ee6f4fae139892a1a4335c269dcbb6671497.tar.lz
hypervideo-pre-45b2ee6f4fae139892a1a4335c269dcbb6671497.tar.xz
hypervideo-pre-45b2ee6f4fae139892a1a4335c269dcbb6671497.zip
Update to ytdl-commit-2dd6c6e
[YouTube] Avoid crash if uploader_id extraction fails https://github.com/ytdl-org/youtube-dl/commit/2dd6c6edd8e0fc5e45865b8e6d865e35147de772 Except: * 295736c9cba714fb5de7d1c3dd31d86e50091cf8 [jsinterp] Improve parsing * 384f632e8a9b61e864a26678d85b2b39933b9bae [ITV] Overhaul ITV extractor * 33db85c571304bbd6863e3407ad8d08764c9e53b [feat]: Add support to external downloader aria2p
Diffstat (limited to 'test/test_age_restriction.py')
-rw-r--r--test/test_age_restriction.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/test/test_age_restriction.py b/test/test_age_restriction.py
index ff248432b..68107590e 100644
--- a/test/test_age_restriction.py
+++ b/test/test_age_restriction.py
@@ -10,6 +10,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import is_download_test, try_rm
from yt_dlp import YoutubeDL
+from yt_dlp.utils import DownloadError
def _download_restricted(url, filename, age):
@@ -25,10 +26,14 @@ def _download_restricted(url, filename, age):
ydl.add_default_info_extractors()
json_filename = os.path.splitext(filename)[0] + '.info.json'
try_rm(json_filename)
- ydl.download([url])
- res = os.path.exists(json_filename)
- try_rm(json_filename)
- return res
+ try:
+ ydl.download([url])
+ except DownloadError:
+ pass
+ else:
+ return os.path.exists(json_filename)
+ finally:
+ try_rm(json_filename)
@is_download_test
@@ -38,12 +43,12 @@ class TestAgeRestriction(unittest.TestCase):
self.assertFalse(_download_restricted(url, filename, age))
def test_youtube(self):
- self._assert_restricted('07FYdnEawAQ', '07FYdnEawAQ.mp4', 10)
+ self._assert_restricted('HtVdAasjOgU', 'HtVdAasjOgU.mp4', 10)
def test_youporn(self):
self._assert_restricted(
- 'http://www.youporn.com/watch/505835/sex-ed-is-it-safe-to-masturbate-daily/',
- '505835.mp4', 2, old_age=25)
+ 'https://www.youporn.com/watch/16715086/sex-ed-in-detention-18-asmr/',
+ '16715086.mp4', 2, old_age=25)
if __name__ == '__main__':