decoding dianping.com google map lat/lng

diandianping.com now use Google map for its biz locations. I'd like to get latitude and longitude for some of the restaurants I found there.
But "view source" showed its lat/lng are encrypted.

I just don't understand these Chinese sites like mapbar, mapabc, now dianping, why encrypt them? What's the point?
Because dianping use gmap, it has to send clear lat/lng to google, that means the browser has to decode lat/lng, that mean the decoding code is right there in javascript. In this case, the decoding happens in jquery.jmap.min.js.
This js is also obstructed. But I was able to crack it in a short time.
It appears the javascript evaluates and generates code on the fly and then evaluate the generated code that decode lat/lng and send them to google.

Here's my decoding script. It works now but might not in the future as dianping might change the parameters like digi, add, plus and cha.

Chinese: 点评用谷歌地图,但是给地图坐标加了密。我不知道这样做是为了什么。因为你必须在浏览器里解密,所以研究下代码,很容易就解了密。这里给出解密代码,是用python写的。


est said...

why not javascript?

Wensheng Wang said...

"why not javascript?"
Because I use python script to do post-processing off-line, like putting latitude and longitude into database. Javascript version is not very useful, but you can translate the program to js easily.