Skip to content

Instantly share code, notes, and snippets.

@heywoodlh
Created September 15, 2017 16:43
Show Gist options
  • Save heywoodlh/b2d6c1e8748f6cc0c3da9e593111ebac to your computer and use it in GitHub Desktop.
Save heywoodlh/b2d6c1e8748f6cc0c3da9e593111ebac to your computer and use it in GitHub Desktop.
Facebook Search
#!/usr/bin/env python3
import sys
import requests
from bs4 import BeautifulSoup as bs
try:
firstname = sys.argv[1]
except IndexError:
print('Usage: ' + sys.argv[0] + ' firstname lastname')
sys.exit(1)
try:
lastname = sys.argv[2]
except IndexError:
pass
try:
query_string = 'https://www.facebook.com/public?query=' + firstname + '+' + lastname + '&init=ffs&nomc=0'
except NameError:
query_string = 'https://www.facebook.com/public?query=' + firstname + '&init=ffs&nomc=0'
r = requests.get(query_string)
content = r.text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment