Guest User

Untitled

a guest
May 13th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. import urllib.request as urllibR
  2.  
  3. import bs4
  4.  
  5. url = "https://www.dmi.dk/lokation/show/DK/2624652/Aarhus/"
  6.  
  7. dmi = urllibR.urlopen(url)
  8. dmiBS = bs4.BeautifulSoup(dmi.read(), "lxml")
  9.  
  10. images = []
  11. for link in dmiBS.find_all("img"):
  12.     images.append(link.get("src"))
  13. billed = "jeg fandt ikke noget :("
  14. for img in images:
  15.     print(img)
  16.     if "Russel_gletsjeren_i_2010_TN.jpg" in img:
  17.         billed = img
  18.  
  19. if billed != "jeg fandt ikke noget :(":
  20.     urllibR.urlretrieve("https://www.dmi.dk/"+billed, "Vejr.png")
  21.  
  22. print(billed)
Add Comment
Please, Sign In to add comment