fbridge icon indicating copy to clipboard operation
fbridge copied to clipboard

"IndexError: list index out of range" (can't connect to Facebook?)

Open chrisbeckstrom opened this issue 5 years ago • 5 comments

I feel like I'm so close, but maybe missing some detail somewhere. I'd be grateful if anybody could shed some light on what I'm doing wrong here!

when I run python3 fbridge.py, here's what I get:

Logging in [email protected]...
Attempt #1 failed, retrying
Traceback (most recent call last):
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_client.py", line 209, in login
    user_agent=user_agent,
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_state.py", line 151, in login
    return cls.from_session(session=session)
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_state.py", line 190, in from_session
    revision = int(r.text.split('"client_revision":', 1)[1].split(",", 1)[0])
IndexError: list index out of range
Attempt #2 failed, retrying
Traceback (most recent call last):
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_client.py", line 209, in login
    user_agent=user_agent,
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_state.py", line 151, in login
    return cls.from_session(session=session)
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_state.py", line 190, in from_session
    revision = int(r.text.split('"client_revision":', 1)[1].split(",", 1)[0])
IndexError: list index out of range
Attempt #3 failed, retrying
Traceback (most recent call last):
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_client.py", line 209, in login
    user_agent=user_agent,
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_state.py", line 151, in login
    return cls.from_session(session=session)
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_state.py", line 190, in from_session
    revision = int(r.text.split('"client_revision":', 1)[1].split(",", 1)[0])
IndexError: list index out of range
Attempt #4 failed, retrying
Traceback (most recent call last):
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_client.py", line 209, in login
    user_agent=user_agent,
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_state.py", line 151, in login
    return cls.from_session(session=session)
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_state.py", line 190, in from_session
    revision = int(r.text.split('"client_revision":', 1)[1].split(",", 1)[0])
IndexError: list index out of range
Traceback (most recent call last):
  File "fbridge.py", line 100, in <module>
    client = FBListener(username, password)
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_client.py", line 103, in __init__
    self.login(email, password, max_tries, user_agent=user_agent)
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_client.py", line 209, in login
    user_agent=user_agent,
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_state.py", line 151, in login
    return cls.from_session(session=session)
  File "/home/chris/.local/lib/python3.5/site-packages/fbchat/_state.py", line 190, in from_session
    revision = int(r.text.split('"client_revision":', 1)[1].split(",", 1)[0])
IndexError: list index out of range

my matterbridge.toml:

[mattermost]
    [mattermost.work]
    UseTLS=true
    NoTLS=false
    Server="https://secret"
    Team="helloworld"
    Login="secretusername"
    Password="p355w0rd"
    PrefixMessagesWithNick=true
    RemoteNickFormat="[{PROTOCOL}] <{NICK}> "

[api.myapi]
BindAddress="127.0.0.1:4242"
Buffer=1000
RemoteNickFormat="{NICK}"


## This is the default FB gateway. All facebook measseages will be sendt here
[[gateway]]
name="FBgateway"
enable=true

[[gateway.inout]]
account="mattermost.work"
channel="hello"

[[gateway.inout]]
account="api.myapi"
channel="api"

chrisbeckstrom avatar Oct 29 '20 20:10 chrisbeckstrom

same, i hate fb so difficult to work with.

nileplumb avatar Nov 25 '20 02:11 nileplumb

been trying again today no success have tried various python's, PR's, forks and and their patches, and the alternative fbchat-asyncio.

simply defining my password leads to a 2FA request, which it seemingly passes then the above error occurs/ using an AppPassword instead gets this error

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fbchat/_client.py", line 209, in login
    user_agent=user_agent,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fbchat/_state.py", line 155, in login
    "(Failed on url: {})".format(r.url)
fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login/?email=user%40domain.com&li=CODEHERE&e=NUMBERS&shbl=1&refsrc=https%3A%2F%2Fwww.facebook.com%2F&_rdr)

nileplumb avatar Nov 28 '20 15:11 nileplumb

This seems to be a problem from "fbchat" itself. When I try a very simple login script it doesn't work.

Edit: Well it seems the project isn't maintained anymore. https://github.com/fbchat-dev/fbchat Look at the readme.

Edit 2: Also when reading around in the issues there, seems like facebook changed something drastically again...so yeah.

powerjungle avatar Nov 30 '20 22:11 powerjungle

I can successfully log in using pidgin's lib purple Facebook of that helps route a successful path at all

On 30 Nov 2020, at 22:03, powerjungle [email protected] wrote:

 This seems to be a problem from "fbchat" itself. When I try a very simple login script it doesn't work.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

nileplumb avatar Dec 01 '20 00:12 nileplumb

I tried making an alternative to this repo. Here it is: https://github.com/powerjungle/fbridge-asyncio

Anyone that can help or leave feedback, please do!

powerjungle avatar Dec 28 '20 09:12 powerjungle