-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfacebook.py
More file actions
60 lines (51 loc) · 1.33 KB
/
facebook.py
File metadata and controls
60 lines (51 loc) · 1.33 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import sys
import urllib
from HTMLParser import HTMLParser
import mechanize
import cookielib
import re
import webbrowser
#sock = urllib.urlopen("https://www.facebook.com/?stype=lo&jlou=Afduq5yKvL_2euq0CPaoS0mMpWJN5jJpJaatX67IwQ8iGTYMmqH3R2K_Al2q1ivyyAmAxH5hwUJLa6CpUTrj-uEo&smuh=64571&lh=Ac_TPtZHW4mIFrKh")
#f = sock.read()
#sock.close()
friendslist = []
def connect():
br = mechanize.Browser()
cj = cookielib.LWPCookieJar()
br.set_cookiejar(cj)
br.set_handle_equiv(True)
br.set_handle_redirect(True)
br.set_handle_robots(False)
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
br.open("https://facebook.com")
br.select_form(nr=0)
#br.form['email'] = ''
#br.form['pass'] = ''
response = br.submit()
return response.read()
def find(text):
match = re.search(r"[^a-zA-Z](InitialChatFriendsList)[^a-zA-Z]", text)
start = match.start(1) + 36
fin = False
while (start < len(text) and not fin):
if text[start] == '}':
fin = True
elif text[start] == '"':
aux = start
start += 1
while text[start] != '"':
start += 1
friendslist.append(text[(aux+1):(start-2)])
start += 1
else:
start += 1
return friendslist
def names():
i = 0
w = webbrowser.get('google-chrome')
while i < 6:
w.open_new_tab('https://facebook.com/' + friendslist[i])
i += 1
f = connect()
find(f)
names()