I have two kids with their own iPhones and iPads and all of their devices are locked down to prevent unrestricted web browsing. With these limits in place, its difficult for me to share funny or interesting videos I see on Reddit. Can I make a shortcut to find the source of those videos, convert them to a format that is easily shareable, and put them straight in the Messages app? Let’s try! tl;dr, I could.
I started by using Safari’s Web Inspector and focusing on the section of the page that is responsible for playing the video. Right away, it looked like the HTML element named <shreddit-player> was going to be a promising starting point.

Before continuing, I decided to try a couple of quick things that might make finding a solution easier:
<video> element to play the media. Instead, I got a non-functional page that showed only the first frame of the video and a loading spinner that animated indefinitely.Back to the <shreddit-player> element. It has a couple of attributes that looked interesting:
This is what a truncated payload looks like:
{
"playbackMp4s": {
"duration": 12,
"permutations": [
{
"source": {
"url": "https://packaged-media.redd.it/zw4c1qw9tj9g1/pb/m2-res_294p.mp4?m=DASHPlaylist.mpd&v=1&e=1766815200&s=87ba26df4695eb69922a17ecb1ac5a9b66d40874",
"dimensions": {
"width": 220,
"height": 294
}
}
},
{
"source": {
"url": "https://packaged-media.redd.it/zw4c1qw9tj9g1/pb/m2-res_960p.mp4?m=DASHPlaylist.mpd&v=1&e=1766815200&s=72da95af9a4b2342ba9c73ed4c364b36653dd7f9",
"dimensions": {
"width": 720,
"height": 960
}
}
}
]
}
}
Ultimately, I decided to use the JSON.
I took the “url” in the “source” object and, using curl, requested it. But it came back with a response of 403 Forbidden. That was surprising, until I noticed my obvious mistake: I forgot to decode the & in the URLs. After doing so, the URL gave me the video I was looking for!
After figuring out how to get the video, here’s the possible strategy I came up with for an end-to-end workflow for this shortcut:
I was able to get it working in 5 actions, with one of the actions (extracting the URL of the video) doing most of the work.

This lines up with the strategy above, with the exceptions of steps 3-4, which are combined into the “Run JavaScript” on Active Safari Tab” action below:
var result = "";
const players = document.querySelectorAll('shreddit-player');
if (players.length > 0) {
// Assume the first player is the one we want.
var json = players[0].getAttribute('packaged-media-json');
if (json !== null && json.length > 0) {
const obj = JSON.parse(json);
// Assume the last permutation is the best.
const last = obj.playbackMp4s.permutations.slice(-1)[0];
result = last.source.url;
}
}
completion(result);
This code is naive in that it makes multiple assumptions about the structure of the HTML, the JSON, and doesn’t handle an unparseable payload. This is a one-off shortcut for fun, so I’m skipping all that. It could always be made more robust in the future.
It’s a little slow, and it requires changing Content & Privacy Restrictions to “Allow JavaScript from Apple Events”. But it does work.

Depending on the your platform, the second action is slightly different and may require tweaking the shortcut:
And that’s it! This simple shortcut is available on GitHub.