Skip to content

Instantly share code, notes, and snippets.

@fmasanori
Last active November 8, 2017 18:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fmasanori/4684949 to your computer and use it in GitHub Desktop.
Save fmasanori/4684949 to your computer and use it in GitHub Desktop.
Python 3.x Facebook Search
#@@@@@Sorry: this code has been deprecated in 2015, April 30 with new Facebook 2.0 API version
import urllib.request
import json
def search(texto):
#pegue o access_token
#em https://developers.facebook.com/tools/explorer
url = 'https://graph.facebook.com/search?q='
tail = '&type=post&access_token=<copie aqui o access_token>'
resp = urllib.request.urlopen(url+texto+tail).read()
data = json.loads(resp.decode('utf-8'))
return data['data']
for resp in search('CPRecife2'):
if 'message' in resp:
print (resp['from']['name'] + ': ' + resp['message'] + '\n')
@lmfrossard
Copy link

hello buddy, you have a new code that works with API 2.0?

@lmfrossard
Copy link

hello buddy, you have a new code that works with API 2.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment