getThreadList
This commit is contained in:
@@ -63,6 +63,10 @@ class Client(object):
|
||||
if not self.login():
|
||||
raise Exception("id or password is wrong")
|
||||
|
||||
self.threads = []
|
||||
self.threads = []
|
||||
self.data = data
|
||||
|
||||
def _console(self, msg):
|
||||
if self.debug: print(msg)
|
||||
|
||||
@@ -192,7 +196,10 @@ class Client(object):
|
||||
r = self._post("https://www.facebook.com/ajax/mercury/send_messages.php", form)
|
||||
return r.ok
|
||||
|
||||
def getThreadList(self, start, end):
|
||||
def getThreadList(self, start, end=None):
|
||||
if not end:
|
||||
end = start + 20
|
||||
|
||||
timestamp = now()
|
||||
date = datetime.now()
|
||||
data = {
|
||||
@@ -206,11 +213,18 @@ class Client(object):
|
||||
'inbox[offset]' : start,
|
||||
'inbox[limit]' : end,
|
||||
}
|
||||
print data
|
||||
|
||||
r = self._post("https://www.facebook.com/ajax/mercury/threadlist_info.php", data)
|
||||
self.r = r
|
||||
return r.ok
|
||||
if not r.ok:
|
||||
return None
|
||||
|
||||
j = get_json(r.text)
|
||||
|
||||
for thread in j['payload']['threads']:
|
||||
t = Thread(thread)
|
||||
self.threads.append(t)
|
||||
|
||||
return self.threads
|
||||
|
||||
def sendSticker(self):
|
||||
pass
|
||||
|
@@ -21,3 +21,6 @@ class User(Base):
|
||||
|
||||
self.data = data
|
||||
|
||||
class Thread():
|
||||
def __init__(self, **entries):
|
||||
self.__dict__.update(entries)
|
||||
|
@@ -15,7 +15,7 @@ def now():
|
||||
return int(time()*1000)
|
||||
|
||||
def get_json(text):
|
||||
return json.loads(re.sub(r"for.*(.*;.*;.*).*;", '', text.decode("unicode-escape").encode('utf-8')))
|
||||
return json.loads(re.sub(r"for.*(;;).*;", '', text.decode("unicode-escape").encode('utf-8'), 1))
|
||||
|
||||
def digit_to_char(digit):
|
||||
if digit < 10:
|
||||
|
Reference in New Issue
Block a user