From 3d5446383919b5d12703a78adc29f4d68ee06ca2 Mon Sep 17 00:00:00 2001 From: manetta Date: Wed, 29 Sep 2021 18:54:41 +0200 Subject: [PATCH] pick FIRST image from the search result list --- command-line/update.py | 3 ++- web-interface/update.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/command-line/update.py b/command-line/update.py index 72b77c5..8ae906c 100644 --- a/command-line/update.py +++ b/command-line/update.py @@ -63,9 +63,10 @@ def download_media(html, images, wiki): # we select the first search result # (assuming that this is the image we are looking for) - image = data['query']['allimages'][:1] # pick last item!!! + image = data['query']['allimages'][0] # then we download the image + print(image) image_url = image['url'] image_filename = image['name'] print('Downloading:', image_filename) diff --git a/web-interface/update.py b/web-interface/update.py index 7241306..f57e43f 100644 --- a/web-interface/update.py +++ b/web-interface/update.py @@ -64,7 +64,7 @@ def download_media(html, images, wiki): # we select the first search result # (assuming that this is the image we are looking for) - image = data['query']['allimages'][:1] # !!! pick last image + image = data['query']['allimages'][0] # then we download the image image_url = image['url']