Open yushaamalik opened 4 years ago
credentials
should be tupple
for post in get_posts(group='EatsleeprepeatESR/', credentials=('yushaa.malik6969@gmail.com', '*****************')):
print(post['text'][:50])
Also check if you have 2 factor auth enabled (I guess that would also produce login unsuccessful)
Empty console. Nothing happens. No error, nothing. Also, I do not have 2 factor auth enabled.
A way to check if the login is successful is to request some path that requires authentication, e.g.:
next(facebook_scraper.get_posts(account='something', credentials=('email@user.com', '***'))
response = facebook_scraper._session.get('https://m.facebook.com/settings', allow_redirects=False)
print(response.status_code)
If it prints 200 it means the login worked, 300 means it didn't.
You might want to check the response from the post request in the login function to see what went wrong:
Also, I've noticed group scraping doesn't work sometimes :confused:, so maybe the issue is not login related.
The login works, yet there is not data scraped.
Same problem, no data scraped.
Same problem too, no data scraped. @kevinzg
I also had this issue.
I tried logging in before and after disabling multi-factor authentication using a generated App Password.
Something I noticed while creating my PR above is that the latest (not yet released) version of the login function will probably include more debugging info for login difficulties. https://github.com/kevinzg/facebook-scraper/blob/1a703c8cc4576ac2a85ecf65200078e19362925c/facebook_scraper/facebook_scraper.py#L71-L78
So hopefully we will be able to view the debug info for the login attempts using an argument/option in the next release
I have installed the latest version (10 Nov 2020) of facebook_scraper. I execute the code:
import facebook_scraper
get_p = facebook_scraper.get_posts('nitento', credentials=('bilospap.2020@gmail.com', '***'))
and i get the following:
C:\Users\tampn\Anaconda3\lib\site-packages\facebook_scraper\facebook_scraper.py:80: UserWarning: login unsuccessful warnings.warn('login unsuccessful')
To be noticed that, I have disabled multi-factor authentication!
Can you help me, please? Best regards
Same here
same here
I can confirm the issue is with Groups. I can scrape pages, I change to a group and get a login unsuccessful message
same here
Same here bro, Is someone has any solution?
same. i am a total python newbie. this is an amazing resource. I am standing on the shoulders of giants. but login unsuccessful. waaaah.
I added a cookies parameter on the latest version, try with that please.
To use it log into Facebook on your browser, then install an extension to export the cookie file, like this one.
Then do get_posts('page', cookies='path/to/cookies.txt')
. The file format should be the Netscape one.
You can also pass a CookieJar
or a dictionary that will be converted to a cookie jar using cookiejar_from_dict
instead.
Please report back as I haven't tried it.
I tried https://github.com/kevinzg/facebook-scraper/commit/b4812f859c36ef0206a6a9c9921d60c2f2aa4026, it just needed one minor change to get it working - https://github.com/kevinzg/facebook-scraper/pull/175
I got "Login Approval Needed" on CLI.
Please tell me what I should do?
You need to login with a browser and approve the login
Thank for replying
I've done 2FA but still didn't work
I logged in with a browser then ran the code, in the first loop, unauthorized devices notification popped up and I approved it then the next loop same issue occur as if it's not the same device/ user agent.
Maybe just use cookies then
get_posts(target_id, pages=5, extra_info=True, credentials=(_email, _password), cookies='cookies.json')
I got '_email' is not defined. Do I have to set credentials when I use cookies? What should I do with this argument?
no, use one or the other. Just delete the credentials argument if you don't need it
Hello, I'm having trouble using the lib. I want to scrape the pages and information from different profiles. It needs to be logged while for others not, I guess it's due to the security of FB i tried several things, but nothing works : for post in get_posts(group='EatsleeprepeatESR/', credentials={'email' : 't@hotmail.fr' , 'pass' : "pass"}): print(post['text'][:50]) OR for post in get_posts(group='EatsleeprepeatESR/', credentials=('@hotmail.fr' ,"password")): print(post['text'][:50]) But it gives the following error: facebook_scraper.exceptions.LoginError: Login unsuccessful
I tried this : print(get_profile("pageName",cookies='Path/cookies.txt')) print(get_post("pageName",cookies='Path/cookies.txt'))
I put both user_c and xs cookies in cookies.txt but it doesn't work. No error in the terminal
To finish : I tried this next(facebook_scraper.get_posts(account = 'pageName' , credentials = ("@hotmail.fr" , "password")) response=facebook_scraper._session.get('https://m.facebook.com/settings',allow_redirects=False) print(response.status_code) but I have this error : response=facebook_scraper._session.get('https://m.facebook.com/settings',allow_redirects=False) ^ SyntaxError: invalid syntax
Could you help me ? I work under kali linux and I am in Europe
try update to latest master, a recent PR (https://github.com/kevinzg/facebook-scraper/pull/606) fixed an issue with logins originating from Europe
essayez de mettre à jour le dernier maître, un récent PR ( #606 ) a corrigé un problème avec les connexions provenant d'Europe
Thank it work for profiles.
for post in get_posts(group='EatsleeprepeatESR/', credentials={'email' : 'yushaa.malik6969@gmail.com' , 'pass' : '*****'}): print(post['text'][:50])
This is my code. Despite of providing my correct credentials, it gives me error: " warnings.warn('login unsuccessful') UserWarning: login unsuccessful"