Image search API

python, api
Published on 2017-03-18 | Jeremy Greze

The Google Image Search API has been officially deprecated. I suggest here a free alternative. It is a hack based on the search engine Qwant.

import requests
import random

query = "toulouse pink city"

r = requests.get("",
        'count': 50,
        'q': query,
        't': 'images',
        'safesearch': 1,
        'locale': 'en_US',
        'uiv': 4
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'

response = r.json().get('data').get('result').get('items')
urls = [r.get('media') for r in response]