README.md
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## 使用说明
|
2 |
+
|
3 |
+
安装程序需要在windows98 简体中文版中打开
|
4 |
+
进入系统后,插入setup.iso,安装时根据提示插入1-5号光盘;其他光盘在读取插图时使用。
|
5 |
+
(建议使用VirtualBox虚拟机)
|
6 |
+
|
7 |
+
## 启动爬虫
|
8 |
+
|
9 |
+
1. 安装ie6
|
10 |
+
2. 在安装目录的html/cgi-bin/oneart.htm的"</STYLE>"后插入
|
11 |
+
```
|
12 |
+
|
13 |
+
<SCRIPT language=JavaScript>
|
14 |
+
var a =function() {
|
15 |
+
if (document.readyState !="complete") return;
|
16 |
+
var x = new ActiveXObject("Microsoft.XMLHTTP");
|
17 |
+
var content = document.documentElement.outerHTML;
|
18 |
+
x.open("post","http://192.168.1.205:3000/upload", true); // 换成server的ip地址
|
19 |
+
x.onreadystatechange=function() {
|
20 |
+
if(x.readyState==4&&x.status==200){
|
21 |
+
if (x.responseText.indexOf("goto:")==0) {
|
22 |
+
location.replace(x.responseText.substring(5))
|
23 |
+
}
|
24 |
+
}
|
25 |
+
};
|
26 |
+
x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
27 |
+
x.send("document="+encodeURIComponent(content) +"&location="+encodeURIComponent(location.href));
|
28 |
+
};
|
29 |
+
document.onreadystatechange = a;
|
30 |
+
setInterval(a, 5000); // 确保使用快照恢复虚拟机后自动运行
|
31 |
+
</SCRIPT>
|
32 |
+
```
|
33 |
+
|
34 |
+
3. 服务端使用nodejs 运行本目录的whb.js
|
35 |
+
4. 虚拟机中打开任意一篇文章,此时应该可以发现页面正在自动跳转。缩小窗口提高爬虫效率。
|
36 |
+
5. 为虚拟机创建快照(因为程序有bug,运行一段时间会崩溃,需要定时恢复快照)
|
37 |
+
6. 设置定时任务使虚拟机自动恢复和启动, 在任意位置创建restart_vm.sh
|
38 |
+
```
|
39 |
+
|
40 |
+
VM_NAME1="98 Clone"
|
41 |
+
VM_NAME2="98 Clone2"
|
42 |
+
VM_NAME3="98 Clone3"
|
43 |
+
VM_NAME4="98 Clone4"
|
44 |
+
|
45 |
+
SNAPSHOT_UUID1="ad86b38f-f761-4f7d-b020-b2ace1871e33"
|
46 |
+
SNAPSHOT_UUID2="c8657e84-6134-4d26-a2da-dc83d4e0ab5b"
|
47 |
+
SNAPSHOT_UUID3="8cc82fbb-4611-4f09-a24d-988ccc00903d"
|
48 |
+
SNAPSHOT_UUID4="2afcec64-7397-4515-abea-79ba1e5626b8"
|
49 |
+
|
50 |
+
VBoxManage controlvm "$VM_NAME1" poweroff
|
51 |
+
#VBoxManage controlvm "$VM_NAME2" poweroff
|
52 |
+
#VBoxManage controlvm "$VM_NAME3" poweroff
|
53 |
+
#VBoxManage controlvm "$VM_NAME4" poweroff
|
54 |
+
sleep 5
|
55 |
+
VBoxManage snapshot "$VM_NAME1" restore "$SNAPSHOT_UUID1"
|
56 |
+
#VBoxManage snapshot "$VM_NAME2" restore "$SNAPSHOT_UUID2"
|
57 |
+
#VBoxManage snapshot "$VM_NAME3" restore "$SNAPSHOT_UUID3"
|
58 |
+
#VBoxManage snapshot "$VM_NAME4" restore "$SNAPSHOT_UUID4"
|
59 |
+
VBoxManage startvm "$VM_NAME1" --type headless &
|
60 |
+
sleep 3
|
61 |
+
#VBoxManage startvm "$VM_NAME2" --type headless &
|
62 |
+
#sleep 3
|
63 |
+
#VBoxManage startvm "$VM_NAME3" --type headless &
|
64 |
+
#sleep 3
|
65 |
+
#VBoxManage startvm "$VM_NAME4" --type headless &
|
66 |
+
```
|
67 |
+
* 设置定时任务 crontab -e
|
68 |
+
```
|
69 |
+
*/15 * * * * /home/restart_vm.sh
|
70 |
+
```
|
71 |
+
* 根据实际情况,可启动多个虚拟机为爬虫加速(需要修改whb.js的next函数)
|