diff options
-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; |