abfahrt
v0.0.8
Published
a library for retrieving information about micromobility services like MILES Mobility GmbH with focus on the Berlin area
Downloads
5
Readme
abfahrt
a library for retrieving information about micromobility services like MILES Mobility GmbH with focus on the Berlin area.
$ npm install abfahrt
MILES examples
// make requests without an account
import { MilesClient, polygonToArea } from "abfahrt";
async function main() {
const miles = new MilesClient();
const areasResponse = await miles.getCityAreas();
const berlin = areasResponse.JSONCityAreas.areas.find(
(i) => i.idCity === "BER" && i.idCityLayerType === "CITY_SERVICE_AREA"
)!;
const berlinArea = polygonToArea(berlin);
const vehiclesResponses = await miles
.createVehicleSearch(berlinArea)
.execute();
console.log(
"amount of miles vehicles in berlin that are currently rentable:",
vehiclesResponses.length
);
}
main();
// make requests with an account
import { MilesClient } from "abfahrt";
async function main() {
const miles = new MilesClient();
// WARNING: this will sign you out of your MILES account on your phone.
await miles.loginWithCredentials"[email protected]", "yourMilesPassword");
const vehiclePricesRes = await miles.getVehiclePrices("S");
console.log("current vehicle prices:", vehiclePricesRes.length);
// no reason you would do this lol
await miles.logout();
}
main();
MILES device keys
every request to the MILES api requires a deviceKey
parameter.
a random device key will result in unpredictable, incorrect query results.
methods to retrieve a device key
copying from network traffic
- install the MILES app on an android device or virtual machine
- root the device and install a ssl certificate to be able to read the traffic
- use a package sniffer (e.g. HTTP Toolkit, Wireshark) to intercept HTTP requests
- copy the device key from a request body