В то время как другие ответы совершенно правильны.
Я нашел его очень медленным для загрузки и не знаю прогресса с изображениями с высоким разрешением.
Итак, сделайте это.
from bs4 import BeautifulSoup
import requests
import subprocess
url = "https://example.site/page/with/images"
html = requests.get(url).text # get the html
soup = BeautifulSoup(html, "lxml") # give the html to soup
# get all the anchor links with the custom class
# the element or the class name will change based on your case
imgs = soup.findAll("a", {"class": "envira-gallery-link"})
for img in imgs:
imgUrl = img['href'] # get the href from the tag
cmd = [ 'wget', texUrl ] # just download it using wget.
subprocess.Popen(cmd) # run the command to download
# if you don't want to run it parallel;
# and wait for each image to download just add communicate
subprocess.Popen(cmd).communicate()
Предупреждение: оно не будет работать на win/mac при использовании wget.
Бонус: вы можете видеть прогресс каждого изображения, если вы не используете связь.
BeautifulSoup предназначен для разбора HTML, 'запросы' предназначены для запросов по HTTP. Загрузка относится к последней категории. 'request.get', а затем проверьте документацию о том, как сохранить тело ответа. –