dotzenith / Septum

An API to augment endpoints that I wish Septa provided
https://septum.jawn.website/
MIT License
0 stars 0 forks source link

/api/stations returns incorrect parameter for Wayne #1

Open nicholaides opened 3 days ago

nicholaides commented 3 days ago

I'm not sure of this is a new issue?

https://www3.septa.org/VIRegionalRail.html shows the parameter as being "Wayne", which I realize is the source of this error.

Interestingly:

I ran a script to check every station and only Wayne caused this error.

dotzenith commented 3 days ago

Good catch! I'm assuming this is in reference to https://septum.jawn.website/api/stations returning the wrong parameter name for Wayne?

I looked at the requests the iOS app was making they're (naturally) using an internal only API with station IDs instead of names. So next-to-arrive working for the iOS app unfortunately does not help.

I can manually add an override for Wayne in Septum so it returns Wayne Station as the parameter name. That does however feel very brittle, but I'm not sure we have a way to reach out to Septa to fix that web page.

nicholaides commented 2 days ago

I'm assuming this is in reference to https://septum.jawn.website/api/stations returning the wrong parameter name for Wayne?

Yep.

I did a bit more digging and found that this page might be the better one to scrape for station names: https://app.septa.org/nta/.

In particular, this element: #septa_main_content select[name='loc_a'] seems to contain the names and parameters we'd want.

Here are the differences between that and the current data source:

Parameters

app.septa.org/nta/ www3.septa.org/VIRegionalRail.html
Jefferson Station Market East
Wawa not included
Wayne Station Wayne

I tested each of the new parameters from app.septa.org/nta/ and they see to work.

Names

app.septa.org/nta/ www3.septa.org/VIRegionalRail.html
9th Street 9th Street Station
30th Street 30th Street Station
Airport Terminal C-D Airport Terminals C & D
Airport Terminal E-F Airport Terminals E & F
Churchmans Crossing, DE Churchmans Crossing
Claymont, DE Claymont
Eastwick Eastwick Station
Elm Street-Norristown Elm Street, Norristown
Fernwood-Yeadon Fernwood–Yeadon
Jefferson Station Jefferson Station (Market East)
Main Street-Norristown Main Street, Norristown
Mt. Airy Mount Airy
Newark Station Newark
Noble Station Noble
Wawa not included
West Trenton, NJ West Trenton
Wilmington, DE Wilmington
dotzenith commented 2 days ago

Thank you for looking into it further! The new page does seem promising.

It is odd to me that Market East and Jefferson Station are valid inputs to /api/NextToArrive. For example:

Both work and return the same results.

In either case, https://app.septa.org/nta/ seems to be the more correct version for now. The changes look pretty easy so I'll make them and once I can test them with tst, I'll push a release to Septum as well!

Thank you for your help :)