go-tiktok

Pure-Go best-effort read client for public TikTok content.

CGO_ENABLED=0 zero third-party deps standard library only best-effort · fragile BSD-3-Clause
Documentation GitHub

A pure-Go, dependency-free, best-effort read client for public TikTok content, talking to TikTok's undocumented web JSON endpoints. The Go API is small and stable with an overridable base URL for network-free testing; the code builds correct requests and parses correct responses, but working end-to-end against live TikTok is not guaranteed.

⚠️ Best-effort — expect breakage

TikTok does not publish or support a public web API. This client calls the same internal endpoints TikTok's own website uses, and TikTok actively defends them.

Requests often need a valid `msToken` and a signed parameter (`X-Bogus` / `_signature`) that this library does not compute; many reads additionally require a logged-in `sessionid` cookie. Expect anti-bot responses (403/429, or a 200 with an empty body) at any time.

Usage

Pure Go, standard library only. go get github.com/go-tiktok/tiktok

c := tiktok.New(
	tiktok.WithMSToken("...msToken from a browser session..."),
	tiktok.WithSessionID("...sessionid cookie for authed reads..."),
)

// secUid is TikTok's opaque per-user id; obtain it once from a profile
// page's embedded JSON, then pass it here.
feed, err := c.UserPosts(context.Background(), "MS4wLjABAAAA...", 20, "0")
if err != nil {
	panic(err)
}
for _, v := range feed.Videos {
	fmt.Printf("%s  %d likes  %s\n", v.Permalink, v.Likes, v.Description)
}
fmt.Printf("cursor=%s hasMore=%v\n", feed.Cursor, feed.HasMore)

Repositories

Everything that actually exists in the org today.

tiktok client

Pure-Go best-effort read client for public TikTok content.

CI Go Reference

brand brand

Logos, icons and social images for go-tiktok.