专栏名称: Python开发者
人生苦短,我用 Python。伯乐在线旗下账号「Python开发者」分享 Python 相关的技术文章、工具资源、精选课程、热点资讯等。
目录
相关文章推荐
51好读  ›  专栏  ›  Python开发者

Python 获取网易云音乐热门评论

Python开发者  · 公众号  · Python  · 2017-05-30 20:10

正文

请到「今天看啥」查看全文


= AES_encrypt ( first_param , first_key , iv )

else :

offset = str (( page - 1 ) * 20 )

first_param = '{rid:"", offset:"%s", total:"%s", limit:"20", csrf_token:""}' % ( offset , 'false' )

h_encText = AES_encrypt ( first_param , first_key , iv )

h_encText = AES_encrypt ( h_encText , second_key , iv )

return h_encText

# 获取 encSecKey

def get_encSecKey () :

encSecKey = "257348aecb5e556c066de214e531faadd1c55d814f9be95fd06d6bff9f4c7a41f831f6394d5a3fd2e3881736d94a02ca919d952872e7d0a50ebfa1769a7a62d512f5f1ca21aec60bc3819a9c3ffca5eca9a0dba6d6f7249b06f5965ecfff3695b54e1c28f3f624750ed39e7de08fc8493242e26dbc4484a01c76f739e135637c"

return encSecKey

# 解密过程

def AES_encrypt ( text , key , iv ) :

pad = 16 - len ( text ) % 16

text = text + pad * chr ( pad )

encryptor = AES . new ( key , AES . MODE_CBC , iv )

encrypt_text = encryptor . encrypt ( text )

encrypt_text = base64 . b64encode ( encrypt_text )

return encrypt_text

# 获得评论json数据

def get_json ( url , params , encSecKey ) :

data = {

"params" : params ,

"encSecKey" : encSecKey

}

response = requests . post ( url , headers = headers , data = data ,







请到「今天看啥」查看全文