Skip to content

Commit

Permalink
fix ulm
Browse files Browse the repository at this point in the history
  • Loading branch information
the-infinity committed Dec 26, 2023
1 parent 89683db commit 5b6ddd1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 33 deletions.
40 changes: 20 additions & 20 deletions original/ulm.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"source_url": null,
"address": "Bahnhofsplatz 8",
"capacity": 540,
"has_live_capacity": false
"has_live_capacity": true
},
"geometry": {
"type": "Point",
Expand All @@ -30,8 +30,8 @@
"public_url": "https://www.parken-in-ulm.de/parkhaeuser/rathaus.php",
"source_url": null,
"address": "Neue Str. 113",
"capacity": 558,
"has_live_capacity": false
"capacity": 555,
"has_live_capacity": true
},
"geometry": {
"type": "Point",
Expand All @@ -44,14 +44,14 @@
{
"type": "Feature",
"properties": {
"id": "ulmcongresscentrumnordbasteicenter",
"id": "ulmccunord",
"name": "Congress Centrum Nord / Basteicenter",
"type": "underground",
"public_url": "https://www.parken-in-ulm.de/parkhaeuser/congress_nord.php",
"source_url": null,
"address": "Wichernstraße",
"capacity": 400,
"has_live_capacity": false
"has_live_capacity": true
},
"geometry": {
"type": "Point",
Expand All @@ -64,14 +64,14 @@
{
"type": "Feature",
"properties": {
"id": "ulmcongresscentrumsuedmaritimhotel",
"id": "ulmccusued",
"name": "Congress Centrum Süd / Maritim Hotel",
"type": "underground",
"public_url": "https://www.parken-in-ulm.de/parkhaeuser/congress_sued.php",
"source_url": null,
"address": "Basteistraße 46",
"capacity": 240,
"has_live_capacity": false
"capacity": 235,
"has_live_capacity": true
},
"geometry": {
"type": "Point",
Expand All @@ -91,7 +91,7 @@
"source_url": null,
"address": "Friedrich-Ebert-Straße 8",
"capacity": 594,
"has_live_capacity": false
"has_live_capacity": true
},
"geometry": {
"type": "Point",
Expand All @@ -110,8 +110,8 @@
"public_url": "https://www.parken-in-ulm.de/parkhaeuser/fischerviertel.php",
"source_url": null,
"address": "Schwilmengasse",
"capacity": 395,
"has_live_capacity": false
"capacity": 326,
"has_live_capacity": true
},
"geometry": {
"type": "Point",
Expand All @@ -130,8 +130,8 @@
"public_url": "https://www.parken-in-ulm.de/parkhaeuser/frauenstrasse.php",
"source_url": null,
"address": "Rosengasse 19",
"capacity": 770,
"has_live_capacity": false
"capacity": 780,
"has_live_capacity": true
},
"geometry": {
"type": "Point",
Expand All @@ -150,8 +150,8 @@
"public_url": "https://www.parken-in-ulm.de/parkhaeuser/kornhaus.php",
"source_url": null,
"address": "Rosengasse 9",
"capacity": 135,
"has_live_capacity": false
"capacity": 70,
"has_live_capacity": true
},
"geometry": {
"type": "Point",
Expand All @@ -170,8 +170,8 @@
"public_url": "https://www.parken-in-ulm.de/parkhaeuser/salzstadel.php",
"source_url": null,
"address": "Salzstadelgasse 14",
"capacity": 530,
"has_live_capacity": false
"capacity": 520,
"has_live_capacity": true
},
"geometry": {
"type": "Point",
Expand All @@ -190,8 +190,8 @@
"public_url": "https://www.parken-in-ulm.de/parkhaeuser/theater.php",
"source_url": null,
"address": "Olgastraße 63",
"capacity": 83,
"has_live_capacity": false
"capacity": 80,
"has_live_capacity": true
},
"geometry": {
"type": "Point",
Expand All @@ -202,4 +202,4 @@
}
}
]
}
}
24 changes: 11 additions & 13 deletions original/ulm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,29 @@ class Ulm(ScraperBase):

def get_lot_data(self) -> List[LotData]:
timestamp = self.now()
soup = self.request_soup(self.POOL.public_url)
root = self.request_soup(self.POOL.public_url)

lots = []

table = soup.find('table', id='haupttabelle')
table2 = table.find('table', width='790')
rows = table2.find_all('tr')
for row in rows[3:12]:
parking_data = row.find_all('td')
parking_name = parking_data[0].text

try:
section = root.find('section', class_='s_live_counter')
cards = section.find_all('div', class_='card-container')
for card in cards:
parking_name = card.find('a', class_='stretched-link').text
parking_data = card.find('div', class_='counter-text').get_text().strip().split(' / ')
if parking_data[1] == '?':
parking_state = LotData.Status.open
parking_free = int(parking_data[2].text)
except:
parking_free = None
parking_free = int_or_none(parking_data[0])
else:
parking_state = LotData.Status.nodata
parking_free = None

lots.append(
LotData(
timestamp=timestamp,
id=name_to_legacy_id("ulm", parking_name),
status=parking_state,
num_free=parking_free,
capacity=int_or_none(parking_data[1].text),
capacity=int_or_none(parking_data[1]),
)
)

Expand Down

0 comments on commit 5b6ddd1

Please # to comment.