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

Code before:
        },
        'playlist_count': 17,
    }, {
        'url': 'https://play.caracoltv.com/videoDetails/MzoxX3BwbjRmNjB1',
        'only_matching': True,
    }]

    _USER_TOKEN = None

    def _extract_app_token(self, webpage):
        config_js_path = self._search_regex(
            r'<script[^>]+src\s*=\s*"([^"]+coreConfig.js[^"]+)', webpage, 'config_js_url', fatal=False)

        mediation_config = {} if not config_js_path else self._search_json(
            r'mediation\s*:', self._download_webpage(
                urljoin('https://play.caracoltv.com/', config_js_path), None, fatal=False, note='Extracting JS config'),
            'mediation_config', None, transform_source=js_to_json, fatal=False)

        key = traverse_obj(
            mediation_config, ('live', 'key')) or '795cd9c089a1fc48094524a5eba85a3fca1331817c802f601735907c8bbb4f50'
        secret = traverse_obj(
            mediation_config, ('live', 'secret')) or '64dec00a6989ba83d087621465b5e5d38bdac22033b0613b659c442c78976fa0'

        return base64.b64encode(f'{key}:{secret}'.encode()).decode()

    def _login(self, email, password):
        webpage = self._download_webpage('https://play.caracoltv.com/', None, fatal=False)
        app_token = self._extract_app_token(webpage)

        bearer_token = self._download_json(
            'https://eu-gateway.inmobly.com/applications/oauth', None, data=b'', note='Retrieving bearer token',
            headers={'Authorization': f'Basic {app_token}'})['token']

        self._USER_TOKEN = self._download_json(
            'https://eu-gateway.inmobly.com/user/login', None, note='Performing login', headers={
                'Content-Type': 'application/json',
                'Authorization': 'Bearer' + bearer_token
            }, data=json.dumps({
                'device_data': {
                    'device_id': str(uuid.uuid4()),
                    'device_token': '',
                    'device_type': 'web'
                },
                'login_data': {
                    'enabled': True,
                    'email': email,
                    'password': password,
                }
            }).encode())['user_token']

    def _perform_login(self, username, password):

Review comment (suggestion):
```suggestion
    def _perform_login(self, email, password):
```

Code after:
        },
        'playlist_count': 17,
    }, {
        'url': 'https://play.caracoltv.com/videoDetails/MzoxX3BwbjRmNjB1',
        'only_matching': True,
    }]

    _USER_TOKEN = None

    def _extract_app_token(self, webpage):
        config_js_path = self._search_regex(
            r'<script[^>]+src\s*=\s*"([^"]+coreConfig.js[^"]+)', webpage, 'config js url', fatal=False)

        mediation_config = {} if not config_js_path else self._search_json(
            r'mediation\s*:', self._download_webpage(
                urljoin('https://play.caracoltv.com/', config_js_path), None, fatal=False, note='Extracting JS config'),
            'mediation_config', None, transform_source=js_to_json, fatal=False)

        key = traverse_obj(
            mediation_config, ('live', 'key')) or '795cd9c089a1fc48094524a5eba85a3fca1331817c802f601735907c8bbb4f50'
        secret = traverse_obj(
            mediation_config, ('live', 'secret')) or '64dec00a6989ba83d087621465b5e5d38bdac22033b0613b659c442c78976fa0'

        return base64.b64encode(f'{key}:{secret}'.encode()).decode()

    def _perform_login(self, email, password):
        webpage = self._download_webpage('https://play.caracoltv.com/', None, fatal=False)
        app_token = self._extract_app_token(webpage)

        bearer_token = self._download_json(
            'https://eu-gateway.inmobly.com/applications/oauth', None, data=b'', note='Retrieving bearer token',
            headers={'Authorization': f'Basic {app_token}'})['token']

        self._USER_TOKEN = self._download_json(
            'https://eu-gateway.inmobly.com/user/login', None, note='Performing login', headers={
                'Content-Type': 'application/json',
                'Authorization': f'Bearer {bearer_token}',
            }, data=json.dumps({
                'device_data': {
                    'device_id': str(uuid.uuid4()),
                    'device_token': '',
                    'device_type': 'web'
                },
                'login_data': {
                    'enabled': True,
                    'email': email,
                    'password': password,
                }
            }).encode())['user_token']

    def _extract_video(self, video_data, series_id=None, season_id=None, season_number=None):