Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Readme
JavaScript client for the FlixBus (Meinfernbus) / FlixTrain API. Inofficial, using endpoints by FlixMobility. Ask them for permission before using this module in production.
This module conforms to the FPTI-JS 0.3.2
standard for JavaScript public transportation modules.
npm install flix
const flix = require('flix')
The flix
module conforms to the FPTI-JS 0.3.2
standard for JavaScript public transportation modules and exposes the following methods:
Method | Feature description | FPTI-JS 0.3.2 |
---|---|---|
stations.all([opt]) | All stations of the Flix network, such as Berlin central bus station or Frankfurt Hbf | ✅ yes |
regions.all([opt]) | All regions (cities) of the Flix network, such as Berlin or Frankfurt | ✅ yes |
journeys(origin, destination, [opt]) | Journeys between stations or regions | ✅ yes |
stations.all([opt])
Get all stations of the Flix network, such as Berlin central bus station
or Frankfurt Hbf
. See this method in the FPTI-JS 0.3.2
spec.
Attribute | Description | FPTI-spec | Value type | Default |
---|---|---|---|---|
apiKey | Custom Flix API key | ❌ | String | default api key |
const flix = require('flix')
const stationStream = flix.stations.all()
stationStream.on('data', item => {
// item is an FPTF station object
console.log(item)
})
{
type: "station",
id: "1",
name: "Berlin central bus station",
location: {
type: "location",
longitude: 13.279399,
latitude: 52.507171,
address: "Masurenallee 4-6, 14057 Berlin, Germany",
country: {
name: "Germany",
code: "DE"
},
zip: "14057",
street: "Masurenallee 4-6"
},
slug: "berlin-zob",
aliases: [],
regions: [
"88"
],
connections: [
2,
3,
4,
5,
8,
9
// …
],
importance: 100
}
regions.all([opt])
Get all regions of the Flix network, such as Berlin
or Frankfurt
. See this method in the FPTI-JS 0.3.2
spec.
Attribute | Description | FPTI-spec | Value type | Default |
---|---|---|---|---|
apiKey | Custom Flix API key | ❌ | String | default api key |
const flix = require('flix')
const regionStream = flix.regions.all()
regionStream.on('data', item => {
// item is an FPTF region object
console.log(item)
})
{
type: "region",
id: "88",
name: "Berlin",
location: {
type: "location",
longitude: 13.404616,
latitude: 52.486081,
country: {
name: "Germany",
code: "DE"
}
},
class: "A",
stations: [
"1",
"20688",
"1224",
"20678",
"481"
// …
],
connections: [
89,
90,
91,
92,
93,
94,
96,
97,
98
// …
],
slug: "berlin"
}
journeys(origin, destination, [opt])
Find journeys between stations or regions. See this method in the FPTI-JS 0.3.2
spec. Note that origin and destination must have the same type (so either both region
or both station
).
Attribute | Description | FPTI-spec | Value type | Default |
---|---|---|---|---|
when | Journey date, synonym to departureAfter | ✅ | Date | new Date() |
departureAfter | List journeys with a departure (first leg) after this date | ✅ | Date | new Date() |
results | Max. number of results returned | ✅ | Number | null |
interval | Results for how many minutes after when /departureAfter | ✅ | Number | null |
transfers | Max. number of transfers | ✅ | Number | null |
currency | Currency for journey.price | ✅ | ISO 4217 code | EUR |
language | Language of the results | ❌ | ISO 639-1 code | en |
adults | Number of traveling adults | ❌ | Number | 1 |
children | Number of traveling children | ❌ | Number | 0 |
bicycles | Number of traveling bicycles | ❌ | Number | 0 |
apiKey | Custom Flix API key | ❌ | String | default api key |
Note that, unless opt.interval
is specified, the module will return journeys that start after when
/departureAfter
, but before the beginning of the following calendar day.
// journeys between stations
const berlinZOB = '1' // station id
const hamburgCentral = { // FPTF station
type: 'station',
id: '36'
// …
}
flix.journeys(berlinZOB, hamburgCentral, { when: new Date('2019-06-27T05:00:00+0200'), currency: 'PLN' }).then(…)
// journeys between regions
const berlin = { // FPTF region
type: 'region',
id: '88'
// …
}
const hamburg = { // FPTF region
type: 'region',
id: '118'
// …
}
flix.journeys(berlin, hamburg, { when: new Date('2019-06-27T05:00:00+0200'), transfers: 0 }).then(…)
{
type: "journey",
id: "direct-80979121-1-36",
legs: [
{
origin: {
type: "station",
id: "1",
name: "Berlin central bus station",
importance: 100
},
destination: {
type: "station",
id: "36",
name: "Hamburg ZOB",
importance: 100
},
departure: "2019-06-27T06:45:00+02:00",
arrival: "2019-06-27T10:00:00+02:00",
operator: {
type: "operator",
id: "mfb",
name: "FlixBus DACH GmbH",
url: "http://flixbus.de",
address: "Karl-Liebknecht-Straße 33, D-10178 Berlin"
},
mode: "bus",
public: true
}
],
status: "available",
borders: false,
info: {
title: null,
hint: null,
message: null,
warnings: []
},
price: {
amount: 9.99,
currency: "EUR",
discounts: null,
saleRestriction: false,
available: true,
url: "https://shop.global.flixbus.com/s?departureCity=88&arrivalCity=118&departureStation=1&arrivalStation=36&rideDate=27.06.2019¤cy=EUR&adult=1&children=0&bike_slot=0"
}
}
If you found a bug or want to propose a feature, feel free to visit the issues page.
FAQs
JavaScript client for the FlixBus (Meinfernbus) / FlixTrain API.
The npm package flix receives a total of 11 weekly downloads. As such, flix popularity was classified as not popular.
We found that flix demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.