Dex

Big hearted fluffdragon...

...fictional ex-90s platformer mascot, nerd, plural, ΘΔ.



jkap
@jkap

tl;dr you can download the shortcut here, but i strongly recommend reading this post! it's not even that long! https://www.icloud.com/shortcuts/d7024a9b120a47c4b713403d322157fb

an annoying change that tumblr introduced at some point in the iOS app (maybe the android app too, who knows) is that clicking "copy link" on a post or trying to share the URL gives you a long, incomprehensible, bad URL.

for example, a post with the URL https://yrfriendjkap.tumblr.com/post/708341407760433152 is copied as https://at.tumblr.com/a/key_live_loIM22jCfY1c0N7G2HnBDcmjDCpTeypJ?%24randomized_bundle_token=1059087567293502909&alias=yrfriendjkap/708341407760433152/wvo5aoh6gtl2&type=0&duration=0&source=ios&data=eyIkY2Fub25pY2FsX2lkZW50aWZpZXIiOiI3MDgzNDE0MDc3NjA0MzMxNTIiLCIkZGVza3RvcF91cmwiOiJodHRwczovL3lyZnJpZW5kamthcC50dW1ibHIuY29tL3Bvc3QvNzA4MzQxNDA3NzYwNDMzMTUyIiwiJGNhbm9uaWNhbF91cmwiOiJodHRwczovL3lyZnJpZW5kamthcC50dW1ibHIuY29tL3Bvc3QvNzA4MzQxNDA3NzYwNDMzMTUyIiwiYmxvZ19yZWZlcnJlciI6InlyZnJpZW5kamthcCIsIiRmYWxsYmFja191cmwiOiJodHRwczovL3lyZnJpZW5kamthcC50dW1ibHIuY29tL3Bvc3QvNzA4MzQxNDA3NzYwNDMzMTUyIiwiJGxvY2FsbHlfaW5kZXhhYmxlIjp0cnVlLCIkcHVibGljbHlfaW5kZXhhYmxlIjp0cnVlLCJwYWdlIjoiQmxvZ1Bvc3RzVGltZWxpbmUiLCIkb2dfcmVkaXJlY3QiOiJodHRwczovL3lyZnJpZW5kamthcC50dW1ibHIuY29tL3Bvc3QvNzA4MzQxNDA3NzYwNDMzMTUyIn0%3D

(sorry that this is unreadable. nature of the beast.)

we know that this URL has to contain enough information for tumblr to do a redirect; while they could get by with storing something in the DB and querying it, that would be Extremely Dumb, as just clicking "copy link" would immediately create an unnecessary DB entry that would have to sit around for who knows how long.

if we look, we see two potential options here: the alias query parameter (yrfriendjkap/708341407760433152/wvo5aoh6gtl2) which appears to contain the blog name, post ID, and some mystery string; we also see the data field which is Immediately Suspicious. large alphanumeric blob with a url-encoded last character? smells like base64

and that's because it IS base64! when decoded, you get this (JSON prettified for readability):

{
  "$canonical_identifier": "708341407760433152",
  "$desktop_url": "https://yrfriendjkap.tumblr.com/post/708341407760433152",
  "$canonical_url": "https://yrfriendjkap.tumblr.com/post/708341407760433152",
  "blog_referrer": "yrfriendjkap",
  "$fallback_url": "https://yrfriendjkap.tumblr.com/post/708341407760433152",
  "$locally_indexable": true,
  "$publicly_indexable": true,
  "page": "BlogPostsTimeline",
  "$og_redirect": "https://yrfriendjkap.tumblr.com/post/708341407760433152"
}

WELL WHAT DO YOU KNOW, IT'S THE FUCKING POST URL! HIDDEN IN PLAIN SIGHT!

ok that's great and all but what do you with this? EASY ANSWER: did you know that Shortcuts.app on iOS is Really Fucking Good?

this is a long image so i made it scrollable

Minus some traversal for type conversion, it's literally just "get the data query param -> url decode it -> base64 decode it -> parse it as JSON -> get the URL -> share the URL"

There's other steps you could add for things like pulling from the clipboard, verifying it's a valid URL before continuing, copying back onto the clipboard, etc etc, but this works, is fast, and is a good workaround to a stupid problem.

if you also want this, you can download the shortcut here:

this wasn't exactly complicated to figure out, but i enjoy sharing stuff like this. micro reverse engineering. you get the idea.



You must log in to comment.

in reply to @jkap's post:

you can set up shortcuts to run automatically when a certain condition is met. one of those conditions is closing a certain app, such as tumblr. this was something i used back when twitter added tracking urls to shared links

I tried deleting all but one parameter a few times to see what the functional part was, I think the alias part works on its own, but it landed me on a page asking me to download the tumblr app...I'm on a desktop browser. It wanted me to scan a QR code with my phone rofl. "wouldn't you rather be looking at this on your smaller screen?"

in reply to @jkap's post: