Blog

Four Cool URLs

One of the things I've always found elegant about programming is how small, simple elements can be combined to accomplish complicated tasks. Sometimes this is a compound elegance (like stringing unrelated UNIX commands together to achieve your goal); sometimes it's an atomic elegance (like someone using something simple in a way you never imagined).

URLs have been around for more than 20 years. They're a method of "identifying a resource", which means "unambiguously pointing to something on the internet." That's how they're normally used: URLs point to websites, articles, images, songs, videos, downloads – everything. Most people don't give them much thought, in part because web browsers increasingly hide URLs away. But some URLs have special powers. Here are some that knock my socks off.

Goodhertz – Vulf Compressor preset

https://goodhertz.co/vulf-comp/2.0.1/?cm:90/wf:0/out:-7.5/cat:8/cre:1.3/csl:0/drl:0

Goodhertz is a company that makes audio processing plugins1. Presets let people save their favourite sounds, share them with others, and keep them safe so they can revisit the settings later. They're also a great way to learn: if you want to learn how someone got a great sound, they can show you the settings.

This URL is cool for a couple of reasons: first up, it's a preset in itself. Pass it to the audio plugin, and the plugin uses the settings from the URL. But it's also a valid web page2 that shows the settings used, in a more human-readable format. This is great for learning, and if you find yourself in a niche situation3 it might make your life easier.

Reddit - /r/redditlaqueristas

https://reddit.com/r/redditlaqueristas

There's nothing specific about the Laqueristas subreddit that made me select it, beyond it being a great example of an online interest-specific community. I could have picked any Reddit URL for this demo – and indeed, that's what makes this URL cool. Take any Reddit URL, append .json to it, and you'll get back a JSON version:

https://reddit.com/r/redditlaqueristas.json

This is a really user-friendly way of exposing an API! It makes it easy for programmers to get started – no need to register an API key, set up oAuth, or anything like that. Those barriers are often counterproductive (as people will just scrape the web pages rather than jump through those hurdles). It's not just subreddits – if you want to retrieve user details, or the contents of a post, it works there as well. Removing a .json can be useful too: if you're trying to debug some code that interacts with Reddit, you can take the relevant link and turn it back into a form designed for human consumption rather than trying to read through the JSON.

The concept of content negotiation has been around for a while, where you can do this via the HTTP Accept header, but I'd really like to see more of it. Wouldn't it be neat to get a PDF version of your receipt by appending .pdf to the URL? Websites can use <link rel="alternate"> to expose these other versions to the world, though sadly most browsers don't communicate those alternate versions to users.

Combine.fm

https://combine.fm/spotify/album/4PXQAD8t4hfKeAlQiEc7mM

It seems the idea of an open music web is pretty much dead. It's all closed silos these days: there's no interoperability between Spotify, YouTube, Apple Music, Soundcloud, and so on. If you're sharing a track with a friend, what do you do? Generally, the most practical solution is to send a YouTube link. That tends to work OK, but isn't ideal4. You could send them a link to your preferred service, but they might use a different one. And you probably don't keep track of which friend uses which service.

Enter Combine.fm. You hand it a link to something on a music service:

https://open.spotify.com/album/4PXQAD8t4hfKeAlQiEc7mM

And it gives you links to that music on all the services it can:

https://combine.fm/spotify/album/4PXQAD8t4hfKeAlQiEc7mM

Now your friend can click through to their music provider and play what you shared. That's a cool service, but look at the URL: it's pretty similar to the Spotify one.

This means you don't need to use Combine.fm to construct a Combine.fm URL – you can do it yourself, or write a script to handle it. If the Combine.fm service disappears or changes, you haven't lost a link to your music – the original ID is intact.

Traintimes.org.uk

Traintimes.org.uk is a site that provides "accessible UK train timetables". It's an unofficial site, but I vastly prefer it to National Rail Enquiries. It's got a simple visual design and works great without JavaScript – which means it's a tiny web page. Tiny web pages are quick to load, and work well even on poor 3G coverage. Just what you need if you're in the middle of nowhere trying to figure out a route home.

The URL is cool because it's designed to be human editable. Let's look at trains from London to Brighton:

https://traintimes.org.uk/london/brighton/11:30/today

Do you happen to know the official 3 letter code for London Bridge, and want to travel from that station specifically? You can drop that in:

https://traintimes.org.uk/LBG/brighton/11:30/today

Do you want to leave a couple of hours later? That's also an easy change:

https://traintimes.org.uk/LBG/brighton/13:30/today

Are you actually planning for tomorrow? Change the last part.

https://traintimes.org.uk/LBG/brighton/13:30/tomorrow

This is all documented on the front page of the site, but you don't need to know these details to use the service. There's a friendly form to start your search, and the results page lets you navigate to earlier or later trains (along with the return trip). But a user interface that tried to cater for every use case would be cluttered, and supporting URL editing doesn't cost anything. If you use the site often enough to be familiar with it the URLs, it's often quicker to edit the URL rather than perform a fresh search.


We can see some general principles at work in these URLs:

  • A URL points to a thing, but it can also be the thing itself. In the Goodhertz case, the preset was the URL (and the URL was the preset). A page of search results is a more prosaic example: the results displayed match the parameters for the search in the URL.
  • URLs can be for both human and machine consumption. The Goodhertz URL is primarily for consumption by software – the plugin that uses the preset. The Traintimes URL is designed to be easy for a human to manipulate. The Reddit page is a hybrid: easy for a human to transform into a computer-friendly format by adding .json to the end.
  • URLs can be robust. Even if the Combine.fm service fails or dies, you can easily return to the original links.
  • URLs can be predictable. You don't need API documentation to get started with Reddit's API. You don't need to involve Combine.fm to generate a valid Combine.fm link. If you learn the format of the Traintimes links, you could type one in by hand.
  • Let power users edit your URLs. Most Reddit or Traintimes users aren't going to retrieve JSON or explore times by editing the URL, but power users can do so. There's no extra cost to that apart from the initial design, and your users benefit from having the option.
  • Good URLs are descriptive. The Traintimes URL describes the results you'll see. Even if you've never visited the site, you can make a reasonable guess about what https://traintimes.org.uk/london/brighton/11:30/today would show you.

These principles aren't applicable to every scenario. Sometimes a link is just a pointer to a particular document online. A news website would find it hard to let users edit their links in a meaningful way. And sometimes you want your URLs to be hard to predict (for instance, you don't want people to guess the links to your Google docs).

URLs are consumed by machines, but they should be designed for humans. If your URL thinking stops at "uniquely identifies a page" and "good for SEO", you're missing out.


  1. Software that changes sound. Want to add an echo effect? Make your vocals sound like a robot? Make your audio sound like it's underwater? These plugins are one way of accomplishing that.  ↩

  2. Some software constructs strings that look like URLs to store info, and the software can use the URL, but it doesn't lead to a working web page. Those always make me sad.  ↩

  3. "My laptop doesn't have an internet connection in the studio, but I only have this preset on my phone. Do I have to type it all out by hand? Oh cool, I can see the settings on my phone & use the interface to set them all."  ↩

  4. The quality can be iffy, it might get taken down due to copyright claims, it might not be available in their territory. They can't add it to a playlist, save it to their music library, or listen in the background when on a mobile device. Plus it's video rather than audio, so it's not mobile-data-friendly.  ↩