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

Code before:
                'thumbnail': thumbnail,
            })

            if feed_data.get('programType') == 'episode':
                info.update({
                    'episode_number': int_or_none(
                        feed_data.get('tvSeasonEpisodeNumber')),
                    'season_number': int_or_none(
                        feed_data.get('tvSeasonNumber')),
                    'series': feed_data.get('mediasetprogram$brandTitle'),
                })

        info.update({
            'id': guid,
            'formats': formats,
            'subtitles': subtitles,
        })
        return info


class MediasetClipIE(MediasetIE):
    _VALID_URL = r'''(?x)
                     https?://
                         (?:www\.)?\w+\.mediaset\.it/
                             video/[\w-]+_(?P<id>\d{5,})\.s?html?
                 '''

    _TESTS = [{
        'url': 'https://www.grandefratello.mediaset.it/video/ventinovesima-puntata_27071.shtml',
        'info_dict': {
            'id': 'F310293901002901',
            'ext': 'mp4',
        },
        'skip': 'DRM content only',
    }]

    def _real_extract(self, url):
        clip_id = self._match_id(url)
        webpage = self._download_webpage(url, clip_id)
        guid = self._search_regex(r'''var\s*_onplay_guid\s*=\s*(?P<q>'|"|\b)(?P<guid>[\dA-Z]{16,})(?P=q)\s*;''', webpage, 'clip GUID', group='guid')
        return self.url_result('mediaset:%s' % guid, ie='Mediaset', video_id=clip_id)


class MediasetShowIE(MediasetIE):
    _VALID_URL = r'''(?x)
                    (?:
                        https?://
                            (?:(?:www|static3)\.)?mediasetplay\.mediaset\.it/
                            (?:
                                (?:fiction|programmi-tv|serie-tv)/(?:.+?/)?
                                    (?:[a-z]+)_SE(?P<id>\d{12})

Review comment (suggestion):
```suggestion
    _VALID_URL = r'(?x)https?://(?:www\.)?\w+\.mediaset\.it/video/[\w-]+_(?P<id>\d{5,})\.s?html?'
```

Code after:
                    'series': feed_data.get('mediasetprogram$brandTitle'),
                })

        info.update({
            'id': guid,
            'formats': formats,
            'subtitles': subtitles,
        })
        return info


class MediasetShowIE(MediasetIE):
    _VALID_URL = r'''(?x)
                    (?:
                        https?://
                            (?:(?:www|static3)\.)?mediasetplay\.mediaset\.it/
                            (?:
                                (?:fiction|programmi-tv|serie-tv|kids)/(?:.+?/)?
                                    (?:[a-z-]+)_SE(?P<id>\d{12})
                                    (?:,ST(?P<st>\d{12}))?
                                    (?:,sb(?P<sb>\d{9}))?$
                            )
                    )
                    '''
    _TESTS = [{
        # TV Show webpage (general webpage)
        'url': 'https://www.mediasetplay.mediaset.it/programmi-tv/leiene/leiene_SE000000000061',
        'info_dict': {
            'id': '000000000061',
            'title': 'Le Iene',
        },
        'playlist_mincount': 7,
    }, {
        # TV Show webpage (specific season)
        'url': 'https://www.mediasetplay.mediaset.it/programmi-tv/leiene/leiene_SE000000000061,ST000000002763',
        'info_dict': {
            'id': '000000002763',
            'title': 'Le Iene',
        },
        'playlist_mincount': 7,
    }, {
        # TV Show specific playlist (with multiple pages)
        'url': 'https://www.mediasetplay.mediaset.it/programmi-tv/leiene/iservizi_SE000000000061,ST000000002763,sb100013375',
        'info_dict': {
            'id': '100013375',
            'title': 'I servizi',
        },
        'playlist_mincount': 50,
    }]

    _BY_SUBBRAND = 'https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs-v2?byCustomValue={subBrandId}{%s}&sort=:publishInfo_lastPublished|desc,tvSeasonEpisodeNumber|desc&range=%d-%d'