This repository contains examples of using various APIs such as Google Generative AI, Google Custom Search, and YouTube Data API. Below are the steps to use each of these codes along with the required installations and instructions on obtaining API keys and enabling API services.
- Node.js installed on your machine
- Clone this repository.
- Install dependencies using npm:
npm install
- Obtain an API key for Google Generative AI by following these steps:
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Navigate to the API & Services > Credentials page.
- Click "Create credentials" and select "API key".
- Copy the generated API key.
- Set up your Google Generative AI API key by creating a
.env
file in the root directory of the project and adding the following line:API_KEY=your_api_key_here
- Run the
gemini.js
script:node gemini.js
- Follow the prompts and interact with the script to generate content using the Gemini API.
- Node.js installed on your machine
- Clone this repository.
- Install dependencies using npm:
npm install
- Obtain API keys for Google Custom Search API by following these steps:
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Navigate to the API & Services > Credentials page.
- Click "Create credentials" and select "API key".
- Copy the generated API key.
- Navigate to the Custom Search JSON API page.
- Enable the API for your project.
- Obtain your Custom Search Engine ID by creating a Custom Search Engine following the instructions here.
- Set up your Google Custom Search API key and Custom Search Engine ID by creating a
.env
file in the root directory of the project and adding the following lines:CSE_ID=your_custom_search_engine_id_here GOOGLE_CONSOLE_API_KEY=your_api_key_here
- Run the
googleSearch.js
script:node googleSearch.js
- Follow the prompts and interact with the script to perform a Google search and fetch the results.
- Node.js installed on your machine
- Clone this repository.
- Install dependencies using npm:
npm install
- Obtain an API key for YouTube Data API by following these steps:
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Navigate to the API & Services > Credentials page.
- Click "Create credentials" and select "API key".
- Copy the generated API key.
- Navigate to the YouTube Data API page.
- Enable the API for your project.
- Set up your YouTube Data API key by creating a
.env
file in the root directory of the project and adding the following line:GOOGLE_CONSOLE_API_KEY=your_api_key_here
- Run the
youtubeSearch.js
script:node youtubeSearch.js
- Follow the prompts and interact with the script to search for videos on YouTube.