Scrape Data from Booking.com using Python - HTML to Excel & CSV

  Рет қаралды 21,952

Amin Boutarfi

Amin Boutarfi

Күн бұрын

Пікірлер: 47
@olumidepeter3456
@olumidepeter3456 Жыл бұрын
This is a better way than bs4. Good job
@AminBoutarfi
@AminBoutarfi Жыл бұрын
I agree! It is better since playwright provides more functionalities. Basically simulating everything we can do on a browser, and it's lighter than Selenium. Thank you for your interest!
@healwhazy
@healwhazy 2 ай бұрын
I swearrr this helped me so much! Thank youuuu
@rrvbin6354
@rrvbin6354 8 ай бұрын
Your videos are very interesting, so I followed you. It’s a shame that your last video was uploaded 11 months ago. This channel has potential to grow a lot more!
@AminBoutarfi
@AminBoutarfi 8 ай бұрын
Thanks a lot @rrvbin6354 will be back very soon 🙏
@ahassan7270
@ahassan7270 7 ай бұрын
Thank you so much for sharing such valuable information. You are Genius.👏👏
@unknown35514
@unknown35514 11 ай бұрын
How can I scrape more data in each hotels? because there is a lot more data when you click every hotel listed in the search like most popular facilities, address etc
@alexmckinley79
@alexmckinley79 Жыл бұрын
You legend! Thank you!
@XiangyiZhu-k9m
@XiangyiZhu-k9m Жыл бұрын
Hi! this is an amazing tutorial! I have a one quick question, why only 30 hotels are scraped?
@mohdkhaizurkhairuddin3830
@mohdkhaizurkhairuddin3830 10 ай бұрын
Can we scrappe the reviews?
@santiagonegrotto2777
@santiagonegrotto2777 4 ай бұрын
Could you do it to search rental cars ?
@p.a.8283
@p.a.8283 9 ай бұрын
Can you tell us how to scrape the Stars rating? So the number of stars a hotel has?
@pavlos1016
@pavlos1016 Жыл бұрын
Also, you may face the issue of clicking on the accept cookie button, otherwise the banner will prevent you from scrapping some data. Especially if you want to go to the next page because the cookie banner hides the next page button. If you want the script to run automatically, you must automate the accept cookie button. In selenium, this is the script: driver.find_element(By.XPATH, '//button[contains(text(), "Accept")]').click() But you should wait for the browser to fully load in order for the cookie banner to pop up and then click the accept button.
@flaviacittadini5017
@flaviacittadini5017 Жыл бұрын
I am getting a timeout error with Amin's code and I think that's the reason why the output files are not being generated although it runs and print the number of results. Would you know why that is? (just asking because I noticed you clearly have a better domain on this than I do)
@AminBoutarfi
@AminBoutarfi Жыл бұрын
Good observations! Will update the code to that.
@AminBoutarfi
@AminBoutarfi Жыл бұрын
Will fix the code shortly, was away from KZbin for a while.
@novotododia709
@novotododia709 Жыл бұрын
@@AminBoutarfi hello! just found out your video today, thank you for helping us! did you already fix this cookie error?
@novotododia709
@novotododia709 Жыл бұрын
@@flaviacittadini5017 I was having this problem, then i noticed it was because of the check in and out date, which were on april, and we are on july, so the url wasnt working. You gotta change the dates
@SmartTech-m1u
@SmartTech-m1u 4 ай бұрын
brillant one
@dr.python4113
@dr.python4113 Жыл бұрын
I'm the first commenter. I really like this video.
@AminBoutarfi
@AminBoutarfi Жыл бұрын
Thank you! I really appreciate it!
@asuelkellm1515
@asuelkellm1515 Жыл бұрын
Hey really nice tutorial, thanks :) PS : How do you do when you want to scrape several city at the same time?
@AminBoutarfi
@AminBoutarfi Жыл бұрын
Still didn't implement that yet! Will do it in future for sure. Right now you can add like a list of cities to the script and loop over them. The city is currently static in the URL (Paris). You need to make it dynamic
@Mangopa94ify
@Mangopa94ify 11 ай бұрын
@@AminBoutarfi how do you make it dynamic? my goal would be to enter a precise location and search the hotels within X km. I'm struggling with that
@itspacenews
@itspacenews Жыл бұрын
So how can we scrape for more data??
@AminBoutarfi
@AminBoutarfi Жыл бұрын
You need to go through multiple pages (deal with pagination). You have 2 options: 1- tell Playwright to click on the next button bellow each time (google how to click buttons using playwright. Very easy) 2- Booking as of now Booking.com use the "&offset=" in the URL for pagination purposes. If you go to page 2, you would find that the URL is the same as page 1, the only difference is that: "&offset=25" is added, and for page 3 "&offset=50" and so on. Loop over multiple pages since now we just need the first URL, and add "&offset= ..." each time, and scrape data. Hope it helps!
@flaviacittadini5017
@flaviacittadini5017 Жыл бұрын
Hi! Could you make it? I tried the second option that Amin suggested but I can only scrap 2 pages at a time and then it will timeout :/
@novotododia709
@novotododia709 Жыл бұрын
@@AminBoutarfi how can i get to know how many pages are for a specific location, so I can loop for a specific number of pages
@amineboussetta9391
@amineboussetta9391 9 ай бұрын
The booking page asks me to log in everytime so the script doesn't work. Any solutions ? Thank you!
@Rob.U
@Rob.U 8 ай бұрын
Maybe because this is older and they have changed somethings but I'm getting an error trying to scrape with the price. When I comment out the code for the line of price it works just fine.. but of course that is a very important piece. How can I work around this?
@flaviacittadini5017
@flaviacittadini5017 Жыл бұрын
Hi! Sorry, I am a REAL beginner. You included a Proxy in the comments but never mentioned it in the video. What should I do with that one?
@AminBoutarfi
@AminBoutarfi Жыл бұрын
Hey, implementing proxies in your code depends on the provider. Usually you send a code or proxy numbers with the header of the request. Will make a special video about it. Proxy providers usually have documentation/ code examples, check that out.
@eldarkadric349
@eldarkadric349 Жыл бұрын
How can we scrape all hotel URLs?
@AminBoutarfi
@AminBoutarfi Жыл бұрын
Not sure if I understood, but this script will get you data from the first page only. You need to add a pagination mechanism in place, Will do that in future!
@motivational-speech-
@motivational-speech- 11 ай бұрын
@@AminBoutarfi I mean scrape galery photos inside each hotel and other data
@EduardStaudinger
@EduardStaudinger Жыл бұрын
Hi there, really amazing tutorial, thank you so much for this! I've got a bit of an issue, though: Whenever I launch the script, it never creates the Excel/CSV files. It prints out the amount of hotels within the console, though. But I think it crashes after that, because it also doesn't close the browser window. Do you know what might cause this issue?
@jenchendiadeguzman8142
@jenchendiadeguzman8142 Жыл бұрын
Hello Amin, can you teach how to scrape data from booking flight website to Excel? Thank you! 😊
@AminBoutarfi
@AminBoutarfi Жыл бұрын
Great idea! Will that in future video
@jenchendiadeguzman8142
@jenchendiadeguzman8142 Жыл бұрын
Thank you! I'll wait for that. 😊
Web Scraping to CSV | Multiple Pages Scraping with BeautifulSoup
29:06
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
Always Check for the Hidden API when Web Scraping
11:50
John Watson Rooney
Рет қаралды 654 М.
How to Scrape Google Maps at the Country Level
18:05
Scrap-io
Рет қаралды 21 М.
Scraping Data from a Real Website | Web Scraping in Python
25:23
Alex The Analyst
Рет қаралды 535 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 1,1 МЛН
Python AI Web Scraper Tutorial - Use AI To Scrape ANYTHING
45:36
Tech With Tim
Рет қаралды 210 М.
How To Extract Scraped Data To Excel (Using Python)
6:38
Oxylabs
Рет қаралды 25 М.
Scrape Booking.com with me
59:20
The Data Nomad
Рет қаралды 383