https://github.com/adman/node-imhdsk
An unofficial API for grabbing data from imhd.sk
https://github.com/adman/node-imhdsk
Last synced: 10 months ago
JSON representation
An unofficial API for grabbing data from imhd.sk
- Host: GitHub
- URL: https://github.com/adman/node-imhdsk
- Owner: Adman
- License: mit
- Created: 2019-09-25T14:19:21.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-05-11T20:51:06.000Z (about 3 years ago)
- Last Synced: 2025-06-20T10:09:14.603Z (12 months ago)
- Language: JavaScript
- Size: 20.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-imhdsk
[](https://badge.fury.io/js/node-imhdsk)
This is a nodejs port of [python-imhdsk-api](https://github.com/mrshu/python-imhdsk-api)
## Installation
`$ npm i node-imhdsk`
## Usage
### Search for a route from point A to point B
```javascript
const imhdsk = require('node-imhdsk');
var options = {'from': 'mlyny',
'to': 'patronka',
'time': '23:00',
'date': '25.9.2019'}
imhdsk.get_routes(options).then(function(res) {
console.log(res)
});
```
#### Available options
| parameter | type | description |
| --------- | ------- | ------------------------------------------------------- |
| `city` | string | City in Slovakia supported by imhd.sk. Defaults to `ba` |
| `from` | string | Starting point (required). |
| `to` | string | Destination (required). |
| `time` | string | Departure time. Defaults to current time. |
| `date` | string | Departure date. Defaults to current date. |
### Get real-time information from particular stop
The function `get_livetable` takes the stop ID as a parameter. These IDs can
be found at [imhd.sk](https://imhd.sk). Open the page with the stop information,
then open the livetable in new window. The parameter `st` in the url should be
the stop's ID.
```javascript
const imhdsk = require('node-imhdsk');
imhdsk.get_livetable(93).then(function(res) {
console.log(res);
});
```
*Beware that by using this you might be violating imhd.sk ToS*