summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/DBRIS.pm
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-12-14 21:00:28 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2024-12-14 21:00:28 +0100
commit091f9fa04b5a44e8ccecc65b0dc22dc0d12a94d2 (patch)
treeac9ef7c93e2a3d9655135eb9203a197c0c67b366 /lib/Travel/Status/DE/DBRIS.pm
parentf6f56f81ffbf168c0fc313e63eb94911b88859dd (diff)
Add locationSearch support
Diffstat (limited to 'lib/Travel/Status/DE/DBRIS.pm')
-rw-r--r--lib/Travel/Status/DE/DBRIS.pm12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Travel/Status/DE/DBRIS.pm b/lib/Travel/Status/DE/DBRIS.pm
index 7743fce..2b19924 100644
--- a/lib/Travel/Status/DE/DBRIS.pm
+++ b/lib/Travel/Status/DE/DBRIS.pm
@@ -57,6 +57,10 @@ sub new {
$req
= "https://www.bahn.de/web/api/reiseloesung/orte/nearby?lat=${lat}&long=${lon}&radius=9999&maxNo=100";
}
+ elsif ( my $query = $conf{locationSearch} ) {
+ $req
+ = "https://www.bahn.de/web/api/reiseloesung/orte?suchbegriff=${query}&typ=ALL&limit=10";
+ }
# journey : https://www.bahn.de/web/api/reiseloesung/fahrt?journeyId=2%7C%23VN%231%23ST%231733779122%23PI%230%23ZI%23324190%23TA%230%23DA%23141224%231S%238000001%231T%231822%23LS%238000080%23LT%232050%23PU%2380%23RT%231%23CA%23DPN%23ZE%2326431%23ZB%23RE+26431%23PC%233%23FR%238000001%23FT%231822%23TO%238000080%23TT%232050%23&poly=true
else {
@@ -100,8 +104,8 @@ sub new {
if ( $conf{station} ) {
$self->parse_stationboard;
}
- elsif ( $conf{geoSearch} ) {
- $self->parse_geosearch;
+ elsif ( $conf{geoSearch} or $conf{locationSearch} ) {
+ $self->parse_search;
}
return $self;
@@ -129,7 +133,7 @@ sub new_p {
if ( $conf{station} ) {
$self->parse_stationboard;
}
- elsif ( $conf{geoSearch} ) {
+ elsif ( $conf{geoSearch} or $conf{locationSearch} ) {
$self->parse_search;
}
else {
@@ -237,7 +241,7 @@ sub get_with_cache_p {
return $promise;
}
-sub parse_geosearch {
+sub parse_search {
my ($self) = @_;
$self->{results} = [];