dimanche 22 août 2021

download an image with python

hi i want download an image in this link: https://cdn.mangaeden.com/mangasimg/20/200cce46395205ec41e1415dae82d0f625dd369e8c09b70f0b2ccf8e.jpg, but i can't open the created image. This is the fileenter image description here. How can i solve this? This is the code:

from requests.models import Response
import requests

url = 'https://beta.mangaeden.com/it/it-manga/jojo-no-kimyou-na-bouken---jojorion/1/1'
r = requests.get(url)
soup = BeautifulSoup(r.content, 'html.parser')
immagine = soup.find(id='mainImg')
src = str(immagine.get('src'))
link_immagine = "https:"+src
print(link_immagine)
'''download imagege'''
response = requests.get(link_immagine)
f = open("C:\\Users\\chris\\Desktop\\image.jpg", "wb")
f.write(response.content)
f.close()
print('download successfull')



Aucun commentaire:

Enregistrer un commentaire