Amtrak Price Tracking Tool

Amtrak Unlimited Discussion Forum

Help Support Amtrak Unlimited Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
To replicate Amsnag's functionality would require a much deeper and more difficult hack to beat Amtrak's security and independently invoke that internal Amtrak API to get a JSON object which the hacker could consume to get the data. Although a few months ago a member here apparently had successfully done that, I have not heard anything more about it.

Unfortunately I have not made any more progress- The hang up is still in making Amtrak consistently accept requests, as they tend to block you after fetching JSON a few times.
 
I don't want to get hopes up prematurely but I have had much more success hitting the API directly. I'm able to return 30 days of trains in about 5 seconds for short routes in my testing. Some very busy routes take much longer (30+ seconds) due to the sheer number of options. This is through interacting with their API directly without relying on any scraping methods (like RailForLess.us).

The primary caveat is it will require a Chrome extension to be installed that links a valid Amtrak page to my (currently nonexistent) website. In the future if I get everything up and running without issues, I could cache trips and allow people to view these cached trips without using the extension, but this requires a database and a web API. V1 will most likely be a static Blazor SPA hosted for free by Cloudflare.
 
Unfortunately I have not made any more progress- The hang up is still in making Amtrak consistently accept requests, as they tend to block you after fetching JSON a few times.
I am not computer saavy, so forgive my lack of knowledge, but in order for Amtrak to do that, don't they have to place "cookies" on your computer, to recognize repeated inquiries? Couldn't some program "erase" these automatically after each inquiry, so they would not recognize repeated inquiries?
🤔
 
I am not computer saavy, so forgive my lack of knowledge, but in order for Amtrak to do that, don't they have to place "cookies" on your computer, to recognize repeated inquiries? Couldn't some program "erase" these automatically after each inquiry, so they would not recognize repeated inquiries?
🤔
No, because:
  1. Amtrak refuses requests that lack cookies, and I have not found a way of generating them, hence needing a legitimate Amtrak tab
  2. Repeated attempts are likely linked to IP as well as cookies.
Sounds encouraging - maybe you and RailForLess could make it a team effort?
Maybe - I have seen his code, though, and our tech stacks are very different.
 
I've had a major breakthrough today - I won't get into details, but it is easily scalable and relatively inexpensive to operate ($35-40/month). I can host the front-end for free with Cloudflare and am looking at Azure Functions as a cheap way of providing a serverless API. The main question mark right now is whether I should use Azure CosmosDb or SQL Server. The latter is potentially more expensive but I also have much more experience managing it than Cosmos.

I also would love to call it Amsnag 2.0 - however I wouldn't want to use it without Paul Marlin's permission and I haven't been able to get in touch with him.
 
Would an open source DB like MySql work for you? That would save the expense of SQL Server.
The issue is not the cost of licensing but the cost of hosting. Both SQL sever and MySQL are relatively expensive compared to Azure CosmosDb which is a NOSQL service with a (optional) serverless model. So in theory, I will pay virtually nothing to run my database and API because of how generous their free limits are.
 
Given that's it's been a month, I decided it was time to post an update. Progress has been slower for a variety of reasons:
  1. I've had issues finding a reliable proxy service
  2. Amtrak has made this exceedingly difficult by not including the prices of bedrooms and family rooms in the trip response (as of a month or so ago) meaning I need to make an additional 60-120 requests to fetch this data from a separate API endpoint.
However, bedroom and family room pricing aside, I have a ~99% success rate against my API. However, this seems to drop if I spam requests at my API, which shouldn't be the case since it is a fully serverless architecture. Regardless, it takes 30-80 seconds to return a month of trips.

I am currently working on improving the reliability of fetching the bedroom and family room prices.
 
I have officially joined forces with RailForLess.us so I can focus on perfecting the backend while Sean, the creator of RailForLess, can focus on frontend. 😀
Thats good news. I have been in touch with Sean and he reported that the site has had a lot of trouble recently scraping data from amtrak.com. This was not a bug in the code—Amtrak.com uses reCAPTCHA Enterprise to prevent bots from scraping the site. This is now all reported on the webpage. With two expert IT guys now addressing the problem we may yet see railsforless functionality again. It is a really useful tool for rail passengers.
 
Amtrak.com uses reCAPTCHA Enterprise to prevent bots from scraping the site.
That's infuriating. The whole point in having peak-hour (transit) or peak-time or -day (travel) fares, after all, is to encourage people to fill up your empty seats. Or berths. Yet Amtrak won't provide this simple comparison nor make it feasible for others to do so.
 
That's infuriating. The whole point in having peak-hour (transit) or peak-time or -day (travel) fares, after all, is to encourage people to fill up your empty seats. Or berths. Yet Amtrak won't provide this simple comparison nor make it feasible for others to do so.
Exactly. It seems Amtrak does everything in its power to hinder ridership not promote it. A public company should make it easy for passengers to use the service and maximize ridership. Instead they put obstacles in the way. This is difficult to understand.
 
That's infuriating. The whole point in having peak-hour (transit) or peak-time or -day (travel) fares, after all, is to encourage people to fill up your empty seats. Or berths. Yet Amtrak won't provide this simple comparison nor make it feasible for others to do so.

Many airlines do the same thing. There are many tools people use to find the lowest airfare for business class and first class. Recently some have received cease and desist letters from the air carriers. This is not a cat and mouse game unique to just Amtrak.
 
Many airlines do the same thing. There are many tools people use to find the lowest airfare for business class and first class. Recently some have received cease and desist letters from the air carriers. This is not a cat and mouse game unique to just Amtrak.
The fact that airlines need to send a C&D letter, because the sites are functioning just fine without their expressed written permission, is the first and most obvious way this is different. Not to mention it's been over a decade since I encountered an airline incapable of displaying at least a week's worth of fares at a time.
 
The fact that airlines need to send a C&D letter, because the sites are functioning just fine without their expressed written permission, is the first and most obvious way this is different. Not to mention it's been over a decade since I encountered an airline incapable of displaying at least a week's worth of fares at a time.

Not every thing you see in the public sphere is the only fares available for a given seat, date, time, airline, etc.
 
Not every thing you see in the public sphere is the only fares available for a given seat, date, time, airline, etc.
The frustration comes from expecting Amtrak to offer the same basic booking services US airlines have provided without issue for more than a decade. It does not come from a lack of specialized services with advanced collating, creative reselling, or real-time arbitrage. If Amtrak published (or reliably enabled) week or month-long fare discovery like US airlines do I would be much more likely to ride and willing to pay more than Amtrak receives from their clunky third party bidding process for a guaranteed room. It would be fair and reasonable to create and designate a carrier-controlled API and insist third parties use it as intended, but the current option of an extremely tedious booking process combined with aggressive anti-scraping and no practical interface is counterproductive to everyone.
 
Last edited:
I have not had major issues with Captcha due to using a different method of accessing the data. We are currently planning on using my API/backend to power Railforless instead of his current method that has Captcha issues (and is slower).
This is great to hear that Sean and yourself have teamed up to do something good for the rail passenger community and for Amtrak as well.
 
I just noticed that Google has seemed to add a plug-in to track the fares of Amtrak trains!

Doing a quick Google search with the keyword "Book trains between Portland and Seattle" I immediately get a page with all of the various trains!

Screenshot 2024-01-06 at 10.40.59 AM.png

I tried it for a couple different city pairs. The tool also shows some of the coach prices for the LDs (I tried SEA-LAX, SEA-CHI, and got results for both), but does not seem to show roomette prices.

I still love what Railforless does and am optimistic for its future, and hoping it can fill in some of the gaps that this Google tracking tool and Amtrak themself don't have.
 
Last edited:
I just noticed that Google has seemed to add a plug-in to track the fares of Amtrak trains!

Doing a quick Google search with the keyword "Book trains between Portland and Seattle" I immediately get a page with all of the various trains!

View attachment 35312

I tried it for a couple different city pairs. The tool also shows some of the coach prices for the LDs (I tried SEA-LAX, SEA-CHI, and got results for both), but does not seem to show roomette prices.

I still love what Railforless does and am optimistic for its future, and hoping it can fill in some of the gaps that this Google tracking tool and Amtrak themself don't have.
I googled and can't seem to have this show up. What specifically am I looking for to make it work.
 
Back
Top