Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]用户详细信息接口无法获得正确响应 #324

Closed
leobigivan opened this issue Feb 15, 2023 · 2 comments
Closed

[BUG]用户详细信息接口无法获得正确响应 #324

leobigivan opened this issue Feb 15, 2023 · 2 comments
Assignees
Labels
故障(bug) 代码问题导致的错误(Bugs caused by code problems) 额外求助(help wanted) 非项目代码错误的求助(Extra attention is needed) 无效(invalid) 非代码故障导致错误或异常(Non-code faults causing errors or anomalies)

Comments

@leobigivan
Copy link

leobigivan commented Feb 15, 2023

描述出现的错误
基于作者提供的接口信息,尝试获取“用户详细信息”以获得用户作品数量,但是返回失败。请教作者是哪里出了问题?
谢谢

写了一个实验代码片段,返回如下

userStr = "sec_user_id=MS4wLjABAAAAHOHnSnqXeVhFZWnVMeOYDjMzxr1sxZj5vn0SNEkIEqw&aid=1128"
USER_DETAIL = "https://www.douyin.com/aweme/v1/web/user/profile/other/?"
GET_XB_PATH = "http://47.115.200.238/xg/path?url="
GET_XB_DICT = "http://47.115.200.238/xg/dict/?params="
def getbyurl(url):
    headers = {
        "cookie": None,
        "referer": "https://www.douyin.com/friend",
        "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"
    }
    try:
        if isinstance(url, dict):
            params = eval(unquote(url, "utf-8"))
            url = urlencode(params, safe="=")
            response = json.loads(requests.post(
                GET_XB_DICT + url,
                    headers = headers).text)
        if isinstance(url, str):
            url = url.replace("&","%26")
            response = json.loads(requests.post(
                GET_XB_PATH + url,
                    headers = headers).text)
        else:
            print("[  提示  ]:传入的参数有误")
    except Exception as e:
        print("[  错误  ]:%s" % e)
    params = response["result"][0]["paramsencode"]
    xb = response["result"][0]["X-Bogus"]["0"]
    return (params, xb)
def main():
    headers = {
        "cookie": None,
        "referer": "https://www.douyin.com/friend",
        "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"
    }
    }
    api_url  = USER_DETAIL + getbyurl(userStr)[0]
    print("get by api:%s", api_url )
    resp = requests.get(api_url, headers= headers)
    js = json.loads(resp.content.decode())
    print(js)

if __name__ == "__main__":
    main()

bug复现
运行结果显示

get by api:%s https://www.douyin.com/aweme/v1/web/user/profile/other/?sec_user_id=MS4wLjABAAAAHOHnSnqXeVhFZWnVMeOYDjMzxr1sxZj5vn0SNEkIEqw&aid=1128&X-Bogus=DFSzswVuSRkANxXhShE%2Fal9WX7jc
{'extra': None, 'log_pb': {'impr_id': '2023021520052259D203A7E5002F099AD6'}, 'status_code': 5, 'status_msg': '参数不合法', 'user': {'favorite_permission': None}}
@leobigivan leobigivan added 故障(bug) 代码问题导致的错误(Bugs caused by code problems) 额外求助(help wanted) 非项目代码错误的求助(Extra attention is needed) 无效(invalid) 非代码故障导致错误或异常(Non-code faults causing errors or anomalies) labels Feb 15, 2023
@Johnserf-Seed
Copy link
Owner

给的参数不够

@Johnserf-Seed
Copy link
Owner

device_platform=webapp&aid=6383&channel=channel_pc_web&publish_video_strategy_type=2&source=channel_pc_web&sec_user_id=xxxxxxxxxxxxx&pc_client_type=1&version_code=170400&version_name=17.4.0&cookie_enabled=true&screen_width=1920&screen_height=1080&browser_language=zh-CN&browser_platform=Win32&browser_name=Edge&browser_version=110.0.1587.46&browser_online=true&engine_name=Blink&engine_version=110.0.0.0&os_name=Windows&os_version=10&cpu_core_num=12&device_memory=8&platform=PC&downlink=10&effective_type=4g&round_trip_time=50&webid=xxxxxxxxx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
故障(bug) 代码问题导致的错误(Bugs caused by code problems) 额外求助(help wanted) 非项目代码错误的求助(Extra attention is needed) 无效(invalid) 非代码故障导致错误或异常(Non-code faults causing errors or anomalies)
Projects
None yet
Development

No branches or pull requests

2 participants