0.0.8 • Published 8 months ago

abfahrt v0.0.8

Weekly downloads
-
License
-
Repository
github
Last release
8 months ago

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"example@example.com", "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

  1. install the MILES app on an android device or virtual machine
  2. root the device and install a ssl certificate to be able to read the traffic
  3. use a package sniffer (e.g. HTTP Toolkit, Wireshark) to intercept HTTP requests
  4. copy the device key from a request body
0.0.8

8 months ago

0.0.7

8 months ago

0.0.6

8 months ago

0.0.5

8 months ago

0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago