⌘ December 11, 2022

Stuff I Love

Shortcuts Tips: Save a Decade of New York Times’ Covers

I happened across this article when browsing through the Shortcuts User Group tonight. It details a shortcut — adapted by Brian Renshaw from one that Matthew Cassinelli created — that saves a copy of that day’s cover of the New York Times to Day One.

That was a neat way to archive the day’s major headlines for future reference, so I added the shortcut to my library and gave it a whirl. It had a couple of issues on the first run, possibly due to Shortcuts itself, so I updated it to use the latest Day One Create Entry’ action and to save the cover as a PDF file rather than a JPEG or PNG. Oh, and I made it name the PDF something sensible while I was rooting around in there. With those changes, the shortcut worked beautifully, so I created a Personal Automation to have it run in the background every day at noon.

Setting up the personal automation to run the shortcut at noon every day.
Set it and forget it!

But, if the point was to save these covers as reference items, did I want my archive to only go back to December 11th, 2022? As a completionist, that was unacceptable. Fortunately, Shortcuts makes repeating an action over and over and over again a breeze with the Repeat’ action. With just a few quick additions, I created a companion shortcut that allowed me to save over ten years of NYT covers in a matter of minutes.1

Get the NYT Covers (Save Consecutive Dates)’ shortcut → Original Version | Latest Version

How It’s Made

Listing out the steps of the shortcut.
Straightforward and effective.

1️⃣ We start with an Ask for Input’ action and set it to ask for a date (time isn’t necessary). I put the default date to be August 1, 2012, because that was the month furthest back that returned a cover for each day.

2️⃣ You might think that with the addition of Magic Variables in Shortcuts way back when it was still Workflow, there’d no longer be a need for manually setting or getting variables. I certainly did for a while. But it turns out that those actions do have their uses. In this case, it’s to change the variable we use for each round of the Repeat’ block later.

With that in mind, we use a Set Variable’ action to save the starting date as the Date variable.

3️⃣ Here, we use a List’ action to provide options for the number of days we might want to save in a row. I added some helper text next to some of them as a reminder of which months and years have certain numbers of days. Watch out for those Leap Years if you’re saving a year at a time, lest you miss December 31st’s cover.

4️⃣ A Choose from List’ action allows us to pick the number of days and pass it on to subsequent actions. Because of that helper text, though, we need to isolate the number of days from the rest of the chosen item to use it in our Repeat’ block below. We accomplish that with a Split Text’ action which breaks the Chosen Item variable by spaces, followed by a Get Item from List’ action to grab the first of the split items.

5️⃣ Next, we add the Repeat’ action and set the number of times parameter to the chosen item variable from the last step. I’ve named it Number of Days.

It’s critical that we put a Get Variable’ action here to call up the latest version of Date. On the first round, it’ll be the literal date you selected. But on subsequent repeats, that Date will change, and we need to get it each time.

After that, a Text’ action lets us format how we want the PDF and Day One entry to be named eventually. I went with New York Times - Month Day, Year”, but you can change it if you want. Add the Date variable in that text, and then tap or right-click it to select the date format; in my case, it’s the long version.

6️⃣ The meat of this shortcut is downloading the NYT cover, which we do by using their (blessedly) consistent static URL scheme. Putting the Date variable within the URL action — using the custom yyyy/MM/dd” format — gets us to the right place on the internet.

A Get Contents of URL action, using the GET method, downloads the file as a PDF.

7️⃣ We use a Set Name’ action with the Text variable from earlier to avoid the PDF being named a generic Scan.pdf” and then save it to Day One with their Create Entry’ action. Use the Text variable again to give the journal entry the same name.

Hit Show More’ on that action to reveal optional parameters like which journal to save it to, which tags to add, and the creation date you want it to be saved under.

8️⃣ The last actions for the Repeat’ block are the all-important Adjust Date’ and Set Variable’. We add one day to the Date variable and then reset Date to the new Adjusted Date. That way, Date will be the next calendar day when the Repeat’ block goes again.

And that’s it!

Click to reveal the Repeat’ block with all actions expanded.
Showing the hidden parameters of the actions within the Repeat block.
Don’t forget to click around on the actions to see the options they’re hiding.

This was a fun challenge and a great way to reprime my brain to think about how setting and getting variables within Repeat’ or If’ blocks can unlock much more powerful workflows. Plus, now, when I use the On This Day’ feature of Day One, I can remind myself of what was noteworthy around the wider world in years past.

My Day One app showing covers from December 2012.
No, you’re a digital hoarder!

Get the NYT Covers (Save Consecutive Dates)’ shortcut → Original Version | Latest Version

  1. Well, getting the process started took mere minutes. But beware, once the covers start having pictures (the earliest available years don’t include them), the downloads slow down significantly.↩︎

Shortcuts Tips

❮ Previous post

My Wife Made Her First Automation December 9, 2022

Next post ❯

7 Things This Week, 2022-12-11 December 11, 2022