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

Code before:
            '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')
            except ExtractorError:
                self.report_warning('PhantomJS is highly recommended for this video, as it might load incredibly slowly otherwise.'
                                    'You can also try opening the page in this device\'s browser first')

        video_meta, meta_paths = self._call_api(
            'https://api.rctiplus.com/api/v1/%s/%s' % (video_type, video_id), display_id, 'Downloading video metadata')

        thumbnails, image_path = [], meta_paths.get('image_path', 'https://rstatic.akamaized.net/media/')
        if video_meta.get('portrait_image'):
            thumbnails.append({
                'id': 'portrait_image',
                'url': image_path + '2000' + video_meta['portrait_image']
            })
        if video_meta.get('landscape_image'):
            thumbnails.append({
                'id': 'landscape_image',
                'url': image_path + '2000' + video_meta['landscape_image']
            })

        formats = self._extract_m3u8_formats(video_url, display_id, 'mp4', headers={'Referer': 'https://www.rctiplus.com/'})
        self._sort_formats(formats)

        for f in formats:
            if 'akamaized' in f['url']:
                f.setdefault('http_headers', {})['Referer'] = 'https://www.rctiplus.com/'  # Referer header is required for akamai CDNs

        return {
            'id': video_meta.get('product_id') or video_json.get('product_id'),
            'title': video_meta.get('title') or video_json.get('content_name'),
            'display_id': display_id,
            'description': video_meta.get('summary'),
            'timestamp': video_meta.get('release_date'),
            'duration': video_meta.get('duration'),
            'categories': [video_meta.get('genre')],
            'average_rating': video_meta.get('star_rating'),
            'series': video_meta.get('program_title') or video_json.get('program_title'),
            'season_number': video_meta.get('season'),
            'episode_number': video_meta.get('episode'),
            'channel': video_json.get('tv_name'),
            'channel_id': video_json.get('tv_id'),
            'formats': formats,
            'thumbnails': thumbnails

Review comment (suggestion):
```suggestion
                'url': '%s%d%s' % (image_path, 2000, video_meta['portrait_image'])
```

Code after:
        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')
            except ExtractorError:
                self.report_warning('PhantomJS is highly recommended for this video, as it might load incredibly slowly otherwise.'
                                    'You can also try opening the page in this device\'s browser first')

        video_meta, meta_paths = self._call_api(
            'https://api.rctiplus.com/api/v1/%s/%s' % (video_type, video_id), display_id, 'Downloading video metadata')

        thumbnails, image_path = [], meta_paths.get('image_path', 'https://rstatic.akamaized.net/media/')
        if video_meta.get('portrait_image'):
            thumbnails.append({
                'id': 'portrait_image',
                'url': '%s%d%s' % (image_path, 2000, video_meta['portrait_image'])  # 2000px seems to be the highest resolution that can be given
            })
        if video_meta.get('landscape_image'):
            thumbnails.append({
                'id': 'landscape_image',
                'url': '%s%d%s' % (image_path, 2000, video_meta['landscape_image'])
            })

        formats = self._extract_m3u8_formats(video_url, display_id, 'mp4', headers={'Referer': 'https://www.rctiplus.com/'})
        for f in formats:
            if 'akamaized' in f['url']:
                f.setdefault('http_headers', {})['Referer'] = 'https://www.rctiplus.com/'  # Referer header is required for akamai CDNs

        self._sort_formats(formats)

        return {
            'id': video_meta.get('product_id') or video_json.get('product_id'),
            'title': video_meta.get('title') or video_json.get('content_name'),
            'display_id': display_id,
            'description': video_meta.get('summary'),
            'timestamp': video_meta.get('release_date'),
            'duration': video_meta.get('duration'),
            'categories': [video_meta.get('genre')],
            'average_rating': video_meta.get('star_rating'),
            'series': video_meta.get('program_title') or video_json.get('program_title'),
            'season_number': video_meta.get('season'),
            'episode_number': video_meta.get('episode'),
            'channel': video_json.get('tv_name'),
            'channel_id': video_json.get('tv_id'),
            'formats': formats,