Given a Guardian cryptic crossword number, spits out a puz file suitable for use with cursewords
- Python 2.something
- puzpy -
pip install puzpy
- beautiful soup -
pip install bs4
python guardianpuz.py <NUMBER> --type=TYPE
NUMBER is the number of the crossword you want to load, for example 27763. You can find it in the URL, e.g. https://www.theguardian.com/crosswords/cryptic/27763. TYPE is one of cryptic, prize, everyman, quiptic (I've only tested with prize and cryptic)
This creates a file named output.puz with your crossword, to open in the puz-reading program of your choice. I only test with cursewords because I'm lazy.
- For non-prize crosswords, get the solution (i.e. press 'reveal all', read all the solution text. Does BS4 know how to javascript?)
- Have code that is not godawful and hacked together when I was too lazy to solve the Prize crossword, but not too lazy to do something.
- Be distributed via pip
- Have any kind of error handling at all
- Not to be written in python 2 (but I think puzpy only works in 2, so not my fault, guv)
- Have the ability to find the latest crossword in a category. I can't see a good way to do this looking at the structure of the Guardian's listing pages.
- Since we're crawling a web page to do this and rely on specific structures, things might break at any time. I probably would have been better off using my time to send the Guardian a nice message asking them to provide puz files daily.
Let's be honest, you're probably better at programming than I am. Just hack on it and send me patches.