From 2849de3dc173c5af880a4e7ffa8d949daceaff91 Mon Sep 17 00:00:00 2001 From: codezjx Date: Wed, 22 Aug 2018 13:01:37 +0800 Subject: [PATCH] #26 Bugfix: Server return: {'code': -460, 'msg': 'Cheating'}, use a 32-bits random '_ntes_nuid' to fix it. --- ncm/constants.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ncm/constants.py b/ncm/constants.py index 07b7b83..b569728 100644 --- a/ncm/constants.py +++ b/ncm/constants.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +import random +import string # Encrypt key modulus = '00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7b725152b3ab17a876aea8a5aa76d2e417629ec4ee341f56135fccf695280104e0312ecbda92557c93870114af6c9d05c4f7f0c3685b7a46bee255932575cce10b424d813cfe4875d3e82047b97ddef52741d546b8e289dc6935b3ece0462db0a22b8e7' @@ -11,7 +13,7 @@ headers = { 'Host': 'music.163.com', 'User-Agent': 'curl/7.51.0', 'Referer': 'http://music.163.com', - 'Cookie': 'appver=2.0.2' + 'Cookie': 'appver=2.0.2; _ntes_nuid={};'.format(''.join(random.choice(string.ascii_letters + string.digits) for _ in range(32))) } song_download_url = 'http://music.163.com/weapi/song/enhance/player/url?csrf_token='