Git Product home page Git Product logo

bc-ferries-api's Introduction

bc-ferries-api's People

Contributors

daytonturner avatar dependabot[bot] avatar enejb avatar kianapaz avatar kieran avatar samuel-pratt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bc-ferries-api's Issues

Incomplete data for Salt Spring Sailings

I am working on a way for salt springers to monitor the relevant ferries easier, but I am missing a bunch of data.

Here's some examples, the only route information I can find for Tsawwassen to Long Harbour is here:
https://www.bcferriesapi.ca/api/TSA/SGI/

This is good data for that route, but there is no inverse, I cannot get any data from SGI to TSA (Long Harbour to Tsawwassen) which is actually the more relevant information for salt springers.

When it comes to Fulford Harbour there's varying data so v2/capacity/ I can get good data including status for sailings from SWB to FUL in addition to the actual times the boats left and arrived which is very nice. But then for the inverse https://www.bcferriesapi.ca/api/FUL/SWB/ is all I have, and its decent because it does have an isCancelled bool, but there's no information on when the ferry actually left.

Lastly, Crofton to Vesuvius all that's available is the non-capacity api which produces the generic schedule. So I cannot tell if anything has been cancelled or running late or anything.

Am I missing something? Is this data available elsewhere? If not, is there any way to extend to have this data?

Thanks!

BC Ferry Times Data Bug

Hi @samuel-pratt, leaving a bug report for BC Ferry app here as I couldn't find an option to send feedback in the app.

There might be a bug in the data API when querying a route before the first sailing of the day. The app is reporting "No more departures today" when I try to lookup HSB to LNG at 07:28 (before first scheduled sailing from HSB to LNG at 07:30) This also gives an error when trying reverse route from LNG to HSB before the first sailing from HSB.

After first sailing, the view is properly populated.

Before First Sailing
image

After First Sailing
image

Cheers,
Paul A. (Sunshine Coast, BC)

Any way to check reservation availability?

Say I want to sail out on a day, and all the reservations are filled up, is there a way to check if resos become available periodically? This would be a super cool function.

Wrong fill details for next day "(Tomorrow)" sailings

For both V1 and V2 of the API, next day sailings (identified by "(Tomorrow)") have wrong fill details.

Example from BC Ferries website:
sailings

API returns:
api

From scraper.go:

  • Fill is taken from reducedArray[2],
  • CarFill from reducedArray[3], and
  • OversizeFill from reducedArray[4].

But seems like for next day sailings, it should be 1 index higher, where:

  • Fill should be taken from reducedArray[3],
  • CarFill from reducedArray[4], and
  • OversizeFill from reducedArray[5].

Misordered ports

Some ports are showing the times and capacities for other routes. Double check they're retrieving the correct ones and reorder as needed.

API slow when updating db

Due to the update to BC Ferries site, the scraper now has to scrape several urls instead of a single one so it takes much longer. The current setup is the scraper runs every 3 minutes, and this worked when it was quick but now there's a period of time after each update where the api can take 3-5 seconds to return a value, instead of the usual 100-200 milliseconds.

Not sure the best solution to this, if anyone knows a good way to separate them in such a way that updating the db doesn't slow down the api please comment it on this issue.

Update site

Site needs to be updated with the following changes:

  • Better styling
  • New name
  • Docs
  • About page
  • Link to FerryTimes app

Scraper.py in need of cleanup / refactor

Scraper.py has several useless if statements, strange expressions, and lots of bugs that need edges cases. Needs to be rewritten to be cleaner and easier to read.

API Call returning website html rather than json

Hi Sam,

This is an awesome project, thanks a bunch for doing this.

I am pretty new to working with APIs so I am hoping I'm just making a stupid mistake in my request. I'm working in React with a basic fetch() call:

fetch("https://ferrytimes.ca/api/tsawwassen", { method: 'GET', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', }}) .then(function(response) { return response.text(); }).then(function(data) { console.log(data); }) .catch(error => console.log('Authorization failed : ' + error.message));

This returns the source html of your home page itself rather than the json data I was looking for. I tried using response.json() but get a "Unexpected token < in JSON at position 0" error which indicates to me I'm not receiving the json response. I also tried using postman to the same effect so I assume I am just looking at the wrong api link.

Any help is appreciated, thanks again and I look forward to being able to contribute to your project in the near future.

Missing smaller ports

Wondering if it is possible to retrieve more information about more ports. Right now I believe you are only retrieving from the major ports.

ISO8601 format for scrapedAt

I'm looking to build a JSON Schema for the API. This will help others build language wrappers for the returned JSON.

I'm hitting a JSON Schema validation error on scrapedAt because it's not strict ISO8601 format. It appears scrapedAt is way to precise, with too many microseconds. My current workaround to define scrapedAt as a string in the schema, but that defeats the purpose of strict typing and will make language wrapping a little harder.

Any chance of updating the code to adhere to strict ISO8601 for where possible?

Update terminal names to be more readable

Currently terminals use whatever name is listed on the BC Ferries website This results in unnecessary brackets, periods, and generally inconsistent naming conventions.

Update scraper to change terminal names when saving data, the api to use the new names, and the readme to show the newly accepted names.

Terminals to update:
nanaimo-(duke-pt) -> nanaimo-duke-point
nanaimo-(dep.bay) -> nanaimo-departure-bay
snug-cove-(bowen-is.) -> snug-cove-bowen-island
fulford-harbour-(saltspring-is.) -> fulford-harbour-saltspring-island

Adding support for late ferry data?

Hi, just came across your API when attempting to build a BCFerries module for HomeAssistant, thanks for keeping this up to date!

The only other module I found was a bcferries python module that is 7 years old and definitely no longer works, sadly.

The one thing they exposed in theirs that I think yours could benefit from, is exposing whether or not the ferry in question is late or not. For instance, the page you could get this from for Langdale<>Horseshoe Bay would be: https://www.bcferries.com/current-conditions/departures?terminalCode=LNG

I was going to take a crack at adding a parser for this data, but wondering if you or anyone else has already attempted this, or if you are aware of a reason it wouldn't work?

Fix InsecureRequestWarning in scraper.py

Running scraper.py results in the following warning:
/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py:979: InsecureRequestWarning: Unverified HTTPS request is being made to host 'www.bcferries.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings

Scraper running twice every minute

Every minute the scraper is supposed to run and update ferries.json with the results. Currently the update runs twice each minute instead.

API Returning empty responses

Hi Sam!

Just noticed the API is returning empty payload responses, not sure why, or if you could take a look

Also, I downloaded the API from the Git repo to attempt to run / debug myself, but not sure the proper way to run the Go app. Do you have any docs you can include?

Thanks again!

Inconsistent time formats and bad string data in "arrivalTime"

Hi,

I've written a JSON Schema for the V2 API (See PR 43). When I use it against JSON returned from the V2 end point it fails due to:

  • Many (40+) arrivalTime values have no space between the time and period indicator (am/pm). This is a consistent error.
  • Some arrivalTime values contain the string Sailingsonly,. This seems to be timing dependent, as it does not always appear in the JSON.

This had been tested using the following JSON validators:

While this is not a big issue for apps that only use the time fields as display strings, it is problematic for consuming apps that need a consistent time format so they can reliably convert the time elements into native Datetime objects in their preferred language.

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.