npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

oebb-api

v1.0.8

Published

A collection of functions to acess train shedules, arrivals/departures, station search and ticketinformation from the [OEBB(ÖBB)](https://www.oebb.at)

Downloads

37

Readme

OEBB-API (ÖBB-API)

A collection of functions fore node.js to acess train shedules, arrivals/departures, station search and ticketinformation from the OEBB(ÖBB)

I had a lot of help help from these great ressources

and a documentation file I found on the web

Installation

npm --save install oebb-api

Functions

searchStationsNew(name)

It returns an promise that resolves to an array of possible stations matching name

const oebb = require('oebb-api');

oebb.searchStationsNew("Wien").then(console.log);

returns

[{ number: 1190100,
    longitude: 16372134,
    latitude: 48208547,
    name: '',
    meta: 'Wien' },
  { number: 1290401,
    longitude: 16375326,
    latitude: 48185507,
    name: 'Wien Hbf (U)',
    meta: '' },
...
...
...]

searchStations(options)

searchStation is very similar to searchStationsNew it however can take more options and returns more information. You can call getStationSearchOptions to get a prefilled options object.

const oebb = require('oebb-api');

var options = oebb.getStationSearchOptions();
options.S="wien h";
oebb.searchStations(options).then(console.log);

It returns an array with matching stations, POIs, etc.

[ { value: 'Wien Hbf (U)',
    id: 'A=1@O=Wien Hbf (U)@X=16375326@Y=48185507@U=181@L=001290401@B=1@p=1513853468@',
    extId: '001290401',
    type: '1',
    typeStr: '[Bhf/Hst]',
    xcoord: '16375326',
    ycoord: '48185507',
    state: 'id',
    prodClass: '6013',
    weight: '32767' },
  { value: 'Wien Meidling',
    id: 'A=1@O=Wien Meidling@X=16333211@Y=48174559@U=181@L=001191201@B=1@p=1513853468@',
    extId: '001191201',
    type: '1',
    typeStr: '[Bhf/Hst]',
    xcoord: '16333211',
    ycoord: '48174559',
    state: 'id',
    prodClass: '4989',
    weight: '32588' },
...
...
...]

Name | description --- | --- value: | name of the station id | no idea extId | used in other queries; same as number (not quite shure if the really are the same all the time) type | int representing the type typeStr | the type as string xcoord | longitude ycoord |latitude state | no idea prodClass| no idea weight | I am guessing it represents how close a match the station is to the string

getStationSearchOptions()

It returns an object containing the options for searchStations

const oebb = require('oebb-api');

var options = oebb.getStationSearchOptions();

options

Name | default value | value | description --- | --- | --- | --- | REQ0JourneyStopsS0A | 1 | An int between 1 and 255. | It selects the type of station to return e.g. 1 is [Bhf/Hst] REQ0JourneyStopsB | 12 | An int greater 0 | the amount of results which are returned S | | a string | the string to match js |true | boolean | no idea what it does

getStationBoardData(options)

It returns a promise resolving to an object containing arrival or depature information for a specific station. You can get a prefilled options object, by calling getStationBoardDataOptions

const oebb = require('oebb-api');

var options = oebb.getStationBoardDataOptions();
options.evaId=1191601;//Ottakring (Wien)
oebb.getStationBoardData(options).then(console.log);

returns:

{ headTexts:
   [ 'Zeit',
     'Fahrt',
     'Nach',
     'Steig',
     'Abfahrten',
     'Aktuell',
     'Ankunft' ],
  stationName: 'Ottakring (Wien)',
  stationEvaId: '1191601',
  boardType: 'dep',
  imgPath: '/img/',
  iconProductsSubPath: 'vs_oebb/',
  rtInfo: true,
  journey:
   [ { id: '875171810',
       ti: '19:46',
       da: '23.12.2017',
       pr: 'U3',
       st: 'Wien Simmering',
       lastStop: 'Wien Simmering Bahnhof (U3)',
       ati: '20:12',
       tr: '1',
       trChg: false,
       rt: false,
       rta: false },
     { id: '836641815',
       ti: '19:46',
       da: '23.12.2017',
       pr: 'Tram 46',
       st: 'Wien Ring/Volkstheater U',
       lastStop: 'Wien Dr.-K.-Renner-Ring/Volkstheater (Schleife)',
       ati: '20:00',
       tr: '',
       trChg: ,
       rt: { status: null, dlm: '2', dlt: '19:47' , dld:'23.12.2017'},
       rta: false },
       ...
       ...
       ...
 ],
  maxJ: 18 }

element description

general:

Name | description --- | --- headTexts | headings for arrivals depatures screen stationName | name of station stationEvaId | Id of station boardType | depatures or arrivals (dep/arr) imgPath | ? iconProductsSubPath | ? rtInfo | ? maxJ | number of returned entries -1

journey:

Name | description --- | --- id | ? ti | arrvial/depature time da | arrival/depature date pr | name of transport st | ? lastStop | last stop ati | wehn arrivals depature time from first stop ; when depatures expected time to reach last stop tr | track identifier trChg | did the track change

rt :

it describes the delay or other status if there is one. If there is one it contains an object formated as follows:

Name | description --- | --- status | current status; "Ausfall" if canceled dlm | how many minutes too late dlt | actual arrival time dld | actual arrival date

rta

it is very similar to rt I think it describes the delay for the arrival, but I am not certain.

Name | description --- | --- status | current status "Ausfall" if canceled then rt too is canceld and rt.status= "Ausfall" dlm | never seen it other than empty dlt | never seen it other than empty

getStationBoardDataOptions()

returns prefilled options for getStationBoardData

const oebb = require('oebb-api');

var options = oebb.getStationBoardDataOptions();

options

Name | default value | values | description --- | --- | --- | --- L | vs_scotty.vs_liveticker| vs_scotty.vs_liveticker | ? evaId | empty| integer | Id of station; extId or number from searchStationsNew or searchStations dirInput | empty| integer | Id of Station in which transportation is heading; extId or number f from searchStationsNew or searchStations. If it is set only trains which actually stop at the station specified with dirInput are shown boardType | dep | dep/arr | depatures or arrivals time | current time| HH:MM | time from when to start looking productsFilter | 1111111111111111 | binary flags? | selects modes of transportation see below for more information additionalTime | 0 | integer | in minute. Is added to time maxJourneys | 19 | integer | max of returned stations outputMode | tickerDataOnly | tickerDataOnly | ? start |yes| yes/no | wheter to start query selectDate | period | period/tody | selects mode; if tody dateBegin and dateEnd are ignored. dateBegin| current date | String dd.mm.YYYY | start day for lookup ignored if selectDate=today dateEnd | current date| String dd.mm.YYYY | end date for lookup ignored if selectDate=today

productsFilter

slects which modes of transports should be listed forexample if I set productsFilter to 0000110000000000 only s-bahn and regionalzüge are shown

Flag number | mode of transport --- | --- 1 | railjet 2 | ? 3 | ec and ice 4 | nightjet d probably also nightjet en 5 | regionalzüge 6 | s-bahn 7 | Bus 8 | ? 9 | subway 10 | tram 11 | ? 12 | ? 13 | Westbahn 14 | ? 15 | ? 16 | ?

getJourneys(from, to, add_offers, date)

returns a promise, that resolves to routes from to at date. To add the offers, if they exist, set add_offers to true. add_offers is by default false. date is a node-datetime object. It has to be imported through npm

const oebb = require('oebb-api');

oebb.searchStationsNew("Wien Hbf").then((res)=>{
	var from = res[0];
	oebb.searchStationsNew("Venezia Santa Lucia").then((res)=>{
		var to=res[0];
		oebb.getJourneys(from, to, true).then((res)=>{
            console.log(res);
        });
	})
});

####from and to they are formated:

from/to = { 
	number: 1190100,
    longitude: 16372134,
    latitude: 48208547,
    name: 'Wien',
};

This returns for example (connections describes the journey and offer contains the information about the price etc.): (The console output will hide most of it, but it is there)

{
	"connections": [
		{
			"connection": {
				"id": "fb8a994b473d2931b32583890559a1dcadd736a0f2016132f6d1628b8b1d68fd",
				"from": {
					"name": "Wien Hbf",
					"esn": 8103000,
					"departure": "2017-12-24T06:25:00.000",
					"departurePlatform": "7",
					"showAsResolvedMetaStation": false
				},
				"to": {
					"name": "Venezia Santa Lucia",
					"esn": 8300094,
					"arrival": "2017-12-24T14:05:00.000",
					"showAsResolvedMetaStation": false
				},
				"sections": [
					{
						"from": {
							"name": "Wien Hbf",
							"esn": 8103000,
							"departure": "2017-12-24T06:25:00.000",
							"departurePlatform": "7"
						},
						"to": {
							"name": "Venezia Santa Lucia",
							"esn": 8300094,
							"arrival": "2017-12-24T14:05:00.000"
						},
						"duration": 27600000,
						"category": {
							"name": "RJ",
							"number": "131",
							"displayName": "RJ",
							"longName": {
								"de": "Railjet",
								"en": "Railjet",
								"it": "Railjet"
							},
							"backgroundColor": "#ffffff",
							"fontColor": "#222222",
							"barColor": "#ab0020",
							"place": {
								"de": "Bahnsteig",
								"en": "Platform",
								"it": "Banchina"
							},
							"assistantIconId": "zugAssistant",
							"train": true,
							"backgroundColorDisabled": "#F0F0F0",
							"fontColorDisabled": "#878787",
							"barColorDisabled": "#878787"
						},
						"type": "journey",
						"hasRealtime": false
					}
				],
				"switches": 0,
				"duration": 27600000
			},
			"offer": {
				"connectionId": "fb8a994b473d2931b32583890559a1dcadd736a0f2016132f6d1628b8b1d68fd",
				"price": 94.6,
				"offerError": false,
				"firstClass": false,
				"availabilityState": "available"
			}
		},
		...
		...
		...
	}
]