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

Code before:
            'duration': 288,
            'timestamp': 1571652600,
            'upload_date': '20191021',
            'series': 'Cahaya Terindah',
            'channel': 'RCTI',
        },
        'params': {
            'fixup': 'never',
        },
    }, {  # Extra
        'url': 'https://www.rctiplus.com/programs/616/inews-malam/extra/9438/diungkapkan-melalui-surat-terbuka-ceo-ruangguru-belva-devara-mundur-dari-staf-khusus-presiden',
        'md5': 'c48106afdbce609749f5e0c007d9278a',
        'info_dict': {
            'id': 'v_ex9438',
            'title': 'md5:2ede828c0f8bde249e0912be150314ca',
            'display_id': 'md5:62b8d4e9ff096db527a1ad797e8a9933',
            'description': 'md5:2ede828c0f8bde249e0912be150314ca',
            'ext': 'mp4',
            'duration': 93,
            'timestamp': 1587561540,
            'upload_date': '20200422',
            'series': 'iNews Malam',
            'channel': 'INews',
        },
        'params': {
            'format': 'bestvideo, bestaudio',
        }
    }]

    def _search_auth_key(self, webpage):
        try:
            self._AUTH_KEY = self._search_regex(
                r'\'Authorization\':"(?P<auth>[^"]+)"', webpage, 'auth-key')
        except RegexNotFoundError:
            pass

    def _real_extract(self, url):
        video_type, video_id, display_id = re.match(self._VALID_URL, url).groups()
        webpage = self._download_webpage(url, display_id)
        self._search_auth_key(webpage)

        video_json = self._call_api(
            'https://api.rctiplus.com/api/v1/%s/%s/url?appierid=.1' % (video_type, video_id), display_id, 'Downloading video URL JSON')[0]
        video_url = video_json['url']
        if 'akamaized' in video_url:
            # Akamai's CDN requires a session to at least be made via Conviva's API
            # TODO: Reverse-engineer Conviva's heartbeat code to avoid phantomJS
            phantom = None
            try:
                phantom = PhantomJSwrapper(self)
                phantom.get(url, webpage, display_id, note2='Initiating video session')

Review comment (suggestion):
```suggestion
            'format': 'bestvideo',
```

Code after:
            'ext': 'mp4',
            'duration': 288,
            'timestamp': 1571652600,
            'upload_date': '20191021',
            'series': 'Cahaya Terindah',
            'channel': 'RCTI',
        },
        'params': {
            'fixup': 'never',
        },
    }, {  # Extra
        'url': 'https://www.rctiplus.com/programs/616/inews-malam/extra/9438/diungkapkan-melalui-surat-terbuka-ceo-ruangguru-belva-devara-mundur-dari-staf-khusus-presiden',
        'md5': 'c48106afdbce609749f5e0c007d9278a',
        'info_dict': {
            'id': 'v_ex9438',
            'title': 'md5:2ede828c0f8bde249e0912be150314ca',
            'display_id': 'md5:62b8d4e9ff096db527a1ad797e8a9933',
            'description': 'md5:2ede828c0f8bde249e0912be150314ca',
            'ext': 'mp4',
            'duration': 93,
            'timestamp': 1587561540,
            'upload_date': '20200422',
            'series': 'iNews Malam',
            'channel': 'INews',
        },
        'params': {
            'format': 'bestvideo',
        },
    }]

    def _search_auth_key(self, webpage):
        try:
            self._AUTH_KEY = self._search_regex(
                r'\'Authorization\':"(?P<auth>[^"]+)"', webpage, 'auth-key')
        except RegexNotFoundError:
            pass

    def _real_extract(self, url):
        video_type, video_id, display_id = re.match(self._VALID_URL, url).groups()
        webpage = self._download_webpage(url, display_id)
        self._search_auth_key(webpage)

        video_json = self._call_api(
            'https://api.rctiplus.com/api/v1/%s/%s/url?appierid=.1' % (video_type, video_id), display_id, 'Downloading video URL JSON')[0]
        video_url = video_json['url']
        if 'akamaized' in video_url:
            # Akamai's CDN requires a session to at least be made via Conviva's API
            # TODO: Reverse-engineer Conviva's heartbeat code to avoid phantomJS
            phantom = None
            try:
                phantom = PhantomJSwrapper(self)