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

更新cookie失效 #40

Open
ShakeWeLy opened this issue Jul 30, 2024 · 19 comments
Open

更新cookie失效 #40

ShakeWeLy opened this issue Jul 30, 2024 · 19 comments

Comments

@ShakeWeLy
Copy link

我尝试更新cookie但是仍然无法运行;所有我尝试着直接把cookie写入代码,运行显示cookie失效,但是这个cookie是我刚更新的。。。

`def check_cookies():
more_url = 'https://edith.xiaohongshu.com/api/sns/web/v1/user_posted'
params = get_params()
headers = get_headers()

cookies_local = {
    "sec_poison_id": "2b74c391",
    "gid": "y",
    "a1": "18",
    "websectiga": "6",
    "webId": "5",
    "web_session": "0",
    "xsecappid": "xhs-pc-web",
    "webBuild": "4.27.7"
}

try:
    test_user_id = '5ad2ede14eacab146f865fe9'
    params['user_id'] = test_user_id
    params['cursor'] = ''
    api = f"/api/sns/web/v1/user_posted?num=30&cursor=&user_id={test_user_id}&image_scenes="
    a1 = cookies_local['a1']
    
    try:
        ret = js.call('get_xs', api, '', a1)
    except Exception as e:
        print(f'缺少nodejs环境: {e}')
        return
    
    headers['x-s'], headers['x-t'] = ret['X-s'], str(ret['X-t'])
    response = requests.get(more_url, headers=headers, cookies=cookies_local, params=params)
    res = response.json()
    
    if not res.get("success", False):
        raise Exception("cookie失效")
    else:
        print("cookie有效")
        return cookies_local

Snipaste_2024-07-30_21-36-52
Snipaste_2024-07-30_21-24-15
Snipaste_2024-07-30_21-24-21
Snipaste_2024-07-30_21-35-21

except Exception as e:
    print(f"cookie失效,请手动更改cookies.txt文件: {e}")
    sys.exit(1)`
@daihehedai
Copy link

我也遇到了相同问题

@ZoeX2023
Copy link

请问解决了吗?我也是哎

@CG0721
Copy link

CG0721 commented Jul 31, 2024

解决了吗?一样遇到同样问题.

@priforjm
Copy link

priforjm commented Aug 5, 2024

同样问题

@tyutltf
Copy link

tyutltf commented Aug 6, 2024

解决了么 估计得重新逆向了 是不是多了几个参数
image

@JasonJiang00
Copy link

可以改一下check_cookies 方法,直接return cookies_local 就行了,不需要校验cookie有效

@ShakeWeLy
Copy link
Author

可以改一下check_cookies 方法,直接return cookies_local 就行了,不需要校验cookie有效

没用 依旧会查询失败

@250743390
Copy link

解决了嘛?遇到同样的问题

@JianingHee
Copy link

有兄弟解决了吗?

@6V836sX
Copy link

6V836sX commented Aug 26, 2024

好久不用,今天一试,遇到同样问题。应该是sec_poison_id,web_session参数的加密变了,楼主快更新!

@yeyuchen198
Copy link

先别搞了,参数生成算法可能变了,还在用旧的小心封号

@6V836sX
Copy link

6V836sX commented Aug 27, 2024 via email

@miworking3
Copy link

等待更新!

@wyx2014
Copy link

wyx2014 commented Sep 10, 2024

等待更新。。。。。。

@daihehedai
Copy link

看到前几天有个新的commit,请问问题解决了吗

@ShelbyOnTheWay
Copy link

求更新 🥺

@an-Underpriviliged-ZJUer

穿西装打领带,拿无线电话有屁用,啊嗯?
跟这种大哥
鸭屎啦你

@ReoCen
Copy link

ReoCen commented Nov 28, 2024

求更新

1 similar comment
@liyuan97
Copy link

求更新

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests