fix: Prefer longer response text for duplicate entries
This commit is contained in:
@@ -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:
|
||||
|
Reference in New Issue
Block a user