Originally Posted by
serpens
Where do I find that JSON info? I know how to get the raw page source; is it in there?
Well…no. To summarize the past 20-odd years of web development, now webpages frequently (if not usually) send Javascript programs in the raw page source, and those programs interact with the server by sending and receiving messages, and those messages are not part of the source.
You can find the session storage in your browser's developer tools. In Firefox, that's Tools > Browser Tools > Web Developer Tools and then select the Storage tab and then Session Storage on the left. In Google Chrome View > Develoepr > Developer Tools and then the Application tab, and then Storage > Session Storage on the left.
Of course
searchResults only shows up after you have done a search. You can also narrow down the output by pasting a one-line program into the Console part of the developer tools, e.g.:
Code:
console.log(JSON.stringify(JSON.parse(sessionStorage.searchresults).journeySolutionOption.journeyLegs.map(j=>j.journeyLegOptions.map(o => o.seatCapacityInfo.seatCapacityTravelClasses)),0," "))
(Sorry you have to scroll, I don't know how to make it wider without breaking the formatting and still keep it one line.)
What is criticalCapacity? What is availableInventory? Sometimes one is larger and sometimes the other, which mean that sometimes the quotient is larger than unity and sometimes smaller, which doesn't make sense. It seems I'm misunderstanding something.
Err…what? Do you have an example where
availableInventory is larger than
criticalCapacity, other than when the latter is zero?
I understand
availableInventory to be the number of seats left for sale in that fare type (which can be a little weird and overlapping if there are multiple fare types in a given class, like when Saver fares would sell out before Value fares before regular fares…I'm not sure if that can still happen in the post-October pricing model?) and
criticalCapacity is the total number of seats for sale in that class of the train (e.g. 360 seats in coach on Train 160, which means 5 coaches at 72 seats per coach).