pick FIRST image from the search result list

This commit is contained in:
manetta 2021-09-29 18:54:41 +02:00
parent 0e33df5f18
commit 3d54463839
2 changed files with 3 additions and 2 deletions

View File

@ -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)

View File

@ -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']