Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the saved json file is empty #5

Open
fatimakashakesh opened this issue Apr 10, 2023 · 3 comments
Open

the saved json file is empty #5

fatimakashakesh opened this issue Apr 10, 2023 · 3 comments

Comments

@fatimakashakesh
Copy link

fatimakashakesh commented Apr 10, 2023

i run the code but the file was empty

@fatimakashakesh
Copy link
Author

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
Copy link
Author

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

@danielbenjamins
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants