Help with shortcut to iteratively download a webpage as a .pdf


I’m trying to make a shortcut that will allow me to select a date, and a number of days to iterate, then create a URL that goes to the NYT homepage for that date, gets the .pdf and downloads it. Each iteration would then increment the date by 1 day, and repeat.

I’ve gotten it to the point where it downloads the .pdf no problem, but with each iteration, the date does not advance, and I just wind up getting the same .pdf X number of times.

Not sure how to upload the shortcut here, but I’ve added a screenshot. Thank you very much.

Just at a quick look, in the last but one line, you are adding 1 day to the value of your variable Date of Homepage, but you then need to save the new date back to the variable for the new date to be used in the next iteration of the loop. Add a Set Variable action after your increment action.

Hope this helps.

Thank you. However, when I insert a Set Variable action after the increment, Shortcuts does not allow me to select either the Date of Homepage or a Magic Variable. I’m not sure how to re-write the value with each iteration.

Change the save folder to your workaround folder and this should work.

As well as storing the date after incrementing, I have also reworked the formatting a little.

Hope that helps.

1 Like

Thank you. I guess I didn’t realize that I could write the variable in the field, even if it was not automatically selectable.

I actually struck upon a solution using the repeat index. Here’s what I came up with that worked -

Thanks again! This forum is amazing.