cbdelavenne / fb-messenger-media-scraper

Helper script to scrape your Facebook Messenger account for images shared in your conversations quickly and efficiently.
MIT License
6 stars 1 forks source link

Error during login #8

Closed lenslol closed 3 years ago

lenslol commented 3 years ago
Logging in svvparakala@gmail.com...
Attempt #1 failed, retrying
Traceback (most recent call last):
  File "C:\Users\Subrahmanyam\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\fbchat\_client.py", line 205, in login
    self._state = State.login(
  File "C:\Users\Subrahmanyam\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\fbchat\_state.py", line 151, in login
    return cls.from_session(session=session)
  File "C:\Users\Subrahmanyam\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\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

This happens for 4 attempts and then quits.

cbdelavenne commented 3 years ago

@lenslol Have you been locked out from logging into your Facebook account? Facebook seems to have gotten a lot more aggressive at blocking these types of scripts, sadly.

lenslol commented 3 years ago

@lenslol Have you been locked out from logging into your Facebook account? Facebook seems to have gotten a lot more aggressive at blocking these types of scripts, sadly.

Nope. I was able to log back in afterwards. Its unfortunate, I think this feature is something sorely needed from messenger. Maybe they're worried of all the costs it will incur all at once. But I really need to grab an archive of all the media (500+) pictures in a specific chat. And your method is the only way I found.

Btw, I just found that there is also a macos/windows marketplace desktop version of Messenger. It's a LOT easier to scroll through the pictures there than it is on the web (as in they load a lot faster) I don't have the skillset to delve into it but if you do I'd recommend checking out whats going on in there, perhaps focus a script on that instead.

outpoints commented 3 years ago

@lenslol did you ever get this to work?

cbdelavenne commented 3 years ago

@lenslol @outpoints I looked into it a little; someone suggested setting a valid user_agent value when logging in (which I tried), but it yields a new error.

Logging in <email>...
Attempt #1 failed, retrying
Traceback (most recent call last):
  File "F:\workspace\git\fb-messenger-media-scraper\fb-messenger-media-scraper\venv\lib\site-packages\fbchat\_client.py", line 209, in login
    user_agent=user_agent,
  File "F:\workspace\git\fb-messenger-media-scraper\fb-messenger-media-scraper\venv\lib\site-packages\fbchat\_state.py", line 151, in login
    return cls.from_session(session=session)
  File "F:\workspace\git\fb-messenger-media-scraper\fb-messenger-media-scraper\venv\lib\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'

It also seems like the Python package this script primarily relies on to interface with Facebook's backend is no longer maintained sadly: https://github.com/fbchat-dev/fbchat/issues/613

If the fbchat-dev/fbchat project gets updated, I'll give it another shot.

cbdelavenne commented 3 years ago

Fixed in the last commit