{"id":50405619,"url":"https://github.com/nikuscs/social-media-parser","last_synced_at":"2026-05-31T01:30:27.252Z","repository":{"id":341799830,"uuid":"1171112592","full_name":"nikuscs/social-media-parser","owner":"nikuscs","description":"Parse, identify, and normalize social media links across major platforms.","archived":false,"fork":false,"pushed_at":"2026-03-23T13:36:39.000Z","size":107,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-24T11:18:32.243Z","etag":null,"topics":["bluesky","dailymotion","facebook","instagram","link-parser","linkedin","npm-package","pinterest","reddit","snapchat","social-media","telegram","threads","tiktok","twitch","twitter","typescript","url-parser","vimeo","youtube"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nikuscs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-02T22:14:02.000Z","updated_at":"2026-03-23T13:36:34.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/nikuscs/social-media-parser","commit_stats":null,"previous_names":["nikuscs/social-media-parser"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/nikuscs/social-media-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikuscs%2Fsocial-media-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikuscs%2Fsocial-media-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikuscs%2Fsocial-media-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikuscs%2Fsocial-media-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikuscs","download_url":"https://codeload.github.com/nikuscs/social-media-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikuscs%2Fsocial-media-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33716338,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bluesky","dailymotion","facebook","instagram","link-parser","linkedin","npm-package","pinterest","reddit","snapchat","social-media","telegram","threads","tiktok","twitch","twitter","typescript","url-parser","vimeo","youtube"],"created_at":"2026-05-31T01:30:21.910Z","updated_at":"2026-05-31T01:30:27.243Z","avatar_url":"https://github.com/nikuscs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# social-media-parser\n\nA lightweight, zero-dependency TypeScript library for parsing, identifying, and normalizing social media URLs. Feed it any link from 39+ supported platforms and get back structured data — the platform name, content type, extracted entities (usernames, post IDs, video IDs), and a clean canonical URL with tracking parameters stripped away.\n\nBuilt for link previews, analytics pipelines, content aggregators, social bookmarking tools, or anywhere you need to make sense of messy social media URLs.\n\n## Features\n\n- ⚡ Fast URL parsing and canonical normalization\n- 🌍 39+ platforms supported out of the box\n- 🧩 Extensible — bring your own parsers or use only the ones you need\n- 🧼 Cleans tracking params (`utm_*`, `fbclid`, `gclid`, `si`, `igshid`, etc.)\n- 🔒 Zero runtime dependencies\n- ✅ Fully typed API with 100% test coverage\n\n## Supported Platforms\n\n- 🐦 Twitter / X\n- 📸 Instagram\n- 🎵 TikTok\n- 👽 Reddit\n- 🧑‍💻 GitHub\n- ▶️ YouTube\n- 🎧 Spotify\n- 🐘 Mastodon\n- ☁️ SoundCloud\n- ☁️ Mixcloud\n- 💬 Discord\n- 📰 Substack\n- ✍️ Medium\n- 🇷🇺 Vkontakte (VK)\n- 📺 Rumble\n- 🎥 Kick\n- 📻 Radio Javan\n- 💸 Patreon\n- 💬 LINE\n- 🐧 QQ / Qzone\n- 🎧 Last.fm\n- ☕ Ko-fi\n- 📘 Facebook\n- 🔎 Search engines (Google, Bing, DuckDuckGo, Yahoo, Yandex, Baidu, Brave, Ecosia, Qwant, Startpage)\n- 💼 LinkedIn\n- 🧵 Threads\n- 🦋 Bluesky\n- 📌 Pinterest\n- 🎮 Twitch\n- ✈️ Telegram\n- 👻 Snapchat\n- 🎬 Vimeo\n- ▶️ Dailymotion\n\n## Short Link \u0026 Redirect Domain Support\n\nThe parser recognizes official short link and redirect domains for major platforms. When a short URL can be fully resolved (e.g., `youtu.be/{video_id}`), it returns the parsed content. When it can't be resolved without following a redirect, it returns `type: 'short'` so you can still identify the platform.\n\n| Platform | Short / Redirect Domains |\n| --- | --- |\n| Twitter / X | `t.co` |\n| TikTok | `vm.tiktok.com`, `vt.tiktok.com`, `tiktok.com/t/{code}` |\n| YouTube | `youtu.be` (resolved), `yt.be` |\n| Facebook | `fb.me`, `fb.watch` (resolved), `m.me` |\n| Instagram | `instagr.am`, `ig.me` |\n| Reddit | `redd.it` (resolved) |\n| Spotify | `spotify.link` |\n| LinkedIn | `lnkd.in` |\n| Pinterest | `pin.it` |\n| SoundCloud | `snd.sc` |\n| Discord | `discord.gg` (resolved), `discordapp.com` (full parsing), `dis.gd` |\n| Telegram | `t.me`, `telegram.me`, `telegram.dog` (all full parsing) |\n| Dailymotion | `dai.ly` (resolved) |\n| LINE | `lin.ee` (resolved) |\n\n```ts\nparse('https://vm.tiktok.com/ZSabc/')\n// { platform: 'tiktok', type: 'short', entities: {}, url: 'https://vm.tiktok.com/ZSabc/' }\n\nparse('https://youtu.be/dQw4w9WgXcQ')\n// { platform: 'youtube', type: 'video', entities: { video_id: 'dQw4w9WgXcQ' }, url: 'https://youtube.com/watch?v=dQw4w9WgXcQ' }\n```\n\n## Installation\n\n```bash\nnpm install social-media-parser\n```\n\n## Quick Example\n\n```ts\nimport { parse, identify, normalize, shorten } from 'social-media-parser'\n\nparse('https://twitter.com/elonmusk/status/1234567890')\n// {\n//   platform: 'twitter',\n//   type: 'post',\n//   entities: { username: 'elonmusk', post_id: '1234567890' },\n//   url: 'https://x.com/i/status/1234567890'\n// }\n\nidentify('https://www.instagram.com/johndoe/')\n// 'instagram'\n\nnormalize('https://youtu.be/dQw4w9WgXcQ?si=abc\u0026utm_source=test')\n// 'https://youtube.com/watch?v=dQw4w9WgXcQ'\n\nshorten('https://instagram.com/p/ABC123')\n// 'ABC123'\n\nshorten('https://twitter.com/elonmusk/status/1234567890')\n// 'elonmusk/1234567890'\n\nshorten('https://www.example.com/some/path?ref=123')\n// 'example.com/some/path'\n```\n\n## API\n\n### `parse(input, options?)`\n\nReturns:\n\n- `SocialLinkParsedLink` when recognized\n- `null` when input is invalid or unsupported\n\n### `identify(input, parsers?)`\n\nReturns:\n\n- platform string (`'twitter'`, `'instagram'`, etc.)\n- `null` when unsupported\n\n### `normalize(input, parsers?)`\n\nReturns:\n\n- canonical URL string\n- `null` when unsupported\n\n### `shorten(input, options?)`\n\nReturns the shortest meaningful identifier from a URL. For recognized platforms, it joins the parsed entity values (e.g., `username/post_id`). For short links with no entities, it extracts the path. For unrecognized URLs, it strips the protocol, `www.`, query string, and hash.\n\nReturns:\n\n- shortened string identifier\n- `null` when input is unparseable\n\n## Custom Parsers\n\n```ts\nimport { parse, twitter } from 'social-media-parser'\n\nconst result = parse('https://x.com/elonmusk', { parsers: [twitter] })\n```\n\n## Forced Network\n\n```ts\nimport { parse } from 'social-media-parser'\n\nconst result = parse('@elonmusk', { network: 'twitter' })\n```\n\n## Development\n\n- `bun run typecheck`\n- `bun run lint`\n- `bun run lint:fix`\n- `bun run test`\n- `bun run test:coverage`\n- `bun run build`\n- `bun run check`\n- `bun run release`\n- `bun run release:dry-run`\n\n`bun run check` enforces 100% coverage thresholds.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikuscs%2Fsocial-media-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikuscs%2Fsocial-media-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikuscs%2Fsocial-media-parser/lists"}