Giter VIP home page Giter VIP logo

google-apis's Introduction

API Usage Examples

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.

Gemini API (Google Generative AI)

Prerequisites

  • Node.js installed on your machine

Installation

  1. Clone this repository.
  2. Install dependencies using npm:
    npm install

Usage

  1. 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.
  2. 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
    
  3. Run the gemini.js script:
    node gemini.js
  4. Follow the prompts and interact with the script to generate content using the Gemini API.

Google Custom Search API

Prerequisites

  • Node.js installed on your machine

Installation

  1. Clone this repository.
  2. Install dependencies using npm:
    npm install

Usage

  1. 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.
  2. Obtain your Custom Search Engine ID by creating a Custom Search Engine following the instructions here.
  3. 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
    
  4. Run the googleSearch.js script:
    node googleSearch.js
  5. Follow the prompts and interact with the script to perform a Google search and fetch the results.

YouTube Data API

Prerequisites

  • Node.js installed on your machine

Installation

  1. Clone this repository.
  2. Install dependencies using npm:
    npm install

Usage

  1. 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.
  2. 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
    
  3. Run the youtubeSearch.js script:
    node youtubeSearch.js
  4. Follow the prompts and interact with the script to search for videos on YouTube.

google-apis's People

Contributors

lagnajit09 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.