Reviews of shops latitude and longitude information

Source: Internet
Author: User

Public reviews the map of the store does not find coordinates (latitude and longitude) information from the HTML source.
Analysis JS found that it is the coordinates (latitude and longitude) information is converted (anti-collection), is the POI parameter in HTML.

Take http://www.dianping.com/shop/4101814 shop as an example.

Part of the source file with POI (poi: ' HETSIFZVVHWATW ')

In which the following script

<script src= "//www.dpfile.com/s/js/p.pak.min.1361abe883291540eae764799aa98b95.js" type= "Text/javascript" > </script>
namely: View-source:http://www.dpfile.com/s/js/p.pak.min.1361abe883291540eae764799aa98b95.js

Decoding algorithm for POI with JavaScript implementation

Checkpoi:function (A, b) {
A | | (A = Array (b));
"Array"! = $type (a) && (A = Array (a));
for (var d = a.length,
c = 0; C < D; C + +) {
var f = A[c] | | "";
if (F.poi) {
var g = This.decode (F.poi);
F.lat = G.lat;
F.LNG = G.LNG;
Delete F.poi
}
if (!f.lat | |!f.lng) if (b) for (Var e in b) f[e] = B[e];
else A.splice (c, 1),
d--
}
b && 1 > A.length && (a = Array (b));
Return a
},
Decode:function (a) {
var B =-1,
d = 0,
c = "",
f = a.length,
g = A.charcodeat (f-1),
A = a.substring (0, f-1);
f--;
for (var e = 0; e < F; e++) {
var h = parseint (A.charat (e), This.options.settings.cha)-this.options.settings.add;
H >= this.options.settings.add && (H-= this.options.settings.plus);
c + = h.tostring (This.options.settings.cha);
H > D && (b = e, d = h)
}
A = parseint (c.substring (0, B), This.options.settings.digi);
b = parseint (c.substring (b + 1), This.options.settings.digi);
G = (A + b-parseint (g))/2;
b = (b-g)/1E5;
return {
LAT:B,
Lng:g/1E5
}
},

Resources

How to crawl (collect) public reviews web coordinates (latitude and longitude) information

Http://www.site-digger.com/html/articles/20111110/18.html

A further process after the demo JavaScript script is as follows:

<! DOCTYPE html>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title>Demo</title>
<body>
<script type= "Text/javascript" >

function decode (C) {
var digi=16;
var add= 10;
var plus=7;
var cha=36;
var I =-1;
var H = 0;
var B = "";
var J = c.length;
var G = c.charcodeat (J-1);
C = c.substring (0, J-1);
j--;
for (var E = 0; E < J; e++) {
var D = parseint (C.charat (E), cha)-add;
if (D >= add) {
D = D-plus
}
B + = (D). toString (CHA);
if (D > H) {
I = E;
H = D
}
}
var A = parseint (b.substring (0, I), Digi);
var F = parseint (b.substring (I + 1), Digi);
var L = (A + f-parseint (G))/2;
var K = (f-l)/100000;
L/= 100000;
return {
Lat:k,
Lng:l
}
}
document.write (Decode (' Hhdfjgzvvihijg '). lat+ ', ' +decode (' HHDFJGZVVIHIJG '). LNG);
document.write ("<br/>");
document.write (Decode (' HETSIFZVVHWATW '). lat+ ', ' +decode (' HETSIFZVVHWATW '). LNG);

</script>

</body>

Reviews of shops latitude and longitude information

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.