Metadata-Version: 2.4
Name: yandex-ris
Version: 0.1.2
Summary: A professional reverse image search and crawling tool that uses Yandex's image search engine to find and download similar images.
Home-page: https://github.com/BIGBALLON/yandex-ris
Author: BIGBALLON
Author-email: fm.bigballon@gmail.com
Project-URL: Bug Reports, https://github.com/BIGBALLON/yandex-ris/issues
Project-URL: Source, https://github.com/BIGBALLON/yandex_ris
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
Classifier: Topic :: Multimedia :: Graphics
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: selenium>=4.18.1
Requires-Dist: webdriver-manager>=4.0.1
Requires-Dist: beautifulsoup4>=4.12.3
Requires-Dist: icrawler>=0.6.10
Requires-Dist: python-dateutil>=2.8.2
Requires-Dist: colorlog>=6.8.2
Requires-Dist: tqdm>=4.66.2
Requires-Dist: requests>=2.31.0
Requires-Dist: urllib3>=2.0.0
Requires-Dist: lxml>=5.1.0
Requires-Dist: pillow>=10.2.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 🔍 Yandex Reverse Image Search Tool

A professional reverse image search and crawling tool that uses [Yandex](https://yandex.ru/images/)'s image search engine to find and download similar images.

- Advanced reverse image search with Yandex's AI engine
- Support for local images, URLs, and directories
- Multi-process parallel processing
- Automatic resume for interrupted operations

![demo](https://github.com/user-attachments/assets/737830de-ba18-4093-a9f3-d7f69713cff1)

> Note: Yandex may restrict access if too many requests are made concurrently.  
> -> https://yandex.ru/images/

## Installation

1. Install Python(3.8 or higher) dependencies: ``pip install yandex-ris``
2. Install Google Chrome and ChromeDriver (**matching your Chrome version**)

<details>
<summary>check Chrome & Chromedriver Info</summary>

```bash
>>> which chromedriver
/usr/local/bin/chromedriver
>>> which google-chrome
/usr/bin/google-chrome
>>> google-chrome --version
Google Chrome 137.0.7151.68 
>>> chromedriver --version
ChromeDriver 137.0.7151.68 (2989ffee9373ea8b8623bd98b3cb350a8e95cadc-refs/branch-heads/7151@{#1873})
```

</details> 

## Usage

### 💻 Command Line Interface

```bash
# Basic usage with a single image
yandex-ris -i image.jpg -o output_dir

# Process all images in a directory
yandex-ris -i images_folder -o output_dir

# Process images from a URL
yandex-ris -i https://example.com/image.jpg -o output_dir

# Process images from a list file
yandex-ris -i image_list.txt -o output_dir

# With custom options
yandex-ris -i input_path -o output_dir -m 200 -w 4 -t 8
```

### Configuration

- `--input`, `-i`: Input path (file, directory or URL) (required)
- `--output`, `-o`: Output root directory (default: downloaded_images)
- `--max-images`, `-m`: Maximum images to download per source (default: 100)
- `--pause-time`, `-p`: Page load wait time in seconds (default: 7)
- `--workers`, `-w`: Number of parallel processing workers (default: 2)
- `--download-threads`, `-t`: Download threads per process (default: 4)
- `--log-level`: Logging level (default: INFO)

### 📝 Input Types

The tool supports multiple input types:
1. Single image file (e.g., `image.jpg`)
2. Directory containing images (will recursively scan for images)
3. Image URL (e.g., `https://example.com/image.jpg`)
4. Text file containing a list of paths/URLs (one per line)

### 🐍 Python API

```python
from yandex_ris import YandexImageCrawler

crawler = YandexImageCrawler(
    output_dir="downloaded_images",
    max_images=100,
    workers=4,
    download_threads=4
)

# Process a single image
crawler.process_images(["path/to/image.jpg"])

# Process multiple images
crawler.process_images([
    "path/to/image1.jpg",
    "path/to/image2.jpg",
    "https://example.com/image.jpg"
])
```

## TODO

- [ ] Support downloading original/full-size images instead of thumbnails
- [ ] Add proxy support to bypass regional restrictions and reduce the risk of IP bans
- [ ] Improve robustness against Yandex's anti-scraping mechanisms:

## Disclaimer

This tool is provided solely for research and educational purposes. By using this tool, you agree to abide by the following terms and conditions:

1. **Permitted Use**: This tool is intended strictly for non-commercial, research, and educational use.
2. **Prohibited Use**: Any use of this tool for unlawful, malicious, or unauthorized purposes is strictly prohibited.
3. **User Responsibility**: Users are fully responsible for ensuring that their use of this tool complies with all applicable local, national, and international laws and regulations.
4. **Liability Disclaimer**: The developers, contributors, and maintainers of this tool shall not be held liable for any direct, indirect, incidental, or consequential damages arising from the use or misuse of this tool.
5. **No Warranty**: This tool is provided "as is", without any warranties, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, or non-infringement.
6. **Consequences of Misuse**: Any misuse of this tool, particularly for malicious or illegal activities, may result in the violation of laws and could lead to civil or criminal penalties.

By using this tool, you acknowledge that you have read, understood, and agreed to be bound by these terms.

## License

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

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.
