Answers for "Python script to download all images from a website to a specified folder with BeautifulSoup"

0

Python script to download all images from a website to a specified folder with BeautifulSoup

# your imports
...
from selenium import webdriver

site = 'http://heroimages.com/portfolio'
directory = "pixabay/" #Relative to script location

driver = webdriver.Chrome('/usr/local/bin/chromedriver')

driver.get(site)

soup = BeautifulSoup(driver.page_source, 'html.parser')
img_tags = soup.find_all('img')

urls = [img['src'] for img in img_tags]

for url in urls:
    print(url)
    # your code
    ...
Posted by: Guest on May-08-2022

Code answers related to "Python script to download all images from a website to a specified folder with BeautifulSoup"

Python Answers by Framework

Browse Popular Code Answers by Language