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

'NoneType' object has no attribute 'group' #6

Closed abeyternater closed 4 years ago

abeyternater commented 4 years ago

This is what it says when it try to run the script. This is happening right after its logging into my facebook. Any help is greatly appreciated.

Attempt #1 failed, retrying Traceback (most recent call last): File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_client.py", line 254, in login state = State.login( File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 141, in login return cls.from_session(session=session) File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 175, in from_session fb_dtsg = FB_DTSG_REGEX.search(r.text).group(1) AttributeError: 'NoneType' object has no attribute 'group' Attempt #2 failed, retrying Traceback (most recent call last): File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_client.py", line 254, in login state = State.login( File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 141, in login return cls.from_session(session=session) File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 175, in from_session fb_dtsg = FB_DTSG_REGEX.search(r.text).group(1) AttributeError: 'NoneType' object has no attribute 'group' Attempt #3 failed, retrying Traceback (most recent call last): File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_client.py", line 254, in login state = State.login( File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 141, in login return cls.from_session(session=session) File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 175, in from_session fb_dtsg = FB_DTSG_REGEX.search(r.text).group(1) AttributeError: 'NoneType' object has no attribute 'group' Attempt #4 failed, retrying Traceback (most recent call last): File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_client.py", line 254, in login state = State.login( File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 141, in login return cls.from_session(session=session) File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 175, in from_session fb_dtsg = FB_DTSG_REGEX.search(r.text).group(1) AttributeError: 'NoneType' object has no attribute 'group' Traceback (most recent call last): File "./fbm-scraper.py", line 83, in fb_client = Client(fb_email, fb_pw) File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_client.py", line 99, in init self.login(email, password, max_tries, user_agent=user_agent) File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_client.py", line 254, in login state = State.login( File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 141, in login return cls.from_session(session=session) File "C:\Users\beta4\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fbchat_state.py", line 175, in from_session fb_dtsg = FB_DTSG_REGEX.search(r.text).group(1) AttributeError: 'NoneType' object has no attribute 'group'

cbdelavenne commented 4 years ago

Hello!

I'll try to see if I can repro it tonight. From the stack trace, I see you're using Python 3.8 32-bit, correct?

cbdelavenne commented 4 years ago

So, it seems like Facebook has gotten quite aggressive at blocking scripts like this one. As the fbchat Python library suggestes:

However, there's a catch! Using this library may not comply with Facebook's Terms Of Service!, so be responsible Facebook citizens! We are not responsible if your account gets banned!

Source: https://github.com/fbchat-dev/fbchat#caveats

Definitely a bit of a bummer, but yea, that's why you got this error. If you go to your browser, and navigate to Facebook, it'll likely tell you your account was locked out due to suspicious activity, and force you to change your password.