|
...
|
...
|
@@ -17,6 +17,7 @@ from requests import Session as Session_ |
|
|
|
|
|
|
|
from lib import common, graph
|
|
|
|
from utils import parse_html, encpass
|
|
|
|
from utils.cache import cache
|
|
|
|
|
|
|
|
|
|
|
|
class Session(Session_):
|
|
...
|
...
|
@@ -37,7 +38,9 @@ class Session(Session_): |
|
|
|
content = res.text
|
|
|
|
set_cookie = res.headers.get('Set-Cookie', None)
|
|
|
|
if 'checkpoint' in res.url:
|
|
|
|
# self.get_deal_lock_method(int(kwargs['data']['jazoest']), kwargs['data']['lsd'])
|
|
|
|
way_list = self.get_verification_method(**kwargs)
|
|
|
|
email = kwargs['data']['email']
|
|
|
|
cache.set(key=f'{email}:verification_method', value=way_list)
|
|
|
|
raise FBchatUserError('账号被封锁:' + parse_html.checkpoint_text(content))
|
|
|
|
elif 'ServerRedirect' in content and self._match_redirect_(content) == '\\/checkpoint\\/block\\/':
|
|
|
|
raise FBchatUserError('账号被封锁')
|
|
...
|
...
|
@@ -61,7 +64,7 @@ class Session(Session_): |
|
|
|
hasattr(self, 'logout_call') and self.logout_call()
|
|
|
|
raise
|
|
|
|
|
|
|
|
def get_init_lock_args(self, jazoest: str, lsd: str):
|
|
|
|
def verification_init(self, **kwargs):
|
|
|
|
"""
|
|
|
|
获取解封方式 所需要参数
|
|
|
|
"""
|
|
...
|
...
|
@@ -73,26 +76,27 @@ class Session(Session_): |
|
|
|
'modules': 'FormSubmit',
|
|
|
|
"dpr": 2,
|
|
|
|
"fb_dtsg_ag": fb_dtsg_ag,
|
|
|
|
"jazoest": jazoest,
|
|
|
|
"jazoest": int(kwargs['data']['jazoest']),
|
|
|
|
"nh": nh,
|
|
|
|
"lsd": lsd
|
|
|
|
"lsd": kwargs['data']['lsd']
|
|
|
|
}
|
|
|
|
return params
|
|
|
|
|
|
|
|
def get_deal_lock_method(self, jazoest, lsd):
|
|
|
|
params = self.get_init_lock_args(jazoest, lsd)
|
|
|
|
res = super().request('GET', 'https://www.facebook.com/ajax/bootloader-endpoint',
|
|
|
|
params=params)
|
|
|
|
|
|
|
|
res = super().request('POST', 'https://www.facebook.com/cookie/consent/',
|
|
|
|
params=params)
|
|
|
|
|
|
|
|
params['submit[Continue]'] = 'Continue'
|
|
|
|
res = super().request('POST',
|
|
|
|
'https://www.facebook.com/checkpoint/async?next'
|
|
|
|
, data=params
|
|
|
|
)
|
|
|
|
pass
|
|
|
|
def get_verification_method(self, **kwargs):
|
|
|
|
"""
|
|
|
|
获取解封方法
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
params = self.verification_init(**kwargs)
|
|
|
|
# res = super().request('POST', 'https://www.facebook.com/cookie/consent/',params=params)
|
|
|
|
# res = super().request('GET', 'https://www.facebook.com/ajax/bootloader-endpoint',params=params)
|
|
|
|
params['submit[Continue]'] = 'Continue'
|
|
|
|
res = super().request('POST', 'https://www.facebook.com/checkpoint/async?next', data=params)
|
|
|
|
res = super().request('GET', 'https://zh-cn.facebook.com/checkpoint/?next')
|
|
|
|
way_list = parse_html.get_verification_method(res.text)
|
|
|
|
return way_list # 解封方式在里面
|
|
|
|
except:
|
|
|
|
return []
|
|
|
|
|
|
|
|
|
|
|
|
class PCState(State):
|
|
...
|
...
|
@@ -162,7 +166,7 @@ class PCState(State): |
|
|
|
'lgnjs': int(time.time()),
|
|
|
|
'timezone': '-480'
|
|
|
|
})
|
|
|
|
r = session.post('https://www.facebook.com/login/device-based/regular/login/?login_attempt=1&lwv=110',
|
|
|
|
r = session.post('https://zh-cn.facebook.com/login/device-based/regular/login/?login_attempt=1&lwv=110',
|
|
|
|
data=data)
|
|
|
|
setCookie = r.headers.get('Set-Cookie') or ''
|
|
|
|
|
...
|
...
|
|