Documentation
¶
Overview ¶
Package slinky parses social media URLs and extracts structured information such as the service name, profile type, and username or identifier.
It supports a wide range of platforms including Facebook, GitHub, GitLab, Instagram, LinkedIn, Mastodon, Reddit, Snapchat, Spotify, TikTok, Twitch, Twitter/X, YouTube, and many more.
Usage:
u, err := slinky.Parse("https://github.com/hjr265")
// u.Service == slinky.GitHub
// u.Type == "User"
// u.ID == "hjr265"
// u.Data["username"] == "hjr265"
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotAbsolute is returned when the URL does not have a scheme. ErrNotAbsolute = errors.New("url is not absolute") // ErrUnknownService is returned when the URL does not match any known social media service. ErrUnknownService = errors.New("url belongs to an unknown service") // ErrInvalidURL is returned when the URL matches a known service but has an invalid format. ErrInvalidURL = errors.New("invalid URL") )
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service string
Service identifies a social media service.
const ( Bandcamp Service = "Bandcamp" Behance Service = "Behance" Bitbucket Service = "Bitbucket" Bluesky Service = "Bluesky" Codeberg Service = "Codeberg" DeviantArt Service = "DeviantArt" Dribbble Service = "Dribbble" Facebook Service = "Facebook" FLOSSSocial Service = "FLOSSSocial" Fosstodon Service = "Fosstodon" GitHub Service = "GitHub" GitLab Service = "GitLab" Goodreads Service = "Goodreads" Instagram Service = "Instagram" Kick Service = "Kick" Kofi Service = "Kofi" Letterboxd Service = "Letterboxd" LinkedIn Service = "LinkedIn" Mastodon Service = "Mastodon" Medium Service = "Medium" Messenger Service = "Messenger" Patreon Service = "Patreon" Pinterest Service = "Pinterest" Reddit Service = "Reddit" Signal Service = "Signal" Snapchat Service = "Snapchat" Sourcehut Service = "Sourcehut" SoundCloud Service = "SoundCloud" Spotify Service = "Spotify" Steam Service = "Steam" Substack Service = "Substack" Telegram Service = "Telegram" Threads Service = "Threads" TikTok Service = "TikTok" Toph Service = "Toph" Tumblr Service = "Tumblr" Twitch Service = "Twitch" Twitter Service = "Twitter" Vimeo Service = "Vimeo" WhatsApp Service = "WhatsApp" YouTube Service = "YouTube" )
Supported social media services.
type URL ¶
A URL represents a parsed social media URL.
func Parse ¶
Parse parses a raw url into a URL structure.
The url must be absolute (starting with a scheme).
Example ¶
package main
import (
"fmt"
"github.com/FurqanSoftware/slinky"
)
func main() {
u, err := slinky.Parse("https://github.com/hjr265")
if err != nil {
fmt.Println(err)
return
}
fmt.Println(u.Service)
fmt.Println(u.Type)
fmt.Println(u.ID)
fmt.Println(u.Data["username"])
}
Output: GitHub User hjr265 hjr265
Source Files
¶
- bandcamp.go
- behance.go
- bitbucket.go
- bluesky.go
- codeberg.go
- deviantart.go
- doc.go
- dribbble.go
- error.go
- facebook.go
- github.go
- gitlab.go
- goodreads.go
- instagram.go
- kick.go
- kofi.go
- letterboxd.go
- linkedin.go
- mastodon.go
- medium.go
- messenger.go
- patreon.go
- pinterest.go
- reddit.go
- registry.go
- signal.go
- slinky.go
- snapchat.go
- soundcloud.go
- sourcehut.go
- spotify.go
- steam.go
- substack.go
- telegram.go
- threads.go
- tiktok.go
- toph.go
- tumblr.go
- twitch.go
- twitter.go
- vimeo.go
- whatsapp.go
- youtube.go
Click to show internal directories.
Click to hide internal directories.