import urllib3 def finde(s,f): index = s.find(f) if(index == -1): exit() return(index) def stationInfo(name): user_agent = {'user-agent': 'agen'} http = urllib3.PoolManager(10,headers=user_agent) url = http.urlopen('GET',"https://www.stationsweb.nl/station.asp?station="+name) s = str(url.data) #f = open("station.asp?station=bobeldijk") #s = f.read() s= s[finde(s,"Geopend")+5:] s= s[finde(s,"op"):] s= s[finde(s,"td"):] s= s[finde(s,"td"):] s= s[finde(s,">")+1:] t= s[:finde(s,"<")] datum = t.split(" ") print(datum) #print(f"Geopend op {datum[0]} {datum[1]} {datum[2]}") s= s[finde(s,"Gesloten")+48:] t= s[:finde(s,"<")] datum = t.split(" ") print(f"Gesloten op {datum[0]} {datum[1]} {datum[2]}") stationInfo("culemborg")