# dsbapi

> An api for mobile.dsbcontrol.de

Latest version **4.1.1** (published 2021-10-02) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install dsbapi
pnpm add dsbapi
yarn add dsbapi
bun add dsbapi
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 4.1.1 |
| Published | 2021-10-02 |
| First published | 2017-02-15 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 204.2 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 26 |
| Author | Nils Bergmann |
| Maintainers | thenoim, dunklestoast |
| Keywords | dsb, api, mobile |

## Links

- npm: https://www.npmjs.com/package/dsbapi
- Repository: https://github.com/TheNoim/DSBAPI
- Homepage: https://github.com/TheNoim/DSBAPI#readme
- Issues: https://github.com/TheNoim/DSBAPI/issues
- npm.io page: https://npm.io/package/dsbapi

## Dependencies (3)

- [pako](https://npm.io/package/pako.md) ^2.0.4
- [axios](https://npm.io/package/axios.md) ^0.22.0
- [percentage-calc](https://npm.io/package/percentage-calc.md) ^0.0.1

## Recent versions

- 4.1.1 (latest) — 2021-10-02
- 4.1.0 — 2021-05-02
- 4.0.4 — 2019-12-02
- 4.0.3 — 2019-10-23
- 4.0.2 — 2019-10-22
- 4.0.1 — 2019-10-10
- 3.2.8 — 2019-07-14
- 3.2.7 — 2019-07-14
- 3.2.6 — 2019-05-31
- 3.2.5 — 2019-05-11
- 3.2.4 — 2019-05-11
- 3.2.3 — 2019-05-11
- 3.2.2 — 2019-05-11
- 3.1.3 — 2019-05-11
- 3.1.1 — 2019-05-11
- … 16 more at https://npm.io/package/dsbapi/versions

## README

![Test Status](https://github.com/TheNoim/DSBAPI/workflows/Test%20the%20dsb/badge.svg) [![Greenkeeper badge](https://badges.greenkeeper.io/TheNoim/DSBAPI.svg)](https://greenkeeper.io/)

## Installation

Use your favorite package manager for javascript

```bash
yarn add dsbapi
# Or
npm install dsbapi --save
```

_Note: Requires `node >= 8`_

## How to use:

### Read the Documentation

##### [https://noim.me/DSBAPI/](https://noim.me/DSBAPI/)

### In NodeJS

```javascript
const DSB = require('dsbapi');

const dsb = new DSB('USERNAME', 'PASSWORD');

dsb.fetch()
	.then(data => {
		const timetables = DSB.findMethodInData('timetable', data);
		const tiles = DSB.findMethodInData('tiles', data);

		// Work with it
	})
	.catch(e => {
		// An error occurred :(
		console.log(e);
	});
```

Or with modern javascript

```javascript
import DSB from 'dsbapi';

const dsb = new DSB('USERNAME', 'PASSWORD');

async function getMyShit() {
	const data = await dsb.fetch();
	const timetables = DSB.findMethodInData('timetable', data);
	const tiles = DSB.findMethodInData('tiles', data);

	// YEAH
}

getMyShit();
```

### Fetch V1

The old iPhone API is not active anymore. You need to use the new fetch() method. After you got the data with the fetch() method you can find the timetables with the findMethodInData method. Look at the example above.

### Browser

It will probably not work in the browser. The dsb does not set cors, so you are not able to use this module on the client side of your website. You can only use it on the backend.

---
_Source: https://npm.io/package/dsbapi · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
