'Downloading image from capture node screenshot Chrome

I'm trying to download an imagem from a Node Screenshot from chrome, works fine when i'm doing manually, but how can I do it using python?



Solution 1:[1]

Well if you want to download a png for example i would use the urllib.request module. It's a module that uses requests to resolve functions.

# Importing required libraries
import urllib.request

# Adding information about user agent
opener=urllib.request.build_opener()
opener.addheaders=[('User-Agent','Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1941.0 Safari/537.36')]
urllib.request.install_opener(opener)

# setting filename and image URL
filename = 'sunshine_dog.jpg'
image_url = "https://cdn.pixabay.com/photo/2020/02/06/09/39/summer-4823612_960_720.jpg"

# calling urlretrieve function to get resource
urllib.request.urlretrieve(image_url, filename)

That is one way of downloading an Image with python For more techniques go to: https://www.kite.com/python/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1