YandexImagesParser
1.0.0
Python module for parsing photos from Yandex.Images
To work you need to install or download the module. There are two ways to install the module:
$ git submodule add https://github.com/Ulbwaa/YandexImagesParser
$ git clone https://github.com/Ulbwaa/YandexImagesParser
For convenient work, it is recommended to use the first method.
$ pip install -r requirements.txt
from ImageParser import YandexImage
parser = YandexImage ()
print ( parser . about , parser . version )
>>> Yandex Images Parser 1.0-release
from ImageParser import YandexImage
parser = YandexImage ()
for item in parser . search ( "Hello world!" ):
print ( item . title )
print ( item . url )
print ( item . preview . url )
print ( "(" , item . size , ")" , sep = '' )
>>> Hello world! - SYNDICATE
>>> https://access.viasyndicate.com/wp-content/uploads/helloworld.jpg
>>> https://im0-tub-ru.yandex.net/i?id=f4c8a1308fd44579344172c874f228a4&n=13
>>> (1900*800)
YandexImage.search
function YandexImage.search
returns a list of elements having the following parameters:
self.title
(Shortened to a certain number of characters)self.description
(Abbreviated to a certain number of characters)self.domain
self.url
self.width
(In pixels)self.height
(In pixels)self.size
(View: 1280*720)self.preview.url
self.preview.width
(In pixels)self.preview.height
(In pixels)self.preview.size
(View: 1280*720)To get information in dict format use
self.__dict__
To filter your search, you can use the following functions:
from ImageParser import YandexImage
parser = YandexImage ()
for item in parser . search ( "Hello world!" , sizes = parser . size . large ):
print ( item . title )
print ( item . url )
print ( item . preview . url )
print ( "(" , item . size , ")" , sep = '' )
YandexImage.size
functionself.large
self.medium
self.small
To get information in dict format use
self.__dict__
More filters will be added in the future.