Skip to content

emreYbs/TripAdvisor-Hotel-Data-Scraper

Repository files navigation

TripAdvisor-Hotel-Data-Scraper

TripAdvisor Hotel Data Scraper: Scrape Hotels' data from TripAdvisor using Python

From Hotel Data, I mean the names of the Hotels, their Ratings, Reviews, Price.You'll get a data frame output about these scraped Hotel Data, if the code works for you according to your situation, your research. You may wish to get a .csv file out of this pandas output if you need.

Again, bear in mind:

You may encounter an issue to get a successful Status Code of 200 from Trip Advisor Website sometimes. For example, I can get successful StatusCode 200 in my country but with some foreign destinations, I need to re-run this step for a couple of times for the Python Reguests library to get a Response 200 from the server. You can just change the tripadvisor link in the code and see if it works for you but as I said, sometimes, you may need to re-run this step in Jupyter Notebook. Just "don't give up the fight", as Bob Marley said:).

The code works well, just TripAdvisor server sometimes want to give us some issues not to be scraped, maybe:). So, don't give up. It will work eventually.

Step in the code to re-run till you get a successful status, 200, from Trip Advisor:
html = requests.get('https://www.tripadvisor.com.tr/Hotels-g14984534-Marmaris_District_Mugla_Province_Turkish_Aegean_Coast-Hotels.html')

Example Output

You can see an example output of this TripAdvisor Hotel Data scraper for a famous holiday destination in my country, Marmaris. You may need to change the currency sign, and try to re-run the code till you get a successful 200 Response from the server.

image

image