添加获取用户信息的接口,及部分信息分析
This commit is contained in:
parent
b3bfe6ae58
commit
1f222a2a94
@ -1,6 +1,9 @@
|
||||
import json
|
||||
|
||||
from flask import Flask, request, Response
|
||||
from handler.common import MESSAGE_QUEUE, MessagePayload
|
||||
import logging
|
||||
# 不要日志,当它不存在
|
||||
log = logging.getLogger('werkzeug')
|
||||
log.setLevel(logging.ERROR)
|
||||
|
||||
@ -13,3 +16,33 @@ def message_from_mitmproxy():
|
||||
payload = MessagePayload(request.data, request.headers.get("X-MITM-TS", ""))
|
||||
MESSAGE_QUEUE.put(payload)
|
||||
return Response(status=204)
|
||||
|
||||
|
||||
@app.post("/user_info")
|
||||
def user_info_from_mitmproxy():
|
||||
try:
|
||||
user_info = json.loads(request.data)
|
||||
except json.JSONDecodeError:
|
||||
return Response(status=403)
|
||||
print(user_info)
|
||||
if "user" not in user_info:
|
||||
# 这个请求有问题
|
||||
return Response(status=403)
|
||||
user = user_info['user']
|
||||
#有用的信息
|
||||
{
|
||||
# 抖音加密的用户id,也就是url上的id字符串
|
||||
"sec_user_id": user.get('sec_uid', ""),
|
||||
# 用户真实的数字id
|
||||
"user_id": user.get('uid', 0),
|
||||
# 开播状态,1是开播了
|
||||
"live_status": user.get('live_status', 0),
|
||||
# 和西瓜视频一样,每次开播,room_id都会变化,需要动态拿取
|
||||
"room_id": user.get('room_id', 0),
|
||||
"nickname": user.get('nickname', ""),
|
||||
# 多平台粉丝数,包含西瓜视频等关联字节公司下的账号粉丝总数
|
||||
"mp_fans_count": user.get('mplatform_followers_count', 0),
|
||||
# 近期加的归属地
|
||||
"ip_location": user.get('ip_location', ""),
|
||||
}
|
||||
return Response(status=204)
|
||||
|
@ -9,6 +9,15 @@ session = requests.session()
|
||||
|
||||
|
||||
class Writer:
|
||||
def response(self, flow: http.HTTPFlow):
|
||||
# /aweme/v1/web/user/profile/other/ 他人主页获取他人信息
|
||||
if '/aweme/v1/web/user/profile/other' in flow.request.path:
|
||||
response_json_content = flow.response.content
|
||||
session.post("http://127.0.0.1:5000/user_info", headers={
|
||||
"X-MITM-TS": str(time.time()),
|
||||
"X_REFERER": flow.request.url
|
||||
}, data=response_json_content, timeout=(1, 1))
|
||||
|
||||
def websocket_message(self, flow: http.HTTPFlow):
|
||||
re_c = re.search('webcast\d-ws-web-.*\.douyin\.com', flow.request.host)
|
||||
if re_c:
|
||||
@ -18,7 +27,7 @@ class Writer:
|
||||
content = message.content
|
||||
session.post("http://127.0.0.1:5000/message", headers={
|
||||
"X-MITM-TS": str(time.time()),
|
||||
"X_REFERER": flow.request.host
|
||||
"X_REFERER": flow.request.url
|
||||
}, data=content, timeout=(1, 1))
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user