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

Code before:
    _GEO_BYPASS = False

    _AUS_AGES = {
        'G': 0,
        'PG': 15,
        'M': 15,
        'MA': 15,
        'MA15+': 15,
        'R': 18,
        'X': 18,
    }

    def _real_extract(self, url):
        content_id = self._match_id(url)
        data = self._download_json(
            'https://10.com.au/api/v1/videos/' + content_id, content_id)

        video_data = self._download_json(
            f'https://vod.ten.com.au/api/videos/bcquery?command=find_videos_by_id&video_id={data["altId"]}',
            content_id, 'Downloading video JSON')
        # Convert DASH to HLS using update_url_query
        m3u8_url = self._request_webpage(
            HEADRequest(update_url_query(video_data['items'][0]['dashManifestUrl'], {
                'manifest': 'm3u',
                'mbr': 'true',
                'format': 'redirect',
            })),
            content_id, 'Checking stream URL').url
        if '10play-not-in-oz' in m3u8_url:
            self.raise_geo_restricted(countries=['AU'])
        if '10play_unsupported' in m3u8_url:
            raise ExtractorError('Unable to extract stream (10Play says "unsupported")')
        # Attempt to get a higher quality stream
        formats = self._extract_m3u8_formats(
            m3u8_url.replace(',150,75,55,0000', ',500,300,150,75,55,0000'),
            content_id, 'mp4', fatal=False)
        if not formats:
            formats = self._extract_m3u8_formats(m3u8_url, content_id, 'mp4')

        return {
            'id': content_id,
            'formats': formats,
            'subtitles': {'en': [{'url': data['captionUrl']}]} if url_or_none(data.get('captionUrl')) else None,
            'uploader': 'Channel 10',
            'uploader_id': '2199827728001',
            **traverse_obj(data, {
                'id': ('altId', {str}),
                'duration': ('duration', {int_or_none}),
                'title': ('subtitle', {str}),
                'alt_title': ('title', {str}),
                'description': ('description', {str}),

Review comment (suggestion):
These would be added if they weren't in the query params of the original URL. Is that what is wanted? It's not the same semantics as the former `replace()` formula. 

Code after:
        'params': {'skip_download': 'm3u8'},
        'expected_warnings': ['Failed to download m3u8 information: HTTP Error 502'],
        'skip': 'video unavailable',
    }, {
        'url': 'https://10play.com.au/how-to-stay-married/web-extras/season-1/terrys-talks-ep-1-embracing-change/tpv190915ylupc',
        'only_matching': True,
    }]
    _GEO_BYPASS = False

    _AUS_AGES = {
        'G': 0,
        'PG': 15,
        'M': 15,
        'MA': 15,
        'MA15+': 15,
        'R': 18,
        'X': 18,
    }

    def _real_extract(self, url):
        content_id = self._match_id(url)
        data = self._download_json(
            'https://10.com.au/api/v1/videos/' + content_id, content_id)

        video_data = self._download_json(
            f'https://vod.ten.com.au/api/videos/bcquery?command=find_videos_by_id&video_id={data["altId"]}',
            content_id, 'Downloading video JSON')
        # Dash URL 403s, changing the m3u8 format works
        m3u8_url = self._request_webpage(
            HEADRequest(update_url_query(video_data['items'][0]['dashManifestUrl'], {
                'manifest': 'm3u',
            })),
            content_id, 'Checking stream URL').url
        if '10play-not-in-oz' in m3u8_url:
            self.raise_geo_restricted(countries=['AU'])
        if '10play_unsupported' in m3u8_url:
            raise ExtractorError('Unable to extract stream')
        # Attempt to get a higher quality stream
        formats = self._extract_m3u8_formats(
            m3u8_url.replace(',150,75,55,0000', ',500,300,150,75,55,0000'),
            content_id, 'mp4', fatal=False)
        if not formats:
            formats = self._extract_m3u8_formats(m3u8_url, content_id, 'mp4')

        return {
            'id': content_id,
            'formats': formats,
            'subtitles': {'en': [{'url': data['captionUrl']}]} if url_or_none(data.get('captionUrl')) else None,
            'uploader': 'Channel 10',
            'uploader_id': '2199827728001',
            **traverse_obj(data, {