关于tiktok(抖音国际版)的注册协议
访问TikTok需要使用VPN,但我听说国外的市场前景很广。
手机注册tiktok新用户,需要以下5步:
1。 界面中选择生日,主要协议分析如下:
POST birthdayUrl = 'https://api16-normal-c-alisg.tiktokv.com/aweme/v3/verification/age/?os_api=22&device_type=OPPO+R9m&ssmix=a&manifest_version_code=2021705050&dpi=480&uoo=1®ion=CN&App_name=musical_ly&version_name=17.5.5&timezone_offset=28800&ts=1619706896&ab_version=17.5.5&residence=CN&pass-route=1&cpu_support64=true&pass-region=1¤t_region=CN&storage_type=0&ac2=wifi&app_type=normal&ac=wifi&host_abi=armeabi-v7a&update_version_code=2021705050&channel=googleplay&_rticket=1619706899477&device_platform=Android&iid=6950565326678279942&build_number=17.5.5&locale=en&op_region=CN&version_code=170505&timezone_name=Asia%2FShanghai&cdid=55a88099-ae5f-4320-ad66-081eb9144fc6&openudid=5607690bd12d555e&sys_region=CN&device_id=6950565064088782341&app_language=en&resolution=1080*1920&os_version=5.1&language=zh-Hans&device_brand=OPPO&aid=1233'
比如传的参数是 'birthday=1990-09-01&session_registered=1',并且在https的request中,计算出参数的'x-ss-stub'值,然后设置到header中。具体算法是:?
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 |
def xSsStubEncode( bArr): m = hashlib.md5() m.update(bArr.encode('utf-8')) md = m.digest() return xSsStubEncodeHex(md,'0123456789ABCDEF') def xSsStubEncodeHex(bArr,cArr): length = len(bArr) cArr2 = [''] * (length << 1) i2 = 0 for i3 in range(0, length): i4 = i2 + 1 cArr2[i2] = cArr[unsigned_right_shitf(bArr[i3] & 240, 4)] i2 = i4 + 1 cArr2[i4] = cArr[bArr[i3] & 15] return ''.join(cArr2[0:]) |
2. 向服务器发送获取验证码请求:
sendCodeUrl = "https://api16-normal-c-alisg.tiktokv.com/passport/mobile/send_code/v1/?passport-sdk-version=17&os_api=22&device_type=OPPO+R9m&ssmix=a&manifest_version_code=2021705050&dpi=480&uoo=1®ion=US&app_name=musical_ly&version_name=17.5.5&timezone_offset=28800&ts=1619101443&ab_version=17.5.5&residence=US&pass-route=1&cpu_support64=true&pass-region=1¤t_region=US&storage_type=0&ac2=wifi&app_type=normal&ac=wifi&host_abi=armeabi-v7a&update_version_code=2021705050&channel=googleplay&_rticket=1619101443703&device_platform=android&iid=6950565326678279942&build_number=17.5.5&locale=en&op_region=US&version_code=170505&timezone_name=Asia%2FShanghai&cdid=a6d131ba-934f-436a-9fe9-ef851658d8fc&openudid=5607690bd12d555e&sys_region=US&device_id=6950565064088782341&app_language=en&resolution=1080*1920&os_version=5.1&language=zh-Hans&device_brand=OPPO&aid=1233"
传的参数是 'mix_mode=1&multi_login=1&unbind_exist=35&mobile=' + encode(mobile) + '&auto_read=0&account_sdk_source=app&check_register=0&type=3731' 所有跟服务器交换的数据都是加密的,加密算法是:
?
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 |
def encode(str): try: bytessstr = bytes(str, encoding = "utf8") bytess=[] for c in bytessstr: bytess.append(c ^ 5) i3 = len(bytess) * 2 i4 = 0 cArr=['']*100 for bb in bytess: b = (bb & 255) i6 = i4 + 1 cArr2 ='0123456789abcdef' cArr[i4] = cArr2[b >> 4] i4 = i6 + 1 cArr[i6] = cArr2[b & 15] return ''.join(cArr[0:i3]) except: print('the encode string is unrecoganized - ' + str) |
3、第二次获取验证码
4、设置密码
5、设置用户名
所有的请求中,都会要求计算 'x-gorgon'和 'x-khronos',关于这个网上有很多解法,就不重复。
TT的核心算法就那么多,掌握上面内容后,可以实现tiktok的完全自主操作。