From 224d10a18b3c794bd158a548eda7f42e5f4a7796 Mon Sep 17 00:00:00 2001 From: doe1080 <98906116+doe1080@users.noreply.github.com> Date: Mon, 11 Aug 2025 03:00:40 +0900 Subject: [PATCH 1/2] [ie/generic] Fix `age_limit` --- yt_dlp/extractor/generic.py | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/yt_dlp/extractor/generic.py b/yt_dlp/extractor/generic.py index bc34aafa7a..5890b2e14c 100644 --- a/yt_dlp/extractor/generic.py +++ b/yt_dlp/extractor/generic.py @@ -121,7 +121,6 @@ class GenericIE(InfoExtractor): 'id': 'cauky-lidi-70-dil-babis-predstavil-pohadky-prymulanek-nebo-andrejovy-nove-saty-ac867', 'ext': 'mp4', 'title': 'čauky lidi 70 finall', - 'age_limit': 0, 'description': 'md5:47b2673a5b76780d9d329783e1fbf5aa', 'direct': True, 'duration': 318.0, @@ -244,7 +243,6 @@ class GenericIE(InfoExtractor): 'id': 'paris-d-moll', 'ext': 'mp4', 'title': 'Paris d-moll', - 'age_limit': 0, 'description': 'md5:319e37ea5542293db37e1e13072fe330', 'thumbnail': r're:https?://www\.filmarkivet\.se/wp-content/uploads/.+\.jpg', }, @@ -255,7 +253,6 @@ class GenericIE(InfoExtractor): 'info_dict': { 'id': '60413035', 'title': 'Etter ett års planlegging, klaffet endelig alt: - Jeg måtte ta en liten dans', - 'age_limit': 0, 'description': 'md5:bbb4e12e42e78609a74fd421b93b1239', 'thumbnail': r're:https?://www\.dagbladet\.no/images/.+', }, @@ -267,7 +264,6 @@ class GenericIE(InfoExtractor): 'info_dict': { 'id': 'single_clip', 'title': 'Single Clip player examples', - 'age_limit': 0, }, 'playlist_count': 3, }, { @@ -324,7 +320,6 @@ class GenericIE(InfoExtractor): 'id': 'videos-1', 'ext': 'mp4', 'title': 'Videos & Audio - King Machine (1)', - 'age_limit': 0, 'description': 'Browse King Machine videos & audio for sweet media. Your eyes will thank you.', 'thumbnail': r're:https?://media\.indiedb\.com/cache/images/.+\.jpg', '_old_archive_ids': ['generic videos'], @@ -363,7 +358,6 @@ class GenericIE(InfoExtractor): 'id': '21217', 'ext': 'mp4', 'title': '40 ночей (2016) - BogMedia.org', - 'age_limit': 0, 'description': 'md5:4e6d7d622636eb7948275432eb256dc3', 'display_id': '40-nochey-2016', 'thumbnail': r're:https?://bogmedia\.org/contents/videos_screenshots/.+\.jpg', @@ -378,7 +372,6 @@ class GenericIE(InfoExtractor): 'id': '18485', 'ext': 'mp4', 'title': 'Клип: Ленинград - ЗОЖ скачать, смотреть онлайн | Youix.com', - 'age_limit': 0, 'display_id': 'leningrad-zoj', 'thumbnail': r're:https?://youix\.com/contents/videos_screenshots/.+\.jpg', }, @@ -419,7 +412,6 @@ class GenericIE(InfoExtractor): 'id': '105', 'ext': 'mp4', 'title': 'Kelis - 4th Of July / Embed Player', - 'age_limit': 0, 'display_id': 'kelis-4th-of-july', 'thumbnail': r're:https?://www\.kvs-demo\.com/contents/videos_screenshots/.+\.jpg', }, @@ -430,9 +422,8 @@ class GenericIE(InfoExtractor): 'info_dict': { 'id': 'beltzlaw-1', 'ext': 'mp4', - 'title': 'Beltz Law Group | Dallas Traffic Ticket, Accident & Criminal Attorney (1)', - 'age_limit': 0, - 'description': 'md5:5bdf23fcb76801dc3b31e74cabf82147', + 'title': str, + 'description': str, 'thumbnail': r're:https?://beltzlaw\.com/wp-content/uploads/.+\.jpg', 'timestamp': int, # varies 'upload_date': str, @@ -447,7 +438,6 @@ class GenericIE(InfoExtractor): 'id': 'cine-1', 'ext': 'webm', 'title': 'CINE.AR (1)', - 'age_limit': 0, 'description': 'md5:a4e58f9e2291c940e485f34251898c4a', 'thumbnail': r're:https?://cine\.ar/img/.+\.png', '_old_archive_ids': ['generic cine'], @@ -461,7 +451,6 @@ class GenericIE(InfoExtractor): 'id': 'ipy2AcGL', 'ext': 'mp4', 'title': 'Hoe een bladvlo dit verwoestende Japanse onkruid moet vernietigen', - 'age_limit': 0, 'description': 'md5:6a9d644bab0dc2dc06849c2505d8383d', 'duration': 111.0, 'thumbnail': r're:https?://images\.nu\.nl/.+\.jpg', @@ -477,7 +466,6 @@ class GenericIE(InfoExtractor): 'id': 'porsche-911-gt3-rs-rij-impressie-2', 'ext': 'mp4', 'title': 'Test: Porsche 911 GT3 RS - AutoWeek', - 'age_limit': 0, 'description': 'md5:a17b5bd84288448d8f11b838505718fc', 'direct': True, 'thumbnail': r're:https?://images\.autoweek\.nl/.+', @@ -493,7 +481,6 @@ class GenericIE(InfoExtractor): 'id': 'k6gl2kt2eq', 'ext': 'mp4', 'title': 'Breezy HR\'s ATS helps you find & hire employees sooner', - 'age_limit': 0, 'average_rating': 4.5, 'description': 'md5:eee75fdd3044c538003f3be327ba01e1', 'duration': 60.1, @@ -509,7 +496,6 @@ class GenericIE(InfoExtractor): 'id': 'videojs_hls_test', 'ext': 'mp4', 'title': 'video', - 'age_limit': 0, 'duration': 1800, }, 'params': {'skip_download': 'm3u8'}, @@ -984,7 +970,7 @@ def _real_extract(self, url): 'title': self._generic_title('', webpage, default='video'), 'description': self._og_search_description(webpage, default=None), 'thumbnail': self._og_search_thumbnail(webpage, default=None), - 'age_limit': self._rta_search(webpage), + 'age_limit': self._rta_search(webpage) or None, }) self._downloader.write_debug('Looking for embeds') From 7181c1c232cf4e9ca9b923dae24c66dec8de20ab Mon Sep 17 00:00:00 2001 From: doe1080 <98906116+doe1080@users.noreply.github.com> Date: Mon, 11 Aug 2025 04:02:35 +0900 Subject: [PATCH 2/2] `_rta_search` --- yt_dlp/extractor/common.py | 4 ++-- yt_dlp/extractor/generic.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 4a4b5416d0..cdb6d5a1f4 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -1527,11 +1527,11 @@ def _rta_search(html): r'>\s*(?:18\s+U(?:\.S\.C\.|SC)\s+)?(?:§+\s*)?2257\b', ] - age_limit = 0 + age_limit = None for marker in AGE_LIMIT_MARKERS: mobj = re.search(marker, html) if mobj: - age_limit = max(age_limit, int(traverse_obj(mobj, 1, default=18))) + age_limit = max(age_limit or 0, int(traverse_obj(mobj, 1, default=18))) return age_limit def _media_rating_search(self, html): diff --git a/yt_dlp/extractor/generic.py b/yt_dlp/extractor/generic.py index 5890b2e14c..b3a27f31e8 100644 --- a/yt_dlp/extractor/generic.py +++ b/yt_dlp/extractor/generic.py @@ -970,7 +970,7 @@ def _real_extract(self, url): 'title': self._generic_title('', webpage, default='video'), 'description': self._og_search_description(webpage, default=None), 'thumbnail': self._og_search_thumbnail(webpage, default=None), - 'age_limit': self._rta_search(webpage) or None, + 'age_limit': self._rta_search(webpage), }) self._downloader.write_debug('Looking for embeds')