From 1cf1aeeabe4b64f523874ef0018f3e52f002f67f Mon Sep 17 00:00:00 2001 From: Lars Schwarz Date: Mon, 12 Aug 2024 20:31:56 +0200 Subject: [PATCH 1/7] Update oldenburg.py pls2.php returns a 301 and redirects to pls.php. Changed source_url to pls2.php therefore. --- original/oldenburg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/original/oldenburg.py b/original/oldenburg.py index f561256..1c9d294 100644 --- a/original/oldenburg.py +++ b/original/oldenburg.py @@ -12,7 +12,7 @@ class Oldenburg(ScraperBase): id="oldenburg", name="Oldenburg", public_url="https://oldenburg-service.de/pls/", - source_url="https://oldenburg-service.de/pls2.php", + source_url="https://oldenburg-service.de/pls.php", timezone="Europe/Berlin", attribution_contributor="Stadt Oldenburg", attribution_license=None, From 4619454be90a6abf6d11ae7fd7b4177e0cd674a0 Mon Sep 17 00:00:00 2001 From: Lars Schwarz Date: Mon, 12 Aug 2024 20:46:22 +0200 Subject: [PATCH 2/7] Update oldenburg.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added Parkhaus August Carrée, removed Parkhaus Ärztehaus. Also added "Parkhaus" to the existing special Umlaut handling cases to differentiate, because the site lists parking garages and parking spaces. --- original/oldenburg.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/original/oldenburg.py b/original/oldenburg.py index 1c9d294..672fa3c 100644 --- a/original/oldenburg.py +++ b/original/oldenburg.py @@ -38,11 +38,11 @@ def get_lot_data(self) -> List[LotData]: parking_name = td[0].string # work-around for the Umlaute-problem: ugly but working if 'Heiligengeist-' in parking_name: - parking_name = 'Heiligengeist-Höfe' + parking_name = 'Parkhaus Heiligengeist-Höfe' elif 'Schlossh' in parking_name: - parking_name = 'Schlosshöfe' - elif 'Aerztehaus' == parking_name: - parking_name = 'Ärztehaus' + parking_name = 'Parkhaus Schlosshöfe' + elif 'August Carr' == parking_name: + parking_name = 'Parkhaus August Carrée' parking_free = None parking_state = LotData.Status.open From 537dfb5783b0646c5811e84d0d37ade37bd09b01 Mon Sep 17 00:00:00 2001 From: Lars Schwarz Date: Mon, 12 Aug 2024 21:24:23 +0200 Subject: [PATCH 3/7] Update oldenburg.geojson Removed old parking garages --- original/oldenburg.geojson | 62 +------------------------------------- 1 file changed, 1 insertion(+), 61 deletions(-) diff --git a/original/oldenburg.geojson b/original/oldenburg.geojson index cfecbbd..6f04b37 100644 --- a/original/oldenburg.geojson +++ b/original/oldenburg.geojson @@ -1,66 +1,6 @@ { "type": "FeatureCollection", "features": [ - { - "type": "Feature", - "properties": { - "id": "oldenburgaerztehaus", - "name": "Ärztehaus", - "type": "lot", - "public_url": null, - "source_url": null, - "address": "Brandenburger Straße 21", - "capacity": null, - "has_live_capacity": false - }, - "geometry": { - "type": "Point", - "coordinates": [ - 8.21986, - 53.11142 - ] - } - }, - { - "type": "Feature", - "properties": { - "id": "oldenburgccoparkdeck1", - "name": "CCO Parkdeck 1", - "type": "level", - "public_url": null, - "source_url": null, - "address": "Heiligengeiststraße 4", - "capacity": 190, - "has_live_capacity": false - }, - "geometry": { - "type": "Point", - "coordinates": [ - 8.21322, - 53.14406 - ] - } - }, - { - "type": "Feature", - "properties": { - "id": "oldenburgccoparkdeck2", - "name": "CCO Parkdeck 2", - "type": "level", - "public_url": null, - "source_url": null, - "address": "Heiligengeiststraße 4", - "capacity": 230, - "has_live_capacity": false - }, - "geometry": { - "type": "Point", - "coordinates": [ - 8.21322, - 53.14406 - ] - } - }, { "type": "Feature", "properties": { @@ -262,4 +202,4 @@ } } ] -} \ No newline at end of file +} From 4c40aa29bbf7d9f32e9c97269fa30850afac02ec Mon Sep 17 00:00:00 2001 From: Lars Schwarz Date: Mon, 12 Aug 2024 21:50:09 +0200 Subject: [PATCH 4/7] Update oldenburg.geojson --- original/oldenburg.geojson | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/original/oldenburg.geojson b/original/oldenburg.geojson index 6f04b37..522cd48 100644 --- a/original/oldenburg.geojson +++ b/original/oldenburg.geojson @@ -4,14 +4,14 @@ { "type": "Feature", "properties": { - "id": "oldenburgcinemaxx", + "id": "oldenburgparkhausalterstadthafencinemaxx", "name": "Cinemaxx", "type": "garage", "public_url": null, "source_url": null, "address": "Stau 79-85", "capacity": 0, - "has_live_capacity": false + "has_live_capacity": true }, "geometry": { "type": "Point", @@ -24,14 +24,14 @@ { "type": "Feature", "properties": { - "id": "oldenburgcity", + "id": "oldenburgcityparkhausstaulinie", "name": "City", "type": "garage", "public_url": null, "source_url": null, "address": "Staulinie 10", "capacity": 440, - "has_live_capacity": false + "has_live_capacity": true }, "geometry": { "type": "Point", @@ -44,14 +44,14 @@ { "type": "Feature", "properties": { - "id": "oldenburggaleriakaufhof", + "id": "oldenburgparkhausgaleriakaufhof", "name": "Galeria Kaufhof", "type": "garage", "public_url": null, "source_url": null, "address": "Ritterstraße", "capacity": 326, - "has_live_capacity": false + "has_live_capacity": true }, "geometry": { "type": "Point", @@ -64,14 +64,14 @@ { "type": "Feature", "properties": { - "id": "oldenburghbfzob", + "id": "oldenburgparkhausbahnhofzob", "name": "Hbf/ZOB", "type": "garage", "public_url": null, "source_url": null, "address": "Karlstraße", "capacity": 358, - "has_live_capacity": false + "has_live_capacity": true }, "geometry": { "type": "Point", @@ -84,14 +84,14 @@ { "type": "Feature", "properties": { - "id": "oldenburgheiligengeisthoefe", + "id": "oldenburgparkhausheiligengeisthoefe", "name": "Heiligengeist-Höfe", "type": "garage", "public_url": null, "source_url": null, "address": "Georgstraße", "capacity": 275, - "has_live_capacity": false + "has_live_capacity": true }, "geometry": { "type": "Point", @@ -104,14 +104,14 @@ { "type": "Feature", "properties": { - "id": "oldenburgpferdemarkt", + "id": "oldenburgparkplatzpferdemarkt", "name": "Pferdemarkt", "type": "lot", "public_url": null, "source_url": null, "address": "Pferdemarkt 13", "capacity": 401, - "has_live_capacity": false + "has_live_capacity": true }, "geometry": { "type": "Point", @@ -124,14 +124,14 @@ { "type": "Feature", "properties": { - "id": "oldenburgschlosshoefe", + "id": "oldenburgparkhausschlosshoefe", "name": "Schlosshöfe", "type": "garage", "public_url": null, "source_url": null, "address": "Mühlenstraße", "capacity": 430, - "has_live_capacity": false + "has_live_capacity": true }, "geometry": { "type": "Point", @@ -144,14 +144,14 @@ { "type": "Feature", "properties": { - "id": "oldenburgtheatergarage", + "id": "oldenburgparkhaustheatergarage", "name": "Theatergarage", "type": "garage", "public_url": null, "source_url": null, "address": "Roonstraße", "capacity": 107, - "has_live_capacity": false + "has_live_capacity": true }, "geometry": { "type": "Point", @@ -164,14 +164,14 @@ { "type": "Feature", "properties": { - "id": "oldenburgtheaterwall", + "id": "oldenburgparkplatztheaterwall", "name": "Theaterwall", "type": "lot", "public_url": null, "source_url": null, "address": "Theaterwall 4", "capacity": 125, - "has_live_capacity": false + "has_live_capacity": true }, "geometry": { "type": "Point", @@ -184,14 +184,14 @@ { "type": "Feature", "properties": { - "id": "oldenburgwaffenplatz", + "id": "oldenburgparkhausamwaffenplatz", "name": "Waffenplatz", "type": "garage", "public_url": null, "source_url": null, "address": "Waffenplatz 3", "capacity": 650, - "has_live_capacity": false + "has_live_capacity": true }, "geometry": { "type": "Point", From f5d73bf67b9225254a5af685d9bee54444afc78c Mon Sep 17 00:00:00 2001 From: Lars Schwarz Date: Mon, 12 Aug 2024 21:53:38 +0200 Subject: [PATCH 5/7] Update oldenburg.geojson --- original/oldenburg.geojson | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/original/oldenburg.geojson b/original/oldenburg.geojson index 522cd48..a978b7a 100644 --- a/original/oldenburg.geojson +++ b/original/oldenburg.geojson @@ -200,6 +200,27 @@ 53.14169 ] } + }, + { + "type": "Feature", + "properties": { + "id": "oldenburgparkhausaugustcarrée", + "name": "August Carrée", + "type": "garage", + "public_url": null, + "source_url": null, + "address": "Auguststraße 7", + "capacity": 650, + "has_live_capacity": true + }, + "geometry": { + "type": "Point", + "coordinates": [ + 8.2032572, + 53.1426765 + ] + } } + ] } From 9f20ae93722b071699f6ab2989f94364870745ff Mon Sep 17 00:00:00 2001 From: Lars Schwarz Date: Mon, 12 Aug 2024 22:12:15 +0200 Subject: [PATCH 6/7] Update oldenburg.geojson New naming, removed old parking garages (3), added new one and added live capacity --- original/oldenburg.geojson | 1 + 1 file changed, 1 insertion(+) diff --git a/original/oldenburg.geojson b/original/oldenburg.geojson index a978b7a..b904598 100644 --- a/original/oldenburg.geojson +++ b/original/oldenburg.geojson @@ -224,3 +224,4 @@ ] } + From b51e66ed2210ec8fcf94b0b6248cfbf8a80f50fb Mon Sep 17 00:00:00 2001 From: Lars Schwarz Date: Mon, 12 Aug 2024 22:14:02 +0200 Subject: [PATCH 7/7] Update oldenburg.py Changed parsing (site now uses 2 tables instead of one), added live capacity, removed old parking garages, added new one --- original/oldenburg.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/original/oldenburg.py b/original/oldenburg.py index 672fa3c..ae363df 100644 --- a/original/oldenburg.py +++ b/original/oldenburg.py @@ -29,8 +29,10 @@ def get_lot_data(self) -> List[LotData]: last_updated = str(soup.select("body")) start = last_updated.find("Letzte Aktualisierung:") + 23 last_updated = self.to_utc_datetime(last_updated[start:start + 16]) - - for tr in soup.find_all("tr"): + + table = soup.find_all("table") +# The site now uses 2 tables. Table 1 holds the last updated info, table 2 the actual data. Tables dont have any ID or Class so we use 0 and 1 + for tr in table[1].find_all("tr"): if tr.td is None: continue @@ -46,13 +48,13 @@ def get_lot_data(self) -> List[LotData]: parking_free = None parking_state = LotData.Status.open - if 'Geschlossen' in td[3].text: + if 'Geschlossen' in td[4].text: parking_state = LotData.Status.closed try: - parking_free = int(td[1].text) + parking_free = int(td[2].text) except: parking_state = LotData.Status.nodata - + parking_capacity = int(td[1].text) lots.append( LotData( timestamp=timestamp, @@ -60,6 +62,7 @@ def get_lot_data(self) -> List[LotData]: id=name_to_legacy_id("oldenburg", parking_name), status=parking_state, num_free=parking_free, + capacity=parking_capacity ) )