Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/dailymotion.py (Python)

Code before:
        'only_matching': True,
    }, {
        'url': 'https://geo.dailymotion.com/player/xakln.html?video=x8mjju4&customConfig%5BcustomParams%5D=%2Ffr-fr%2Ftennis%2Fwimbledon-mens-singles%2Farticles-video',
        'only_matching': True,
    }]
    _GEO_BYPASS = False
    _COMMON_MEDIA_FIELDS = '''description
      geoblockedCountries {
        allowed
      }
      xid'''

    @classmethod
    def _extract_embed_urls(cls, url, webpage):
        # https://developer.dailymotion.com/player#player-parameters
        yield from super()._extract_embed_urls(url, webpage)
        for mobj in re.finditer(
                r'(?s)DM\.player\([^,]+,\s*{.*?video[\'"]?\s*:\s*["\']?(?P<id>[0-9a-zA-Z]+).+?}\s*\);', webpage):
            yield from 'https://www.dailymotion.com/embed/video/' + mobj.group('id')
        for mobj in re.finditer(
                r'(?s)<script\s+?[^>]*?\bsrc=(["\'])((?:https?:)?//[^>]+\.dailymotion\.com/player/(?:(?!\1).)+)\1[^>]*?>', webpage):
            attrs = extract_attributes(mobj.group(0))
            player_url = url_or_none(attrs.get('src'))
            video_id = attrs.get('data-video')
            if all((player_url, video_id)):
                yield f'{player_url.replace(".js", ".html")}?video={video_id}'

    def _real_extract(self, url):
        url, smuggled_data = unsmuggle_url(url)
        video_id, playlist_id = self._match_valid_url(url).groups()

        if playlist_id:
            if self._yes_playlist(playlist_id, video_id):
                return self.url_result(
                    'http://www.dailymotion.com/playlist/' + playlist_id,
                    'DailymotionPlaylist', playlist_id)

        password = self.get_param('videopassword')
        media = self._call_api(
            'media', video_id, '''... on Video {
      %s
      stats {
        likes {
          total
        }
        views {
          total
        }
      }
    }
    ... on Live {

Review comment (suggestion):
```suggestion
            player_url = url_or_none(attrs.get('src'))
            if not player_url:
                continue
            player_url = player_url.replace('.js', '.html')
            if player_url.startswith('//'):
                player_url = f'https:{player_url}'
            if video_id := attrs.get('data-video'):
                query_string = f'video={video_id}'
            elif playlist_id := attrs.get('data-playlist'):
                query_string = f'playlist={playlist_id}'
            else:
                continue
            yield update_url(player_url, query=query_string)
```

Code after:
        'only_matching': True,
    }, {
        'url': 'https://www.dailymotion.com/video/x3z49k?playlist=xv4bw',
        'only_matching': True,
    }, {
        'url': 'https://geo.dailymotion.com/player/x86gw.html?video=k46oCapRs4iikoz9DWy',
        'only_matching': True,
    }, {
        'url': 'https://geo.dailymotion.com/player/xakln.html?video=x8mjju4&customConfig%5BcustomParams%5D=%2Ffr-fr%2Ftennis%2Fwimbledon-mens-singles%2Farticles-video',
        'only_matching': True,
    }, {  # playlist-only
        'url': 'https://geo.dailymotion.com/player/xf7zn.html?playlist=x7wdsj',
        'only_matching': True,
    }, {
        'url': 'https://geo.dailymotion.com/player/xmyye.html?video=x93blhi',
        'only_matching': True,
    }, {
        'url': 'https://www.dailymotion.com/crawler/video/x8u4owg',
        'only_matching': True,
    }, {
        'url': 'https://www.dailymotion.com/embed/video/x8u4owg',
        'only_matching': True,
    }]
    _WEBPAGE_TESTS = [{
        # https://geo.dailymotion.com/player/xmyye.html?video=x93blhi
        'url': 'https://www.financialounge.com/video/2024/08/01/borse-europee-in-rosso-dopo-la-fed-a-milano-volano-mediobanca-e-tim-edizione-del-1-agosto/',
        'info_dict': {
            'id': 'x93blhi',
            'ext': 'mp4',
            'title': 'OnAir - 01/08/24',
            'description': '',
            'duration': 217,
            'timestamp': 1722505658,
            'upload_date': '20240801',
            'uploader': 'Financialounge',
            'uploader_id': 'x2vtgmm',
            'age_limit': 0,
            'tags': [],
            'view_count': int,
            'like_count': int,
        },
    }, {
        # https://geo.dailymotion.com/player/xf7zn.html?playlist=x7wdsj
        'url': 'https://www.cycleworld.com/blogs/ask-kevin/ducati-continues-to-evolve-with-v4/',
        'info_dict': {
            'id': 'x7wdsj',
        },
        'playlist_mincount': 50,
    }, {
        # https://www.dailymotion.com/crawler/video/x8u4owg
        'url': 'https://www.leparisien.fr/environnement/video-le-veloto-la-voiture-a-pedales-qui-aimerait-se-faire-une-place-sur-les-routes-09-03-2024-KCYMCPM4WFHJXMSKBUI66UNFPU.php',