84669 Lernen von Personen
152542 Lernen von Personen
20005 Lernen von Personen
5487 Lernen von Personen
7821 Lernen von Personen
359900 Lernen von Personen
3350 Lernen von Personen
180660 Lernen von Personen
48569 Lernen von Personen
18603 Lernen von Personen
40936 Lernen von Personen
1549 Lernen von Personen
1183 Lernen von Personen
32909 Lernen von Personen
比如这个酒店:http://hotels.ctrip.com/hotel/dianping/1943326.html酒店的点评数据是通过ajax方式异步加载的,不想用模拟浏览器的方式来爬,太慢了,想直接请求点评数据的地址,但是这个eleven参数不知道是怎么生成的,在网页源码中没找到,分析js代码也没看出个所以然来,请大神来分析下,多谢了
闭关修行中......
这个确实有点变态,不过可以模拟手机去访问(改user agent).能得到评论数据,是静态的html.http://m.ctrip.com/html5/hotel/HotelDetail/dianping/1943326.html仔细看请求,里面有个就是在算参数,压缩过的js,看的头疼.
不用管他怎么生成的,暴力一点,headers全部带上,参数全部一致,肯定OK
看起来可能是base64编码或者是加密过。跟其他参数相关,怀疑是个签名参数防抓取用的。
是下面这个代码生成的,看不懂:,_getElevenValue:function(e){
function o(e){ for(var o=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],n="",t=0;e>t;t++){ var i=Math.ceil(25*Math.random()); n+=o[i] } return n } var n,t=o(7),i=!1; if(!hotelDomesticConfig.cas.OceanBall)return e.resolve(""); for(;window[t];) t=o(15); n=hotelDomesticConfig.cas.OceanBallUrl+"?callback="+t+"&_="+(new Date).getTime() ,window[t]=function(o){ window[t]=void 0; var n=""; try{n=o()} catch(a){$.ajax("/domestic/cas/image/bi" ,{method:$.AJAX_METHOD_POST,cache:!1,context:{value:"11-"+encodeURIComponent(a.stack||a)}}) } finally{i=!0,e.resolve(n)} } ,$.loader.js(n,{onload:function(){i||(window[t]=void 0,e.reject(""))},onerror:function(o){o&&(window[t]=void 0),e.reject("")}})
}
这个确实有点变态,不过可以模拟手机去访问(改user agent).能得到评论数据,是静态的html.
http://m.ctrip.com/html5/hotel/HotelDetail/dianping/1943326.html
仔细看请求,里面有个就是在算参数,压缩过的js,看的头疼.
不用管他怎么生成的,暴力一点,headers全部带上,参数全部一致,肯定OK
看起来可能是base64编码或者是加密过。跟其他参数相关,怀疑是个签名参数防抓取用的。
是下面这个代码生成的,看不懂:
,_getElevenValue:function(e){
}