"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=123"
带的参数是:
payload={'mix_mode': '1',
'multi_login': '1',
'unbind_exist': '35',
'mobile': encode(mobile),
'auto_read': '0',
'account_sdk_source': 'app',
'check_register': '0',
'type': '3731'}
关键的数据都在cookie里,其中重要的是 x-ss-stub,主要md5操作。
xSsStubEncode('mix_mode=1&multi_login=1&unbind_exist=35&mobile='+encode(mobile)+'&auto_read=0&account_sdk_source=app&check_register=0&type=3731')
[Python] 纯文本查看 复制代码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
[Python] 纯文本查看 复制代码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)
'x-gorgon'和 'x-khronos'根据协议版本计算,主要是对url,x-ss-stub,cookie数据进行加密。
#########################################################开始短信登录第一步######################################################
xsub2 = xSsStubEncode('account_sdk_source=app&mix_mode=1&multi_login=1&mobile='+encode(mobile)+'&code=' + encode('收到的验证码'))
headers['x-ss-stub'] = xsub2
smsLoginOnlyUrl = "https://api19-normal-c-alisg.tiktokv.com/passport/mobile/sms_login_only/?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=1619267633&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=1619267634930&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";
获取 sms_code_key 数据。
################################################### 开始短信登录第二步 - login continue ####################################################
xsub3 = xSsStubEncode('account_sdk_source=app&mix_mode=1&multi_login=1&mobile=' + encode(mobile) + '&sms_code_key=' + encode(sms_code_key))
headers['x-ss-stub'] = xsub3
smsLoginContinueUrl = "https://api19-normal-c-alisg.tiktokv.com/passport/mobile/sms_login_continue/?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=1619267634&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=1619267635904&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";
#############################################set password########################################################
xsub4 = xSsStubEncode('mix_mode=1&multi_login=1&password=' + encode(mobile) + '&account_sdk_source=app')
headers['x-ss-stub'] = xsub4
setPasswordUrl = "https://api19-normal-c-alisg.tiktokv.com/passport/password/set/?passport-sdk-version=17&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=1619267652&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=1619267653839&device_platform=android&iid=6950565326678279942&build_number=17.5.5&locale=en&op_region=CN&version_code=170505&timezone_name=Asia%2FShanghai&cdid=a6d131ba-934f-436a-9fe9-ef851658d8fc&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";
#############################################set login name########################################################
xsub5 = xSsStubEncode('login_name=qiucx0161')
headers['x-ss-stub'] = xsub5
setLoginNameUrl = "https://api19-normal-c-alisg.tiktokv.com/passport/login_name/register/?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=1619267668&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=1619267669849&device_platform=android&iid=6950565326678279942&build_number=17.5.5&locale=en&op_region=CN&version_code=170505&timezone_name=Asia%2FShanghai&cdid=a6d131ba-934f-436a-9fe9-ef851658d8fc&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";
[color=]所有的请求中,都会要求计算 'x-gorgon'和 'x-khronos',关于这个网上有很多解法,就不重复。
[color=]TT的核心算法就那么多,掌握上面内容后,可以实现tiktok的完全自主操作,关注大V,获取大v粉丝,关注粉丝,发送消息给粉丝,引流。
[color=]另外,TT给朋友发送消息的时候,会把消息打包成protobuf格式,比如以下是charles解析出来的protobuf text,请教一下自己的py程序,要怎么样才能构造出这样的结构,然后发送给服务器。
[color=]https://www.yuanrenxue.com/app-crawl/parse-protobuf.html 不太清楚怎么跟服务器交互。。。万望了解的朋友指点。
1: 2016
2: 268550
3: "4.0.6.0.44"
4: "03fed6b99a65beab245ffe7227bbfca624013f1871a75d81be8e5d3f3d7c8655e7e546d7af30f5af099005ef9279cc75df1a241cf3e579d0847cc03343b24a67645c39b6a9c98f30085baf87d7d7b7dbe7422-1.0.0"
5: 1
6: 0
7: "4060"
8 {
2016 {
1 {
1: 0
2: "send_msg_by_ws"
3: 1
}
}
}
9: "6967858592842679813"
10: "googleplay"
11: "android"
12: "MI 8"
13: "10"
14: "2021705050"
15 {
1: "iid"
2: "6967858732471699205"
}
15 {
1: "aid"
2: "1233"
}
15 {
1: "user-agent"
2: "okhttp/3.10.0.1"
}