Ddg_images doesnt return any results

I am currently reviewing the first part of the course because it has been a couple of weeks since I last looked at it and am stuck at searching urls with the ddg_images function.

The method used in the video course didnt work for me, so I used the method presented in the according kaggle notebook. The last time I used it it worked, this time it didnt and I dont know why.

from duckduckgo_search import ddg_images
from fastcore.all import *

def search_images(term, max_images=30):
    print(f"Searching for '{term}'")
    return L(ddg_images(term, max_results=max_images)).itemgot('image')

This function will return a empty list no matter the input term, but it wont throw any exceptions.

Does anybody know what the problem could be?

if you want the function on the video to work import this first

import fastbook
from fastbook import *

and then search_images_ddg will work :slight_smile:


Yes it worked, dont know how that slipped past me when I tried it :sweat_smile:
Thank you!

1 Like