-
Notifications
You must be signed in to change notification settings - Fork 6
/
minePosts.py
31 lines (24 loc) · 872 Bytes
/
minePosts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from urllib2 import urlopen
from json import loads
import json
accessToken = 'AAACgchb9wAUBAPVKmhZC5DZAqzEyyyt4y62tSalXOBrg0QDB5W2ONkRnbtoZCns2EK2bwZBGNDnbHvKp7yl1VYBRPVI9yD4ZD' #INSERT YOUR ACCESS TOKEN
userId = '64900834' #INSERT YOUR USER ID
# THIS IS KNOWN AS POSTS ON OPEN GRAPH
url='https://graph.facebook.com/' + userId + '/Statuses?limit=30&access_token=' + accessToken
jsonContent = loads(urlopen(url).read())
for item in jsonContent['data']:
if 'story' in item:
print 'STORY'
print item['story']
print '\n'
elif 'message'in item:
print 'MESSAGE'
print item['message']
if 'likes' in item:
for i in item['likes']['data']:
print (i['name'] + ", " + i['id'])
else:
print 'NO LIKES'
print ('\n')
else:
print ('ERROR\n')