⌘ November 22, 2021

Shortcuts Tips: Clean Up Apple News Links (De-news)

A couple of months back, fed up with the proprietary https://apple.news links that get shared from Apple’s News app, I built a shortcut to fetch the original web URL for a particular article.

If you live in an Apple-only ecosystem, Apple News links may not cause frustration in your life. But as soon as you want to share a link for others to read that sweet new article you came across, it gets tricky. Does the recipient know what Apple News is, and will they trust the funny-looking link? Do they even have an Apple device to read it on?

Furthermore, even as a subscriber to Apple News+ through Apple One, articles are littered with ads. I’d rather save it to my read-it-later queue, which strips out all the ads and lets me peruse the article along with my other saved reads. The apple.news links do not save nicely to Reeder, so getting the original URL is necessary.

I built a shortcut to clean up” Apple News links and then re-share them with the Share Sheet:

Get the Clean Up Apple News Links shortcut → Original Version | Latest Version

How It’s Made

A screenshot of the actions that comprise the Clean Up Apple News Link shortcut.
Short, sweet, and human-readable. Just the way I like my shortcuts!

1️⃣ Even though the shortcut is set to receive URLs only from the Share Sheet, it falls back to receive the clipboard if nothing was shared. Since the clipboard might contain any number of things, like a paragraph of text with the link somewhere in the middle, I use a Get URLs action to make sure the rest of the shortcut uses only the link. It may not be necessary, but I use Get Item from List action to act on just the first URL received.

2️⃣ In the event that the shortcut receives a non-Apple News link, this If block checks for the apple.news domain and displays a notification if it’s not from Apple News. Since you likely wanted to share that URL anyway, it pulls up the Share Sheet. (Editor’s Note: There should be a Stop Shortcut action before the End If to prevent the rest of the shortcut from running. Get the latest version that uses that method.)

3️⃣ Here’s the magic part: A Get Contents of URL action (probably the most versatile action in all of Shortcuts) run with the Apple News link returns all the essential bits of the webpage that redirects to the News app.

A screenshot showing the result of the Get Contents of URL action.
The webpage returned by the Get Contents of URL action. Luckily, you can get the links embedded in this page, one of which is the original web URL.

4️⃣ It turns out that the Click/Tap Here” link is the original URL. Another Get Item from List action grabs that first link.

5️⃣ Let’s share that thing!

Get the Clean Up Apple News Links shortcut → Original Version | Latest Version


UPDATE: A few days ago, I came across Jason Snell’s shortcut (member’s post) that is built with a similar method but uses RegEx (I’m really going to have to learn that someday) and might be more future-proof. I’ve combined the best parts of both our shortcuts into the latest version.

Shortcuts


❮ Previous post

7 Things (Which Are My Unanswered Questions) This Week [#36] November 21, 2021

Next post ❯

Writing My First Script November 23, 2021