Toph now allows programmers to show up to 5 social media URLs on their profile pages.
Instead of showing the entire URL, I wanted to show the important bits from the URL.
To do that, I had to parse the social media URLs and extract information like the username or profile ID (when it is a GitHub, Twitter, LinkedIn, Facebook, etc. profile URL) or the instance of Mastodon.
So, I built Slinky. It is a Go package that parses social media URLs into structured data.
Right now, it supports URLs from the following social media platforms:
When you pass a URL like “https://github.com/hjr265” to
slinky.Parse, Slinky will parse the URL into this:
In the case of a floss.social or a fosstodon.org URL, you will get a
URL value like this:
If you need to parse social media URLs in your Go application, try Slinky.
And, if you want to extend Slinky to support additional social media platforms, feel free to open an issue with details or send a pull request.
comments powered by Disqus