网页爬虫之路 xx小说

抓包

抓包工具

 登录完整请求

POST /web/login.php HTTP/1.1
Host: www.yb3.cc
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
Accept: application/json, text/javascript, */*
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded
X-Requested-With: XMLHttpRequest
Content-Length: 44
Origin: https://www.yb3.cc
Connection: keep-alive
Referer: https://www.yb3.cc/
Cookie: UM_distinctid=17118e0194d10c-05116541e32f538-4c302f7e-e1000-17118e0194e1cf; CNZZDATA1262370718=351798230-1585257263-%7C1585257263

username=1232&password=123456&usecookie=3600

编码

import requests

host = 'https://www.yb3.cc'
login_path = '/web/login.php'

login_url = host + login_path

headers = {
    "User-Agent": "mozilla/4.0 (compatible; MSIE 5.5; Windows NT)",
}

data = dict(
    username='gini', password='123456', usecookie=3600
)

resp = requests.post(login_url, headers=headers, data=data)
print(resp.status_code)
print(resp.text)

/*输出
200
{"msg":"登录成功","return_uri":"/","stat":1}
*/

 

posted @ 2020-03-27 06:11  沐风先生  阅读(432)  评论(0)    收藏  举报