downforacross / downloadacross

chrome extension for downloading crosswords from various sources
4 stars 4 forks source link

nytimes download is broken on missing #17

Open darthwalsh opened 2 years ago

darthwalsh commented 2 years ago

When trying to download any NYTimes puzzle, I'm getting the error Error Loading Puzzle even though I'm signed in.

The line var a = doc.indexOf('pluribus'); is returning -1 for me -- this magic string isn't found. It seems the NYTimes HTML response used to have the puzzle embedded in it(?)

When I inspect the official app now, the puzzle is loaded by the chain

And it's this JSON that has the puzzle data:


      "clues": [
        {
          "cells": [0, 1, 2, 3],
          "direction": "Across",
          "label": "1",
          "text": [{ "plain": "Beginner, in lingo" }]
        },
        {
          "cells": [5, 6, 7, 8],
          "direction": "Across",
          "label": "5",
          "text": [
            {
              "formatted": "Beaten via a referee\u0026#39;s decision, for short",
              "plain": "Beaten via a referee's decision, for short"
            }
          ]
        },

If I try to just naively fetch() this JSON url, it 403's because appspot.com isn't getting NYT cookies. With curl it seems the solution is to send the NYT-S cookie, but i'm unsure how the chrome extension can access that.

(As a workaround, I found that this other extension works to download the PUZ. Also, looking at the source code for how that extension works, downloading from appspot.com API is exactly what it does.)

darthwalsh commented 2 years ago

Instead of accessing https://nyt-games-prd.appspot.com it's simple now to use the same host: https://www.nytimes.com/svc/crosswords/v6/puzzle/daily/2022-04-07.json and get the puzzle data.