def sanitize_got_info_dict(got_dict):
IGNORED_FIELDS = (
- # Format keys
- 'url', 'manifest_url', 'format', 'format_id', 'format_note', 'width', 'height', 'resolution',
- 'dynamic_range', 'tbr', 'abr', 'acodec', 'asr', 'vbr', 'fps', 'vcodec', 'container', 'filesize',
- 'filesize_approx', 'player_url', 'protocol', 'fragment_base_url', 'fragments', 'preference',
- 'language', 'language_preference', 'quality', 'source_preference', 'http_headers',
- 'stretched_ratio', 'no_resume', 'has_drm', 'downloader_options',
-
- # RTMP formats
- 'page_url', 'app', 'play_path', 'tc_url', 'flash_version', 'rtmp_live', 'rtmp_conn', 'rtmp_protocol', 'rtmp_real_time',
+ *YoutubeDL._format_fields,
# Lists
'formats', 'thumbnails', 'subtitles', 'automatic_captions', 'comments', 'entries',
IGNORED_PREFIXES = ('', 'playlist', 'requested', 'webpage')
def sanitize(key, value):
- if isinstance(value, str) and len(value) > 100:
+ if isinstance(value, str) and len(value) > 100 and key != 'thumbnail':
return f'md5:{md5(value)}'
elif isinstance(value, list) and len(value) > 10:
return f'count:{len(value)}'
+ elif key.endswith('_count') and isinstance(value, int):
+ return int
return value
test_info_dict = {
}
# display_id may be generated from id
- if test_info_dict.get('display_id') == test_info_dict['id']:
+ if test_info_dict.get('display_id') == test_info_dict.get('id'):
test_info_dict.pop('display_id')
return test_info_dict
def _repr(v):
if isinstance(v, compat_str):
return "'%s'" % v.replace('\\', '\\\\').replace("'", "\\'").replace('\n', '\\n')
+ elif isinstance(v, type):
+ return v.__name__
else:
return repr(v)
info_dict_str = ''