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

Code before:
            self.raise_no_formats(
                'The requested video is not archived or indexed', expected=True)

        capture_dates = self._get_capture_dates(video_id, int_or_none(url_date))
        self.write_debug('Captures to try: ' + join_nonempty(*capture_dates, delim=', '))
        info = {'id': video_id}
        for capture in capture_dates:
            webpage = self._download_webpage(
                (self._WAYBACK_BASE_URL + 'http://www.youtube.com/watch?v=%s') % (capture, video_id),
                video_id=video_id, fatal=False, errnote='unable to download capture webpage (it may not be archived)',
                note='Downloading capture webpage')
            current_info = self._extract_metadata(video_id, webpage or '')
            # Try avoid getting deleted video metadata
            if current_info.get('title'):
                info = merge_dicts(info, current_info)
                if 'captures' not in self._configuration_arg('check_all'):
                    break

        info['thumbnails'] = self._extract_thumbnails(video_id)

        formats = []
        for fmt in traverse_obj(video_info, ('formats', lambda _, v: url_or_none(v['url']))):
            format_id = traverse_obj(fmt, ('url', {parse_qs}, 'itag', 0))
            formats.append({
                'format_id': format_id,
                **self._formats.get(format_id, {}),
                **traverse_obj(fmt, {
                    'url': ('url', {lambda x: f'https://web.archive.org/web/2id_/{x}'}),
                    'ext': ('ext', {str}),
                    'filesize': ('url', {parse_qs}, 'clen', 0, {int_or_none}),
                }),
            })
        info['formats'] = formats

        return info


Review comment (suggestion):
```suggestion
                **self._FORMATS.get(format_id, {}),
```

Code after:
            self.raise_no_formats(
                'The requested video is not archived or indexed', expected=True)

        capture_dates = self._get_capture_dates(video_id, int_or_none(url_date))
        self.write_debug('Captures to try: ' + join_nonempty(*capture_dates, delim=', '))
        info = {'id': video_id}
        for capture in capture_dates:
            webpage = self._download_webpage(
                (self._WAYBACK_BASE_URL + 'http://www.youtube.com/watch?v=%s') % (capture, video_id),
                video_id=video_id, fatal=False, errnote='unable to download capture webpage (it may not be archived)',
                note='Downloading capture webpage')
            current_info = self._extract_metadata(video_id, webpage or '')
            # Try avoid getting deleted video metadata
            if current_info.get('title'):
                info = merge_dicts(info, current_info)
                if 'captures' not in self._configuration_arg('check_all'):
                    break

        info['thumbnails'] = self._extract_thumbnails(video_id)

        formats = []
        for fmt in traverse_obj(video_info, ('formats', lambda _, v: url_or_none(v['url']))):
            format_id = traverse_obj(fmt, ('url', {parse_qs}, 'itag', 0))
            formats.append({
                'format_id': format_id,
                **self._FORMATS.get(format_id, {}),
                **traverse_obj(fmt, {
                    'url': ('url', {lambda x: f'https://web.archive.org/web/2id_/{x}'}),
                    'ext': ('ext', {str}),
                    'filesize': ('url', {parse_qs}, 'clen', 0, {int_or_none}),
                }),
            })
        info['formats'] = formats

        return info