From 6afbd928b4831f97627364de1a6b7df7e95dcd3f Mon Sep 17 00:00:00 2001 From: ocococ Date: Thu, 3 Jul 2025 19:41:49 +0200 Subject: [PATCH 1/7] [ie/LCI+WAT] fix site-bug #13627 --- yt_dlp/extractor/lci.py | 7 +++++-- yt_dlp/extractor/wat.py | 11 +++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/yt_dlp/extractor/lci.py b/yt_dlp/extractor/lci.py index 708cb548d8..3339f7ced7 100644 --- a/yt_dlp/extractor/lci.py +++ b/yt_dlp/extractor/lci.py @@ -1,6 +1,6 @@ from .common import InfoExtractor from .wat import WatIE -from ..utils import ExtractorError, int_or_none +from ..utils import ExtractorError, str_or_none from ..utils.traversal import traverse_obj @@ -35,6 +35,9 @@ class LCIIE(InfoExtractor): }, { 'url': 'https://www.lci.fr/politique/election-presidentielle-2022-second-tour-j-2-marine-le-pen-et-emmanuel-macron-en-interview-de-lci-vendredi-soir-2217486.html', 'only_matching': True, + }, { + 'url': 'https://www.tf1info.fr/replay-lci/videos/video-24h-pujadas-du-mercredi-2-juillet-2025-73777-2380589.html', + 'only_matching': True, }] def _real_extract(self, url): @@ -42,7 +45,7 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) next_data = self._search_nextjs_data(webpage, video_id) wat_id = traverse_obj(next_data, ( - 'props', 'pageProps', 'page', 'tms', 'videos', {dict.keys}, ..., {int_or_none}, any)) + 'props', 'pageProps', 'page', 'tms', 'videos', {dict.keys}, ..., {str_or_none}, any)) if wat_id is None: raise ExtractorError('Could not find wat_id') diff --git a/yt_dlp/extractor/wat.py b/yt_dlp/extractor/wat.py index c1c3af800b..153e64d454 100644 --- a/yt_dlp/extractor/wat.py +++ b/yt_dlp/extractor/wat.py @@ -8,9 +8,12 @@ ) from ..utils.traversal import traverse_obj +import re + class WatIE(InfoExtractor): - _VALID_URL = r'(?:wat:|https?://(?:www\.)?wat\.tv/video/.*-)(?P[0-9a-z]+)' + _WAT_ID_RE = r'[\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12}' + _VALID_URL = rf'(?:wat:|https?://(?:www\.)?wat\.tv/video/.*-)(?P({_WAT_ID_RE}|[0-9a-z]+))' IE_NAME = 'wat.tv' _TESTS = [ { @@ -54,12 +57,16 @@ class WatIE(InfoExtractor): }, 'params': {'skip_download': 'm3u8'}, }, + { + 'url': 'wat:f0550853-c949-4e0e-8ba4-8237cbb512af', + 'only_matching': True, + }, ] _GEO_BYPASS = False def _real_extract(self, url): video_id = self._match_id(url) - video_id = video_id if video_id.isdigit() and len(video_id) > 6 else str(int(video_id, 36)) + video_id = video_id if re.match(self._WAT_ID_RE, video_id) or re.match(r'\d{7,}', video_id) else str(int(video_id, 36)) # 'contentv4' is used in the website, but it also returns the related # videos, we don't need them From f59002ad130a06377cc9259a482ef603a9d44170 Mon Sep 17 00:00:00 2001 From: ocococococ <104170215+ocococococ@users.noreply.github.com> Date: Thu, 3 Jul 2025 23:46:37 +0200 Subject: [PATCH 2/7] Update yt_dlp/extractor/wat.py Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com> --- yt_dlp/extractor/wat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/wat.py b/yt_dlp/extractor/wat.py index 153e64d454..9df18810b9 100644 --- a/yt_dlp/extractor/wat.py +++ b/yt_dlp/extractor/wat.py @@ -12,8 +12,8 @@ class WatIE(InfoExtractor): - _WAT_ID_RE = r'[\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12}' - _VALID_URL = rf'(?:wat:|https?://(?:www\.)?wat\.tv/video/.*-)(?P({_WAT_ID_RE}|[0-9a-z]+))' + _UUID_RE = r'[\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12}' + _VALID_URL = rf'(?:wat:|https?://(?:www\.)?wat\.tv/video/.*-)(?P({_UUID_RE}|[0-9a-z]+))' IE_NAME = 'wat.tv' _TESTS = [ { From 29504873a082849fd6fa45ffd6524a6959e8a4e5 Mon Sep 17 00:00:00 2001 From: ocococococ <104170215+ocococococ@users.noreply.github.com> Date: Thu, 3 Jul 2025 23:46:49 +0200 Subject: [PATCH 3/7] Update yt_dlp/extractor/wat.py Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com> --- yt_dlp/extractor/wat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt_dlp/extractor/wat.py b/yt_dlp/extractor/wat.py index 9df18810b9..6b2091390e 100644 --- a/yt_dlp/extractor/wat.py +++ b/yt_dlp/extractor/wat.py @@ -66,7 +66,7 @@ class WatIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - video_id = video_id if re.match(self._WAT_ID_RE, video_id) or re.match(r'\d{7,}', video_id) else str(int(video_id, 36)) + video_id = video_id if re.fullmatch(fr'({self._UUID_RE}|\d{{7,}})', video_id) else str(int(video_id, 36)) # 'contentv4' is used in the website, but it also returns the related # videos, we don't need them From bca329b2ec2322734171aa276730cbde09d0fa30 Mon Sep 17 00:00:00 2001 From: ocococ Date: Fri, 4 Jul 2025 00:31:16 +0200 Subject: [PATCH 4/7] passing tests --- yt_dlp/extractor/lci.py | 18 +++++++++++++----- yt_dlp/extractor/wat.py | 18 +++++++++++++++--- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/yt_dlp/extractor/lci.py b/yt_dlp/extractor/lci.py index 3339f7ced7..94d73b02c1 100644 --- a/yt_dlp/extractor/lci.py +++ b/yt_dlp/extractor/lci.py @@ -19,10 +19,11 @@ class LCIIE(InfoExtractor): 'params': { 'skip_download': True, }, + 'skip': 'This content is no longer available', }, { 'url': 'https://www.tf1info.fr/politique/election-presidentielle-2022-second-tour-j-2-marine-le-pen-et-emmanuel-macron-en-interview-de-lci-vendredi-soir-2217486.html', 'info_dict': { - 'id': '13875948', + 'id': 'c5647202-4549-4644-a892-1976e78fc5f8', 'ext': 'mp4', 'title': 'md5:660df5481fd418bc3bbb0d070e6fdb5a', 'thumbnail': 'https://photos.tf1.fr/1280/720/presidentielle-2022-marine-le-pen-et-emmanuel-macron-invites-de-lci-ce-vendredi-9c0e73-e1a036-0@1x.jpg', @@ -32,12 +33,19 @@ class LCIIE(InfoExtractor): 'params': { 'skip_download': True, }, - }, { - 'url': 'https://www.lci.fr/politique/election-presidentielle-2022-second-tour-j-2-marine-le-pen-et-emmanuel-macron-en-interview-de-lci-vendredi-soir-2217486.html', - 'only_matching': True, }, { 'url': 'https://www.tf1info.fr/replay-lci/videos/video-24h-pujadas-du-mercredi-2-juillet-2025-73777-2380589.html', - 'only_matching': True, + 'info_dict': { + 'id': 'f0550853-c949-4e0e-8ba4-8237cbb512af', + 'ext': 'mp4', + 'title': '24H Pujadas du mercredi 2 juillet 2025', + 'thumbnail': 'https://photos.tf1.fr/1280/720/24h-pujadas-du-mercredi-2-juillet-2025-394752-0@1x.jpg', + 'upload_date': '20250702', + 'duration': 5866, + }, + 'params': { + 'skip_download': True, + }, }] def _real_extract(self, url): diff --git a/yt_dlp/extractor/wat.py b/yt_dlp/extractor/wat.py index 6b2091390e..0da1b00272 100644 --- a/yt_dlp/extractor/wat.py +++ b/yt_dlp/extractor/wat.py @@ -1,3 +1,5 @@ +import re + from .common import InfoExtractor from ..utils import ( ExtractorError, @@ -8,8 +10,6 @@ ) from ..utils.traversal import traverse_obj -import re - class WatIE(InfoExtractor): _UUID_RE = r'[\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12}' @@ -56,10 +56,22 @@ class WatIE(InfoExtractor): 'ext': 'mp4', }, 'params': {'skip_download': 'm3u8'}, + 'expected_warnings': ["Ce contenu n'est pas disponible"], + 'skip': 'This content is no longer available', }, { 'url': 'wat:f0550853-c949-4e0e-8ba4-8237cbb512af', - 'only_matching': True, + 'info_dict': { + 'id': 'f0550853-c949-4e0e-8ba4-8237cbb512af', + 'ext': 'mp4', + 'title': '24H Pujadas du mercredi 2 juillet 2025', + 'thumbnail': 'https://photos.tf1.fr/1280/720/24h-pujadas-du-mercredi-2-juillet-2025-394752-0@1x.jpg', + 'upload_date': '20250702', + 'duration': 5866, + }, + 'params': { + 'skip_download': True, + }, }, ] _GEO_BYPASS = False From 02fb2bafbcb87c8dc42def7aa56d85d9d6bfda0a Mon Sep 17 00:00:00 2001 From: ocococ Date: Sat, 5 Jul 2025 09:09:07 +0200 Subject: [PATCH 5/7] commit suggestion --- yt_dlp/extractor/wat.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/yt_dlp/extractor/wat.py b/yt_dlp/extractor/wat.py index 0da1b00272..730cbb3ef9 100644 --- a/yt_dlp/extractor/wat.py +++ b/yt_dlp/extractor/wat.py @@ -1,5 +1,3 @@ -import re - from .common import InfoExtractor from ..utils import ( ExtractorError, @@ -13,7 +11,7 @@ class WatIE(InfoExtractor): _UUID_RE = r'[\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12}' - _VALID_URL = rf'(?:wat:|https?://(?:www\.)?wat\.tv/video/.*-)(?P({_UUID_RE}|[0-9a-z]+))' + _VALID_URL = rf'(?:wat:|https?://(?:www\.)?wat\.tv/video/.*-)(?P{_UUID_RE}|[0-9]{{7,}}|(?:[a-z0-9]+_){{2}}|(?P[0-9a-z]+))(?:$|\.html|[#?/])' IE_NAME = 'wat.tv' _TESTS = [ { @@ -78,7 +76,10 @@ class WatIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - video_id = video_id if re.fullmatch(fr'({self._UUID_RE}|\d{{7,}})', video_id) else str(int(video_id, 36)) + video_id, b36_id = self._match_valid_url(url).group('id', 'b36') + if b36_id: + video_id = str(int(video_id, 36)) + # 'contentv4' is used in the website, but it also returns the related # videos, we don't need them From 4dbd9402f9f466c4f71b38e0f907078b9dd764a9 Mon Sep 17 00:00:00 2001 From: ocococ Date: Sat, 5 Jul 2025 09:11:34 +0200 Subject: [PATCH 6/7] remove unneeded empty line --- yt_dlp/extractor/wat.py | 1 - 1 file changed, 1 deletion(-) diff --git a/yt_dlp/extractor/wat.py b/yt_dlp/extractor/wat.py index 730cbb3ef9..fe3793a6eb 100644 --- a/yt_dlp/extractor/wat.py +++ b/yt_dlp/extractor/wat.py @@ -80,7 +80,6 @@ def _real_extract(self, url): if b36_id: video_id = str(int(video_id, 36)) - # 'contentv4' is used in the website, but it also returns the related # videos, we don't need them # video_data = self._download_json( From 20837703beb307cbbbd8192e3b30b2fa25f88c70 Mon Sep 17 00:00:00 2001 From: ocococ Date: Sat, 5 Jul 2025 15:32:21 +0200 Subject: [PATCH 7/7] remove another unneeded line --- yt_dlp/extractor/wat.py | 1 - 1 file changed, 1 deletion(-) diff --git a/yt_dlp/extractor/wat.py b/yt_dlp/extractor/wat.py index fe3793a6eb..0c60d3f445 100644 --- a/yt_dlp/extractor/wat.py +++ b/yt_dlp/extractor/wat.py @@ -75,7 +75,6 @@ class WatIE(InfoExtractor): _GEO_BYPASS = False def _real_extract(self, url): - video_id = self._match_id(url) video_id, b36_id = self._match_valid_url(url).group('id', 'b36') if b36_id: video_id = str(int(video_id, 36))