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

Code before:
        else:  # vod case
            media_type = 'vod'
        puid = try_call(lambda: self._get_cookies('https://www.litv.tv/')['PUID'].value)
        if puid is None:
            puid = str(uuid.uuid4())
            endpoint = 'get-urls-no-auth'
        else:
            endpoint = 'get-urls'
        payload = {'AssetId': asset_id, 'MediaType': media_type, 'puid': puid}
        video_data = self._download_json(
            f'https://www.litv.tv/api/{endpoint}', video_id,
            data=json.dumps(payload).encode(),
            headers={'Content-Type': 'application/json'})

        if video_data.get('error'):
            error_msg = traverse_obj(video_data, ('error', 'message'))
            if error_msg == 'OutsideRegionError: ':
                self.raise_geo_restricted('This video is available in Taiwan only')
            if error_msg:
                raise ExtractorError(f'{self.IE_NAME} said: {error_msg}', expected=True)
            raise ExtractorError(f'Unexpected error from {self.IE_NAME}')

        try:
            asset_url = video_data['result']['AssetURLs'][0]
        except KeyError:
            raise ExtractorError(f'Unexpected result from {self.IE_NAME}')
        formats = self._extract_m3u8_formats(
            asset_url, video_id, ext='mp4',
            entry_protocol='m3u8_native', m3u8_id='hls')
        for a_format in formats:
            # LiTV HLS segments doesn't like compressions
            a_format.setdefault('http_headers', {})['Accept-Encoding'] = 'identity'

        title = program_info['title'] + program_info.get('secondary_mark', '')
        description = program_info.get('description')
        thumbnail = program_info.get('picture')
        if thumbnail is not None:
            thumbnail = 'https://p-cdnstatic.svc.litv.tv/' + thumbnail
        categories = [item['name'] for item in program_info.get('genres', [])]
        episode = int_or_none(program_info.get('episode'))

        return {
            'id': video_id,
            'formats': formats,
            'title': title,
            'description': description,
            'thumbnail': thumbnail,
            'categories': categories,
            'episode_number': episode,
        }


Review comment (bug):
we can remove this and have it be fatal below, since the request will fail anyway without it
```suggestion
```

Code after:
            headers={'Content-Type': 'application/json'})

        if error := traverse_obj(video_data, ('error', {dict})):
            error_msg = traverse_obj(error, ('message', {str}))
            if error_msg and 'OutsideRegionError' in error_msg:
                self.raise_geo_restricted('This video is available in Taiwan only')
            elif error_msg:
                raise ExtractorError(f'{self.IE_NAME} said: {error_msg}', expected=True)
            raise ExtractorError(f'Unexpected error from {self.IE_NAME}')

        formats = self._extract_m3u8_formats(
            video_data['result']['AssetURLs'][0], video_id, ext='mp4', m3u8_id='hls')
        for a_format in formats:
            # LiTV HLS segments doesn't like compressions
            a_format.setdefault('http_headers', {})['Accept-Encoding'] = 'identity'

        return {
            'id': video_id,
            'formats': formats,
            'title': join_nonempty('title', 'secondary_mark', delim='', from_dict=program_info),
            **traverse_obj(program_info, {
                'description': ('description', {str}),
                'thumbnail': ('picture', {urljoin('https://p-cdnstatic.svc.litv.tv/')}),
                'categories': ('genres', ..., 'name', {str}),
                'episode_number': ('episode', {int_or_none}),
            }),
        }