zoranpandovski / bookingscraper Goto Github PK
View Code? Open in Web Editor NEW:earth_americas: :hotel: Scrape Booking.com :hotel: :earth_americas:
License: GNU General Public License v3.0
:earth_americas: :hotel: Scrape Booking.com :hotel: :earth_americas:
License: GNU General Public License v3.0
We don't have any tests. Contributions are welcome
Regardless of the specified output format, the save_data
function prints:
You can find them in hotels-in-macedonia.xlsx file
Lines 99 to 102 in 2206fe9
Traceback (most recent call last):
File "booking.py", line 214, in <module>
get_data(args.rooms, args.country, args.out_format, args.startdate, args.enddate)
File "booking.py", line 153, in get_data
save_data(hotels_list, out_format=out_format, country=country)
File "booking.py", line 164, in save_data
file = writer.output_file()
File "C:\Projects\bookingscraper\file_writer.py", line 22, in output_file
json.dump(list(self.data), outfile, indent=2, ensure_ascii=False)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 180, in dump
fp.write(chunk)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u01c0' in position 23: character maps to <undefined>
Got this after python booking.py
. Does it require any arguments or config changes?
Hi there, Excellent work, thanks a lot!
I face an issue when running it though:
The error is:
Exception in thread Thread-18:
Traceback (most recent call last):
File "C:\Anaconda3\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Anaconda3\Projects\Scraper\Booking.com\bthread.py", line 15, in run
self.process_hotels(self.session, self.offset, self.rooms, self.country)
File "booking.py", line 56, in process_hotels
**name = ho.find('a', {'class': 'jq_tooltip'})['title']**
File "C:\Anaconda3\lib\site-packages\bs4\element.py", line 1071, in __getitem__
return self.attrs[key]
KeyError: 'title'
This error is thrown out 11 times, for different threads.
The line throwing the error seems to be: name = ho.find('a', {'class': 'jq_tooltip'})['title']
I ran the script booking.py
It produces however a file with a list of hotels in the country.
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.
Currently, booking URL is hardcoded, we need an option for choosing which country should be scrapped.
/Documents/GitHub/BookingScraper/booking.py' && echo Exit status: $? && exit 1
Traceback (most recent call last):
File "/Documents/GitHub/BookingScraper/booking.py", line 214, in
get_data(args.rooms, args.country, args.out_format, args.startdate, args.enddate)
File "/Documents/GitHub/BookingScraper/booking.py", line 152, in get_data
hotels_list: list = prep_data(rooms, country, out_format, start_date, end_date)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pascal/Documents/GitHub/BookingScraper/booking.py", line 122, in prep_data
parsed_html.find_all("li", {"class": "sr_pagination_item"})[-1]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
IndexError: list index out of range
Currently, all of the accommodations are saved inside as JSON inside a file, we need more options e.g(CSV, excel)
Right now the scraper just gets names of the accommodations.
Would it be possible to start tracking more data points? E.g. price per night, amenities, location, ratings, reviews etc.
We need more tests. Contributions are welcome!
Congratulation for the nice work.
I was wondering how can it be added the city to the searching arguments?
Thank you in advance.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
requirements.txt
openpyxl ==2.6.2
argcomplete ==1.12.2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.