From 1027a850fbe1840d9fa2f461814a4ceadeb9a908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Mon, 13 Dec 2021 11:57:42 +0100 Subject: [PATCH] feat: add bvg disruptions script --- .bin/bvg.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 .bin/bvg.sh diff --git a/.bin/bvg.sh b/.bin/bvg.sh new file mode 100755 index 0000000..690e021 --- /dev/null +++ b/.bin/bvg.sh @@ -0,0 +1,46 @@ +#!/bin/sh +interesting="U6 N6 140 M46 184 N84" + +curl -sSL 'https://www.bvg.de/disruption-reports/q' \ + --data-raw '{"variables":{},"query":"{ + allDisruptions { + disruptions { + meldungsId + linie + verkehrsmittel + __typename + ... on Traffic { + datum + gueltigVonDatum + gueltigVonZeit + gueltigBisDatum + gueltigBisZeit + richtungName + richtungHafasId + beginnAbschnittName + beginnAbschnittHafasId + endeAbschnittName + endeAbschnittHafasId + textIntUrsache + sev + textIntAuswirkung + umfahrung + textWAPSMSUrsache + textWAPSMSAuswirkung + prioritaet + __typename + } + } + __typename + } + }"}' \ + | jq --arg interesting "$interesting" ' + .data.allDisruptions.disruptions + | map(select( + (.linie as $linie + | $interesting + | split(" ") + | index($linie)) + and (.["__typename"] == "Traffic") + )) + '