diff options
| author | Birte Kristina Friesel <birte.friesel@uos.de> | 2025-02-20 06:36:37 +0100 |
|---|---|---|
| committer | Birte Kristina Friesel <birte.friesel@uos.de> | 2025-02-20 09:36:37 +0100 |
| commit | 6141430b13ac39a606f8bfb8872aea490688abb0 (patch) | |
| tree | d4339cee0f93e473ba22bf469fa69cb6fd57b309 | |
| parent | ff4531822e5fd45cf620f62494538dcabf33cbe3 (diff) | |
what
| -rw-r--r-- | lib/Travel/Routing/DE/DBRIS.pm | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Travel/Routing/DE/DBRIS.pm b/lib/Travel/Routing/DE/DBRIS.pm index 22aef46..bae8e1b 100644 --- a/lib/Travel/Routing/DE/DBRIS.pm +++ b/lib/Travel/Routing/DE/DBRIS.pm @@ -214,6 +214,12 @@ sub new { say decode( 'utf-8', $content ); } + # Sometimes, bahn.de adds garbage at the end + if ( $content =~ m/^[^{]/ or $content =~ m/[^}]$/ ) { + $content =~ s/^[^{]+//; + $content =~ s/[^}]+$//; + } + $self->{raw_json} = $json->decode($content); if ( $conf{from} and $conf{to} ) { $self->parse_connections; |
