Skip to content

Latest commit

 

History

History
 
 

using-custom-search-engine-api

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

To run this:

  • pip3 install -r requirements.txt
  • You need to setup a CSE account, check the tutorial on how you can set up one.
  • Change API_KEY and SEARCH_ENGINE_ID to yours, and then:
    python search_engine.py "python"
    
    This will use the query "python" to search for results, here is a cropped output:
    ========== Result #1 ==========
    Title: Welcome to Python.org
    Description: The official home of the Python Programming Language.
    URL: https://www.python.org/
    
    ========== Result #2 ==========
    Title: The Python Tutorial — Python 3.8.2 documentation
    Description: It has efficient high-level data structures and a simple but effective approach to 
    object-oriented programming. Python's elegant syntax and dynamic typing,
    together ...
    URL: https://docs.python.org/3/tutorial/
    
    ========== Result #3 ==========
    Title: Download Python | Python.org
    Description: Looking for Python with a different OS? Python for Windows, Linux/UNIX, Mac OS     
    X, Other. Want to help test development versions of Python? Prereleases ...
    URL: https://www.python.org/downloads/