cool tiktok thing

this is a cool project I thought I'd host so other people could use it - I'll maybe make something cool with it at some point... but for now feel free to use it however works best for you.

how to use

there are two main api endpoints, details and liked - you can see how to use both below.

GET

/api/details/{videoId}

videoId is just, you guessed it, the ID of the tiktok!

response schema

id: string,
video: {
  url: string,
  height: number,
  width: number
}
image: {
  url: string
}
audio: {
  url: string
}
author: {
  username: string
}
statistics: {
  likes: number,
  comments: number
}
src: {
  type: string,
  data: {
    // i'm not documenting the sheer amount of data in here, go have a look yourself...
  }
}

example response

id: "7234283230088776961",
video: {
  url: "https://api16-normal-c-useast1a.tiktokv.com/aweme/v1/play/?video_id=v10044g50000chilcg3c77u6fb9e2r70&line=0&is_play_url=1&source=PackSourceEnum_FEED&file_id=547b164bd2a74356a8bd26f77a7ac440",
  height: 1024,
  width: 576
}
image: {
  url: "https://p16-sign-sg.tiktokcdn.com/large/tos-alisg-p-0037/4da60f985e8f47bf99cd2d21d4de8520_1684362836.jpeg?x-expires=1687863600&x-signature=CzMXXpUpNVj%2B8Ntg3Uh24luXuds%3D&s=FEED&se=false&sh=≻=cover&l=2023062611070574D60D721A9D0B101CE3"
}
audio: {
  url: "https://sf16-ies-music-sg.tiktokcdn.com/obj/tiktok-obj/6928719130585467649.mp3"
}
author: {
  username: "madisonbeermoon"
}
statistics: {
  likes: 74343,
  comments: 184
}
src: {
  type: string,
  data: {
    // i'm not documenting the sheer amount of data in here, go have a look yourself...
  }
}

GET

/api/liked/{secUid}/{sidGuard}

secUid is a unique identifier for your account

to find your secUid, view the page source of the explore home page and CTRL + F for secUid

sidGuard is some special tiktok cookie that you shouldn't share with random people

to find your sidGuard, view the cookies (with inspect, application > storage (or just storage if you use firefox)) for www.tiktok.com and filter by sid_guard

query parameters

onlyIds (optional), if you specify true, will return only the video IDs, otherwise will return a playable URL

response schema

liked: string[]

example responses

liked: [
  "https://api16-normal-c-useast1a.tiktokv.com/aweme/v1/play/?video_id=v10044g50000chilcg3c77u6fb9e2r70&line=0&is_play_url=1&source=PackSourceEnum_FEED&file_id=547b164bd2a74356a8bd26f77a7ac440"
]

liked: [
  "7234283230088776961"
]