Skip to content

Commit

Permalink
newyorker: move theme title handling and test (thisisparker#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisparker authored Jan 12, 2024
1 parent 323a591 commit 3d4976d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/status-check-outlets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ jobs:
- name: Test New Yorker themed
if: '!cancelled()'
run: xword-dl "https://www.newyorker.com/puzzles-and-games-dept/crossword/2024/01/05"
- name: Test New Yorker themed, special chars title
if: '!cancelled()'
run: xword-dl tny -d 1/12/24
- name: Test Newsday latest
if: '!cancelled()'
run: xword-dl nd
Expand Down
11 changes: 6 additions & 5 deletions xword_dl/downloader/newyorkerdownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,18 @@ def parse_xword(self, xword_data):
if '<' in puzzle.title:
puzzle.title = puzzle.title.split('<')[0]

if self.theme_title:
puzzle.title += f' - {self.theme_title}'

return puzzle

def pick_filename(self, puzzle, **kwargs):
try:
supra, main = puzzle.title.split(':', 1)
if self.theme_title:
main = main.rsplit(' - ')[0]
if supra == 'The Crossword' and dateparser.parse(main):
if self.theme_title:
title = self.theme_title
puzzle.title += f' - {self.theme_title}'
else:
title = ''
title = self.theme_title
else:
title = main.strip()
except XWordDLException:
Expand Down

0 comments on commit 3d4976d

Please sign in to comment.