爬虫学习:登录GitHub
目标:使用Requests包实现GitHub的登录
1.## 确定表单参数
多次抓包对比表单参数
commit: Sign in
utf8: ✓
authenticity_token: sO34KvtovZgqSKQsVIkEdWbwX6ykeuzCMxuZbWul6wUmlpz/3Hc4SaeuRB5WEWbL1JbkgYL3r9Na1ivFxM+o+w==
ga_id: 1192443032.1565138303
login: 用户名
password: 明文密码
webauthn-support: supported
webauthn-iuvpaa-support: unsupported
required_field_34aa:
timestamp: 1573029556609
timestamp_secret: bc3d494a0b7f36c58e7b3dc07c52fcd3e149456f46aff70797e3709c766434c7
commit: Sign in
utf8: ✓
authenticity_token: M0Xosj8ILvss0InDr0iNNiVylyczk06WBKmc6mfRbjKefRzgRUiPVzOKmu3CeVu4rAbQd7mj1EC99oP5yLCNoQ==
ga_id: 1192443032.1565138303
login: 用户名
password: 明文密码
webauthn-support: supported
webauthn-iuvpaa-support: unsupported
required_field_90c0:
timestamp: 1573029878918
timestamp_secret: 68be517605bc020dbc20be18cb90323267ac88ff650b912fbe087df1be9fe117
通过对比:
固定值:
1. commit: Sign in
2. utf8: ✓
3. login: 用户名
4. password: 明文密码
5. webauthn-support: supported
6. webauthn-iuvpaa-support: unsupported
7. ga_id: 1192443032.1565138303
变化值:
1. authenticity_token: M0Xosj8ILvss0InDr0iNNiVylyczk06WBKmc6mfRbjKefRzgRUiPVzOKmu3CeVu4rAbQd==
2. required_field_90c0:
3. timestamp: 1573029878918
4. timestamp_secret: 68be517605bc020dbc20be18cb90323267ac88ff650b912fbe087df1be9fe117
2.## 分析表单参数
通过抓取登录页源码,发现
<input type="hidden" name="authenticity_token" value="K4gFC3qrPOfJVi8kLoPtjJg2dUp6Yisz4YG2sHktnw8Yu1nAo2n7vVVlupbmMQyTt5iKRLTJZb/+wA6FqPPV4g==">
<input type="hidden" name="ga_id" class="js-octo-ga-id-input" value=