Skip to content

Commit

Permalink
Fix bug: when only 1 page is available (no pagination)
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentine-456 committed Dec 6, 2023
1 parent 9518397 commit e17c152
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion otodom/task_1/Valentyn/src/Scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def start_scraping(self, limit: int = 200) -> [HouseItem]:
last_page_elem = soup.select_one('nav[data-cy="pagination"] a:last-of-type')
if last_page_elem is None:
print("ERROR: no pagination found on the page")
return []
print("Trying to scrape 1st (the only) page...")
return self.get_page(1)

scraped_pages = []
max_page = int(last_page_elem.getText())
Expand Down

0 comments on commit e17c152

Please sign in to comment.