The site is not best,there are lot better site with free API to get weather info in eg JSON.
The site has language detection.
Just to get temp as a demo,
i use PhatomJS(to no load a browser) as a driver for selenium.
This is the simple way to get away not looking at JavaScript source for reverse engineer as mention bye @stranac.
The site has language detection.
Just to get temp as a demo,
i use PhatomJS(to no load a browser) as a driver for selenium.
This is the simple way to get away not looking at JavaScript source for reverse engineer as mention bye @stranac.
from selenium import webdriver from bs4 import BeautifulSoup import time browser = webdriver.PhantomJS() url = 'http://freemeteo.no/vaer/oslo/daglig-vaermelding/idag/?gid=3143244&language=norwegian&country=norway' browser.get(url) time.sleep(3) # Give source code to BeautifulSoup soup = BeautifulSoup(browser.page_source, 'lxml') temp = soup.select('#content > div.right-col > div.weather-now > div.today.clearfix > a.section.first > span.temp > strong') print(temp) print(temp[0].text)
Output:[<strong>2<em>°C</em></strong>]
2°C