serpapi

Sorting Hotel Listings by Price in Descending Order Using SerpAPI with Google Hotels


I'm using SerpAPI to scrape hotel listings from Google Hotels based on a specified budget. Currently, I'm facing a challenge where I need to retrieve the most expensive hotel within a given budget, but Google Hotels does not support sorting the listings by price in descending order. Additionally, setting a fixed minimum and maximum price range is not feasible as it might exclude available hotels if none fit within that exact range.

How can I effectively retrieve the most expensive hotel within a dynamic budget using SerpAPI with Google Hotels, given these constraints?

Any guidance or workaround to manage the price sorting or filtering would be greatly appreciated.


Solution

  • this is the answer I got from serpapi when asking them about this through their support:

    "Unfortunately, we don't currently have support for sorting hotel results from highest to lowest price. This is because Google itself does not support that option. Using the method you mentioned where you sort from lowest, you can find the maximum by paginating using the next_page_token until you reach the last page of results. The last result on that page will be the actual maximum."

    Hope this helps.

    O