Unable to run the script
Closed this issue · 2 comments
JoeNg93 commented
Problem:
When I try, to run the script, I get the following error:
Looking for interesting users for Radu_Raicea...
Retrieving user ID...
Traceback (most recent call last):
File "finder.py", line 178, in <module>
interesting_users = get_interesting_users('Radu_Raicea', 10)
File "finder.py", line 165, in get_interesting_users
user_id = get_user_id(username)
File "finder.py", line 23, in get_user_id
response_dict = clean_json_response(response)
File "finder.py", line 13, in clean_json_response
return json.loads(response.text.split('])}while(1);</x>')[1])
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Unterminated string starting at: line 1 column 17383 (char 17382)
Radu-Raicea commented
Found the bug, it's quite funny!
The clean_json_response
splits the response at ])}while(1);</x>
in order to remove it. I recently explained the meaning of ])}while(1);</x>
in one of my responses. When loading my profile, it loads a part of the response where I mention the string ])}while(1);</x>
. clean_json_response
splits the response there too.
In order to fix this, clean_json_response
must only remove the first iteration of ])}while(1);</x>
.
Radu-Raicea commented
Fixed by #4