通过script的方式获取的数据显示正常,但因为需要显示为英文,所以需要将数据获取下来再改为英文,这里想到的是ajax的方式。
抓包获取数据
document.write("<a href='http://www.zzsky.cn' target='_blank'> շ <img src='http://www.zzsky.cn/images/count/5/0.gif' border='0'><img src='http://www.zzsky.cn/images/count/5/0.gif' border='0'><img src='http://www.zzsky.cn/images/count/5/2.gif' border='0'><img src='http://www.zzsky.cn/images/count/5/5.gif' border='0'><img src='http://www.zzsky.cn/images/count/5/1.gif' border='0'><img src='http://www.zzsky.cn/images/count/5/9.gif' border='0'> շ <img src='http://www.zzsky.cn/images/count/5/0.gif' border='0'><img src='http://www.zzsky.cn/images/count/5/0.gif' border='0'><img src='http://www.zzsky.cn/images/count/5/1.gif' border='0'><img src='http://www.zzsky.cn/images/count/5/2.gif' border='0'><img src='http://www.zzsky.cn/images/count/5/8.gif' border='0'><img src='http://www.zzsky.cn/images/count/5/3.gif' border='0'> վ <img src='http://www.zzsky.cn/images/count/5/0.gif' border='0'><img src='http://www.zzsky.cn/images/count/5/0.gif' border='0'><img src='http://www.zzsky.cn/images/count/5/6.gif' border='0'><img src='http://www.zzsky.cn/images/count/5/0.gif' border='0'><img src='http://www.zzsky.cn/images/count/5/4.gif' border='0'><img src='http://www.zzsky.cn/images/count/5/9.gif' border='0'></a>")
乱码部分是因为编码的问题。
获取数据的时候,因为数据中有document.write的方法,会有错误发生,造成内容无法显示。
count.asp:2 Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.这个时候需要自己重写document.write,让document.write执行我们想要的效果。
定义一个html标签,在自己重写的document.write中将获取的内容插入到定义的标签中。
function newwrite(str){
//str为获取的数据,这里可以自定义数据的处理。
};
document.write = newwrite;