Implementation:7onez Cti expert Sharelink Resolve Unwrap
| Knowledge Sources | |
|---|---|
| Domains | OSINT, Social_Media |
| Last Updated | 2026-10-28 14:00 GMT |
Overview
Concrete tool for unwrapping social share links (vm.tiktok.com, t.co, bit.ly, facebook.com/share) to their final URL and extracting platform IDs, provided by the cti-expert social intake module.
Description
The unwrap function in sharelink_resolve.py follows every URL layer nested via carrier params (outermost first), breadth-first and depth-bounded (max_depth default 6). It never revisits a URL. The platform_ids function extracts platform-specific identifiers from the resolved URLs: Facebook (page_id, profile_id, vanity, video_id, group, post_id), Instagram (username, shortcode, media_kind), TikTok (sec_user_id, u_code, share_item_id). The analyse function combines both into a single result with the redirect chain and platform IDs.
The resolver is stdlib-only — urllib.request, urllib.parse, re, json — so it runs on any machine with zero dependencies.
Usage
Import this when you need to:
- Unwrap a social share link to its final destination URL.
- Extract Facebook/Instagram/TikTok platform IDs from a share link.
- Determine the redirect chain (for OPSEC analysis of the sharing platform).
Code Reference
Source Location
- Repository: cti-expert
- File: scripts/osint/sharelink_resolve.py
- Lines: L105-126 (unwrap), L237-260 (platform_ids), L266-280 (analyse)
Signature
def unwrap(url, max_depth=MAX_UNWRAP_DEPTH):
"""Every URL layer nested in `url` via carrier params, outermost first.
Breadth over all carrier params at each layer; depth-bounded; never revisits."""
def platform_ids(urls: list) -> dict:
"""Extract platform-specific IDs from a list of URLs."""
def analyse(input_url: str, final_url: str) -> dict:
"""Combine unwrap + platform_ids into a single result."""
Import
from sharelink_resolve import unwrap, platform_ids, analyse
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| url | str | Yes /// Share link URL | |
| max_depth | int | No /// Max unwrap depth (default 6) |
Outputs
| Name | Type | Description |
|---|---|---|
| layers | list | [{url, depth, via_param}] — redirect chain |
| platform_ids | dict | {facebook/instagram/tiktok: {page_id, user_id, ...}} |
Usage Examples
from sharelink_resolve import unwrap, platform_ids
layers = unwrap("https://vm.tiktok.com/Z123abc/")
final_url = layers[-1]["url"]
ids = platform_ids([l["url"] for l in layers])
print(final_url)
print(ids.get("tiktok", {})) # {sec_user_id, u_code, share_item_id, ...}