Skip to content

Instantly share code, notes, and snippets.

@xtekky
Created October 18, 2022 08:10
Show Gist options
  • Save xtekky/8056208e082036a8f29b97f159786f5d to your computer and use it in GitHub Desktop.
Save xtekky/8056208e082036a8f29b97f159786f5d to your computer and use it in GitHub Desktop.
TikTok Sessid Gen
import requests, time, uuid
from urllib.parse import urlencode
def __get_sessid():
params = urlencode({
"scene" : "normal",
"os_api" : 25,
"device_type" : "SM-N976N",
"ssmix" : "a",
"dpi" : 320,
"region" : "FR",
"carrier_region": "FR",
"app_name" : "musically_go",
"version_name" : "26.8.2",
"ab_version" : "26.8.2",
"ts" : int(time.time()),
"ac2" : "wifi",
"ac" : "wifi",
"app_type" : "normal",
"channel" : "googleplay",
"_rticket" : int(time.time() * 1000),
"build_number" : "26.8.2",
"locale" : "fr",
"op_region" : "FR",
"version_code" : 260802,
"timezone_name" : "Africa/Harare",
"cdid" : str(uuid.uuid4()),
"sys_region" : "FR",
"app_language" : "fr",
"resolution" : "900*1600",
"language" : "fr",
"device_brand" : "samsung",
"os_version" : "7.1.2",
"aid" : 1340,
"okhttp_version": "4.1.89.10-ul",
"ttnet_version" : "4.1.89.10-ul",
"timezone_offset" : 7200,
"device_platform" : "android",
"manifest_version_code" : 260802,
"update_version_code" : 260802
})
headers = {
"accept-encoding": "gzip",
"sdk-version" : "2",
"x-tt-ultra-lite": "1",
"user-agent" : "com.zhiliaoapp.musically.go/260802 (Linux; U; Android 7.1.2; fr_FR; SM-N976N; Build/QP1A.190711.020;tt-ok/3.12.13.2-rc.5)",
"host" : "api.tiktokv.com",
"connection" : "Keep-Alive",
"x-gorgon" : "0",
"x-khronos" : str(int(time.time())),
"passport-sdk-version" : "122",
"x-tt-store-region-did" : "none",
"x-tt-store-region-uid" : "none",
"x-vc-bdturing-sdk-version" : "2.2.1.i18n",
"x-tt-local-region" : "fr"
}
response = requests.get(
url = (
"https://api.tiktokv.com/passport/account/info/v2?" + params
),
headers = headers
)
return response.json()['data']['session_key']
sessid = __get_sessid()
print(sessid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment