Python, How to download images from yandex and google - python

I found this "https://github.com/hardikvasa/google-images-download" and i'm usually using it with -u url link, but how i can make it download related images in each images result ? Each images in result have 7 related images when you clicked on it and 6 related images on yandex.
i'm looking for a solution to download(or get direct link) all images + related images with provided image search link (google/yandex)
Thank

Related

Is there a way to download photos from Google photos that match a certain pattern/style?

I have a large number of photos stored in Google Photos. I'd like to download (only) those that are screenshots I took from Instagram profiles in order to organize them locally (group photos of the same profile into the same folder).
I think the following would be necessary:
Log into Google
Iterate over images
Match each photo to a "pattern"
Download it
Run OCR and move it to a folder
I assume this should be possible to realize with Python. Step 3 is the one, I am really struggling with. Does anyone have a hint on how this could be done? Or is there even a tool out there that helps me doing, what I'd like to do? :)

The extension in image url is different from actual format

I downloaded an image from a url such as "https://www.xxxx.com/filename.jpeg. I expected that that image is a jpeg image whose format is acceptable for Computer Vision Annotation Tool (CVAT). However, it was saved as filename.heif or filename.jpeg.heif, so it causes an error when I tried to create a task with that image because heif format is not acceptable in CVAT. (CVAT automatically downloads images and create a task once I put image urls and submit them.)
I usually put more than 1000 image urls to create a task, and it is really hard to find invalid url or image among them.
Is there any way to find the "actual format" only by looking at the image url? Or can I just skip invalid urls in CVAT?
Thank you.

How to break "select different image" CAPTCHA with Python

So I have this code in Python3 that scraps data from websites through object recongnition (I used this to automate the download process inside a flash player based website) and Selenium. The problem is that I'm stuck with this website that have a custom made Captcha where the user have to select the different image from the group and I donĀ“t know how to download or get these images from the site in order to identify the different one, has anyone solved a problem like this? or have an idea on how to solve this captcha with any other technique or method?
This is the login that has the CAPTCHA
And here's the link to the site which is in spanish. The captcha basically says "Select the different image"
https://portalempresas.sb.cl/login.php
Thanks!
To download those images as png files you could do:
from io import BytesIO
from PIL import Image
# Download image function
def downloadImage(element,imgName):
img = element.screenshot_as_png
stream = BytesIO(img)
image = Image.open(stream).convert("RGB")
image.save(imgName)
# Find all the web elements of the captcha images
image_elements = driver.find_elements_by_xpath("*//div[contains(#class,'captcha-image')]")
# Output name for the images
image_base_name = "Imagen_[idx].png"
# Download each image
for i in range(len(image_elements)):
downloadImage(image_elements[i],image_base_name.replace("[idx]","%s"%i))
Edit 1:
If you want to compare 2 images to see if they are equal you could try with this post
Edit 2:
Using the solution edited above, these are the results:

how to extract youtube thumbnail from youtube link in python

I want to extract and display Youtube search results for a query to the user.
In that process, I have completed fetching the Youtube link and also extracted the title from the link.
Nevertheless I also want the thumbnail of that link displayed, same as that displayed in Youtube suggestions section.
For a question like this, I'd recommend using the site:youtube.com Google Images search, and just have a look at one or two thumbnails. I believe the below should work in all cases, though you'd need to test on different types of videos.
If the video URL is https://www.youtube.com/watch?v=xxxxxxxxxxxx
The thumbnail URL is https://i.ytimg.com/vi/xxxxxxxxxxxx/maxresdefault.jpg

Download images from google drive [duplicate]

This question already has an answer here:
Downloading Images from Google Drive
(1 answer)
Closed 6 years ago.
I have multiple google drive images url in the text file, I want to download each image from its url, Here catch is I want to download and save images to it's original name.
Here is the reference
Can anyone help me with the solution
Alternate Solution:
I have found out one solution to make it download images
Original URL:-
https://drive.google.com/open?id=0BwJzkr_gZEA0d1h2dTN6MndvdkE
Convert it to:-
https://drive.google.com/uc?export=download&id=0BwJzkr_gZEA0d1h2dTN6MndvdkE
After that add this url into IDM you will able to download image with original name.
Hope that will help.
Have you try to do it throught Google Drive API :
here to create a simple script and here for endpoints

Categories