diff --git a/yt_dlp/extractor/dailymotion.py b/yt_dlp/extractor/dailymotion.py index d0f1afe44..a6bdf350d 100644 --- a/yt_dlp/extractor/dailymotion.py +++ b/yt_dlp/extractor/dailymotion.py @@ -99,19 +99,26 @@ class DailymotionBaseInfoExtractor(InfoExtractor): class DailymotionIE(DailymotionBaseInfoExtractor): - _VALID_URL = r'''(?ix) + _VALID_URL_PREFIX = r'''(?ix) https?:// (?: (?:(?:www|touch|geo)\.)?dailymotion\.[a-z]{2,3}| (?:www\.)?lequipe\.fr )/ + ''' + _VALID_URL = [ + rf'''{_VALID_URL_PREFIX} (?: video/| - swf(?:/(?!video)|/video/)| - player(?:/\w+)?\.html\?(?:video|playlist)= - ) - (?P[^/?_&#]+) - ''' + swf(?:/(?!video)|/video/) + )(?P[^/?_&#]+)(?:.+?\bplaylist=(?Px[0-9a-z]+))? + ''', + rf'''{_VALID_URL_PREFIX} + (?: + player(?:/\w+)?\.html\? + )(?:video[=/](?P[^/?_&#]+))?(?:.*?\bplaylist=(?Px[0-9a-z]+))? + ''', + ] IE_NAME = 'dailymotion' _EMBED_REGEX = [r'<(?:(?:embed|iframe)[^>]+?src=|input[^>]+id=[\'"]dmcloudUrlEmissionSelect[\'"][^>]+value=)(["\'])(?P(?:https?:)?//(?:www\.)?dailymotion\.com/(?:embed|swf)/video/.+?)\1'] _TESTS = [{ @@ -225,6 +232,9 @@ class DailymotionIE(DailymotionBaseInfoExtractor): }, { 'url': 'https://geo.dailymotion.com/player/xakln.html?video=x8mjju4&customConfig%5BcustomParams%5D=%2Ffr-fr%2Ftennis%2Fwimbledon-mens-singles%2Farticles-video', 'only_matching': True, + }, { + 'url': 'https://geo.dailymotion.com/player/xf7zn.html?playlist=x7wdsj', + 'only_matching': True, }] _WEBPAGE_TESTS = [{ # https://geo.dailymotion.com/player/xmyye.html?video=x93blhi @@ -285,13 +295,13 @@ class DailymotionIE(DailymotionBaseInfoExtractor): def _real_extract(self, url): url, smuggled_data = unsmuggle_url(url) - video_id = self._match_id(url) + video_id, playlist_id = self._match_valid_url(url).groups() - if 'playlist=' in url: - if self._yes_playlist(video_id, video_id): + if playlist_id: + if self._yes_playlist(playlist_id, video_id): return self.url_result( - 'http://www.dailymotion.com/playlist/' + video_id, - 'DailymotionPlaylist', video_id) + 'http://www.dailymotion.com/playlist/' + playlist_id, + 'DailymotionPlaylist', playlist_id) password = self.get_param('videopassword') media = self._call_api(