How to query an advanced search with google customsearch API?

前端 未结 3 1236
没有蜡笔的小新
没有蜡笔的小新 2021-02-05 14:53

How can I programmatically using the Google Python client library do an advanced search with Google custom search API search engine in order to return a list of first n

3条回答
  •  名媛妹妹
    2021-02-05 15:08

    An alternative using the python requests library if you do not want to use the google discovery api:

    import requests, pprint
    q='italy'
    api_key='AIzaSyCs.....................'
    
    q = requests.get('https://content.googleapis.com/customsearch/v1', 
        params={ 'cx': '013027958806940070381:dazyknr8pvm', 'q': q, 'key': api_key} )
    pprint.pprint(q.json())
    

提交回复
热议问题