aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authordirkf <[email protected]>2023-02-04 23:18:24 +0000
committerdirkf <[email protected]>2023-02-13 03:54:51 +0000
commitd6b14ba3163b255d0dd8d3b9ddf25d977b8262e7 (patch)
treeed197d63acecbb7d2a18d14a0df11eeebba01a2b /test
parent30e986b83493f68bd4c2405b5f4d801891c9bdde (diff)
downloadyoutube-dl-d6b14ba3163b255d0dd8d3b9ddf25d977b8262e7.tar.gz
youtube-dl-d6b14ba3163b255d0dd8d3b9ddf25d977b8262e7.zip
[test] Fix TestAgeRestriction
* age restriction may cause DownloadError * update obsolete test URLs [skip ci]
Diffstat (limited to 'test')
-rw-r--r--test/test_age_restriction.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/test_age_restriction.py b/test/test_age_restriction.py
index 6f5513faa..db98494ab 100644
--- a/test/test_age_restriction.py
+++ b/test/test_age_restriction.py
@@ -11,6 +11,7 @@ from test.helper import try_rm
from youtube_dl import YoutubeDL
+from youtube_dl.utils import DownloadError
def _download_restricted(url, filename, age):
@@ -26,7 +27,10 @@ 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])
+ try:
+ ydl.download([url])
+ except DownloadError:
+ try_rm(json_filename)
res = os.path.exists(json_filename)
try_rm(json_filename)
return res
@@ -38,12 +42,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__':