Python Forum
Can not make this image downloader work
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can not make this image downloader work
#4
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.close    
I 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.
Reply


Messages In This Thread
RE: Can not make this image downloader work - by Blue Dog - Jun-23-2020, 11:50 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  m3u8 using build-in browser downloader? kucingkembar 3 414 Mar-29-2024, 01:47 AM
Last Post: kucingkembar
  RFC downloader not working sidsr003 2 2,790 Dec-19-2018, 09:31 PM
Last Post: snippsat
  How to make my code work with asyncio? DevinGP 0 2,741 Jan-09-2018, 06:21 PM
Last Post: DevinGP
  Multiple File Downloader Josh_Python890 1 2,521 Sep-16-2017, 11:19 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020