#!/usr/bin/env python # -*- coding: utf-8 -*- import json import re import requests request = requests.get('http://www.ipma.pt/pt/index.html') MATCH = re.search(r"var stations=(.*?)\;", request.text, re.DOTALL) """ text_file = open("bleh.json", "w") text_file.write(MATCH.group(1)) text_file.close() """ stations = json.loads(MATCH.group(1)) for s in stations: print(s['properties']['idEstacao'], s['properties']['localEstacao'])