Skip to content

Commit

Permalink
Add a little check for possible extra rows
Browse files Browse the repository at this point in the history
  • Loading branch information
mlandauer committed Apr 12, 2022
1 parent d8d3cf8 commit 72533e3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scraper.py
Expand Up @@ -29,6 +29,10 @@
bs4 = BeautifulSoup(page, "html.parser")

rows = bs4.find(id='ContentPlaceHolderBody_gridViewLocalities').find_all('tr')
if len(rows) == 20:
# These postcodes probably will have extra pages
print("WARNING: Maximum number of rows reached on postcode {}".format(postcode))

for row in rows:
tds = row.find_all('td')
if len(tds) == 6:
Expand Down

0 comments on commit 72533e3

Please sign in to comment.