public-roadmap
public-roadmap copied to clipboard
[Google Flights API] Return link to the selected flights page
At the bookings screen (after you've selected your flights), there's a share button that can be clicked, I'd like to for the API to return the link that appears when the share button is clicked.
It is likely we need a new endpoint for this:
curl 'https://www.google.com/_/TravelFrontendUi/data/batchexecute?rpcids=A603Y&source-path=%2Ftravel%2Fflights%2Fbooking&f.sid=9024555003883451653&bl=boq_travel-frontend-ui_20240318.01_p0&hl=en-US&soc-app=162&soc-platform=1&soc-device=1&_reqid=2444454&rt=c' \
--data-raw 'f.req=%5B%5B%5B%22A603Y%22%2C%22%5B%5C%22https%3A%2F%2Fwww.google.com%2Ftravel%2Fflights%2Fbooking%3Ftfs%3DCAIQAhpEEgoyMDI0LTA0LTE4Ih8KA0tVTBIKMjAyNC0wNC0xOBoDRFBTKgJRWjIDNTU1agwIAhIIL20vMDQ5ZDFyBwgBEgNEUFMaRBIKMjAyNC0wNC0yNCIfCgNEUFMSCjIwMjQtMDQtMjQaA0tVTCoCQUsyAzM3N2oHCAESA0RQU3IMCAISCC9tLzA0OWQxQAFIAXABggELCP___________wGYAQE%26source%3Dflre_fli_share%26utm_campaign%3Dsharing%5C%22%5D%22%2Cnull%2C%22generic%22%5D%5D%5D&' \
--compressed
Hmm.... I think what i'm really interested in is getting this URL from the booking page:
Right now, SerpApi returns a google_flights_url
in the search_metadata
. When used with the booking_token
, that url looks like https://www.google.com/travel/flights?hl=en&gl=us&curr=USD&q=Flights+to+AUS+from+CDG+on+2024-03-21+through+2024-03-27
. But I would like the API to return a link to the actual booking page as seen on the screenshot.
Would that be a better alternative? Would it make sense for me to close this issue and create a new one?
After looking more details into the new endpoint payload, they are actually the same thing. The new endpoint is to retrieve the shortened URL with tracking information.
Thus, we do not need a new endpoint but we have to generate the tfs
value (which contains the info of the selected flights). The tfs
query is a protobuf byte data encoded in base64, it could be challenging to reverse engineer.
Would that be a better alternative? Would it make sense for me to close this issue and create a new one?
That's fine, we could keep this open. Thanks for the reporting!
We've released a fix for this. Now search_metadata.google_flights_url
returns correct URL.
The actual Google Flight Page following the link.