To scrape airbnb.com I have a big problem.
This is my code(python):
driver = webdriver.Chrome()
driver.get("https://www.airbnb.com/s/Italy/homes?tab_id=home_tab&refinement_paths%5B%5D=%2Fhomes&flexible_trip_lengths%5B%5D=one_week&monthly_start_date=2024-05-01&monthly_length=3&monthly_end_date=2024-08-01&price_filter_input_type=0&channel=EXPLORE&date_picker_type=calendar&checkin=2024-05-16&checkout=2024-05-17&adults=1&source=structured_search_input_header&search_type=user_map_move&price_filter_num_nights=1&zoom=5.703720341646269&zoom_level=5.703720341646269&query=Italy&place_id=ChIJA9KNRIL-1BIRb15jJFz1LOI&ne_lat=46.12096643813858&ne_lng=27.19562831030737&sw_lat=37.79321931924548&sw_lng=-0.4337798647522675&search_by_map=true")
page_load_time=5
driver.maximize_window()
time.sleep(30)
NextPage_Xpath='//*[@aria-label="Next"]'
nextpage_elements=driver.find_elements(By.XPATH,NextPage_Xpath)
if(len(nextpage_elements)>0):
while True:
next_perfomation=WebDriverWait(driver,20).until(
EC.element_to_be_clickable(nextpage_elements[0]))
if(next_perfomation):
next_perfomation.click()
time.sleep(10)
else:
break
the results are over 1000 but result pages that is shown are limited to 15 pages.
…resluts pagination Image
to solve this problem, I checked pages URL and I found a hashed value specified by cursor variable and decode it.for example, the URL of Page 2, has this hashed key :
eyJzZWN0aW9uX29mZnNldCI6MSwiaXRlbXNfb2Zmc2V0IjozNiwidmVyc2lvbiI6MX0%3D
and its decoded value is :
{"section_offset":1,"items_offset":36,"version":1}7
but i could not find a way to handle this issue.
Now, How can I load/see all search results(more than 15 pages).