Social Links

Detect, validate, and sanitize social media links in Python

Gallery image 1
Gallery image 2

Social Links

Detect, validate, sanitize, and parse IDs from social profile URLs: many platforms, no extra dependencies

social-links is a pure Python helper for social URLs: auto-detect platform, check a link against a named platform, normalize to a canonical shape, and extract usernames or IDs. The README ships 65+ predefined platforms (major networks plus developer and creator sites) and allows custom regex-based platforms when you need more.

When it is useful

You ingest profile links from users, build directory or signup flows, or clean UGC before storage. Install from PyPI; docs and a browser demo are linked from the repository.

What you can do

  • Call the module-level API for typical cases or the SocialLinks class when you need custom lists or regex flags.
  • Extend or override platform definitions for internal domains or new networks.
  • Rely on pattern-based matching; understand that edge-case URLs may still need human review.

Limits

  • Validation is regex-driven, not a live probe of whether an account exists or is safe.
  • Platforms change URLs over time; pin versions and add tests for links you care about.
  • Phishing and lookalike domains are a separate security concern; do not treat “valid shape” as “trusted site.”

You might also like

Explore All Blogs