I'm a Software Developer from Victoria, BC working at Katipult. Previously worked at Kano and Ensemble.
- π³οΈ BC Ferry Times
- π Ferry Watch
- βοΈ BC Ferries API
π³ The only public API for retrieving current data on BC Ferries sailings.
Home Page: https://bcferriesapi.ca
License: MIT License
I'm a Software Developer from Victoria, BC working at Katipult. Previously worked at Kano and Ensemble.
I canβt seem to find reference to Bowen Island (Snug Cove) in the code, and I canβt get the API to return any results for Bowen, but the README says it is built to reference Bowen island as a departure and destination.
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!
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.
Cheers,
Paul A. (Sunshine Coast, BC)
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.
For both V1 and V2 of the API, next day sailings (identified by "(Tomorrow)") have wrong fill details.
Example from BC Ferries website:
From scraper.go:
reducedArray[2]
,reducedArray[3]
, andreducedArray[4]
.But seems like for next day sailings, it should be 1 index higher, where:
reducedArray[3]
,reducedArray[4]
, andreducedArray[5]
.Currently api only has major routes, add in all the smaller routes.
Some ports are showing the times and capacities for other routes. Double check they're retrieving the correct ones and reorder as needed.
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.
As seen at the bottom of readme, add custom messages for when a parameter is incorrect.
Site needs to be updated with the following changes:
Are you able to get the info for the return trip as well?
The URL that I am trying to request is
https://ferrytimes.ca/api/horseshoe-bay/snug-cove-bowen-island which seems to return a 500
and
https://www.api.ferrytimes.ca/api/horseshoe-bay/snug-cove-bowen-island/ also return a 500 error.
Not sure if the urls should be something different.
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.
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.
It would be very, very entertaining to have a ferry from Langford to Horseshoe Bay.
Wondering if it is possible to retrieve more information about more ports. Right now I believe you are only retrieving from the major ports.
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?
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
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?
Current website is pretty bland, I'm open to any changes.
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
Every minute the scraper is supposed to run and update ferries.json with the results. Currently the update runs twice each minute instead.
The relevant page is at https://www.bcferries.com/routes-fares/schedules/gambier-keats
unfortunately it is in a very much non-standard format.
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!
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:
arrivalTime
values have no space between the time and period indicator (am/pm). This is a consistent error.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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.