Download svg image from website using python

Viewed 525

I am trying to create a simple weather script. The idea is to look in this website and extract the current temperature and the icon to its left.

I know how to extract the html code using request and extract the temperature. But I have no clue on how to get the icon. I am not sure on how to get the icon/image path (not sure even if is possible).

Here my code

import requests
import urllib
from bs4 import BeautifulSoup

url = "https://www.meteored.com.ar/tiempo-en_La+Plata-America+Sur-Argentina-Provincia+de+Buenos+Aires-SADL-1-16930.html"

hdr = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
   'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
   'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
   'Accept-Encoding': 'none',
   'Accept-Language': 'en-US,en;q=0.8',
   'Connection': 'keep-alive'}

a=urllib.request.Request(url,headers = hdr)
response = urllib.request.urlopen(a).read()

soup = BeautifulSoup(response,"lxml")

data =  soup.find_all(class_ = "dato-temperatura changeUnitT")
temperature = data[0].text
0 Answers
Related