Closed xcorat closed 8 years ago
I forked this, fixed this, and will create a pull request tonight, after taking a look at some other bugs
@PidgeyL Thx!
how to use getThreadList() ?
from the code: def getThreadList(self, start, end=None):
, I'm assuming it's calculating back in time, where start is either 0 (the last message) or a number of messages to skip, and end is the x'th message
Error code
import fbchat
client = fbchat.Client("id", "pass")
print(client.getThreadList(0))
Traceback (most recent call last):
File "
That's very odd. Doesn't seem like something I changed. Can you print the json from the getTrheadList?
No, I can't. :sob:
Sure you can. when you download this project, add the following line to fbchat/client.py
, on line 221:
print(j)
Then, run sudo pip uninstall fbchat
(or pip3 if you're using python3) to uninstall the current fbchat
Then, run 'sudo python setup.py install' (or python3) to install your modified version
Then run the script again (or your code in the interpreter) to get the output of the json
I don't know if there is any personal data in the json file, I don't know it by heart. If you're using a dummy facebook account, it doesn't matter, but if you don't, perhaps have a look at the output, and replace any ouput that looks personal by fake output, but keep the same format (numbers vs letters, length, etc)
import fbchat
client = fbchat.Client("id", "pass")
print(client.getThreadList(0))
,"thread_fbid":null,"time":0000004752987},{"other_user_fbid":"000000395885","
thread_fbid":null,"time":00000098306},{"other_user_fbid":"00000088685","th
read_fbid":null,"time":000000001561}],"payload_source":"server_fetch_threadlist
_info"},"bootloadable":{},"ixData":{},"lid":"6224703000000533"}
Or, as Thai lang . Facebook used to encode non-utf8.
Sounds legit. I'll take a look when I have some time. When you look for "snippet" in the text, what does that look like? Text, Null, ... ?
feom test https://github.com/wannaphongcom/fbchat/commit/9d4d44372f0045175b6254b9894cfddeb8192701
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\py34\lib\site-packages\fbchat\client.py", line 235, in getThreadList
j = get_json(r.text)
File "C:\py34\lib\site-packages\fbchat\utils.py", line 18, in get_json
return json.loads(re.sub(r"for.*(.*;.*;.*).*;", '', text.encode('utf-8').dec
ode("unicode-escape"), 1))
File "C:\py34\lib\json\__init__.py", line 318, in loads
return _default_decoder.decode(s)
File "C:\py34\lib\json\decoder.py", line 343, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\py34\lib\json\decoder.py", line 359, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting ',' delimiter: line 1 column 17182 (char 17181)
yeah, I understand that, but I would need to know the format of the data, to see how to parse it properly :)
{"fbid":1000ss8,"gender":2,"href":"https:\/\/www.facebook.com\/profile.php?id=","id":"fbid:friends","image_src":"https:\/\/f","big_image_src":"https:\/\/","name":"\u0e40\u0e0a\u0e19 ",
"short_name":"\u0e40","employee":false,"is_employee_away":false,"typ
e":"user","vanity":"","is_friend":true,"social_snippets":[],"is_messenger_user":
true}
I think I see the issue. I wouldn't be surprised if regex couldn't handle unicode like that. Could you open a new issue with this information?
The result of getThreadList() Of you?
Well this issue is closed (and a different issue), so could you open a new ticket which includes the info you put here, so we can work on it?
getThreadList() gives me an error in python 3.4. It was fixed by changing
https://github.com/carpedm20/fbchat/blob/master/fbchat/client.py#L224
to
(I can fork and fix it if needed, unless you guys have already fixed it)