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

Code before:
    }, {
        'url': 'https://www.hotstar.com/in/tv/bigg-boss/14714/seasons/season-4/ss-8208/',
        'info_dict': {
            'id': '8208',
        },
        'playlist_mincount': 19,
    }]

    def _real_extract(self, url):
        url, season_id = self._match_valid_url(url).groups()
        headers = {
            'x-country-code': 'IN',
            'x-platform-code': 'PCTV',
        }
        item_json = self._download_json(
            f'{self._API_URL}/o/v1/season/asset?tao=0&tas=0&size=10000&id={season_id}', season_id, headers=headers)['body']['results']
        entries = [
            self.url_result(HotStarIE._video_url(video['contentId'], root=url), HotStarIE, video['contentId'])
            for video in item_json['items'] if video.get('contentId')]

        return self.playlist_result(entries, season_id)


class HotStarSeriesIE(HotStarBaseIE):
    IE_NAME = 'hotstar:series'
    _VALID_URL = r'(?P<url>https?://(?:www\.)?hotstar\.com(?:/in)?/tv/[^/]+/(?P<id>\d+))(?!.*/list/)'
    _TESTS = [{
        'url': 'https://www.hotstar.com/in/tv/radhakrishn/1260000646',
        'info_dict': {
            'id': '1260000646',
        },
        'playlist_mincount': 690,
    }, {
        'url': 'https://www.hotstar.com/tv/dancee-/1260050431',
        'info_dict': {
            'id': '1260050431',
        },
        'playlist_mincount': 43,
    }, {
        'url': 'https://www.hotstar.com/in/tv/mahabharat/435/',
        'info_dict': {
            'id': '435',
        },
        'playlist_mincount': 267,
    }]

    def _real_extract(self, url):
        url, series_id = self._match_valid_url(url).groups()
        headers = {
            'x-country-code': 'IN',
            'x-platform-code': 'PCTV',

Review comment (suggestion):
```suggestion
    _VALID_URL = r'(?P<url>https?://(?:www\.)?hotstar\.com(?:/in)?/tv/[^/]+/(?P<id>\d+))/?(?:[#?].*)?$'
```

Code after:
    }, {
        'url': 'https://www.hotstar.com/in/tv/bigg-boss/14714/seasons/season-4/ss-8208/',
        'info_dict': {
            'id': '8208',
        },
        'playlist_mincount': 19,
    }]

    def _real_extract(self, url):
        url, season_id = self._match_valid_url(url).groups()
        headers = {
            'x-country-code': 'IN',
            'x-platform-code': 'PCTV',
        }
        item_json = self._download_json(
            f'{self._API_URL}/o/v1/season/asset?tao=0&tas=0&size=10000&id={season_id}', season_id, headers=headers)['body']['results']
        entries = [
            self.url_result(HotStarIE._video_url(video['contentId'], root=url), HotStarIE, video['contentId'])
            for video in item_json['items'] if video.get('contentId')]

        return self.playlist_result(entries, season_id)


class HotStarSeriesIE(HotStarBaseIE):
    IE_NAME = 'hotstar:series'
    _VALID_URL = r'(?P<url>https?://(?:www\.)?hotstar\.com(?:/in)?/tv/[^/]+/(?P<id>\d+))/?(?:[#?]|$)'
    _TESTS = [{
        'url': 'https://www.hotstar.com/in/tv/radhakrishn/1260000646',
        'info_dict': {
            'id': '1260000646',
        },
        'playlist_mincount': 690,
    }, {
        'url': 'https://www.hotstar.com/tv/dancee-/1260050431',
        'info_dict': {
            'id': '1260050431',
        },
        'playlist_mincount': 43,
    }, {
        'url': 'https://www.hotstar.com/in/tv/mahabharat/435/',
        'info_dict': {
            'id': '435',
        },
        'playlist_mincount': 267,
    }]

    def _real_extract(self, url):
        url, series_id = self._match_valid_url(url).groups()
        headers = {
            'x-country-code': 'IN',
            'x-platform-code': 'PCTV',