Repository: yt-dlp/yt-dlp
File: youtube_dlc/extractor/zee5.py (Python)

Code before:
    "Referer": "https://www.zee5.com",
    "Accept": "*/*",
    "Accept-Encoding": "gzip, deflate, br",
    "Accept-Language": "en-US,en;q=0.9",
    "Origin": "https://www.zee5.com",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-site",
}


class Zee5IE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?zee5\.com/.*/(?P<id>.*)'
    _TEST = {
        'url': 'https://www.zee5.com/movies/details/krishna-the-birth/0-0-63098',
        # 'md5': 'cd5abd10fab020dbb633cb8e94df0e12',
        'info_dict': {
            'id': '0-0-63098',
            'ext': 'm3u8',
            'title': 'Krishna - The Birth',
            'thumbnail': 'https://akamaividz.zee5.com/resources/0-0-63098/list/270x152/0063098_list_80888170.jpg',
            'description': str,
            'show': str,
            'season_title': str,
            'season_index': str,
            'ep_index': str,
        },
        'params': {
            'format': 'bv',
        },
    }

    def _real_extract(self, url):
        video_id = self._match_id(url)
        # webpage = self._download_webpage(url, video_id)

        # TODO more code goes here, for example ...
        token_request = requests.get(token_url, headers=headers).json()
        x_access_token = requests.get(platform_token).json()["token"]
        headers["X-Access-Token"] = x_access_token
        json_data = requests.get(search_api_endpoint + video_id, headers=headers,
                                 params={"translation": "en", "country": "IN"}).json()
        partial_m3u8_url = (json_data["hls"][0].replace("drm", "hls") + token_request["video_token"])
        title = json_data['title']
        m3u8_url = stream_baseurl + partial_m3u8_url
        description = json_data['description']
        thumbnail = json_data['image_url']
        formats = self._extract_m3u8_formats(m3u8_url=m3u8_url, video_id=video_id)
        if json_data['asset_subtype'] == 'episode':
            show_title = json_data['tvshow_details']['title']
            season_title = json_data['season_details']['title']

Review comment (suggestion):
Preferable to use md5 or actual value, not just type

Code after:
)


class Zee5IE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?zee5\.com/[^#?]*/(?P<display_id>[-\w]+)/(?P<id>[-\d]+)'
    _TESTS = [{
        'url': 'https://www.zee5.com/movies/details/krishna-the-birth/0-0-63098',
        'info_dict': {
            "id": "0-0-63098",
            "ext": "m3u8",
            "display_id": "krishna-the-birth",
            "title": "Krishna - The Birth",
            "duration": 4368,
            "average_rating": 4,
            "description": str,
            "alt_title": "Krishna - The Birth",
            "uploader": "Zee Entertainment Enterprises Ltd",
            "release_date": "20060101",
            "upload_date": "20060101",
            "timestamp": 1136073600,
            "thumbnail": "https://akamaividz.zee5.com/resources/0-0-63098/list/270x152/0063098_list_80888170.jpg",
            "tags": list
        },
        'params': {
            'format': 'bv',
        },
    }, {
        'url': 'https://zee5.com/tvshows/details/krishna-balram/0-6-1871/episode-1-the-test-of-bramha/0-1-233402',
        'info_dict': {
            "id": "0-1-233402",
            'ext': 'm3u8',
            "display_id": "episode-1-the-test-of-bramha",
            "title": "Episode 1 - The Test Of Bramha",
            "duration": 1336,
            "average_rating": 4,
            "description": str,
            "alt_title": "Episode 1 - The Test Of Bramha",
            "uploader": "Green Gold",
            "release_date": "20090101",
            "upload_date": "20090101",
            "timestamp": 1230768000,
            "thumbnail": "https://akamaividz.zee5.com/resources/0-1-233402/list/270x152/01233402_list.jpg",
            "series": "Krishna Balram",
            "season_number": 1,
            "episode_number": 1,
            "tags": list,
        },
        'params': {
            'format': 'bv',
        },
    }]