Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thenoim/dsbapi
DSB mobile API
https://github.com/thenoim/dsbapi
api dsb hacktoberfest javascript mobile nodejs npm
Last synced: about 6 hours ago
JSON representation
DSB mobile API
- Host: GitHub
- URL: https://github.com/thenoim/dsbapi
- Owner: TheNoim
- License: apache-2.0
- Created: 2017-02-15T18:56:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-17T09:53:04.000Z (about 2 months ago)
- Last Synced: 2024-11-11T20:29:37.937Z (4 days ago)
- Topics: api, dsb, hacktoberfest, javascript, mobile, nodejs, npm
- Language: JavaScript
- Homepage: https://noim.me/DSBAPI/
- Size: 4.14 MB
- Stars: 23
- Watchers: 3
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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.