ysskrishna logoysskrishna

Social Links

Users paste messy profile links. One Python library turns them into clean, comparable URLs.

Gallery image 1
Gallery image 2
Built with
PyPI Packages
Python
uv
PyPI
GitHub Actions
Pytest
Details
FreeMIT licenseCreated December 6, 2025Updated November 12, 2026
Share this product

Someone types twitter.com/jane. Someone else pastes a full x.com link with tracking parameters. A third person drops a linkedin.com/in/ URL with trailing junk. You are about to store three strings that mean the same person on three different platforms, and your dedupe job just got harder.

Social Links is the small Python library that spots the platform, checks the shape, normalizes the URL, and hands you the handle.

One messy paste in. One canonical link out.

What you get

  • Platform detection without a giant if-chain. Pass a URL and learn whether it is LinkedIn, GitHub, X, Instagram, or one of many others already built in.
  • Validation that matches how people actually paste. Check a link against a named platform, including bare usernames when you already know the network.
  • Canonical URLs for storage and compare. Strip leading www, old hostnames, and share-link noise so two rows that mean the same profile line up.
  • Handles you can index. Pull the username or profile id without writing a regex per site.
  • Room to grow. Add or override platforms with your own patterns when you hit an internal tool or a network the defaults do not cover.
  • No extra packages. Pure Python with zero dependencies, so it stays easy to drop into an API or a batch job.

Picture your signup export

An illustrative case: a CSV of social profile fields lands on Monday. Rows mix http and https, mobile LinkedIn paths, and legacy Twitter hosts. You run detection and sanitization before insert. The table stores canonical linkedin.com/in/jane and x.com/jane URLs, and handle extraction returns jane for both networks. Duplicate review stops being a spelling contest.

Try it in your browser first

No install required. The interactive demo runs in the browser so you can paste real links and see detection, validation, sanitization, and id extraction before you wire it into your app.

Ready to try it?

Frequently asked questions

Why not just parse the hostname myself?

You can, and hostname matching works until path rules matter. LinkedIn has personal and company path shapes. YouTube has channels and handles. X still shows up under the old Twitter hostname. This library ships patterns for 65+ predefined platforms and keeps share links with query strings from breaking detection when the path still points at a profile.

How do I validate a LinkedIn or GitHub profile URL in Python?

Name the platform and pass the URL. The library checks it against that platform's patterns, including variants with or without www and protocol. It also rejects URLs where a social link is only embedded at the end of an unrelated string.

How do I detect which social platform a URL belongs to?

Call detection on the full URL. It returns a platform name when a pattern matches from the start of the input, or nothing when the host is not a supported profile link. A bare username alone does not guess a platform; you name the platform when validating or sanitizing bare ids.

Can I extract the username from a profile URL?

Yes. After you know the platform, extraction returns the captured id or username, including company-style paths where the patterns define them.

How many platforms are included out of the box?

The README ships 65+ predefined platforms, from major networks to developer and creator sites. You can list them programmatically or skim the table in the documentation.

Does validation prove the account exists?

No. Matching is regex-driven pattern work, not a live check that a profile is real or safe. Valid shape is separate from trust; phishing and lookalike domains still need their own review.

Is it free?

Yes. It is open source under the MIT license.

Do I need to install anything besides Python?

Install the package from PyPI. The library itself has zero dependencies. Documentation and the browser demo are linked from the repository.

Continue exploring

ProductPyPINested Utils

Nested Utils

Deep JSON and config paths, one string, no guard maze.
PyPI Packages
Python
+4
ProductPyPIPyPI Package Stats

PyPI Package Stats

PyPI download counts, version mix, and package facts in one call, with disk caching built in.
PyPI Packages
Python
+6
ProductPyPIQuotes Convert

Quotes Convert

Flip single and double quotes in text without breaking nested escapes.
Text & Data Conversion
PyPI Packages
+5
ProductPyPIDocker Detector

Docker Detector

One call tells your Python app whether it is running inside Docker.
DevOps & Infrastructure
PyPI Packages
+6
ProductPyPIOSC 7501

OSC 7501

Tell your terminal when your CLI is working, blocked, finished, or failed.
DevOps & Infrastructure
PyPI Packages
+6
ProductPyPIContainer Detect

Container Detect

One Python call to learn if your process is inside Docker, Podman, Kubernetes, or another Linux container.
DevOps & Infrastructure
PyPI Packages
+7