kevinzg / facebook-scraper

Scrape Facebook public pages without an API key
MIT License
2.4k stars 627 forks source link

Login error. #114

Closed walterleonardo closed 3 years ago

walterleonardo commented 4 years ago

I use the example

for post in get_posts("nintendo", pages=1, credentials=['username','password']): print(post)

with credentials option

I receive the message in my phone with "You try to access from a new browser", and click ok Save new browser. But don't has result... try again and the same answer, and the same message ... don't give me access

This is the answer:

/usr/bin/python3 facebook-scraper/test.py

Login response text: %s Facebook Utilizamos las cookies para personalizar contenido, adaptar y medir los anuncios, y facilitar una experiencia más segura. Al hacer clic en el sitio, aceptas que usemos las cookies dentro y fuera de Facebook. Consulta aquí más información, incluida la relativa a los controles disponibles: Política de cookies. facebook Introduce el código de inicio de sesión para continuar Parece que es la primera vez que inicias sesión desde este navegador. Introduce el código de inicio de sesión de tu teléfono a continuación. ¿Tienes problemas? Enviar código ¿No eres USER? Inicia sesión aquí Español (España) Català Português (Brasil) Italiano English (US) Français (France) Deutsch Cargando... Intentar de nuevo facebook_scraper/facebook_scraper.py:80: UserWarning: login unsuccessful

kevinzg commented 4 years ago

I guess a different session is being used each time so the browser isn't really being saved.

I think the best solution for this would be to log in in a real browser, save the cookies to a file and then load them into the requests session, like it is suggested in #115. That may also help with captcha and 2FA problems.

kevinzg commented 3 years ago

Try with this method: https://github.com/kevinzg/facebook-scraper/issues/28#issuecomment-793066983