StackOverflow - web-scraping, graphql, airbnb-js-styleguide
How to set the AirBNB API "extensions" parameter?
I am trying to scrape AirBNB by plain HTTP requests and noticed something. Let's say we use this search string: " New York, New York, United States ". The simplest working request (striped off from unnecessary headers and fields) I can use to get the desired results is this: GET /api/v3/ExploreSections?operationName=ExploreSections&locale=en¤cy=USD&variables=%7B%22isInitialLoad%22%3Atrue%2C%22hasLoggedIn%22%3Afalse%2C%22cdnCacheSafe%22%3Afalse%2C%22source%22%3A%22EXPLORE%22%2C%22exploreRequest%22%3A%7B%22metadataOnly%22%3Afalse%2C%22version%22%3A%221.8.3%22%2C%22itemsPerGrid%22%3A20%2C%22placeId%22%3A%22ChIJOwg_06VPwokRYv534QaPC8g%22%2C%22query%22%3A%22New%20York%2C%20New%20York%2C%20United%20States%22%2C%22cdnCacheSafe%22%3Afalse%2C%22screenSize%22%3A%22large%22%2C%22isInitialLoad%22%3Atrue%2C%22hasLoggedIn%22%3Afalse%7D%2C%22removeDuplicatedParams%22%3Atrue%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%2282cc0732fe2a6993a26859942d1342b6e42830704b1005aeb2d25f78732275e7%22%7D%7D HTTP/2 Host: www.airbnb.com X-Airbnb-Api-Key: d306zoyjsyarp7ifhu67rjxn52tv0t20 Accept-Encoding: gzip, deflate At this point, that API key is pretty much public, so not a concern. The readable content of the "variables" parameter is this: { "isInitialLoad": true, "hasLoggedIn": false, "cdnCacheSafe": false, "source": "EXPLORE", "exploreRequest": { "metadataOnly": false, "version": "1.8.3", "itemsPerGrid": 20, "placeId": "ChIJOwg_06VPwokRYv534QaPC8g", "query": "New York, New York, United States", "cdnCacheSafe": false, "screenSize": "large", "isInitialLoad": true, "hasLoggedIn": false }, "removeDuplicatedParams": true } The readable content of the "extensions" parameter is this: { "persistedQuery": { "version": 1, "sha256Hash": "82cc0732fe2a6993a26859942d1342b6e42830704b1005aeb2d25f78732275e7" } } I am trying to figure out where that hash comes from. It seems it's calculated from a GraphQL query but I don't know anything else and there is no documentation about it. Any help?
Was this helpful?
Related Articles
Have a different question?
Can't find the answer you're looking for? Submit your own question to our community.
🛎️ Get Weekly OTA Fixes
New answers, vendor issues, and updates — straight to your inbox.