1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-07-21 04:38:29 +00:00

[ie/LCI+WAT] fix site-bug #13627

This commit is contained in:
ocococ 2025-07-03 19:41:49 +02:00
parent 0b41746964
commit 6afbd928b4
2 changed files with 14 additions and 4 deletions

View File

@ -1,6 +1,6 @@
from .common import InfoExtractor from .common import InfoExtractor
from .wat import WatIE from .wat import WatIE
from ..utils import ExtractorError, int_or_none from ..utils import ExtractorError, str_or_none
from ..utils.traversal import traverse_obj 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', '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, '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): def _real_extract(self, url):
@ -42,7 +45,7 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
next_data = self._search_nextjs_data(webpage, video_id) next_data = self._search_nextjs_data(webpage, video_id)
wat_id = traverse_obj(next_data, ( 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: if wat_id is None:
raise ExtractorError('Could not find wat_id') raise ExtractorError('Could not find wat_id')

View File

@ -8,9 +8,12 @@
) )
from ..utils.traversal import traverse_obj from ..utils.traversal import traverse_obj
import re
class WatIE(InfoExtractor): class WatIE(InfoExtractor):
_VALID_URL = r'(?:wat:|https?://(?:www\.)?wat\.tv/video/.*-)(?P<id>[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<id>({_WAT_ID_RE}|[0-9a-z]+))'
IE_NAME = 'wat.tv' IE_NAME = 'wat.tv'
_TESTS = [ _TESTS = [
{ {
@ -54,12 +57,16 @@ class WatIE(InfoExtractor):
}, },
'params': {'skip_download': 'm3u8'}, 'params': {'skip_download': 'm3u8'},
}, },
{
'url': 'wat:f0550853-c949-4e0e-8ba4-8237cbb512af',
'only_matching': True,
},
] ]
_GEO_BYPASS = False _GEO_BYPASS = False
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(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 # 'contentv4' is used in the website, but it also returns the related
# videos, we don't need them # videos, we don't need them