image-reverse-search
v2.0.0
Published
A powerful and easy-to-use library for performing reverse image searches using Google Lens with Puppeteer
Downloads
13
Maintainers
Readme
Image Reverse Search
A powerful and easy-to-use TypeScript library for performing reverse image searches using Google Lens with Puppeteer.
Features
- 🔍 Reverse image search using Google Lens
- 🎯 Extract titles, links, sources, and images from search results
- ⚙️ Configurable wait times and browser options
- 🤖 Anti-detection measures with human behavior simulation
- 📦 Full TypeScript support with type definitions
- 🚀 Built on Puppeteer for reliable browser automation
- 🎨 Clean and simple API
Installation
npm install image-reverse-searchUsage
Basic Example
import { reverseImageSearch } from 'image-reverse-search';
const imageUrl = 'https://example.com/image.jpg';
const results = await reverseImageSearch(imageUrl);
console.log(results);With Options
const results = await reverseImageSearch('https://example.com/image.jpg', {
waitTime: 8000,
headless: 'new',
humanBehavior: true,
viewport: { width: 1920, height: 1080 }
});API
reverseImageSearch(imageUrl, options?)
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| waitTime | number | 5000 | Time in ms to wait for page load |
| headless | boolean | 'new' | 'new' | Puppeteer headless mode |
| viewport | object | { width: 1080, height: 1920 } | Browser viewport size |
| humanBehavior | boolean | true | Simulate human-like mouse movements |
Result Type
interface ReverseImageSearchResult {
title: string;
link: string;
source: string;
image: string;
}Troubleshooting
CAPTCHA / "Unusual Traffic" Errors
Google may show CAPTCHA challenges. To reduce this:
Add delays - Wait 30-60 seconds between searches
Enable human behavior (default):
reverseImageSearch(url, { humanBehavior: true });Use residential proxies - Datacenter IPs are flagged more
Increase wait time:
reverseImageSearch(url, { waitTime: 10000 });Run visible browser:
reverseImageSearch(url, { headless: false });
Note: For production at scale, use Google Cloud Vision API.
No Results
- Increase
waitTime(try 8000-10000ms) - Ensure image URL is publicly accessible
- Try
headless: falseto debug - Check if image loads in regular browser
Anti-Detection Features
- Removes
navigator.webdriverflag - Sets proper Chrome runtime objects
- Configures realistic browser headers
- Simulates human mouse movements (optional)
- Uses latest Chrome user agent
- Disables automation features
License
MIT
Author
TejasLamba2006
Links
Disclaimer
This library automates Google Lens access. Please comply with Google's Terms of Service. Use responsibly and avoid excessive requests.
