Created
November 12, 2019 13:10
-
-
Save karngyan/98fa49ce9f34b13c32d049b4622d23bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, bs4, sys | |
base_url = "https://www.google.com" | |
r = requests.get(base_url) | |
soup = bs4.BeautifulSoup(r.text) | |
img = soup.select('img')[0] | |
image_url = img.get('src') | |
url = base_url + image_url | |
rm = requests.get(url) | |
file = open("/home/google.png", "wb") | |
for chunk in rm.iter_content(10**5): | |
file.write(chunk) | |
file.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment