Socket
Socket
Sign inDemoInstall

realtime-trains-scraper

Package Overview
Dependencies
21
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    realtime-trains-scraper

Get Unlimited and Fully Detailed UK Train Data from Realtime Trains without an API Key.


Version published
Weekly downloads
4
decreased by-33.33%
Maintainers
1
Install size
3.18 MB
Created
Weekly downloads
 

Readme

Source

🚆 Realtime Trains Scraper 🚆

Get Unlimited and Fully Detailed UK Train Data from Realtime Trains without an API Key.

NPM

Downloads Discord Server

Features

  • Lightning Fast | Data from Realtime Trains is Fetched in a Matter of Seconds!

  • 📑 Detailed JSON Response | To get the Detailed Data instead of the Simple Data, you would have to contact the Realtime Trains Team. By using this package, you don't have to do that!

  • 🔓 100% Free & Unlimited Access to Data | By utilising Node Fetch and Cheerio, you can fetch data whenever and as many times as you want to, without any API Key!

Install Package

To install the package, simply run the following command in your terminal:

npm install realtime-trains-scraper

Example Code

const realtimeTrains = require('realtime-trains-scraper');

// Fetching Data using the Station Code
realtimeTrains.getTrains("KGX");

// Fetching Data using the Station Name. However, this is not recommended as the Station Code is more reliable.
realtimeTrains.getTrains("London King's Cross");

You can also add a second parameter to specify how many results you want to get.

realtimeTrains.getTrains("KGX", 10); // Defaults to 15 (Max).

Example Result

{
    "operator": {
      "name": "LNER",
      "code": "GR"
    },
    "stp": "WTT",
    "plannedArrival": "2055",      
    "actualArrival": "2056",       
    "plannedDeparture": null,
    "actualDeparture": null,
    "origin": {
      "name": "Edinburgh",
      "code": "EDB"
    },
    "destination": {
      "name": "London Kings Cross",
      "code": "KGX"
    },
    "callingPoints": [
      {
        "name": "Berwick-upon-Tweed",
        "code": "BWK",
        "platform": "1",
        "plannedArrival": "1711",
        "actualArrival": "1709",
        "plannedDeparture": "1712",
        "actualDeparture": "1712",
        "delay": null
      },
      {
        "name": "Newcastle",
        "code": "NCL",
        "platform": "3",
        "plannedArrival": "1756",
        "actualArrival": "1754",
        "plannedDeparture": "1759",
        "actualDeparture": "1759",
        "delay": null
      },
      {
        "name": "Darlington",
        "code": "DAR",
        "platform": "1",
        "plannedArrival": "1827",
        "actualArrival": "1825",
        "plannedDeparture": "1829",
        "actualDeparture": "1829",
        "delay": null
      },
      {
        "name": "York",
        "code": "YRK",
        "platform": "3",
        "plannedArrival": "1855",
        "actualArrival": "1855",
        "plannedDeparture": "1858",
        "actualDeparture": "1859",
        "delay": "+1"
      },
      {
        "name": "Stevenage",
        "code": "SVG",
        "platform": "2",
        "plannedArrival": "2028",
        "actualArrival": "2033",
        "plannedDeparture": "2030",
        "actualDeparture": "2035",
        "delay": "+5"
      },
      {
        "name": "London Kings Cross",
        "code": "KGX",
        "platform": "0",
        "plannedArrival": "2055",
        "actualArrival": "2054",
        "plannedDeparture": null,
        "actualDeparture": null,
        "delay": "-1"
      }
    ],
    "platform": "0",
    "uid": "C86178",
    "trainid": "1E23",
    "sourceURL": "https://www.realtimetrains.co.uk/service/gb-nr:C86178/2021-08-30/detailed",
    "isPassengerTrain": true,
    "isCalling": true,
    "isCancelled": false,
    "runsAsRequired": false
  }

If any of the Arrival or Departure Times are null, the field for that data on the timetable has been left blank.

A '+' symbol in the Delay indicates that the train is delayed by 'x' minutes.

A '-' symbol in the Delay indicates that the train is early by 'x' minutes.

If No Delay is present, the Delay field will be null.

Contact Me

Keywords

FAQs

Last updated on 30 Aug 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc