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

itabus-api

v4.0.3

Published

access to ItabusAPI's unofficial API

Downloads

8

Readme

itabus-api

version npm

Access to Itabus's unofficial API with object-oriented promises.

Itabus is an Italian road transport company operating exclusively within Italy.

The name of the stations is accepted only in Italian! Example: * 'MILANO' is valid station * 'MILAN' is not valid station The project is developed for information purposes. **Do not use this code for evil purposes and respect the service offered. **

Installation

npm install itabus-api

Features

  • Search tickets
  • Station retrieval

How To Use - Search tickets

const ItabusAPI = require("itabus-api")
const Itabus = new ItabusAPI()

// DATE FORMAT --> "YYYY-MM-DD"
Itabus.search_tickets("Milano", "Bologna", "2023-10-10")
    .then(request => {

        if(request.success === false){
            console.log(request.error)
        }
        else{
            const Results = request.data

            // Get all travel ticket solutions
            console.log(Results.getTickets())

            // Get the ticket with the shortest trip
            console.log(Results.getShortestTrip())

            // Get the ticket with the cheapest trip
            console.log(Results.getCheapestTrip())

            // For each ticket, you can extract individual information
            const exampleTicket = Results.getTickets()[0]

            console.log(exampleTicket.getTravelDuration())
            console.log(exampleTicket.getId())
            console.log(exampleTicket.getOrigin())
            console.log(exampleTicket.getDestination())
            console.log(exampleTicket.getDepartureTimestamp())
            console.log(exampleTicket.getArrivalTimestamp())
            console.log(exampleTicket.getRates())
            console.log(exampleTicket.getBasicPrice())
        }
    })
    .catch(err => console.log(`Error searching: ${err.message}`));

How To Use - Station retrieval

const ItabusAPI = require("itabus-api")
const Itabus = new ItabusAPI()

const result = Itabus.get_station("Milano")

if(result.success === false){
    console.log(result.error)
} else {
    console.log(result.data)

    //Id of Station
    console.log(result.data.getCode())

    //City of Station
    console.log(result.data.getCity())

    //Address of Station
    console.log(result.data.getAddress())

    //List of available destinations from this station
    console.log(result.data.getDestinations())
}