Inspiration

What it does

How I built it

Challenges I ran into

Accomplishments that I'm proud of

What I learned

What's next for tikviewer-cli

Inspiration

I run TikViewer, a browser tool where you type a TikTok username and watch that account's stories anonymously. The most common support message was some version of "it says user not found" — and almost every time, the person had pasted a full share URL with tracking parameters instead of a plain username.

What it does

tikviewer-cli takes any of these and prints one canonical result:

$ tikviewer @Charli
https://tikviewer.org/@charli

$ tikviewer "https://www.tiktok.com/@charli/video/123?lang=en"
https://tikviewer.org/@charli

It accepts a bare handle, an @handle, or any tiktok.com/@handle/... URL with or without a query string, and it validates against TikTok's actual rule: [A-Za-z0-9._] , 2 to 24 characters. No hyphens — that one surprises people coming from GitHub.

How we built it

Plain Go, no dependencies. The extraction half is strings.Index / strings.IndexAny slicing; only the final validation uses a compiled regexp. The interesting part is the order of operations: strip the @ before you cut the query string and tiktok.com/@charli?lang=en normalizes to charli?lang=en, which then fails validation for the wrong reason.

Challenges we ran into

Periods are significant. char.li and charli are two different accounts, so you cannot fold dots away the way you would with a Gmail address.

What's next

Exposing it as a handle package so it can be imported rather than shelled out to. That part already works — the CLI is a thin wrapper over it.

Built With

Share this project:

Updates