Skip to content

Commit

Permalink
Release 2023.1.25 (#96)
Browse files Browse the repository at this point in the history
* accommodate both observed forms of WSJ urls
* Modern crossword by date (#95) thanks to @boisvert42
  • Loading branch information
thisisparker authored Jan 25, 2023
1 parent bd8de33 commit a7a6092
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Supported outlets:
|*Guardian Weekend*|`grdw`|✔️||✔️|
|*Los Angeles Times*|`lat`|✔️|✔️||
|*The McKinsey Crossword*|`mck`|✔️|✔️|✔️|
|*The Modern Crossword*|`mod`|✔️||✔️|
|*The Modern Crossword*|`mod`|✔️|✔️|✔️|
|*New York Times*|`nyt`|✔️|✔️|✔️|
|*New York Times Mini*|`nytm`|✔️|✔️|✔️|
|*New York Times Variety*|`nytv`|✔️|✔️|✔️|
Expand Down
8 changes: 8 additions & 0 deletions xword_dl/downloader/puzzlesocietydownloader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
import json
import urllib

import requests

Expand All @@ -18,6 +19,13 @@ def init(self, **kwargs):
@staticmethod
def matches_url(url_components):
return 'puzzlesociety.com' in url_components.netloc and 'modern-crossword' in url_components.path

def find_by_date(self, dt):
url_format = dt.strftime('%Y/%m/%d')
guessed_url = urllib.parse.urljoin(
'https://www.puzzlesociety.com/crossword-puzzles/modern-crossword/',
url_format)
return guessed_url

def find_latest(self):
return 'https://www.puzzlesociety.com/crossword-puzzles/modern-crossword'
Expand Down
2 changes: 1 addition & 1 deletion xword_dl/downloader/wsjdownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def find_solver(self, url):
return self.find_solver(puzzle_link)

def fetch_data(self, solver_url):
data_url = solver_url.replace('index.html', 'data.json')
data_url = solver_url.rsplit('/', maxsplit=1)[0] + '/data.json'
return requests.get(data_url, headers=self.headers).json()['data']

def parse_xword(self, xword_data):
Expand Down
2 changes: 1 addition & 1 deletion xword_dl/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023.1.19
2023.1.25

0 comments on commit a7a6092

Please sign in to comment.