Loading bin/dbris +3 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ use List::Util qw(max); use Travel::Status::DE::DBRIS; use Travel::Routing::DE::DBRIS; my ( $date, $time, $from, $to ); my ( $date, $time, $from, $to, $language ); my $mots; my $discounts; my $developer_mode; Loading @@ -39,6 +39,7 @@ GetOptions( 'h|help' => sub { show_help(0) }, 'f|full-route' => \$show_full_route, 'm|modes-of-transit=s' => \$mots, 'l|language=s' => \$language, 't|time=s' => \$time, 'V|version' => \&show_version, 'cache!' => \$use_cache, Loading Loading @@ -94,6 +95,7 @@ sub get_stop { my %opt = ( from => get_stop($from_raw), to => get_stop($to_raw), language => $language, cache => $cache, developer_mode => $developer_mode, ); Loading lib/Travel/Routing/DE/DBRIS.pm +12 −12 Original line number Diff line number Diff line Loading @@ -36,11 +36,14 @@ sub new { $ua->env_proxy; } # Supported Languages: de cs da en es fr it nl pl my $self = { cache => $conf{cache}, developer_mode => $conf{developer_mode}, from => $conf{from}, to => $conf{to}, language => $conf{language} // 'de', ua => $ua, }; Loading @@ -53,6 +56,10 @@ sub new { @mots = @{ $conf{modes_of_transit} // [] }; } my $req_url = $self->{language} eq 'de' ? 'https://www.bahn.de/web/api/angebote/fahrplan' : 'https://int.bahn.de/web/api/angebote/fahrplan'; my $req = { abfahrtsHalt => $conf{from}->id, ankunftsHalt => $conf{to}->id, Loading Loading @@ -133,9 +140,7 @@ sub new { say "requesting $req_str"; } my ( $content, $error ) = $self->post_with_cache( 'https://www.bahn.de/web/api/angebote/fahrplan', $req_str ); my ( $content, $error ) = $self->post_with_cache( $req_url, $req_str ); if ($error) { $self->{errstr} = $error; Loading Loading @@ -215,13 +220,8 @@ sub post_with_cache { my $reply = $self->{ua}->post( $url, Accept => 'application/json', 'Accept-Language' => $self->{language}, 'Content-Type' => 'application/json; charset=utf-8', Origin => 'https://www.bahn.de', Referer => 'https://www.bahn.de/buchung/fahrplan/suche', 'Sec-Fetch-Dest' => 'empty', 'Sec-Fetch-Mode' => 'cors', 'Sec-Fetch-Site' => 'same-origin', TE => 'trailers', Content => $req, ); Loading Loading
bin/dbris +3 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ use List::Util qw(max); use Travel::Status::DE::DBRIS; use Travel::Routing::DE::DBRIS; my ( $date, $time, $from, $to ); my ( $date, $time, $from, $to, $language ); my $mots; my $discounts; my $developer_mode; Loading @@ -39,6 +39,7 @@ GetOptions( 'h|help' => sub { show_help(0) }, 'f|full-route' => \$show_full_route, 'm|modes-of-transit=s' => \$mots, 'l|language=s' => \$language, 't|time=s' => \$time, 'V|version' => \&show_version, 'cache!' => \$use_cache, Loading Loading @@ -94,6 +95,7 @@ sub get_stop { my %opt = ( from => get_stop($from_raw), to => get_stop($to_raw), language => $language, cache => $cache, developer_mode => $developer_mode, ); Loading
lib/Travel/Routing/DE/DBRIS.pm +12 −12 Original line number Diff line number Diff line Loading @@ -36,11 +36,14 @@ sub new { $ua->env_proxy; } # Supported Languages: de cs da en es fr it nl pl my $self = { cache => $conf{cache}, developer_mode => $conf{developer_mode}, from => $conf{from}, to => $conf{to}, language => $conf{language} // 'de', ua => $ua, }; Loading @@ -53,6 +56,10 @@ sub new { @mots = @{ $conf{modes_of_transit} // [] }; } my $req_url = $self->{language} eq 'de' ? 'https://www.bahn.de/web/api/angebote/fahrplan' : 'https://int.bahn.de/web/api/angebote/fahrplan'; my $req = { abfahrtsHalt => $conf{from}->id, ankunftsHalt => $conf{to}->id, Loading Loading @@ -133,9 +140,7 @@ sub new { say "requesting $req_str"; } my ( $content, $error ) = $self->post_with_cache( 'https://www.bahn.de/web/api/angebote/fahrplan', $req_str ); my ( $content, $error ) = $self->post_with_cache( $req_url, $req_str ); if ($error) { $self->{errstr} = $error; Loading Loading @@ -215,13 +220,8 @@ sub post_with_cache { my $reply = $self->{ua}->post( $url, Accept => 'application/json', 'Accept-Language' => $self->{language}, 'Content-Type' => 'application/json; charset=utf-8', Origin => 'https://www.bahn.de', Referer => 'https://www.bahn.de/buchung/fahrplan/suche', 'Sec-Fetch-Dest' => 'empty', 'Sec-Fetch-Mode' => 'cors', 'Sec-Fetch-Site' => 'same-origin', TE => 'trailers', Content => $req, ); Loading