fbchat-dev / fbchat

Facebook Chat (Messenger) for Python
https://fbchat.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.19k stars 412 forks source link

Cant Login since morning! #638

Open ambit0 opened 3 years ago

ambit0 commented 3 years ago

I'm getting error: fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/cookie/consent-page/?next_uri=https%3A%2F%2Fm.facebook.com%2Fhome.php%3Frefsrc%3Dhttps%253A%252F%252Fwww.facebook.com%252F&_rdr)

m-el-azzouzi commented 3 years ago

Check the location of the file _state.py (written in the Exception) then edit it and go to login function (around line 126), scroll to line: r = session.post("https://m.facebook.com/login.php?login_attempt=1", data=data) (line 139 for me).

Paste that after this line (with correct indentation):


if "cookie" in r.url:
    beg = r.text.find("action=")+8
    end = r.text.find("\"", beg)
    urlCookies = "https://m.facebook.com" + r.text[beg:end]
    payload = {i["name"]:i["value"] for i in find_input_fields(r.text).find_all('input')}
    r = session.post(urlCookies, data=payload)
mawerty commented 3 years ago

I used it, but now i have error: Attempt #1 failed, retrying Traceback (most recent call last): File "C:\Users\krzysiek\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_client.py", line 205, in login self._state = State.login( File "C:\Users\krzysiek\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 157, in login return cls.from_session(session=session) File "C:\Users\krzysiek\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 196, in from_session revision = int(r.text.split('"client_revision":', 1)[1].split(",", 1)[0]) IndexError: list index out of range

m-el-azzouzi commented 3 years ago

I used it, but now i have error: Attempt #1 failed, retrying Traceback (most recent call last): File "C:\Users\krzysiek\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_client.py", line 205, in login self._state = State.login( File "C:\Users\krzysiek\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 157, in login return cls.from_session(session=session) File "C:\Users\krzysiek\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 196, in from_session revision = int(r.text.split('"client_revision":', 1)[1].split(",", 1)[0]) IndexError: list index out of range

Ok, do you have some more logs? It seems it's something with your config, not fbchat Try print(r.text) before line 196 and paste what it prints

mawerty commented 3 years ago

Attempt #1 failed, retrying Traceback (most recent call last): File "C:\Users\krzysiek\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_client.py", line 205, in login self._state = State.login( File "C:\Users\krzysiek\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 157, in login return cls.from_session(session=session) File "C:\Users\krzysiek\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 196, in from_session revision = int(r.text.split('"client_revision":', 1)[1].split(",", 1)[0]) IndexError: list index out of range <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">Facebook