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

Code before:
            'age_limit': 13,
        }
    }, {
        # json ld metadata type equal to Movie instead of TVEpisodes
        'url': 'https://www.viu.com/ott/id/id/all/video-japanese-animation-movies-demon_slayer_kimetsu_no_yaiba_the_movie_mugen_train-1165892707?containerId=1675060691786',
        'info_dict': {
            'id': '1165892707',
            'ext': 'mp4',
            'timestamp': 1577836800,
            'upload_date': '20200101',
            'title': 'Demon Slayer - Kimetsu no Yaiba - The Movie: Mugen Train',
            'age_limit': 13,
            'cast': 'count:9',
            'thumbnail': 'https://vuclipi-a.akamaihd.net/p/cloudinary/h_171,w_304,dpr_1.5,f_auto,c_thumb,q_auto:low/1165895279/d-1',
            'description': 'md5:1ce9c35a3aeab384085533f746c87469',
            'duration': 7021,
        }
    }]

    def _real_extract(self, url):
        display_id = self._match_id(url)
        webpage = self._download_webpage(url, display_id)
        episode_json = traverse_obj(list(filter(
            lambda x: x.get('@type') in ('TVEpisode', 'Movie'), self._yield_json_ld(webpage, display_id))), 0) or {}
        initial_state_json = self._search_json(
            r'window\.__INITIAL_STATE__\s*=', webpage, 'window.__INITIAL_STATE__',
            display_id)['content']['clipDetails']
        video_data = self._download_json(
            f'https://um.viuapi.io/drm/v1/content/{display_id}', display_id, data=b'',
            headers={'Authorization': ViuOTTNewBaseIE._TOKEN, **self._HEADERS, 'ccode': 'ID'})
        formats, subtitles = self._extract_m3u8_formats_and_subtitles(
            video_data['playUrl'], display_id)

        for key in initial_state_json:
            lang, ext = self._search_regex(
                r'^subtitle_(?P<lang>[\w-]+)_(?P<ext>\w+)$', key, 'subtitle metadata',
                default=(None, None), group=('lang', 'ext'))
            if lang and ext:
                subtitles.setdefault(lang, []).append({
                    'ext': ext,
                    'url': initial_state_json[key]
                })
                subtitles[lang].append({
                    'ext': 'srt',
                    'url': f'{remove_end(initial_state_json[key], "vtt")}srt'
                })

        return {
            'id': display_id,
            'title': (initial_state_json.get('title') or initial_state_json.get('display_title')
                      or episode_json.get('name')),

Review comment (suggestion):
```suggestion
        episode = traverse_obj(list(filter(
            lambda x: x.get('@type') in ('TVEpisode', 'Movie'), self._yield_json_ld(webpage, display_id))), 0) or {}
        initial_state = self._search_json(
            r'window\.__INITIAL_STATE__\s*=', webpage, 'window.__INITIAL_STATE__',
```

These are not json though

Code after:
            'age_limit': 13,
        }
    }, {
        # json ld metadata type equal to Movie instead of TVEpisodes
        'url': 'https://www.viu.com/ott/id/id/all/video-japanese-animation-movies-demon_slayer_kimetsu_no_yaiba_the_movie_mugen_train-1165892707?containerId=1675060691786',
        'info_dict': {
            'id': '1165892707',
            'ext': 'mp4',
            'timestamp': 1577836800,
            'upload_date': '20200101',
            'title': 'Demon Slayer - Kimetsu no Yaiba - The Movie: Mugen Train',
            'age_limit': 13,
            'cast': 'count:9',
            'thumbnail': 'https://vuclipi-a.akamaihd.net/p/cloudinary/h_171,w_304,dpr_1.5,f_auto,c_thumb,q_auto:low/1165895279/d-1',
            'description': 'md5:1ce9c35a3aeab384085533f746c87469',
            'duration': 7021,
        }
    }]

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

        video_data = self._download_json(
            f'https://um.viuapi.io/drm/v1/content/{display_id}', display_id, data=b'',
            headers={'Authorization': ViuOTTIndonesiaBaseIE._TOKEN, **self._HEADERS, 'ccode': 'ID'})
        formats, subtitles = self._extract_m3u8_formats_and_subtitles(video_data['playUrl'], display_id)

        initial_state = self._search_json(
            r'window\.__INITIAL_STATE__\s*=', webpage, 'initial state',
            display_id)['content']['clipDetails']
        for key, url in initial_state.items():
            lang, ext = self._search_regex(
                r'^subtitle_(?P<lang>[\w-]+)_(?P<ext>\w+)$', key, 'subtitle metadata',
                default=(None, None), group=('lang', 'ext'))
            if lang and ext:
                subtitles.setdefault(lang, []).append({
                    'ext': ext,
                    'url': url,
                })

                if ext == 'vtt':
                    subtitles[lang].append({
                        'ext': 'srt',
                        'url': f'{remove_end(initial_state[key], "vtt")}srt',
                    })

        episode = traverse_obj(list(filter(
            lambda x: x.get('@type') in ('TVEpisode', 'Movie'), self._yield_json_ld(webpage, display_id))), 0) or {}
        return {
            'id': display_id,