ingresstools icon indicating copy to clipboard operation
ingresstools copied to clipboard

No JSON Object

Open stillru opened this issue 11 years ago • 6 comments

Traceback (most recent call last): File "actionlog.py", line 98, in for action in monitor.monitor(): File "actionlog.py", line 79, in monitor for action in self.actiongen(): File "actionlog.py", line 74, in return (message for message in messages if message[2]['plext']['plextType'] == 'SYSTEM_BROADCAST') File "actionlog.py", line 58, in messagegen responseItems = json.loads(jsonStr) File "/usr/lib/python2.7/json/init.py", line 326, in loads return _default_decoder.decode(s) File "/usr/lib/python2.7/json/decoder.py", line 366, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded

Where is the problem? And how i can define area for reading?

stillru avatar May 01 '13 06:05 stillru

I have same issue too. I have inserted debug code. line 58 is debug code.

 56     def messagegen(self):
 57         jsonStr = self.getChat(self.minTimestampMs)
 58         print(jsonStr)
 59         responseItems = json.loads(jsonStr)

It resutls. jsonStr is not JSON fortmat. It is just HTML. That is why This program told us 'No JSON object'.

It seems to me that Ingress protocol has been changed. We need to find how to get JSON Format messages. Who knows?

yabuki avatar Jul 23 '14 09:07 yabuki

Hey there. I haven't played for a long time, but I took a quick look at the intel map. I believe the problem is simply that the url to get chat messages has changed since I made this. It now looks to be something like 'https://www.ingress.com/r/getPlexts' instead of 'http://www.ingress.com/rpc/dashboard.getPaginatedPlextsV2'. I think other minor bits of the interface have changed as well, but the actual messages themselves look the same. You are probably getting html instead of json because the bad url gets redirected to either the front page or an error page.

To see what's going on open up the intel map in chrome and press F12 to open the development toolbar. Click on the Network tab, and then move the map to a new area. You should look for requests to 'getPlexts'.

bluemoo avatar Jul 23 '14 09:07 bluemoo

The geographic area is currently hardcoded to minneapolis. The requests to getPlexts has a lat/long boundary specified. You'll need to change it to yours (or better yet, submit a patch that makes it configurable!). You can take a look at the relevant code for both of these problems here: https://github.com/bluemoo/ingresstools/blob/master/src/actionlog.py#L38

bluemoo avatar Jul 23 '14 09:07 bluemoo

Actually, this fork looks recently updated: https://github.com/tinbotu/ingresstools

bluemoo avatar Jul 23 '14 09:07 bluemoo

Thank you for your response. @bluemoo

I had tried to use 'https://github.com/tinbotu/ingresstools'. Unfortunately, his program returned 'None' in getChat method.

It seems to me that @tinbotu 's program which is PhantomJS makes 'cookies.json' which contain SESSION_ID and .CSRF_TOKEN. And send GOOGAPPUID to server. I can not find GOOGAPPUID in coolies.json. Yes, I misunderstand to set up his program which do 'cd munge;make' then python actionlog.py

Anyway, Now that time, I need to understand intelmap's requests and responses. Thank you.

P.S. About 10 days ago, a lot of iOS players join Ingress. I have lived in Japan. Environment has changed.

yabuki avatar Jul 23 '14 17:07 yabuki

Hi, @yabuki, @bluemoo

GOOGAPPUID has gone a few days ago.

API of Ingress changes at short intervals (every 1 or 2 weeks), sometimes large change comes suddenly (every 2 or 3 months).

In my 'https://github.com/tinbotu/ingresstools', PhantomJS script decodes obfuscated API "munge" with IITC's library semi-automagically. Extras, gets SESSION_ID, CSRF_TOKEN, GOOGAPPUID etc from cookie instead of to copy from developers console by hand work.

though few weeks ago, suddenly "munge" has completely obsoleted. and a few days ago, GOOGAPPUID has gone.

now I think that to analyze API of Ingress is not difficult, but following to change frequently is so hard.

PS. @yabuki I fixed it and works for me. but its API tired me a little.., and I think this can (probably will) get you banned from Niantic.

tinbotu avatar Jul 24 '14 06:07 tinbotu