0
votes

I'am trying to add "Hotel name" and "Price" to Excel.

Via google spreadsheet which has function =importXML where one can add URL and Xpath to data. The problem is that xpath is not correct for prices and hotel names.

Second day struggle. At this page for example: Booking website - xpath for prices is:
//*[@id="hotellist_inner"]/div[2]/div[2]/div[3]/div/table/tbody/tr/td[4]/div[2]/strong/b. Am i Wrong?

1
How are you getting the source? - Padraic Cunningham
chrome developers tools -> copy xpath. i thought, maybe it copies wrong xpath, but i checked other things, like page title, i mean static information. And it shows, but when it comes to price and hotel name... it doesn't show. - helgun
The source of the page not the xpath expression. - Padraic Cunningham
ah, my bad. Source of the page loads via importXML query where i add web page url - helgun
Does that handle JavaScript? - Padraic Cunningham

1 Answers

0
votes

For the hotel names the xpath you want to use is:

IMPORTXML(A1,"//*[@class='sr-hotel__name']")

The price is dynamic and constantly changes - so it is likely being loaded by a javascript endpoint - you could xpath the links to the individual pages and then pull the price from there maybe