-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfblikes.py
More file actions
29 lines (25 loc) · 726 Bytes
/
fblikes.py
File metadata and controls
29 lines (25 loc) · 726 Bytes
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
from bs4 import BeautifulSoup
import re
import requests
import json
TOKEN="" #Insert access token here.
movie_data=requests.get('https://graph.facebook.com/100000305682125?fields=id,name,movies&access_token='+TOKEN)
result = json.loads(movie_data.text)
count=0
raw=[]
for i in result['movies']['data']:
count+=1
print count,i['name']
raw.append(i['id'])
choice=input("Enter your choice: ")
choice-=1
link='https://www.facebook.com/plugins/fan.php?connections=100&id='+str(raw[choice])
data=requests.get(link)
soup=BeautifulSoup(data.content)
for i in soup.find_all('a',href=re.compile('https://www\.facebook\.com/')):
try:
print unicode(i['title'])
except KeyError:
continue
except UnicodeEncodeError:
continue