Giter Site home page Giter Site logo

mnemocron / zrhmovementsspottertool Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 60 KB

Downloads and sorts arrival / departure timetables from the Zürich airport website (ZRH)

Home Page: https://dxmek.ch/zrharr

License: MIT License

Python 97.50% Shell 2.50%
airport airport-timetable timetable zrh flight json webcrawler webcrawling arrival departure

zrhmovementsspottertool's Introduction

ZRH Movements Spottertool

This Python script can fetch the full arrival / departure list of the Zürich airport (ZRH). The output format is 'json'. There multiple lists available. Both the arrivals and depatrures of regular civil flights, as well as both the arrivals and departures of all available flights (including private and freight flights). Typically a regular list contains ~400 flights per day, while a spotter list contains ~450 flights.


Preparation

Before you can use the get-zrh.py script you need to edit the headers. The website requires the cookie parameters to be set. Open your browser and look inside the developer tools to find the cookie headers. Copy them into the get-zrh.py file.

If the cookie headers are not set, the script will fail with AttributeError: 'NoneType' object has no attribute 'tbody'.

Usage

Download Timetables

Get the arrival list (today / regular):

$ get-zrh.py -a

Get the departure list (toady / regular): $ get-zrh.py -d

Get all four available lists of today: $ get-zrh.py -dau

Get all four available lists of tomorrow: $ get-zrh.py -daut

Filter Timetables

Filter out the special flights:

$ spotter-sort.py -r [regular] -s [spotter] [-o][dir] [-v]

Example:

$ spotter-sort.py -r timetable.arrival.regular.json -s timetable.arrival.spotter.json -o ./flighttables

The option -o [dir] is used to set the output directory (not filename) of the filtered timetable.json - if there is already a timetable.[x].special.json, this file will be overwritten

The option -v enables verbos output for further use. You can pipe this output to a Telegram chat for example.

Output Format

The output format is a json file. The structure is taken from the old ZRH website API.

Example:

{
	"timetable":[{
		"airportinformation": {
			"airport_city": "DUBLIN"
		},
		"flightcode": "EI349",
		"masterflight": {
			"registration": "EIDEN"
		}, 
		"scheduled": "20:05", 
		"expected" : "20:20"
	},{
		"airportinformation": {
			"airport_city": ""
		},
		"flightcode": "",
		"masterflight": {
			"registration": ""
		}, 
		"scheduled": "", 
		"expected" : "0"
	}]
}

One more example

dxmek.ch

Dependencies

Python 2.7

Packages used:

  • optparse
  • sys
  • os
  • datetime
  • httplib
  • urllib
  • requests
  • bs4 / BeautifulSoup
  • json

zrhmovementsspottertool's People

Contributors

dxmekch avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.