Giter Site home page Giter Site logo

some-1hing / google-reverse-image-api Goto Github PK

View Code? Open in Web Editor NEW
42.0 3.0 17.0 104 KB

This is a simple API built using Node.js and Express.js that allows you to perform Google Reverse Image Search by providing an image URL. The API uses Cheerio to scrap Google's image search engine's html to get result text and similar images url.

Home Page: https://google-reverse-image-api.vercel.app

License: MIT License

JavaScript 100.00%
google google-api google-image-search google-lens google-reverse-image-search google-search-api image-search image-search-engine requests reverse-image-search

google-reverse-image-api's Introduction

Google Reverse Image Search API

This is a simple API built using Node.js and Express.js that allows you to perform Google Reverse Image Search by providing an image URL. The API uses Cheerio to scrap Google's image search engine's html to get result text and similar images url.

API is currently hosted on Vercel. You can access it using this link.

Usage

To use the API, you need to make a POST request to the /reverse endpoint with a JSON payload containing the image URL. Here's an example using curl:

Invoke-RestMethod -Uri "https://google-reverse-image-api.vercel.app/reverse" -Method Post -Headers @{"Content-Type"="application/json"} -Body '{"imageUrl": "https://fastly.picsum.photos/id/513/200/300.jpg?hmac=KcBD-M89_o9rkxWW6PS2yEfAMCfd3TH9McppOsf3GZ0"}'

The API will respond with a JSON object containing the title and link of the top matching image from Google search, if the search was successful. Here's an example response:

{
  "success" : true,
  "message" : "Successfully Got the Result",
  "data" : {
    "similarUrl" : "https://www.google.com/search?tbm=isch&q=Elderly%20person",
    "resultText" : "Results forÂElderly person"
  }
}

If there was an error during the search process, the API will respond with a JSON object containing an error field with a description of the error. Here's an example response:

{
  "success" : false,
  "message" : "Failed to find text output",
  "data" : null
}

Using the API in Python and JavaScript

To use this API in a Python project, you can use the requests library to make POST requests to the API endpoint. Here's an example:

import requests

url = "https://google-reverse-image-api.vercel.app/reverse"
data = {"imageUrl": "https://fastly.picsum.photos/id/513/200/300.jpg?hmac=KcBD-M89_o9rkxWW6PS2yEfAMCfd3TH9McppOsf3GZ0"}

response = requests.post(url, json=data)

if response.ok:
    print(response.json())
else:
    print(response.status_code)

To use the API in a JavaScript project, you can use the fetch function to make POST requests to the API endpoint. Here's an example:

const url = "https://google-reverse-image-api.vercel.app/reverse";
const data = { imageUrl: "https://fastly.picsum.photos/id/513/200/300.jpg?hmac=KcBD-M89_o9rkxWW6PS2yEfAMCfd3TH9McppOsf3GZ0" };

fetch(url, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify(data),
})
  .then((response) => {
    if (response.ok) {
      return response.json();
    } else {
      throw new Error("Could not perform reverse image search.");
    }
  })
  .then((data) => console.log(data))
  .catch((error) => console.error(error));

Telegram Integration

Python

This api can be easily used in your python telegram bot. The module example code is present here. You can fork ShikimoriBot repository if you are new to telegram bot development.

JavaScript

I will provide the code soon.

Deployment

This API can be deployed to any cloud platform that supports Node.js applications. One popular option is Vercel, which allows you to deploy Node.js applications with zero configuration.

To deploy this API to Vercel, click the button below:

Deploy with Vercel

Credits

This project was created by SOME-1HING. Feel free to use and modify this code for your own projects. If you found this project helpful, please consider giving it a ⭐️ on GitHub.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Terms of Use

By using this API, you agree to the following terms:

  • The API is provided as-is and without warranty.
  • You will not use the API for any illegal or unauthorized purpose.
  • You will include proper attribution if you use the API in a public project.

google-reverse-image-api's People

Contributors

dhruv-tara avatar some-1hing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

google-reverse-image-api's Issues

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.