Package: booking-scraper
booking_scraperI made this python 3.+ to prove that is possible to scrape complex websites with tons of data like booking.com, to study the Beautifulsoup module and to have fun programming.For this project i started from the @ZoranPandovskiBookingScraperHow to install$ pip install booking-scraperHow to useFrom bashlaunch the script with :$ python3 -m booking_scraper.bkscraper --city "New York" --limit 0Usable ParametersParameterDescriptionMandatory--peopleUsed to specify the number of people to the booking request. The default value is 1No--countryUsed to specify the country for the scraping request.Yes if--cityis not used--cityUsed to specify the city for the scraping request.Yes if--countryis not used--dateinUsed to specifiy checkin day. If not setted the field will automatically be setted to todayNo--dateoutUsed to specifiy checkout day. If not setted the field will automatically be setted to tomorrowNo-o --outdirUsed to specify the output dir and filename. If not setted the field the script will automatically set the same execution script directory with the following nomenclature:CountryCity_date_time.jsonNo-d --detailUsed it if you want more details in the output. It will take time to produce the output (not reccomended for long analysis or--limitis not setted to 0)No-v --verboseUsed it if you want more logs during the process.No-l --limitUsed to specify the number of page to fetch. If the number will be greater than the effective number of pages retrieved from the search it will be ignored like if the input number will be < 0. If will be 0 the process will fetch all the pages and if the number will be less than the effective number of page retrieved it will process only those pagesNoBash Example$ python3 -m booking_scraper.bkscraper --city "New York" --limit 0 -d -v -o ./test.jsonFrom python Codeyou can import the module with:from booking_scraper import bkscraperto use it the only available method is:bkscraper.get_result(**kwargs)it use the same logic as the bash execution mode and the available params are:ParameterDescriptionMandatorypeopleUsed to specify the number of people to the booking request. The default value is 1NocountryUsed to specify the country for the scraping request.Yes ifcityis not usedcityUsed to specify the city for the scraping request.Yes ifcountryis not useddateinUsed to specifiy checkin day. If not setted the field will automatically be setted to todayNodateoutUsed to specifiy checkout day. If not setted the field will automatically be setted to tomorrowNodetailUsed it if you want more details in the output. It will take time to produce the output (not reccomended for long analysis orlimitis not setted to 0)NolimitUsed to specify the number of page to fetch. If the number will be greater than the effective number of pages retrieved from the search it will be ignored like if the input number will be < 0. If will be 0 the process will fetch all the pages and if the number will be less than the effective number of page retrieved it will process only those pagesNoIf either city or country param is not setted the script will rise an Exception.Code Exampleimport json
from booking_scraper import bkscraper

#It fetches only the first page for New York city with details
result = bkscraper.get_result(city="New York", limit=1, detail=True)


with open("output.json", 'w', encoding='utf-8') as f:
    json.dump(result, f, ensure_ascii=False, indent=4)
    f.close()## PublicThis script was first featured on Reddit at /r/learnpython -see herefor the thread. I’ve finally decided to release the script.ToDo ListScrape the "all facility checklist" offered in the structure divided by groups like the website in the detail viewMake the script as moduleApply filters in the searchcode review to make it lighterDisclaimerThis project is for educational and research purposes only. Any actions and/or activities related to the material contained on this GitHub Repository is solely your responsibility. The misuse of the information in this GitHub Repository can result in criminal charges brought against the persons in question. The author will not be held responsible in the event any criminal charges be brought against any individuals misusing the information in this GitHub Repository to break the law.You are not allowed to copy and paste content from Booking.com on to your own or third party pages (including social media pages such as Facebook, Twitter, Instagram etc.).This applies to all types of content that can be found on Booking.com pages, including but not limited to hotel descriptions, reviews, hotel and room photos, hotel facility information, and prices. Moreover, this restriction also applies to content from Booking.com partner hotel websites and Booking Holdings Group company brands: such as Agoda, Priceline, Kayak, OpenTable, Rentalcars.Clause 4.1.5 from Booking.com Affiliate Agreement: The Affiliate shall not programmatically evaluate and extract information (including guest reviews) from any part of the Booking.com Website (e.g. screen scrape).