fix: Prefer longer response text for duplicate entries

This commit is contained in:
2025-05-22 19:32:44 -06:00
parent 09fea2decd
commit 0ba3638a27

View File

@@ -51,7 +51,13 @@ def main():
if response_text is not None:
# Ensure response_text is not None (it can be an empty string for 0-byte files)
data[key_from_query_param] = response_text
if key_from_query_param in data:
# If key exists, only update if new data is longer (preferring full images over thumbnails)
if len(response_text) > len(data[key_from_query_param]):
data[key_from_query_param] = response_text
else:
# If key doesn't exist, add it
data[key_from_query_param] = response_text
# Second loop to process JSON entries
for entry in entries: