Skip to content

Commit

Permalink
made the room guessing more agressive
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Mar 21, 2023
1 parent 0de4c55 commit 788ab45
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions data/external/scrapers/roomfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,30 +98,39 @@ def scrape_rooms():


def _guess_queries(rooms, n_rooms):
# First try: all single-digit numbers
# First try: any single-digit number?
for i in range(10):
if len(rooms) < n_rooms:
maybe_sleep(0.05)
yield str(i)
else:
return

# Second try: all double-digit numbers
# Second try: any double-digit number?
for i in range(100):
if len(rooms) < n_rooms:
maybe_sleep(0.05)
yield str(i).zfill(2)
else:
return

# Third try: all characters
# Third try: any character?
for char in string.ascii_lowercase:
if len(rooms) < n_rooms:
maybe_sleep(0.05)
yield char
else:
return

# Fourth try: any character twice?
for c1 in string.ascii_lowercase:
for c2 in string.ascii_lowercase:
if len(rooms) < n_rooms:
maybe_sleep(0.05)
yield c1 + c2
else:
return


@cached_json("maps_roomfinder.json")
def scrape_maps():
Expand Down

0 comments on commit 788ab45

Please sign in to comment.