serpapi / public-roadmap

Public Roadmap for SerpApi, LLC (https://serpapi.com)
45 stars 3 forks source link

[Google Knowledge Graph API] Support `check_in` and `check_out` dates request parameters for Hotel searches #1255

Open martin-serpapi opened 7 months ago

martin-serpapi commented 7 months ago

A customer requested that we add support for specifying Check In and Check Out dates in the Knowledge Graph result for Hotel searches, as request parameters. Google seems to be returning a random:

image

In the actual Google Search engine, those dates can be passed using the #ahotel_dates parameter. Here's an example with #ahotel_dates=2024-02-21,6:

https://www.google.com/search?q=hilton+hotel+sofia&sca_esv=586929607&hotel_occupancy=2&ei=vLJpZemHO-SFxc8PmI6_gA4&ved=0ahUKEwjp1c-cge6CAxXkQvEDHRjHD-AQ4dUDCBA&uact=5&oq=hilton+hotel+sofia&gs_lp=Egxnd3Mtd2l6LXNlcnAiEmhpbHRvbiBob3RlbCBzb2ZpYTILEAAYgAQYigUYkQIyBRAAGIAEMgYQABgWGB4yCxAAGIAEGIoFGIYDMgsQABiABBiKBRiGA0i6ElDWDVjwEHACeAGQAQCYAZ0BoAHZBKoBAzAuNbgBA8gBAPgBAcICChAAGEcY1gQYsAPCAhQQLhiABBjHARivARiYBRieBRiZBeIDBBgAIEGIBgGQBgg&sclient=gws-wiz-serp#ahotel_dates=2024-02-21,6

image

Intercom

djsegal commented 6 months ago

I've looked into adding check_in and check_out date parameters for hotel searches. The main issue is that these dates are handled dynamically through JavaScript in Google's search, not present in the static HTML we scrape. This dynamic content, loaded post-page load or via AJAX, isn't accessible with our current scraping setup focused on static content.

Considering the complexity of scraping dynamic content (like using headless browsers), it adds significant complexity. Open to suggestions or alternative approaches, but we should be aware of these technical limitations

Screenshot 2023-12-14 at 9 50 49 PM
djsegal commented 6 months ago

I don't know how we want to move forward with this? After investigating the problem further, it's clear there is an ajax call we could likely recreate:

https://www.google.com/async/additionalLiveQueryHotelPrices?vet=12ahUKEwivrYiK37KDAxUukYkEHZFrB0QQ2sYBKAd6BAgBEHc..i&ei=87uNZaKvIIaaptQPt9e5UA&opi=89978449&sca_esv=586929607&yv=3&cs=0&async=histlen:8,lqt:4,dlms:750,ui:0,hotel_occupancy:2,chd:2024-04-27,itinerary_type:1,los:2,lqtkn:ADwyn9Uiq1KO1dck5GzC2IuCGD0HRJt4P51_fkGPdfbctzE3fxdHtAcii9DE6yG057dhYe2DrXos1i9PKQ2WY6C9IdJF8Bk1DPLgu1HUqglMLWfnKF2PqJ8,seq:0,addr:,async_id:mhbbn-87uNZaKvIIaaptQPt9e5UA1,cur:USD,fc:,fprint:11568766177958064418,hid:6702074387141893913,is_rates_tab_available:false,mc:false,mdtp:1,name:,pd:nightly_price,rlst:,rqt:2,rtar:false,so:,srnr:0,srv:0,uq:hilton%20hotel%20sofia,_id:mlq-mhbbn-87uNZaKvIIaaptQPt9e5UA1,_pms:s,_fmt:pc

So no matter what this would require two queries. However we already have a Google Hotels API.

Maybe there is some quality of life improvement we could provide these users, but even after reading the Intercom exchange, I'm unsure what we can actually provide them more than said Google Hotels API?

mchrismo commented 6 months ago

Hi,

yes, with the Google Hotels API I can query hotel prices for a specific date, but unfortunately I cannot see the booking provider (source of the price).

Maybe it would be possible to transmit also the price source in the Google Hotel API?

What I wanted to do: read out the price including booking provider for a specific date.

regards,

Christian

Von: djsegal @.> Gesendet: Donnerstag, 28. Dezember 2023 19:26 An: serpapi/public-roadmap @.> Cc: mchrismo @.>; Manual @.> Betreff: Re: [serpapi/public-roadmap] [Google Knowledge Graph API] Support check_in and check_out dates request parameters for Hotel searches (Issue #1255)

I don't know how we want to move forward with this? After investigating the problem further, it's clear there is an ajax call we could likely recreate:

https://www.google.com/async/additionalLiveQueryHotelPrices?vet=12ahUKEwivrYiK37KDAxUukYkEHZFrB0QQ2sYBKAd6BAgBEHc..i&ei=87uNZaKvIIaaptQPt9e5UA&opi=89978449&sca_esv=586929607&yv=3&cs=0&async=histlen:8,lqt:4,dlms:750,ui:0,hotel_occupancy:2,chd:2024-04-27,itinerary_type:1,los:2,lqtkn:ADwyn9Uiq1KO1dck5GzC2IuCGD0HRJt4P51_fkGPdfbctzE3fxdHtAcii9DE6yG057dhYe2DrXos1i9PKQ2WY6C9IdJF8Bk1DPLgu1HUqglMLWfnKF2PqJ8,seq:0,addr:,async_id:mhbbn-87uNZaKvIIaaptQPt9e5UA1,cur:USD,fc:,fprint:11568766177958064418,hid:6702074387141893913,is_rates_tab_available:false,mc:false,mdtp:1,name:,pd:nightly_price,rlst:,rqt:2,rtar:false,so:,srnr:0,srv:0,uq:hilton%20hotel%20sofia,_id:mlq-mhbbn-87uNZaKvIIaaptQPt9e5UA1,_pms:s,_fmt:pc

So no matter what this would require two queries. However we already have a Google Hotels API.

Maybe there is some quality of life improvement we could provide these users, but even after reading the Intercom exchange, I'm unsure what we can actually provide them more than said Google Hotels API?

— Reply to this email directly, view it on GitHub https://github.com/serpapi/public-roadmap/issues/1255#issuecomment-1871400058 , or unsubscribe https://github.com/notifications/unsubscribe-auth/BEMI3WCVNZJN2VP26MBB2FLYLW2ULAVCNFSM6AAAAABACUCRVSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRGQYDAMBVHA . You are receiving this because you are subscribed to this thread. https://github.com/notifications/beacon/BEMI3WEFVQ5X7WXV3CXAO73YLW2ULA5CNFSM6AAAAABACUCRVSWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTPRNGHU.gif Message ID: @. @.> >

ilyazub commented 6 months ago

What I wanted to do: read out the price including booking provider for a specific date. - With Google Hotels API I can read out the price for a specific date, but not the booking provider. - With Google Search API I can read out the booking provider and the price, but just for a random date.

@mchrismo, thanks for your feedback. This is super valuable.

Google Hotels lists the booking providers after clicking "Check Availability in the knowledge graph in Google Search".

image (ref)

Both approaches will require us adding the new engine. @djsegal what source (knowledge graph vs hotels prices does contain more data, is faster, and simpler to implement?

djsegal commented 5 months ago

Given the requirements for integrating date parameters in hotel searches, I recommend pursuing the google.com/travel/search?q= API. This API is likely more suitable for our needs, providing comprehensive travel-related data that includes dynamic hotel pricing and availability based on specific dates. Its broader functionality makes it a more versatile choice for this application