Comments (6)
Tested with curl -i -X POST -H 'Content-Type: application/json' -d <somedata> https://www.amtrak.com/v4/journey-solution-option
may have to try with cookies or through a browser.
One thought is to get cookies from a chromedriver session and pass this in the post request
This returned the default "couldn't process your request" error from amtrak's site, same as when using an unmodified webdriver
from amtrak-rail-planner.
from amtrak-rail-planner.
Parsing session storage worked. Each train is stored in the following path:
journeySolutionOption : dict
journeyLegs : list (of one dict)
journeyLegOptions : list (of all results as dict)
% data stored in here as a mix of list of lists and dicts
This not only makes parsing a page faster as we just need session storage, but it also reveals a lot of hidden data such as fare types and train information for multiple segments, seating accommodations, etc. Would need a deep dive.
from amtrak-rail-planner.
Useful keys from session storage.
searchresults
is the meat of what we're after
stationsData_stations
returns a list of every location served by amtrak, train or bus
traincodes
returns every train by number. Train website is /firstword-secondword-train
.
The latter two can be retrieved just by going to amtrak.com
from amtrak-rail-planner.
After closer examination:
traincodes
is useful, but for what, I am not sure in this applicationstationsData_stations
is great and well formatted but includes bus stops which seems out of scope at this point. However I would not be opposed to including this feature later, perhaps as an "Include Bus Stops" option.searchresults
I really want to work but it still requires that we use a search, and with a webdriver, what's the point
from amtrak-rail-planner.
JSON data only
from amtrak-rail-planner.
Related Issues (14)
- Swapping images during a search displays the wrong city
- Error message for origin/destination being the same even if swapped HOT 1
- Itinerary does not display full date or segment number HOT 1
- Editing display columns only adds to table attributes
- Sort trains list by departure date HOT 1
- Previous search results do not show up
- Display a map of origin and destination stations HOT 3
- Click on city picture to bring up information
- Alert user if new search is the same day as their previous segment
- "Use Rail Pass" option HOT 1
- Re-populate search information from segment list
- When loading application, exception created related to thread
- Webdriver browser may be detected HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amtrak-rail-planner.