fbmessengerexport icon indicating copy to clipboard operation
fbmessengerexport copied to clipboard

Can't seem to get it to work at all

Open aluhrs13 opened this issue 3 years ago • 7 comments

I can't seem to get it to work at all :(, could this be because I'm on Windows or some other user error?

Doing login

PS C:\Users\aluhr\source\repos\AndysQS\FBMessenger> python -m fbmessengerexport.export --login --cookies ANYSTRING
C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbmessengerexport\exporthelpers\logging_helper.py:25: UserWarning: You might want to install 'logzero' for nice colored logs
  warnings.warn("You might want to install 'logzero' for nice colored logs")
email:<email>
password (won't be stored):<password>
Logging in <email>...
Attempt #1 failed, retrying
Traceback (most recent call last):
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_client.py", line 205, in login
    self._state = State.login(
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_state.py", line 151, in login
    return cls.from_session(session=session)
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_state.py", line 188, in from_session
    fb_dtsg = FB_DTSG_REGEX.search(r.text).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

Trying with --cookies

PS C:\Users\aluhr\source\repos\AndysQS\FBMessenger> python -m fbmessengerexport.export --cookies '<cookie string>' --db C:\Users\aluhr\OneDrive\QS\Extracted\FBMessenger
Traceback (most recent call last):
  File "C:\Users\aluhr\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\aluhr\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbmessengerexport\export.py", line 363, in <module>
    main()
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbmessengerexport\export.py", line 286, in main
    run(cookies=params['cookies'], db=db)
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbmessengerexport\export.py", line 257, in run
    session_cookies=json.loads(cookies),
  File "C:\Users\aluhr\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\aluhr\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\aluhr\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

Trying with cookies in --secrets

PS C:\Users\aluhr\source\repos\AndysQS\FBMessenger> python -m fbmessengerexport.export --secrets secrets.py --db C:\Users\aluhr\OneDrive\QS\Extracted\FBMessenger
C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbmessengerexport\exporthelpers\logging_helper.py:25: UserWarning: You might want to install 'logzero' for nice colored logs
  warnings.warn("You might want to install 'logzero' for nice colored logs")
Failed loading session
Traceback (most recent call last):
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_client.py", line 175, in setSession
    self._state = State.from_cookies(session_cookies, user_agent=user_agent)
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_state.py", line 210, in from_cookies
    return cls.from_session(session=session)
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_state.py", line 188, in from_session
    fb_dtsg = FB_DTSG_REGEX.search(r.text).group(1)
AttributeError: 'NoneType' object has no attribute 'group'
Logging in dummy_email...
Attempt #1 failed, retrying
Traceback (most recent call last):
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_client.py", line 205, in login
    self._state = State.login(
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_state.py", line 153, in login
    raise _exception.FBchatUserError(
fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login/?email=dummy_email&li=_7FeYHbE1igg3kDxnbGh_sd4&e=1348028&shbl=1&refsrc=https%3A%2F%2Fwww.facebook.com%2F&_rdr)
Attempt #2 failed, retrying
Traceback (most recent call last):
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_client.py", line 205, in login
    self._state = State.login(
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_state.py", line 153, in login
    raise _exception.FBchatUserError(
fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login/?email=dummy_email&li=A7JeYCPCz8gfJAkBYLMDYj2e&e=1348028&shbl=1&refsrc=https%3A%2F%2Fwww.facebook.com%2F&_rdr)
Attempt #3 failed, retrying
Traceback (most recent call last):
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_client.py", line 205, in login
    self._state = State.login(
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_state.py", line 153, in login
    raise _exception.FBchatUserError(
fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login/?email=dummy_email&li=B7JeYEiWKYjHB1o9w1NUgfRx&e=1348028&shbl=1&refsrc=https%3A%2F%2Fwww.facebook.com%2F&_rdr)
Attempt #4 failed, retrying
Traceback (most recent call last):
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_client.py", line 205, in login
    self._state = State.login(
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_state.py", line 153, in login
    raise _exception.FBchatUserError(
fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login/?email=dummy_email&li=C7JeYMvfXlahaO4ZhcQjVnjV&e=1348028&shbl=1&refsrc=https%3A%2F%2Fwww.facebook.com%2F&_rdr)
Traceback (most recent call last):
  File "C:\Users\aluhr\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\aluhr\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbmessengerexport\export.py", line 363, in <module>
    main()
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbmessengerexport\export.py", line 286, in main    run(cookies=params['cookies'], db=db)
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbmessengerexport\export.py", line 252, in run
    client = Client(
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_client.py", line 103, in __init__
    self.login(email, password, max_tries, user_agent=user_agent)
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_client.py", line 205, in login
    self._state = State.login(
  File "C:\Users\aluhr\AppData\Roaming\Python\Python39\site-packages\fbchat\_state.py", line 153, in login
    raise _exception.FBchatUserError(
fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login/?email=dummy_email&li=D7JeYLj-MefqOtnVY8kgsrxM&e=1348028&shbl=1&refsrc=https%3A%2F%2Fwww.facebook.com%2F&_rdr)

aluhrs13 avatar Mar 27 '21 04:03 aluhrs13

Hi, yeah sorry about it -- the library I'm using seems unmaintained, so it's been broken for me as well :( Related issues are probably:

https://github.com/fbchat-dev/fbchat/issues/598 https://github.com/fbchat-dev/fbchat/issues/638

I might try to monkey-patch one of the hacks suggested there, but seems that they don't work for everyone

I added a warning about this to readme as well.

karlicoss avatar Mar 27 '21 05:03 karlicoss

@karlicoss There are two updates that got the thing to run for me:

  • Changing the user-agent to an older one: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3
  • Overwriting the revision used in fbchat, within my own vendoring of fbchat See more here: https://github.com/fbchat-dev/fbchat/issues/656

kennethbruskiewicz avatar Apr 04 '22 16:04 kennethbruskiewicz

@kennethbruskiewicz thanks for the follow up! How did you overwrite the revision? I can't find the line revision = int(r.text.split('"client_revision":', 1)[1].split(",", 1)[0]) which they reference here https://github.com/fbchat-dev/fbchat/issues/656#issue-1076365878

karlicoss avatar Apr 06 '22 21:04 karlicoss

It appears I'm using an older version with your project. The latest version renamed the file _state to _session.

The only line I'm seeing that might be equivalent to revision like the one above, is here: https://github.com/fbchat-dev/fbchat/blob/master/fbchat/_session.py#L431

kennethbruskiewicz avatar Apr 07 '22 01:04 kennethbruskiewicz

Found a well-working fork: https://github.com/MS-Jahan/fbchat (using this tool: https://github.com/techgaun/active-forks) A link to it in the readme might come in handy.

jarekt avatar Jun 17 '22 14:06 jarekt