Fixes from testing

The `automatic_captions` has a layer for language codes that I didn't account for.

The type checking was copied and I didn't adjust for the arguments in this function.
This commit is contained in:
tcely 2025-01-07 02:55:05 -05:00 committed by GitHub
parent 25d2ff6802
commit 2f34fff713
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -194,8 +194,8 @@ def filter_response(response_dict):
Clean up the response so as to not store useless metadata in the database.
'''
# raise an exception for an unexpected argument type
if not isinstance(filedata, dict):
raise TypeError(f'filedata must be a dict, got "{type(filedata)}"')
if not isinstance(response_dict, dict):
raise TypeError(f'response_dict must be a dict, got "{type(response_dict)}"')
# optimize the empty case
if not response_dict:
return response_dict
@ -227,7 +227,11 @@ def filter_response(response_dict):
and '&expire=' in url
)
_drop_url_keys(response_dict, 'automatic_captions', drop_auto_caption_url)
ac_key = 'automatic_captions'
if ac_key in response_dict.keys():
ac_dict = response_dict[ac_key]
for lang_code in ac_dict:
_drop_url_keys(ac_dict, lang_code, drop_auto_caption_url)
# end of automatic_captions cleanup }}}
return response_dict