Jun-23-2020, 11:50 AM
Ok, I been working on this half the night. Just can't get it to work. I am just not sure how to download all the maps. Their will be many files, I can download one map but that is it. here is what I been working with. the last of many ways.
import requests from bs4 import BeautifulSoup url = 'http://legacy.lib.utexas.edu/maps/topo/indiana/' response = requests.get(url) soup = BeautifulSoup(response.content, 'html.parser') maps = soup.select_one('#actualcontent > ul') map_link = maps.find_all('a') for link in map_link: print(link.get('href')) for map in maps: with open("maps.jpg", "wb") as file: file.write(response.content) file.closeI have the script in its own folder so the maps should be saved in the folder that the script is in. Maybe a while loop will work better. I am just lost on saving the images.