首页 > 关于用requests模拟登陆Acfun的问题

关于用requests模拟登陆Acfun的问题

import requests

s = requests.session()

headers = {
    'Accept':'*/*',
    'Accept-Encoding':'gzip, deflate',
    'Accept-Language':'zh-CN,zh;q=0.8',
    'Content-Length':'37',
    'Connection':'keep-alive',
    'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8',
    'Host':'passport.acfun.tv',
    'Origin':'http://passport.acfun.tv',
    'Referer':'http://passport.acfun.tv/login/',
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36',
    'X-Requested-With':'XMLHttpRequest'
}

login_data = {'username':'****','password':'*****'}
s.post('http://passport.acfun.tv/login',data=login_data,headers=headers)

r = s.get('http://www.acfun.tv/api/friend.aspx?name=getFollowingList&isGrou')
print(r.status_code)
print(r.text)

代码如上,输出结果如下:

200
{"result":"请先登录","success":false,"status":-100}

为什么会失败呢?请各位菊苣指教一下


我把http://passport.acfun.tv/login改成http://passport.acfun.tv/login.aspx就能用了……虽然我一个好友都没有

【热门文章】
【热门文章】