python爬虫实战搞的是PC端,移动端可能有更加方便的接口,欢迎大家留意讨论反正是练手就随便抓一下pc端的包好了
主要内容
- 1.post请求登录
- 2.hmacMD5算法的简单使用
这个例子的登录非常简单没有任何加密直接post就行真的是一点加密和未知参数都没有

python实现,注意此处是类的一个方法不完整无法直接运行
def login(self,user_id,password):
data = {
'account_type': '5',
'device_id': 'web',
'user_id': user_id,
'password': password
}
response = self.session.post(self.login_url,data=data)
if response.status_code==200:
temp = response.json()
errorno = temp['errorno']
errormsg = temp['errormsg']
if errorno == 0:
print('login successful!','登录成功!')
data = temp['data']
self.qingting_id = data['qingting_id']
self.access_token = data['access_token']
else:
print('Login failed','登录失败')
print(errormsg)
录成功后我们把access_token和qingting_id拿到,相当于一个登录后的标志如果账号是会员相当于一个会员标志
音频的真实地址请求了这样一个url:
https://audio.qingting.fm/audiostream/redirect/294280/11604885
其中294280是专辑id,
11604885是当前音频的id

其中还带了一些参数比如access_token,qingting_id(登录成功的response中有,上图没有登录所有是空的),另外还有一些比如t是时间戳, <