Alternatively, you can use DuckDuckGo instead of Bing. DuckDuckGo is a "privacy first" search service, with many useful features. However, they do not have an official API, so the function we'll show here relies on the particular structure of their web interface, which may change.
To use DuckDuckGo to download images, use the
search_images_ddg function from
fastbook, like so:
from fastbook import * urls = search_images_ddg('grizzly bear', max_images=100) len(urls),urls
The URLs are returned as strings, so you won't need the
attrgot line that's in the book:
download_url(urls, 'images/bear.jpg') im = Image.open('images/bear.jpg') im.thumbnail((256,256)) im