Created
October 18, 2022 08:24
-
-
Save xtekky/873342adac566b59a4f557c1c1d4e4c3 to your computer and use it in GitHub Desktop.
TikTok Get Feed NO PROTOBUF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, time, uuid | |
from urllib.parse import urlencode | |
def __get_feed(settings: dict, sessid: str): | |
params = urlencode({ | |
**settings, | |
"os_api" : 25, | |
"device_type" : "SM-N976N", | |
"ssmix" : "a", | |
"manifest_version_code": 260802, | |
"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()), | |
"timezone_offset" : "7200", | |
"ac2" : "wifi", | |
"ac" : "wifi", | |
"app_type" : "normal", | |
"channel" : "googleplay", | |
"update_version_code" : 260802, | |
"_rticket" : int(time.time() * 1000), | |
"device_platform" : "android", | |
"build_number" : "26.8.2", | |
"locale" : "fr", | |
"op_region" : "FR", | |
"version_code" : 260802, | |
"timezone_name" : "Africa/Harare", | |
"cdid" : uuid.uuid4(), | |
"sys_region" : "FR", | |
"app_language" : "fr", | |
"resolution" : "900*1600", | |
"language" : "fr", | |
"device_brand" : "samsung", | |
"os_version" : "7.1.2", | |
"aid" : 1340 | |
}) | |
headers = { | |
"accept-encoding" : "gzip", | |
"sdk-version" : "2", | |
"x-tt-ultra-lite" : "1", | |
"x-tt-local-region": "fr", | |
"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" : "api16-core-c-useast1a.tiktokv.com", | |
"connection" : "Keep-Alive", | |
"cookie" : f"sessid={sessid}", | |
"x-ladon" : "", | |
"x-gorgon" : "0", | |
"x-khronos" : str(int(time.time())), | |
"x-argus" : "" | |
} | |
feed_data = requests.get( | |
url = ( | |
"https://api16-core-c-useast1a.tiktokv.com/aweme/v1/feed/?" | |
+ params | |
), | |
headers = headers | |
) | |
return feed_data.json() | |
if __name__ == "__main__": | |
sessid = "" | |
settings = { | |
"sp" : -1, | |
"type" : 0, | |
"max_cursor" : 0, | |
"min_cursor" : 0, | |
"count" : 6, | |
"volume" : 0.2, | |
"pull_type" : 0, | |
"req_from" : "", | |
"gaid" : "", | |
"filter_warn" : 0, | |
"ad_personality_mode" : 0, | |
"address_book_access" : 1, | |
"local_cache" : "", | |
"vpa_content_choice" : 0, | |
} | |
feed = __get_feed(settings) | |
print(len(feed["aweme_list"])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment