VictorNine / fbridge

Bridge facebook messenger with any service supported by matterbridge
BSD 3-Clause "New" or "Revised" License
29 stars 5 forks source link

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

Open chrisbeckstrom opened 4 years ago

chrisbeckstrom commented 4 years ago

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 me@myemailaddress.com...
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"
nileplumb commented 3 years ago

same, i hate fb so difficult to work with.

nileplumb commented 3 years ago

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)
powerjungle commented 3 years ago

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.

nileplumb commented 3 years ago

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 notifications@github.com 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.

powerjungle commented 3 years ago

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!