Fixes for changes in OEBB website
This commit is contained in:
parent
609194dd97
commit
9f7bf662c2
|
@ -21,8 +21,8 @@ def getService(sid, lines, q, eq = None):
|
|||
depdate = dep.find("td", { "class": "date" }).string.strip() or None
|
||||
deptime = dep.find("td", { "class": "timeValue" }).find("span").string.split()[1].strip()
|
||||
|
||||
depprog = dep.find("span", { "class": "prognosis" }).find("span").string.strip() if dep.find("span", { "class": "prognosis" }).find("span") else None
|
||||
depplat = dep.find("td", { "class": "platform" }).find("span").string.strip() if dep.find("td", { "class": "platform" }).find("span") else None
|
||||
depprog = dep.find("span", { "class": "prognosis" }).find("span").string.strip() if dep.find("span", { "class": "prognosis" }) and dep.find("span", { "class": "prognosis" }).find("span") else None
|
||||
depplat = dep.find("td", { "class": "platform" }).find("span").string.strip() if dep.find("td", { "class": "platform" }) and dep.find("td", { "class": "platform" }).find("span") else None
|
||||
|
||||
walk = dep.find("img", { "class": "product" }).get("src") == "/img/vs_oebb/fuss_pic.gif"
|
||||
name = dep.find("img", { "class": "product" }).get("alt") if not walk else "Walk"
|
||||
|
@ -41,15 +41,17 @@ def getService(sid, lines, q, eq = None):
|
|||
dest = None
|
||||
|
||||
if not (walk or depdate):
|
||||
purl = dep.find("td", { "class": "product" }).find("a").get("href")
|
||||
psource = HTTPClient().get(purl).text
|
||||
try:
|
||||
purl = dep.find("td", { "class": "product" }).find("a").get("href")
|
||||
psource = HTTPClient().get(purl).text
|
||||
zuppa = BeautifulSoup(psource, "html5lib")
|
||||
depdate = zuppa.findAll("div", { "class": "block" })[1].text.strip()
|
||||
arrdate = depdate
|
||||
dest = list(workers.val.validateName(zuppa.findAll("div", { "class": "block" })[2].text.split(":")[1].strip()))[0]
|
||||
except:
|
||||
pass
|
||||
|
||||
zuppa = BeautifulSoup(psource, "html5lib")
|
||||
depdate = zuppa.findAll("div", { "class": "block" })[1].text.strip()
|
||||
arrdate = depdate
|
||||
dest = list(workers.val.validateName(zuppa.findAll("div", { "class": "block" })[2].text.split(":")[1].strip()))[0]
|
||||
|
||||
elif not depdate:
|
||||
if not walk and not depdate:
|
||||
depdate = "01.01.2000"
|
||||
arrdate = depdate
|
||||
|
||||
|
|
|
@ -3,11 +3,12 @@ import urllib.parse
|
|||
from classes import *
|
||||
|
||||
def getValidator(name):
|
||||
return HTTPClient().get("http://www.oebb.at/__ressources/system/stationsHafas.jsp?q=%s" % urllib.parse.quote(name)).text
|
||||
data = HTTPClient().get("http://scotty.oebb.at/bin/ajax-getstop.exe/dn?REQ0JourneyStopsS0A=255&REQ0JourneyStopsB=12&S=%s?&js=true&" % urllib.parse.quote(name)).text
|
||||
return "=".join(data.split("=")[1:]).split(";")[0]
|
||||
|
||||
def validateName(name):
|
||||
stations = json.loads(getValidator(name))
|
||||
for station in stations:
|
||||
for station in stations["suggestions"]:
|
||||
name = station["value"]
|
||||
sttype = station["type"]
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue