前面已经公布了一些流程,除了sig3在so层,其他都是java层;
目前看了下最新版,9-最新版本逻辑一致,9以下 sig3 42位。
快手__nsTokensig和sig签名 :
https://codeooo.blog.csdn.net/article/details/127639252
抓包:
https://codeooo.blog.csdn.net/article/details/127637178
看了下参数:
keyword关键词
client_key : 3c2cd3f3
token是登陆账号的值,这里测试关键词搜索可以忽略;
关键词API:
import uuid
import requests
from sig import sig3_start, getsig3
url = "https://apijs.gifshow.com/rest/n/search/new?earphoneMode=1&mod=Xiaomi%28MI%208%20Lite%29&appver=11.1.40.29872&isp=&language=zh-cn&ud=0&did_tag=0&egid=DFP8FD17773009A01528832DDF38472E89F25E8A6302690B44B87CC4BA032C66&net=WIFI&kcv=1507&app=0&kpf=ANDROID_PHONE&bottom_navigation=false&ver=11.1&oDid=ANDROID_1df15ab612781d06&android_os=0&boardPlatform=sdm660&kpn=KUAISHOU&androidApiLevel=27&newOc=XIAOMI&slh=0&country_code=CN&nbh=130&hotfix_ver=&did_gt=1689592942281&keyconfig_state=2&cdid_tag=7&sys=ANDROID_8.1.0&max_memory=256&cold_launch_time_ms=1689642804517&oc=XIAOMI&sh=2280&ddpi=440&deviceBit=0&browseType=4&socName=Qualcomm%20Snapdragon%20660&is_background=0&c=XIAOMI&sw=1080&ftt=&abi=arm64&userRecoBit=0&device_abi=arm64&totalMemory=5710&grant_browse_type=AUTHORIZED&iuid=&rdid=ANDROID_254db5af72b2742d&sbh=110&darkMode=false&did=ANDROID_1df15ab612781d06"
headers = {
'X-Client-Info': 'model=V1923A;os=Android;nqe-score=4;network=WIFI;signal-strength=4;',
'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': '*/*',
'Host': 'apijs.ksapisrv.com',
'Connection': 'keep-alive'
}
data = {
"isRecoRequest": "false",
"ussid": "",
"fromPage": "4",
"fromPageSessionId": "",
"pcursor": "1",
"requestTabId": "",
"keyword": "捡到男鬼后脱单了",
"queryId": "",
"extParams": "{\"hasSelectedInterest\":false,\"searchTabId\":1,\"imei\":\"869809038521435\",\"layoutStyle\":2,\"referVideoId\":\"5259078570990334169\",\"referLog\":\"mK0HEgwV5jN3GgGrsx0WMuQeeCwDVHGyotnXt9E9Fgcl+Y7h4SbxHUabOCL7u4LuFVpcZropLisGgpu3D+B5Nc6HYx0Bo56uQYl11HqvhORo+ftH2sf15fliA/zGpT1D\",\"isAd\":false,\"referAuthorId\":\"359335788\",\"kwaiSource\":\"search_entrance_bottom_featured\",\"disableCorrection\":false,\"filterType\":\"\",\"collContinuePlayInfo\":{},\"signalParams\":\"H4sIAAAAAAAAAFNi4WARYNSK5ZIvTk0sSs6IT80rKUrMS06NT8ovKcnPjU9LTSwpLUpNUbLi+A8DjAKT/u3ZMs1QitfN1TEkNMjVJT7A0d3VgNGC2UnY1MjU0sDcwtTcwNLSwNjYxNDMEgBhdY5yZQAAAA==\"}",
"videoModelCrowdTag": "1_99",
"os": "android",
"cs": "false",
"client_key": "3c2cd3f3",
"startSessionId": str(uuid.uuid4()),
"uQaTag": ""
}
sig, sig3str = sig3_start(url, data)
sig3 = getsig3(sig3str)
url = url + f"&sig={sig}&__NS_sig3={sig3}"
response = requests.request("POST", url, headers=headers, data=data)
print(response.text)
主页作品页:
用户主页这个得登陆了,登陆后会有个token参数;
这个token登陆时候,会生成一个盐值,可以使用hook sha256
去拿到入参,因为入参是 sig + 盐值,所以只需要取后32位:
8b9a761435578761df9a4838bc942cb58b0b05731c79f830684dd7436181859d
8b9a761435578761df9a4838bc942cb58b0b05731c79f830684dd7436181859d
8b0b05731c79f830684dd7436181859d 8b0b05731c79f830684dd7436181859d
token_client_salt : 8b0b05731c79f830684dd7436181859d
import requests
from urllib.parse import parse_qsl
from sig import sig3_start, getsig3, get_tokening
url = "https://apijs2.gifshow.com/rest/n/feed/profile2?earphoneMode=1&mod=Xiaomi%28MI%208%20Lite%29&appver=11.1.40.29872&isp=&language=zh-cn&ud=3115604858&did_tag=0&egid=DFP4343AA6498BDCA87F15D3B59ADB3A045F45AE4152A8BA42C5CDA172EB32C3&net=WIFI&kcv=1507&app=0&kpf=ANDROID_PHONE&bottom_navigation=false&ver=11.1&oDid=ANDROID_1df15ab612781d06&android_os=0&boardPlatform=sdm660&kpn=KUAISHOU&androidApiLevel=27&newOc=XIAOMI&slh=0&country_code=CN&nbh=130&hotfix_ver=&did_gt=1689657031040&keyconfig_state=2&cdid_tag=7&sys=ANDROID_8.1.0&max_memory=256&cold_launch_time_ms=1689731923266&oc=XIAOMI&sh=2280&ddpi=440&deviceBit=0&browseType=4&socName=Qualcomm%20Snapdragon%20660&is_background=0&c=XIAOMI&sw=1080&ftt=&abi=arm64&userRecoBit=0&device_abi=arm64&totalMemory=5710&grant_browse_type=AUTHORIZED&iuid=&rdid=ANDROID_254db5af72b2742d&sbh=110&darkMode=false&did=ANDROID_1df15ab612781d06"
headers = {
'Host': 'apijs.gifshow.com',
'User-Agent': 'kwai-android aegon/3.26.4',
'Content-Type': 'application/x-www-form-urlencoded'
}
payload = 'user_id=1471088950&lang=zh&count=20&privacy=public&pcursor=1.689605697445E12&referer=ks%3A%2F%2Fprofile%2F1351720628%2F5200250302942104746%2F1_u%2F2002357763686114370_bs4356%2F90&displayType=3&teenagerMode=false&tubeCustomParams=%7B%22tubeCardABParam%22%3A1%7D&preRequest=false&videoModelCrowdTag=1_16&os=android&token=98d1568e5e05486b86091441dfb93076-3115604858&cs=false&client_key=3c2cd3f3&kuaishou.api_st=&uQaTag=0%23'
data = dict(parse_qsl(payload))
print(data)
sig, sig3str = sig3_start(url, data)
tokensig = get_tokening(sig, "8b0b05731c79f830684dd7436181859d")
sig3 = getsig3(sig3str)
print(sig, sig3str, sig3)
url = url + f"&sig={sig}&__NStokensig={tokensig}&__NS_sig3={sig3}"
print(url)
response = requests.request("POST", url, headers=headers, data=data)
print(response.text)
for res in response.json()['feeds']:
try:
time = res['time']
duration = res['duration']
caption = res['caption']
author = res['soundTrack']['name']
share_info = res['share_info']
print('caption: ' + str(caption) + ' author: ' + str(author) + ' time: ' + str(time) + ' duration: ' + str(
duration) + ' share_info: ' + str(share_info))
except Exception as a:
print(a)
continue
文章来源:https://www.toymoban.com/news/detail-643105.html
评论: API
# -*- coding: utf-8 -*-
import requests
from sig import sig3_start, getsig3
url = "https://api3.gifshow.com/rest/n/comment/list/v2?mod=Google%28Pixel%20XL%29&abi=arm32&country_code=CN&kpn=KUAISHOU&is_background=0&cdid_tag=7&deviceBit=0&oc=ANDROID_SHENMA_ZW_SSYQ_CPC&egid=DFP1B2A7E8DB6DEF92C673F3F4C5B7C685731D7598AD80345580EFAE1208BCA2&sbh=84&hotfix_ver=&appver=11.1.30.29775&sh=2560&grant_browse_type=AUTHORIZED&userRecoBit=0&cold_launch_time_ms=1689577363668&nbh=168&socName=Qualcomm%20MSM8996PRO-AB&newOc=ANDROID_SHENMA_ZW_SSYQ_CPC&androidApiLevel=25&max_memory=256&isp=&kcv=1507&earphoneMode=1&browseType=4&kpf=ANDROID_PHONE&ddpi=560&did=ANDROID_60a02c5de917fa4c&android_os=0&boardPlatform=msm8996&app=0&net=WIFI&device_abi=arm64&did_tag=0&ud=0&c=ANDROID_SHENMA_ZW_SSYQ_CPC&sys=ANDROID_7.1.2&bottom_navigation=false&slh=0&sw=1440&oDid=ANDROID_60a02c5de917fa4c&ftt=&keyconfig_state=2&rdid=ANDROID_453bb538c86218be&language=zh-cn&darkMode=false&totalMemory=3764&iuid=&did_gt=1689577366128&ver=11.1"
headers = {
'Host': 'api3.gifshow.com',
'User-Agent': 'kwai-android aegon/3.26.4',
'Content-Type': 'application/x-www-form-urlencoded'
}
data = {
"photoId": "5249508419472077227",
"user_id": "1544872123",
"order": "desc",
"count": "10",
"photoPageType": "145",
"enableEmotion": "true",
"expTag": "1_i/2002353905121107874_scn0",
"urlPackagePage2": "USER_TAG_SEARCH",
"ptp": "",
"feedCommentCount": "83",
"commentPanelType": "1",
"client_key": "3c2cd3f3",
"uQaTag": "",
"cs": "false",
"os": "android",
"videoModelCrowdTag": "1_99"
}
sig, sig3str = sig3_start(url, data)
sig3 = getsig3(sig3str)
url = url + f"&sig={sig}&__NS_sig3={sig3}"
print(sig, sig3str, sig3)
response = requests.request("POST", url, headers=headers, data=data)
print(response.text)
文章来源地址https://www.toymoban.com/news/detail-643105.html
到了这里,关于ks协议请求APP sig __NS_sig3 __NStokensig的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!