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

460 cheating #745

Open
yorks opened this issue Aug 16, 2018 · 2 comments
Open

460 cheating #745

yorks opened this issue Aug 16, 2018 · 2 comments
Labels

Comments

@yorks
Copy link

yorks commented Aug 16, 2018

解决方法见:
Binaryify/NeteaseCloudMusicApi@883d945#diff-3c2039f9ae0902bf44f24a0c1ad4eb32

@nnnewb
Copy link
Contributor

nnnewb commented Sep 29, 2019

用api.NetEase还是不能登录,提示cheating。这个bug是一直没修复吗?

这里是我的临时补丁。

import logging
import random
import arrow
from NEMbox.api import NetEase
from hashlib import md5

from homepage.config import config

BOX = NetEase()

_logger = logging.getLogger('netease')


def _timestamp():
    return int(arrow.now().float_timestamp)


def _random_jsession_id():
    seq = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKMNOPQRSTUVWXYZ\\/+'
    random_seq = random.choices(seq, k=176)
    return ''.join(random_seq) + ':' + str(_timestamp())


def _random_nuid(with_timestamp=True):
    seq = '0123456789abcdefghijklmnopqrstuvwxyz'
    random_seq = random.choices(seq, k=32)
    if with_timestamp:
        return ''.join(random_seq) + ',' + str(_timestamp())
    else:
        return ''.join(random_seq)


def _patch_negative_460_cheating_883d94580():
    # known issue: https://github.com/darknessomi/musicbox/issues/745
    # patch reference: https://github.com/Binaryify/NeteaseCloudMusicApi/commit/883d94580ed4aeeb5a4d30f9d311ffe3d3894b29#diff-3c2039f9ae0902bf44f24a0c1ad4eb32
    base_cookies = {
        'JSESSIONID-WYYY': _random_jsession_id(),
        '_iuqxldmzr_': '32',
        '_ntes_nnid': _random_nuid(),
        '_ntes_nuid': _random_nuid(with_timestamp=False)
    }
    for key, value in base_cookies.items():
        cookie = BOX.make_cookie(key, value)
        # known issue https://github.com/darknessomi/musicbox/issues/790
        cookie._rest = {}
        BOX.session.cookies.set_cookie(cookie)

处理两个问题:

#790 AttributeError
以及这个issue -460 cheating

@nnnewb
Copy link
Contributor

nnnewb commented Sep 29, 2019

NetEase类的login api 设计也很奇怪,passwd参数必须是md5().hexdigest()但也没注释说明

@kigawas kigawas added the bug label Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants