flathunters / flathunter

A bot to help people with their rental real-estate search. 🏠🤖
GNU Affero General Public License v3.0
852 stars 182 forks source link

Index Error on wg-gesucht #54

Closed TaiZziK closed 4 years ago

TaiZziK commented 4 years ago

Hi,

I keep getting an Index Error whenever I try to crawl wg-gesucht. The message is:

flathunter\flathunter\crawl_wggesucht.py", line 40, in extract_data rooms = re.findall(r'\d Zimmer', details_array[0])[0][:1] IndexError: list index out of range

The problem seems to be that it cannot handle an empty list, i.e. there are no numbers with "Zimmer". I did a quick fix and it seems to be working for me now like this:

rooms_tmp = re.findall(r'\d Zimmer', details_array[0]) if not rooms_tmp: rooms = 0 else: rooms = rooms_tmp[0][:1]

codders commented 4 years ago

Hey!

Thanks for the report and the suggested fix. We'll take a look.

codders commented 4 years ago

I implemented the suggested fix in #59