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

Code before:
        'url': 'https://www.lrt.lt/radioteka/irasas/2000359728/nemarios-eiles-apie-pragarus-ir-skaistyklas-su-aiste-kiltinaviciute',
        'info_dict': {
            'id': '2000359728',
            'ext': 'mp4',
            'title': 'Nemarios eilės: apie pragarus ir skaistyklas su Aiste Kiltinavičiūte',
            'description': 'md5:5eee9a0e86a55bf547bd67596204625d',
            'timestamp': 1726143120,
            'upload_date': '20240912',
            'tags': 'count:5',
            'thumbnail': r're:https?://.+/.+\.jpe?g',
            'categories': ['Daiktiniai įrodymai'],
        },
    }, {
        'url': 'https://www.lrt.lt/radioteka/irasas/2000304654/vakaras-su-knyga-svetlana-aleksijevic-cernobylio-malda-v-dalis?season=%2Fmediateka%2Faudio%2Fvakaras-su-knyga%2F2023',
        'only_matching': True,
    }]

    def _real_extract(self, url):
        video_id, path = self._match_valid_url(url).group('id', 'path')
        media = self._download_json(
            'https://www.lrt.lt/radioteka/api/media', video_id,
            query={'url': f'/mediateka/irasas/{video_id}/{path}'})

        return {
            'id': video_id,
            'formats': self._extract_m3u8_formats(media['playlist_item']['file'], video_id, 'mp4'),
            **traverse_obj(media, {
                'title': ('title', {str}),
                'tags': ('tags', ..., 'name', {str}),
                'categories': ('playlist_item', 'category', {str}, filter, all, filter),
                'description': ('content', {clean_html}, {str}),
                'timestamp': ('date', {lambda x: x.replace('.', '/')}, {unified_timestamp}),
                'thumbnail': ('playlist_item', 'image', {urljoin('https://www.lrt.lt')}),
            }),
        }


Review comment (refactor):
```suggestion
            'formats': self._extract_m3u8_formats(media['playlist_item']['file'], video_id),
```

Code after:
        'url': 'https://www.lrt.lt/radioteka/irasas/2000359728/nemarios-eiles-apie-pragarus-ir-skaistyklas-su-aiste-kiltinaviciute',
        'info_dict': {
            'id': '2000359728',
            'ext': 'm4a',
            'title': 'Nemarios eilės: apie pragarus ir skaistyklas su Aiste Kiltinavičiūte',
            'description': 'md5:5eee9a0e86a55bf547bd67596204625d',
            'timestamp': 1726143120,
            'upload_date': '20240912',
            'tags': 'count:5',
            'thumbnail': r're:https?://.+/.+\.jpe?g',
            'categories': ['Daiktiniai įrodymai'],
        },
    }, {
        'url': 'https://www.lrt.lt/radioteka/irasas/2000304654/vakaras-su-knyga-svetlana-aleksijevic-cernobylio-malda-v-dalis?season=%2Fmediateka%2Faudio%2Fvakaras-su-knyga%2F2023',
        'only_matching': True,
    }]

    def _real_extract(self, url):
        video_id, path = self._match_valid_url(url).group('id', 'path')
        media = self._download_json(
            'https://www.lrt.lt/radioteka/api/media', video_id,
            query={'url': f'/mediateka/irasas/{video_id}/{path}'})

        return {
            'id': video_id,
            'formats': self._extract_m3u8_formats(media['playlist_item']['file'], video_id),
            **traverse_obj(media, {
                'title': ('title', {str}),
                'tags': ('tags', ..., 'name', {str}),
                'categories': ('playlist_item', 'category', {str}, filter, all, filter),
                'description': ('content', {clean_html}, {str}),
                'timestamp': ('date', {lambda x: x.replace('.', '/')}, {unified_timestamp}),
                'thumbnail': ('playlist_item', 'image', {urljoin('https://www.lrt.lt')}),
            }),
        }