爬虫 google maps接口分析
关键词搜索接口分析
分析搜索接口
接口查找
接口分析对比差异
分析返回文本
google maps的详情页的URL拼接
key_list_9_2 = round(data[14][9][2], 7)
key_list_9_3 = round(data[14][9][3], 7)
key_list_10 = data[14][10]
key_list_11 = data[14][11]
url = 'https://www.google.es/maps/place/{}/data=!4m5!3m4!1s{}!8m2!3d{}!4d{}?authuser=0&hl=en&rclk=1'.format(key_list_11.replace(' ', '+'), key_list_10, key_list_9_2, key_list_9_3)
google maps如何判断是否还有下一页
分析详情页接口(主要分析Temporarily closed值怎么来的)
请求主页获得主要数据
主要在一个js文件里面
抠出来的部分js代码
var Sma = class {
constructor(a, b) {
this.N = a;
this.O = b;
this.H = a[b]
}
nb(a) {
var b = this.H && this.H[a.Xk];
if (b = null == b ? null : a.PK.O(b))
return b;
b = [];
this.H || (this.N[this.O] = this.H = {});
this.H[a.Xk] = b;
return a.PK.O(b)
}
};
function initialize (a, b, c, d) {
this.V = a = a || [];
if (a.length) {
var e = a.length - 1
, f = bj(a[e]);
e = f ? a[e] : {};
f && a.length--;
f = 0;
var h;
for (var g in e) {
const h = + g;
h <= b ? (a[h - 1] = e[g],
delete e[g]) : f++
}
for (let h = 0, l = 0; d && l < d.length; )
h += d[l++],
g = d[l++],
f += oga(h, g, a, e),
h += g;
a.length > b && (f += oga(b, a.length - b, a, e),
a.length = b);
f && (a[b] = e)
}
c && (this.W = new Sma(this.V,b))
};
function oga (a, b, c, d) {
let e = 0;
for (; 0 < b; --b,
++a)
null != c[a] && (d[a + 1] = c[a],
delete c[a],
e++);
return e
};
function bj (a) {
return null != a && typeof a === "object" && !Array.isArray(a) && a.constructor === Object
};
function ssb (a) {
initialize(a, 1)
};
function ana (a, b, c) {
a = a.V[b];
return null != a ? a : c
};
function K(a, b, c) {
return !!ana(a, b, c)
};
function JD (a) {
return new ssb(a.V[160])
};
function eE (a) {
return K(a, 23) || K(JD(a), 0)
};
经过分析js文件中的代码我们发现主要通过判断传入的object中的a.V[160]是否为1从判断这个Temporarily closed
分析发现object a中的数据就是从图七中的主要数据传入的
page = etree.HTML(response.text)
a = page.xpath('/html/head/script/text()')
for b in a:
if '(function(){window.APP_OPTIONS=' in b:
c = b
break
if c:
e = json.loads(re.findall('window.APP_INITIALIZATION_STATE=(.*?);window.APP_FLAGS', c)[0])
d = json.loads(e[3][6].replace(")]}'", ''))
else:
return False