Skip to content

Commit

Permalink
fix date guesser for atlantic puzzles (#116)
Browse files Browse the repository at this point in the history
Regular Atlantic puzzles have a predictable ID from which we can deduce the puzzle date, but the new Caleb's Inferno puzzle does not. This fixes a crash when encountering one of those puzzles.
  • Loading branch information
thisisparker authored Aug 13, 2023
1 parent 20bb02c commit b7d1cc5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion xword_dl/downloader/atlanticdownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@ def find_by_date(self, dt):
return self.find_puzzle_url_from_id(self.id)

def guess_date_from_id(self, puzzle_id):
self.date = datetime.datetime.strptime(puzzle_id.split('_')[1],
try:
self.date = datetime.datetime.strptime(puzzle_id.split('_')[1],
'%Y%m%d')
# New "Caleb's Inferno" puzzles may have a different ID format
# with no way to guess date. At least for now, no underscore means
# we can identify these by this IndexError.
except IndexError:
pass

0 comments on commit b7d1cc5

Please sign in to comment.