Closed dstelzer closed 7 years ago
To make get_json
work for as long as possible. Maybe one day Facebook decides to remove the for (;;);
. And then everybody who's not using the latest version of fbchat, will get screwed over ;)
Would it be faster to do something like
i = text.index("{")
if i > -1: return text[i:]
else: return ""
I'd imagine it would have the same behaviour if so.
Try testing it's speed, and if it is indeed faster, then make a pull request
I did the speed test, and included your code in a commit somewhere ;)
There's a noticeable delay in each call to get_json. Since the cruft at the beginning is always the same, why not use a slice operation instead of a regex?