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

Code before:
from ..utils import ExtractorError, traverse_obj


class RudoVideoIE(InfoExtractor):
    _VALID_URL = r'https?://rudo\.video/live/(?P<id>[^/]+)'

    def _real_extract(self, url):
        video_id = self._match_id(url)
        webpage = self._download_webpage(url, video_id)

        if "Streaming is not available in your area." in webpage:
            self.raise_geo_restricted()

        stream_url = self._search_regex(r'var\s+streamURL\s*=\s*\'([^?\']+)', webpage, "streamUrl")
        token_array_string = self._search_regex(r'<script>var\s+_\$_[a-zA-Z0-9]+\s*=\s*(\[[^]]+\])', webpage, 'token_array', default=None)
        if token_array_string:
            token_array_string = token_array_string.replace("x", "u00")
            token_array = self._parse_json(token_array_string, video_id)
            if len(token_array) != 9:
                raise ExtractorError('Couldnt get access token array', video_id=video_id)
            access_token_webpage = self._download_webpage(token_array[0], video_id)
            access_token = self._parse_json(access_token_webpage, video_id)
            if "data" not in access_token or token_array[3] not in access_token.get("data"):
                raise ExtractorError('Couldnt get access token', video_id=video_id)
            query_string = token_array[5] + traverse_obj(access_token, ("data", token_array[3]))
            stream_url = f'{stream_url}{query_string}'

        return self.url_result(
            stream_url,
            display_id=video_id, url_transparent=True)


Review comment (security):
These values seem fairly generic and unlikely to change. I think it's more likely that they change position in the array than name, so I would suggest using:
```suggestion
            stream_url = update_url_query(
                stream_url, {'auth-token': traverse_obj(access_token, ('data', 'authToken'))})
```

Code after:
from ..utils import (
    ExtractorError,
    determine_ext,
    js_to_json,
    traverse_obj,
    update_url_query,
    url_or_none,
)


class RudoVideoIE(InfoExtractor):
    _VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
    _EMBED_REGEX = [r'<iframe[^>]+src=[\'"](?P<url>(?:https?:)//rudo\.video/(?:vod|podcast|live)/[^\'"]+)']
    _TESTS = [{
        'url': 'https://rudo.video/podcast/cz2wrUy8l0o',
        'md5': '28ed82b477708dc5e12e072da2449221',
        'info_dict': {
            'id': 'cz2wrUy8l0o',
            'title': 'Diego Cabot',
            'ext': 'mp4',
            'thumbnail': r're:^(?:https?:)?//.*\.(png|jpg)$',
        },
    }, {
        'url': 'https://rudo.video/podcast/bQkt07',
        'md5': '36b22a9863de0f47f00fc7532a32a898',
        'info_dict': {
            'id': 'bQkt07',
            'title': 'Tubular Bells',
            'ext': 'mp4',
            'thumbnail': r're:^(?:https?:)?//.*\.(png|jpg)$',
        },
    }, {
        'url': 'https://rudo.video/podcast/b42ZUznHX0',
        'md5': 'b91c70d832938871367f8ad10c895821',
        'info_dict': {
            'id': 'b42ZUznHX0',
            'title': 'Columna Ruperto Concha',
            'ext': 'mp3',
            'thumbnail': r're:^(?:https?:)?//.*\.(png|jpg)$',
        },
    }, {
        'url': 'https://rudo.video/vod/bN5AaJ',
        'md5': '01324a329227e2591530ecb4f555c881',
        'info_dict': {
            'id': 'bN5AaJ',
            'title': 'Ucrania 19.03',
            'creator': 'La Tercera',
            'ext': 'mp4',
            'thumbnail': r're:^(?:https?:)?//.*\.(png|jpg)$',
        },
    }, {