1.0.31 • Published 3 years ago

@alexvv13/tpapi v1.0.31

Weekly downloads
54
License
MIT
Repository
github
Last release
3 years ago

Themeparks-API

Themeparks API loosely based on existing examples, however I wanted to kill some time and then this came up. Don't expect anything too cool tho.

Unit Test Documentation Build Node.js CI

node-current npm version

Snyk Vulnerabilities for GitHub Repo

API documentation NPM Package

About

This is a module which fetches queue times and operating hours, and returns it as JSON to the user, the data could be used for anything, a website, a discordjs bot, some personal stuff or whatever. Be aware it's not perfect, but it works. It's just being build to work and return data, not to be efficient anyway.

Table of Contents

About Table of Contents Install ENV Usage -Running the script -Example output Changelog Parks available Features of supported parks Result objects -Ride waittimes -Schedules Park object values Tasks

Install

yarn add @alexvv13/tpapi

ENV

In the directory where you're using tpapi, create an .env file and fill in the fields, an example can be found in the Github Repo, or in the ${path}/node_modules/@alexvv13/tpapi/.env.example, or copy below's example and fill in the fields yourself

#Language
LANGUAGES= 'en'

#Efteling
EFTELING_API_KEY=
EFTELING_SEARCH_URL= 
EFTELING_WAITTIMES_URL= 
EFTELING_HIST_URL= 

#Europa-Park
EUROPAPARK_APIBASE=
EUROPAPARK_LOGIN=
EUROPAPARK_FBAPPID=
EUROPAPARK_FBAPIKEY=
EUROPAPARK_FBPROJECTID=
EUROPAPARK_ENCKEY=
EUROPAPARK_ENCIV=

#Phantasialand
PHANTASIALAND_API_KEY=
PHANTASIALAND_POI_URL=
PHANTASIALAND_WAITTIMES_URL=
PHANTASIALAND_HOURS_URL=

#Toverland
TOVERLAND_APIBASE= 
TOVERLAND_TOKEN= 
TOVERLAND_HOURS=

#Compagnie des Alpes
WALIBIHOLLAND_APIBASE= 
WALIBIHOLLAND_APIURL= 
WALIBIBELGIUM_APIBASE=
WALIBIRA_APIBASE=
BELLEWAERDE_APIBASE=

#Plopsa
PLOPSALAND_APIBASE=
PLOPSALAND_APIID=
HOLIDAY_APIBASE=
HOLIDAY_APIID=

#Settings
CACHE_DURATION_POIS= '12'

Usage

Running the script

Run index.js for all parks NOTE: If you use commonjs, it's REQUIRED to use the .mjs extension INSTEAD of .js! Or create an .js file for yourself and do the following:

// Import all parks here
import tpapi from '@alexvv13/tpapi';

const park = new tpapi.parks.Efteling();

// Fetch POIS Example usage of Efteling
park.getWaitTime().then((poiData) => {
  console.log(poiData);
});

// You can also call getCalendar() or getData()

Example output

(Shortened to keep it readable)

[
  {
    "name": "Stoomcarrousel",
    "id": "Efteling_stoomcarrousel",
    "type": "Attraction",
    "location": {
       "area": "Marerijk",
       "latitude": 51.651211,
       "longitude": 5.048955
    },
    "queues": {
       "fastPass": {
          "fastPass": false
       },
       "singlerider": {
          "singleRider": false
       },
       "standBy": {
          "waitTime": 0,
          "status": "Closed",
          "active": false
       }
    },
    "meta": {
       "descriptions": {
        "description":"<p>Would you like a horse, a carriage, a pig or another vehicle? Take your seat in the ‘Stoomcarrousel’ steam carousell, which is more than 100 years old, and lit it spin you around! Duration: varies.   Wheelchair access: via the exit from this attraction.</p>",
        "short_description":"The old-fashioned fairground feeling"
       },
       "restrictions": {
          "minHeightAccompanied": "100 cm"
       },
       "tags": [
          "tranferNecessary",
          "IndoorRide"
       ]
    }
  },
  {
    "name": "Vogel Rok",
    "id": "Efteling_vogelrok",
    "type": "Attraction",
    "location": {
       "area": "Reizenrijk",
       "latitude": 51.652187,
       "longitude": 5.052811
    },
    "queues": {
       "fastPass": {
          "fastPass": false
       },
       "singlerider": {
          "singleRider": false
       },
       "standBy": {
          "waitTime": 0,
          "status": "Closed",
          "active": false
       }
    },
    "meta": {
       "descriptions": {
          "description": "<p>The Vogel Rok is an exiting indoor rollercoaster in the dark. The rollercoaster does not completely turn over, but does zoom through the dark at 40 mph. You must be at least 1.20 meter tall for this attraction. Duration: almost 2 minutes.   Wheelchair access: via the usual entrance to this attraction until the bottom of the stairs. Call here. An employee will then come to meet you.</p>",
          "short_description": "Lightning in the dark"
       },
       "restrictions": {
          "minHeight": "120 cm"
       },
       "tags": [
          "mayGetDizzy",
          "unsuitableForPregnantWomen",
          "tranferNecessary",
          "unsuitableWithInjuries",
          "IndoorRide"
       ]
    }
  }
]

Changelog

View tp-api Changelog

Parks available

10 Parks Supported

  • Efteling (tpapi.parks.Efteling)
  • Europa-Park (tpapi.parks.EuropaPark)
  • Rulantica (tpapi.parks.Rulantica)
  • YULLBE (tpapi.parks.Yullbe)
  • Phantasialand (tpapi.parks.Phantasialand)
  • Toverland (tpapi.parks.Toverland)
  • Walibi Holland (tpapi.parks.WalibiHolland)
  • Walibi Belgium (tpapi.parks.WalibiBelgium)
  • Walibi Rhône-Alpes (tpapi.parks.WalibiRA)
  • Bellewaerde (tpapi.parks.Bellewaerde)
  • Plopsaland de Panne (tpapi.parks.PlopsDePanne)
  • Holiday Park (tpapi.parks.HolidayPark)

Features of the parks

Park NameLive QueuesPark HoursRide SchedulesLanguages
Efteling:heavy_check_mark::heavy_check_mark::heavy_multiplication_x:en, nl, de, fr
Europa-Park:heavy_check_mark::heavy_multiplication_x::heavy_multiplication_x:en, de, fr
Rulantica:heavy_check_mark::heavy_multiplication_x::heavy_multiplication_x:en, de, fr
YULLBE:heavy_check_mark::heavy_multiplication_x::heavy_multiplication_x:en, de, fr
Phantasialand:heavy_check_mark::heavy_check_mark::heavy_check_mark:en, nl, de, fr
Toverland:heavy_check_mark::heavy_check_mark::heavy_check_mark:en, nl, de
Walibi Holland:heavy_check_mark::heavy_check_mark::heavy_multiplication_x:en
Walibi Belgium:heavy_check_mark::heavy_check_mark::heavy_multiplication_x:en, nl, fr
Walibi Rhône-Alpes:heavy_check_mark::heavy_check_mark::heavy_multiplication_x:en, fr
Bellewaerde:heavy_check_mark::heavy_check_mark::heavy_multiplication_x:en, nl, fr
Plopsaland De Panne:heavy_check_mark::heavy_check_mark::heavy_multiplication_x:en
Holiday Park:heavy_check_mark::heavy_check_mark::heavy_multiplication_x:en

Result Objects

Ride WaitTimes

[
    {
        id: (string or number: uniquely identifying a ride),
        name: (string: ride name),
        waitTime: (number: current wait time in minutes),
        active: (bool: is the ride currently active?),
        state: (string: will either be "Operating", "Closed", "Refurbishment", or "Down"),
        location: (object: contains location data such as latlon
             latitude: (number: ride's latitude),
             longitude: (number: ride's longitude),
             area: (string: what area is this ride in?)
        meta: { (object: can contain various park-specific information about this ride - field may be null)
            // examples of potential meta fields
            description: { (object: can contain ride descriptions)
            },
            single_rider: (boolean: does this ride have a single rider line?),
            type: (string: what is this poi?),
            fastPass: (boolean: does this ride have a fastPass line?),
            isVirtQueue: (boolean: is this entity a Virtual Queue?),
            tags: { (object: can contain various ride-specific tags, can be null and fields differ per park)
            },
            restrictions: { (object: can contain various ride-specific restrictions(minHeight etc), can be null and fields differ per park)
            },
        },
    },
    ...
]

Schedules

[
    {
        date: (dateFormat timestamp: day this schedule applies),
        openingTime: (timeFormat timestamp: opening time for requested park - can be null if park is closed),
        closingTime: (timeFormat timestamp: closing time for requested park - can be null if park is closed),
        type: (string: "Operating" or "Closed"),
        special: [ (array of "special" times for this day, usually exclusive hours - field may be null)
          openingTime: (timeFormat timestamp: opening time for requested park),
          closingTime: (timeFormat timestamp: closing time for requested park),
          type: (string: type of schedule eg. "Passholder Event", but can be "Event" or "Special Ticketed Event" or other)
        ],
    },
    ...
]

Park Object values

There are some values available on each park object that may be useful.

VariableDescription
NameName of the park
TimezoneThe park's local timezone
LocationStringThis park's location as a latitude, longitude string
SupportsWaitTimesDoes this park's API support ride wait times?
SupportsOpeningTimesDoes this park's API support opening hours?
SupportsRideSchedulesDoes this park return schedules for rides?
FastPassDoes this park have FastPass (or a FastPass-style service)?
FastPassReturnTimesDoes this park tell you the FastPass return times?
NowCurrent date/time at this park (returned as a Moment object)
LangOptionsWhat languages does this park support?
import tpapi from '@alexvv13/tpapi';

// construct our park objects and keep them in memory for fast access later
const Parks = {};
for (const park in tpapi.parks) {
  Parks[park] = new tpapi.parks[park]();
}

// print each park's name, current location, and timezone
for (const park in Parks) {
  console.log(`* ${Parks[park].Name} [${Parks[park].LocationString}]: (${Parks[park].Timezone})`);
}

Prints:

Tasks

  • Add more parks
  • Multi language support
  • Multiple Queue entities support
  • Merge shared tasks to one function
  • Generate a better infrastructure
  • Multi Language support for CDA parks
  • Update EuropaPark to new API (current setup still works but unsure for how long it'll work)
  • Update output
1.0.31

3 years ago

1.0.30

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.27

3 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.2-3.1

3 years ago

1.0.23

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago