booking_scraper icon indicating copy to clipboard operation
booking_scraper copied to clipboard

the saved json file is empty

Open fatimakashakesh opened this issue 2 years ago • 3 comments

i run the code but the file was empty

fatimakashakesh avatar Apr 10 '23 14:04 fatimakashakesh

when running the code i get this error File "C:\Users\pc\AppData\Local\Programs\Python\Python311\venv\test.py", line 5, in result = bkscraper.get_result(city="New York", limit=1, detail=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pc\AppData\Local\Programs\Python\Python311\venv\Lib\site-packages\booking_scraper\bkscraper.py", line 175, in get_result result = process_data(people, country, city, datein, dateout, is_detail, limit) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pc\AppData\Local\Programs\Python\Python311\venv\Lib\site-packages\booking_scraper\bkscraper.py", line 65, in process_data max_off = int(get_max_offset(soup)) ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pc\AppData\Local\Programs\Python\Python311\venv\Lib\site-packages\booking_scraper\bkscraper.py", line 24, in get_max_offset all_offset = soup.find_all('li', {'class': 'sr_pagination_item'})[-1].get_text().splitlines()[-1] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^ IndexError: list index out of range

fatimakashakesh avatar Apr 10 '23 15:04 fatimakashakesh

in process_data max_offset = int(get_max_offset(soup)) ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pc\AppData\Local\Programs\Python\Python311\venv\bkscraper.py", line 24, in get_max_offset all_offset = soup.find_all('li', {'class': 'sr_pagination_item'})[-1].get_text().splitlines()[-1] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^ IndexError: list index out of range

fatimakashakesh avatar Apr 10 '23 15:04 fatimakashakesh

Same problem (empty json file) here, but no errors

danielbenjamins avatar Feb 01 '24 03:02 danielbenjamins