Yandex
Classes
Yandex
Bases: BaseSearchEngine[YandexResponse]
API client for the Yandex reverse image search engine.
This class provides an interface to perform reverse image searches using Yandex's service. It supports searching by both image URL and local image file upload.
Attributes:
Name | Type | Description |
---|---|---|
base_url |
str
|
The base URL for Yandex image search service. |
Note
- The service might be affected by regional restrictions.
- Search results may vary based on the user's location and Yandex's algorithms.
Source code in PicImageSearch/engines/yandex.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
Functions
__init__(base_url='https://yandex.com', **request_kwargs)
Initializes a Yandex API client with specified configurations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url
|
str
|
The base URL for Yandex searches. |
'https://yandex.com'
|
**request_kwargs
|
Any
|
Additional arguments for network requests. |
{}
|
Source code in PicImageSearch/engines/yandex.py
23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
search(url=None, file=None, **kwargs)
async
Performs a reverse image search on Yandex.
This method supports two ways of searching
- Search by image URL
- Search by uploading a local image file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
Optional[str]
|
URL of the image to search. |
None
|
file
|
Union[str, bytes, Path, None]
|
Local image file, can be a path string, bytes data, or Path object. |
None
|
**kwargs
|
Any
|
Additional arguments passed to the parent class. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
YandexResponse |
YandexResponse
|
An object containing: - Search results and metadata - The final search URL used by Yandex |
Raises:
Type | Description |
---|---|
ValueError
|
If neither |
Note
- Only one of
url
orfile
should be provided. - When using file upload, the image will be sent to Yandex's servers.
- The search process involves standard Yandex parameters like
rpt
andcbir_page
.
Source code in PicImageSearch/engines/yandex.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|