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

Code before:
        # Use utils.get_element_text_and_html_by_tag() instead when it accepts less strict html.

        playerDiv = ''
        for k, line in enumerate(webpage.split("\n")):
            if line.find('mujRozhlasPlayer') != -1:
                playerDiv = line.strip()
                break

        if playerDiv.count('<div') > 1:
            for k, element in enumerate(playerDiv.split('<div')):
                if element.count('mujRozhlasPlayer') == 1:
                    playerDiv = '<div' + element
                    break

        return playerDiv

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

        playerDiv = self.find_element(webpage)

        jsonString = extract_attributes(playerDiv).get('data-player')
        jsonData = json.loads(jsonString)

        entries = []
        for entry in jsonData.get("data").get('playlist'):
            entry0 = entry.get('audioLinks')[0]
            format = {
                'url': entry0.get('url'),
                'ext': entry0.get('variant'),
                'format_id': entry0.get('variant'),
                'abr': entry0.get('bitrate'),
                'acodec': entry0.get('variant'),
                'vcodec': 'none',
            }
            temp = {
                'id': self._match_id(url),  # Prefering to user entry.get('meta').get('ga').get('contentId') for id. Using this because of tests.
                'title': entry.get('title'),
                'description': entry.get('meta').get('ga').get('contentEvent'),
                'duration': entry.get('duration'),
                'formats': [format],
            }
            entries.append(temp)

        return {
            '_type': 'playlist',
            'id': jsonData.get('data').get('embedId'),
            'title': jsonData.get('data').get('series').get('title'),
            'entries': entries,
        }


Review comment (refactor):
```suggestion
        data = self._parse_json(
            extract_attributes(playerDiv)['data-player'], video_id)['data']

        entries = []
        for entry in data['playlist']:
```

Code after:
            },
        }]
    }, {
        'url': 'https://wave.rozhlas.cz/poslechnete-si-neklid-podcastovy-thriller-o-vine-strachu-a-vztahu-ktery-zasel-8554744',
        'info_dict': {
            'id': 8554744,
            'title': 'Poslechněte si Neklid. Podcastový thriller o vině, strachu a vztahu, který zašel příliš daleko',
        },
        'playlist_count': 5,
        'playlist': [{
            'md5': '93d4109cf8f40523699ae9c1d4600bdd',
            'info_dict': {
                'id': '9890713',
                'ext': 'mp3',
                'title': 'Neklid #1',
                'description': '1. díl: Neklid: 1. díl',
                'duration': 1025,
                'artist': 'Josef Kokta',
                'channel_id': 'radio-wave',
                'chapter': 'Neklid #1',
                'chapter_number': 1,
            },
        }, {
            'md5': 'e9763235be4a6dcf94bc8a5bac1ca126',
            'info_dict': {
                'id': '9890716',
                'ext': 'mp3',
                'title': 'Neklid #2',
                'description': '2. díl: Neklid: 2. díl',
                'duration': 768,
                'artist': 'Josef Kokta',
                'channel_id': 'radio-wave',
                'chapter': 'Neklid #2',
                'chapter_number': 2,
            },
        }, {
            'md5': '00b642ea94b78cc949ac84da09f87895',
            'info_dict': {
                'id': '9890722',
                'ext': 'mp3',
                'title': 'Neklid #3',
                'description': '3. díl: Neklid: 3. díl',
                'duration': 607,
                'artist': 'Josef Kokta',
                'channel_id': 'radio-wave',
                'chapter': 'Neklid #3',
                'chapter_number': 3,
            },
        }, {
            'md5': 'faef97b1b49da7df874740f118c19dea',
            'info_dict': {