|
@@ -0,0 +1,73 @@
|
|
|
|
+#!/usr/bin/env python
|
|
|
|
+# -*- coding: utf-8 -*-
|
|
|
|
+'''
|
|
|
|
+@Auther :liuyuqi.gov@msn.cn
|
|
|
|
+@Time :2018/4/11 1:07
|
|
|
|
+@File :main.py
|
|
|
|
+'''
|
|
|
|
+import urllib.request
|
|
|
|
+
|
|
|
|
+# 手机验证码登录
|
|
|
|
+# 获取验证码
|
|
|
|
+url_sendsms = "https://id.kuaishou.com/pass/kuaishou/sms/requestMobileCode"
|
|
|
|
+
|
|
|
|
+# 输入验证码登录
|
|
|
|
+url_login="https://id.kuaishou.com/pass/kuaishou/login/mobileCode"
|
|
|
|
+
|
|
|
|
+url_cache = set()
|
|
|
|
+headers = {
|
|
|
|
+ 'User-Agent': "Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Mobile Safari/537.36",
|
|
|
|
+ 'Cookie': 'did=web_34abffaccc51410a45a2f09bee712ec6; didv=2; Hm_lvt_86a27b7db2c5c0ae37fee4a8a35033ee=1549878747,1549878930,1549878956; Hm_lpvt_86a27b7db2c5c0ae37fee4a8a35033ee=1549879170',
|
|
|
|
+ 'Host': 'id.kuaishou.com',
|
|
|
|
+ 'Referer': 'https://www.kuaishou.com/account/login/?redirectURL=https%3A%2F%2Fverify.kuaishou.com%2F%23%2Fverify%2Fpersonal',
|
|
|
|
+ 'Upgrade-Insecure-Requests': '1',
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+def getCookie():
|
|
|
|
+ pass
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def setCookie():
|
|
|
|
+ pass
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def __init__():
|
|
|
|
+ pass
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+# 获取验证码
|
|
|
|
+def getCode():
|
|
|
|
+ try:
|
|
|
|
+ data = {
|
|
|
|
+ "smsCode": "1454",
|
|
|
|
+ "createId":"true",
|
|
|
|
+ "sid": "kuaishou.web.api",
|
|
|
|
+ "countryCode": "+86",
|
|
|
|
+ "phone": "18516527450"
|
|
|
|
+ }
|
|
|
|
+ req = urllib.request.Request(url=url_sendsms, data=urllib.parse.urlencode(data).encode(encoding='UTF8'),
|
|
|
|
+ headers=headers)
|
|
|
|
+ with urllib.request.urlopen(req) as res:
|
|
|
|
+ print(res.read().decode('utf-8'))
|
|
|
|
+ except Exception as err:
|
|
|
|
+ print(err)
|
|
|
|
+
|
|
|
|
+'''
|
|
|
|
+验证码登录
|
|
|
|
+'''
|
|
|
|
+def login():
|
|
|
|
+ try:
|
|
|
|
+ data = {
|
|
|
|
+ "sid": "kuaishou.web.api",
|
|
|
|
+ "type": "53",
|
|
|
|
+ "countryCode": "+86",
|
|
|
|
+ "phone": "18516527450",
|
|
|
|
+ }
|
|
|
|
+ req = urllib.request.Request(url=url_login, data=urllib.parse.urlencode(data).encode(encoding='UTF8'), headers=headers)
|
|
|
|
+ with urllib.request.urlopen(req) as res:
|
|
|
|
+ print(res.read().decode('utf-8'))
|
|
|
|
+ except Exception as err:
|
|
|
|
+ print(err)
|
|
|
|
+
|
|
|
|
+if __name__ == '__main__':
|
|
|
|
+ login()
|