kesyog / crossword

Scraping personal NYT crossword stats
Apache License 2.0
33 stars 6 forks source link

Support for Mini Stats? #12

Open jsundram opened 1 year ago

jsundram commented 1 year ago

Admittedly this is a feature request, not a bug, but it would be great to pull and store the mini stats as well.

It seems like the approach to getting the main stats is pretty transferrable to this. You can list the puzzle ids here: curl 'https://www.nytimes.com/svc/crosswords/v3/61484727/puzzles.json?publish_type=mini&sort_order=asc&sort_by=print_date&date_start=2023-10-01&date_end=2023-10-31' -H 'accept: application/json' | python3 -m json.tool

{
    "status": "OK",
    "results": [
        {
            "author": "Joel Fagliano",
            "editor": "",
            "format_type": "Normal",
            "print_date": "2023-10-01",
            "publish_type": "Mini",
            "puzzle_id": 21459,
            "title": "",
            "version": 0,
            "percent_filled": 0,
            "solved": false,
            "star": null
        },
        {
            "author": "Joel Fagliano",
            "editor": "",
            "format_type": "Normal",
            "print_date": "2023-10-02",
            "publish_type": "Mini",
            "puzzle_id": 21468,
            "title": "",
            "version": 0,
            "percent_filled": 0,
            "solved": false,
            "star": null
        },
        {
            "author": "Joel Fagliano",
            "editor": "",
            "format_type": "Normal",
            "print_date": "2023-10-03",
            "publish_type": "Mini",
            "puzzle_id": 21469,
            "title": "",
            "version": 0,
            "percent_filled": 0,
            "solved": false,
            "star": null
        },
        {
            "author": "Joel Fagliano",
            "editor": "",
            "format_type": "Normal",
            "print_date": "2023-10-04",
            "publish_type": "Mini",
            "puzzle_id": 21470,
            "title": "",
            "version": 0,
            "percent_filled": 0,
            "solved": false,
            "star": null
        }
    ]
}

And then individual stats are available at the same stats endpoint (https://www.nytimes.com/svc/crosswords/v6/game/{puzzle_id}.json), as the mains, although the json response is different, eg:

{ 
...
   "calcs": {
        "percentFilled": 100,
        "secondsSpentSolving": 22,
        "solved": true
    },
    "firsts": {
        "opened": 1696430328,
        "solved": 1696430351
    },
    "lastCommitID": "1405458",
    "puzzleID": 21470,
    "timestamp": 1696430352,
    "userID": 61484727,
    "minGuessTime": 1696430328,
    "lastSolve": 1696430352
}    
kesyog commented 1 year ago

Thanks for doing the legwork of researching the API’s. I’ll take a look.