|
@@ -17,6 +17,7 @@ from requests import Session as Session_ |
|
@@ -17,6 +17,7 @@ from requests import Session as Session_ |
|
17
|
|
17
|
|
|
18
|
from lib import common, graph
|
18
|
from lib import common, graph
|
|
19
|
from utils import parse_html, encpass
|
19
|
from utils import parse_html, encpass
|
|
|
|
20
|
+from utils.cache import cache
|
|
20
|
|
21
|
|
|
21
|
|
22
|
|
|
22
|
class Session(Session_):
|
23
|
class Session(Session_):
|
|
@@ -37,7 +38,9 @@ class Session(Session_): |
|
@@ -37,7 +38,9 @@ class Session(Session_): |
|
37
|
content = res.text
|
38
|
content = res.text
|
|
38
|
set_cookie = res.headers.get('Set-Cookie', None)
|
39
|
set_cookie = res.headers.get('Set-Cookie', None)
|
|
39
|
if 'checkpoint' in res.url:
|
40
|
if 'checkpoint' in res.url:
|
|
40
|
- # self.get_deal_lock_method(int(kwargs['data']['jazoest']), kwargs['data']['lsd'])
|
41
|
+ way_list = self.get_verification_method(**kwargs)
|
|
|
|
42
|
+ email = kwargs['data']['email']
|
|
|
|
43
|
+ cache.set(key=f'{email}:verification_method', value=way_list)
|
|
41
|
raise FBchatUserError('账号被封锁:' + parse_html.checkpoint_text(content))
|
44
|
raise FBchatUserError('账号被封锁:' + parse_html.checkpoint_text(content))
|
|
42
|
elif 'ServerRedirect' in content and self._match_redirect_(content) == '\\/checkpoint\\/block\\/':
|
45
|
elif 'ServerRedirect' in content and self._match_redirect_(content) == '\\/checkpoint\\/block\\/':
|
|
43
|
raise FBchatUserError('账号被封锁')
|
46
|
raise FBchatUserError('账号被封锁')
|
|
@@ -61,7 +64,7 @@ class Session(Session_): |
|
@@ -61,7 +64,7 @@ class Session(Session_): |
|
61
|
hasattr(self, 'logout_call') and self.logout_call()
|
64
|
hasattr(self, 'logout_call') and self.logout_call()
|
|
62
|
raise
|
65
|
raise
|
|
63
|
|
66
|
|
|
64
|
- def get_init_lock_args(self, jazoest: str, lsd: str):
|
67
|
+ def verification_init(self, **kwargs):
|
|
65
|
"""
|
68
|
"""
|
|
66
|
获取解封方式 所需要参数
|
69
|
获取解封方式 所需要参数
|
|
67
|
"""
|
70
|
"""
|
|
@@ -73,26 +76,27 @@ class Session(Session_): |
|
@@ -73,26 +76,27 @@ class Session(Session_): |
|
73
|
'modules': 'FormSubmit',
|
76
|
'modules': 'FormSubmit',
|
|
74
|
"dpr": 2,
|
77
|
"dpr": 2,
|
|
75
|
"fb_dtsg_ag": fb_dtsg_ag,
|
78
|
"fb_dtsg_ag": fb_dtsg_ag,
|
|
76
|
- "jazoest": jazoest,
|
79
|
+ "jazoest": int(kwargs['data']['jazoest']),
|
|
77
|
"nh": nh,
|
80
|
"nh": nh,
|
|
78
|
- "lsd": lsd
|
81
|
+ "lsd": kwargs['data']['lsd']
|
|
79
|
}
|
82
|
}
|
|
80
|
return params
|
83
|
return params
|
|
81
|
|
84
|
|
|
82
|
- def get_deal_lock_method(self, jazoest, lsd):
|
|
|
|
83
|
- params = self.get_init_lock_args(jazoest, lsd)
|
|
|
|
84
|
- res = super().request('GET', 'https://www.facebook.com/ajax/bootloader-endpoint',
|
|
|
|
85
|
- params=params)
|
|
|
|
86
|
-
|
|
|
|
87
|
- res = super().request('POST', 'https://www.facebook.com/cookie/consent/',
|
|
|
|
88
|
- params=params)
|
|
|
|
89
|
-
|
|
|
|
90
|
- params['submit[Continue]'] = 'Continue'
|
|
|
|
91
|
- res = super().request('POST',
|
|
|
|
92
|
- 'https://www.facebook.com/checkpoint/async?next'
|
|
|
|
93
|
- , data=params
|
|
|
|
94
|
- )
|
|
|
|
95
|
- pass
|
85
|
+ def get_verification_method(self, **kwargs):
|
|
|
|
86
|
+ """
|
|
|
|
87
|
+ 获取解封方法
|
|
|
|
88
|
+ """
|
|
|
|
89
|
+ try:
|
|
|
|
90
|
+ params = self.verification_init(**kwargs)
|
|
|
|
91
|
+ # res = super().request('POST', 'https://www.facebook.com/cookie/consent/',params=params)
|
|
|
|
92
|
+ # res = super().request('GET', 'https://www.facebook.com/ajax/bootloader-endpoint',params=params)
|
|
|
|
93
|
+ params['submit[Continue]'] = 'Continue'
|
|
|
|
94
|
+ res = super().request('POST', 'https://www.facebook.com/checkpoint/async?next', data=params)
|
|
|
|
95
|
+ res = super().request('GET', 'https://zh-cn.facebook.com/checkpoint/?next')
|
|
|
|
96
|
+ way_list = parse_html.get_verification_method(res.text)
|
|
|
|
97
|
+ return way_list # 解封方式在里面
|
|
|
|
98
|
+ except:
|
|
|
|
99
|
+ return []
|
|
96
|
|
100
|
|
|
97
|
|
101
|
|
|
98
|
class PCState(State):
|
102
|
class PCState(State):
|
|
@@ -162,7 +166,7 @@ class PCState(State): |
|
@@ -162,7 +166,7 @@ class PCState(State): |
|
162
|
'lgnjs': int(time.time()),
|
166
|
'lgnjs': int(time.time()),
|
|
163
|
'timezone': '-480'
|
167
|
'timezone': '-480'
|
|
164
|
})
|
168
|
})
|
|
165
|
- r = session.post('https://www.facebook.com/login/device-based/regular/login/?login_attempt=1&lwv=110',
|
169
|
+ r = session.post('https://zh-cn.facebook.com/login/device-based/regular/login/?login_attempt=1&lwv=110',
|
|
166
|
data=data)
|
170
|
data=data)
|
|
167
|
setCookie = r.headers.get('Set-Cookie') or ''
|
171
|
setCookie = r.headers.get('Set-Cookie') or ''
|
|
168
|
|
172
|
|