本文所有教程及源码、软件仅为技术研究。不涉及计算机信息系统功能的删除、修改、增加、干扰,更不会影响计算机信息系统的正常运行。不得将代码用于非法用途,如侵立删! |
抖音 根据sec_uid获取个人详细信息
环境
- win10
- python3.9
方案一
直接请求web端个人主页页面
headers = {
"authority": "",
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"accept-language": "zh-CN,zh;q=0.9",
"cache-control": "max-age=0",
"sec-ch-ua": "\"Google Chrome\";v=\"113\", \"Chromium\";v=\"113\", \"Not-A.Brand\";v=\"24\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "none",
"sec-fetch-user": "?1",
"upgrade-insecure-requests": "1",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
}
url = "https://******/***/MS4wLjABAAAASYLiOdBX1zAfaxxMaJYbF0ynTZpRYwW7b6rL0Yrl1Mc"
response = requests.get(url, headers=headers, cookies=cookies)
一些关键的字段都是有的
方案二
桌面应用接口
headers = {
"Host": "",
"Accept-Language": "zh-CN",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "cross-site",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) ????/1.1.0 Chrome/104.0.5112.102 Electron/20.1.0-tt.6.release.main.24 TTElectron/20.1.0-tt.6.release.main.24 Safari/537.36",
"accept": "application/json, text/plain, */*",
"bd-ticket-guard-version": "1",
"referer": "",
"sdk-version": "2",
"sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"104\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"x-tt-disable-sessionid": "1",
}
params = {
"aid": "339757",
"version_name": "1.1.0",
"version_code": "1.1.0",
"device_platform": "win32",
"sec_user_id": sec_uid,
"os_version": "10.0.19044",
"screen_width": "1680",
"screen_height": "1050",
"browser_language": "zh-CN",
"browser_platform": "Win32",
"browser_name": "Mozilla",
"browser_online": "true",
"cookie_enabled": "true"
}
response = self._parse_url(url=url, headers=headers, params=params)
if not response:
count += 1
return None, None
data = response.json()
# IP属地
ipLocation = jsonpath(data, '$..user.location')
ipLocation = ipLocation[0] if ipLocation else 'None'
# 省份
province = jsonpath(data, '$..user.province')
province = province[0] if province else ''
# 城市
city = jsonpath(data, '$..user.city')
city = city[0] if city else ''
if province or city:
city = f'{province} {city}'
else:
city = "None"
return ipLocation, city
可以看到一些常规的字段都是有的
效果
资源下载
https://download.csdn.net/download/qq_38154948/87939224
本文仅供学习交流使用,如侵立删!wx:1033383881 |
标签:province,city,ch,uid,headers,抖音,sec,ua From: https://www.cnblogs.com/c1033383881/p/17497190.html