Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gsscoder
Last active November 23, 2019 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gsscoder/335e2397a4329167a7f373fb29349640 to your computer and use it in GitHub Desktop.
Save gsscoder/335e2397a4329167a7f373fb29349640 to your computer and use it in GitHub Desktop.
Script that scrapes Facebook demonstrating facebook_snooper
"""
scrap-fb.py:
Demonstrates facebook_snooper module (https://github.com/gsscoder/facebook-snooper).
Install requirements:
$ wget https://raw.githubusercontent.com/gsscoder/facebook-snooper/master/facebook_snooper.py
$ wget https://raw.githubusercontent.com/gsscoder/facebook-snooper/master/requirements.txt
$ python3 -m pip install -r requirements.txt
Run:
$ python3 scrap-fb.py your@login.fb your_password
Note:
facebook_snooper is still under development, so this script may not work
with future versions.
"""
from facebook_snooper import log_in, \
search_profiles, get_intro
import requests
import json
import sys
names_json = requests.get(
'https://gist.githubusercontent.com/gsscoder/e0e905fbef23376aabfa695d85d8ef5c/raw/c250e439541647e3b2125922a04e1323ae51ff7a/names.json')
names = json.loads(names_json.content)
username = sys.argv[1]
password = sys.argv[2]
print('Attempting connection...')
if not log_in(username, password):
sys.exit('Can\'t login to Facebook!')
for name in names[:10]:
profiles = search_profiles(names)
for id, uri in profiles:
print(f'{name} ({id if len(id) > 0 else uri}):')
intro = get_intro(id)
if len(intro) == 0:
print(' - this user takes care of privacy')
else:
for info in intro:
print(f' - {info}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment