📄 spy.asp
字号:
Private Sub ShowControl()
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td align=""center""><input type=""checkbox"" onclick=""chkAll(this)"" /></td>"
MyIO.Echo "<td colspan=""6"">"
MyIO.Echo " <input type=""button"" class=""btn"" value=""删除"" onclick=""jspp.Spy.removeAll(this.form)"" />"
MyIO.Echo " <input type=""button"" class=""btn"" value=""运行采集"" onclick=""jspp.Spy.run(this.form)"" />"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
End Sub
Private Sub doGetModify()
Dim xdb
Set xdb = WM_XMLDB("Spy")
xdb.Filter = "@SeqId=" & atol(MyIO.QueryString("SeqId"))
If xdb.EOF Then
MyIO.Echo "找不到您要编辑的规则"
Else
MyIO.Echo "<form id=""frmMain"" action=""admin_spy.asp?Handle=Modify&SeqId=" & xdb("SeqId") & """ method=""post"" onsubmit=""return(false)"" target=""console"">"
MyIO.Echo "<input type=""hidden"" name=""Check"" value=""" & xdb("Check") & """ />"
MyIO.Echo "<table width=""100%"" border=""1"" cellpadding=""2"" cellspacing=""0"" style=""border-collapse:collapse"" bordercolor=""#000000"">"
MyIO.Echo "<tr>"
MyIO.Echo "<td colspan=""2"" class=""winT0""><b>编辑采集规则[" & xdb("Name") & "]</b></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td width=""10%"">采集名称</td>"
MyIO.Echo "<td width=""90%"">" & xdb("Name") & "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>列表地址</td>"
MyIO.Echo "<td><input type=""text"" name=""List"" style=""width:400px"" class=""txt"" value=""" & xdb("List") & """ /> <input type=""button"" value=""检测地址"" class=""btn"" onclick=""jspp.Spy.chkList(this.form)"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>采集类型</td>"
MyIO.Echo "<td>"
MyIO.Echo "<select name=""Type"">"
MyIO.Echo "<option value=""0""" & setSelected(xdb("Type") = 0) & ">采集所有</option>"
MyIO.Echo "<option value=""1""" & setSelected(xdb("Type") = 1) & ">采集昨日</option>"
MyIO.Echo "<option value=""2""" & setSelected(xdb("Type") = 2) & ">采集今日</option>"
MyIO.Echo "</select>"
MyIO.Echo " [采集所有]只有手工启动采集,而采集昨日和今日还可以在管理员登陆后自动运行"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>检测重复项</td>"
MyIO.Echo "<td>"
MyIO.Echo " <input type=""radio"" name=""Repeat"" value=""1""" & setChecked(xdb("Repeat") = "1") & " /> 是"
MyIO.Echo " <input type=""radio"" name=""Repeat"" value=""0""" & setChecked(xdb("Repeat") = "0") & " /> 否"
MyIO.Echo "</select>"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>页面编码</td>"
MyIO.Echo "<td>"
MyIO.Echo " <input type=""radio"" name=""Charset"" value=""gb2312""" & setChecked(xdb("Charset") = "gb2312") & " /> gb2312"
MyIO.Echo " <input type=""radio"" name=""Charset"" value=""utf-8""" & setChecked(xdb("Charset") = "utf-8") & " /> utf-8"
MyIO.Echo " <input type=""radio"" name=""Charset"" value=""big5""" & setChecked(xdb("Charset") = "big5") & " /> big5"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>列表源码</td>"
MyIO.Echo "<td>"
MyIO.Echo " <div id=""_LIST_BODY"" style=""display:none;width:500px;height:200px;border:1px solid #000000;overflow-x:auto;overflow-y:auto;""></div>"
MyIO.Echo " <iframe id=""_LIST_HTML"" style=""display:none;width:500px;height:200px;border:1px solid #000000;"" src=""about:blank""></iframe>"
MyIO.Echo " <br/><input type=""button"" name=""btnList"" value=""页面预览"" class=""btn"" onclick=""jspp.Spy.showList(this)"" disabled=""true"" />"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>列表规则</td>"
MyIO.Echo "<td><textarea name=""ListRule"" class=""area"" style=""width:400px;height:80px"">" & MyIO.HTMLEncode(xdb("ListRule")) & "</textarea> <input name=""btnChkListRule"" type=""button"" value=""检测规则"" class=""btn"" onclick=""jspp.Spy.chkListRule(this.form)"" disabled=""true"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>连接列表</td>"
MyIO.Echo "<td><select name=""ListPage"" class=""slt"" onchange=""jspp.Spy.chkContent(this)""></select> 需要先检测列表规则</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>内容源码</td>"
MyIO.Echo "<td>"
MyIO.Echo " <div id=""_CONTENT_BODY"" style=""display:none;width:500px;height:200px;border:1px solid #000000;overflow-x:auto;overflow-y:auto;""></div>"
MyIO.Echo " <iframe id=""_CONTENT_HTML"" style=""display:none;width:500px;height:200px;border:1px solid #000000;"" src=""about:blank""></iframe>"
MyIO.Echo " <br/><input type=""button"" name=""btnContent"" value=""页面预览"" class=""btn"" onclick=""jspp.Spy.showContent(this)"" disabled=""true"" />"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>内容规则</td>"
MyIO.Echo "<td><textarea name=""ContentRule"" class=""area"" style=""width:400px;height:80px"">" & MyIO.HTMLEncode(xdb("ContentRule")) & "</textarea> <input name=""btnChkContentRule"" type=""button"" value=""检测规则"" class=""btn"" onclick=""jspp.Spy.chkContentRule(this.form)"" disabled=""true"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>删除标签</td>"
MyIO.Echo "<td>"
MyIO.Echo " <input type=""checkbox"" name=""Mark"" value=""div""" & setChecked(InString(xdb("Mark"), "div", False)) & " /> div"
MyIO.Echo " <input type=""checkbox"" name=""Mark"" value=""table""" & setChecked(InString(xdb("Mark"), "table", False)) & " /> table"
MyIO.Echo " <input type=""checkbox"" name=""Mark"" value=""img""" & setChecked(InString(xdb("Mark"), "img", False)) & " /> img"
MyIO.Echo " <input type=""checkbox"" name=""Mark"" value=""strong""" & setChecked(InString(xdb("Mark"), "strong", False)) & " /> strong"
MyIO.Echo " <input type=""checkbox"" name=""Mark"" value=""b""" & setChecked(InString(xdb("Mark"), "b", False)) & " /> b"
MyIO.Echo " <input type=""checkbox"" name=""Mark"" value=""u""" & setChecked(InString(xdb("Mark"), "u", False)) & " /> u"
MyIO.Echo " <input type=""checkbox"" name=""Mark"" value=""i""" & setChecked(InString(xdb("Mark"), "i", False)) & " /> i"
MyIO.Echo " 删除标签的意思即删除标签及其包含的文字"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>分页规则</td>"
MyIO.Echo "<td><textarea name=""PageRule"" class=""area"" style=""width:400px;height:80px"">" & MyIO.HTMLEncode(xdb("PageRule")) & "</textarea> <input name=""btnChkPageRule"" type=""button"" value=""检测规则"" class=""btn"" onclick=""jspp.Spy.chkPageRule(this.form)"" disabled=""true"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>目标栏目</td>"
MyIO.Echo "<td><select name=""Staple""></select></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>采集范例</td>"
MyIO.Echo "<td>"
MyIO.Echo " <div id=""_CONTENT"" style=""display:none;width:500px;height:200px;border:1px solid #000000;overflow-x:auto;overflow-y:auto;""></div>"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td colspan=""2"" align=""center"">"
MyIO.Echo " <input name=""btnPost"" type=""button"" value=""保存编辑"" class=""btn"" onclick=""Form.submit(this)"" />"
MyIO.Echo " <input type=""button"" value=""新建采集"" class=""btn"" onclick=""opt.cache[1] = null;opt.callBack[1] = newSpy;opt.lock(1);"" />"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "</table>"
MyIO.Echo "</form>"
End If
Set xdb = Nothing
End Sub
Private Sub doGetCopy()
Dim xdb
Set xdb = WM_XMLDB("Spy")
xdb.Filter = "@SeqId=" & atol(MyIO.QueryString("SeqId"))
If xdb.EOF Then
MyIO.Echo "找不到您要拷贝的规则"
Else
MyIO.Echo "<form id=""frmMain"" action=""admin_spy.asp?Handle=Add"" method=""post"" onsubmit=""return(false)"" target=""console"">"
MyIO.Echo "<input type=""hidden"" name=""Check"" value=""" & xdb("Check") & """ />"
MyIO.Echo "<table width=""100%"" border=""1"" cellpadding=""2"" cellspacing=""0"" style=""border-collapse:collapse"" bordercolor=""#000000"">"
MyIO.Echo "<tr>"
MyIO.Echo "<td colspan=""2"" class=""winT0""><b>拷贝采集规则[" & xdb("Name") & "]</b></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td width=""10%"">采集名称</td>"
MyIO.Echo "<td width=""90%""><input type=""text"" name=""Name"" class=""txt"" value=""" & xdb("Name") & " 拷贝"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>列表地址</td>"
MyIO.Echo "<td><input type=""text"" name=""List"" style=""width:400px"" class=""txt"" value=""" & xdb("List") & """ /> <input type=""button"" value=""检测地址"" class=""btn"" onclick=""jspp.Spy.chkList(this.form)"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>采集类型</td>"
MyIO.Echo "<td>"
MyIO.Echo "<select name=""Type"">"
MyIO.Echo "<option value=""0""" & setSelected(xdb("Type") = 0) & ">采集所有</option>"
MyIO.Echo "<option value=""1""" & setSelected(xdb("Type") = 1) & ">采集昨日</option>"
MyIO.Echo "<option value=""2""" & setSelected(xdb("Type") = 2) & ">采集今日</option>"
MyIO.Echo "</select>"
MyIO.Echo " [采集所有]只有手工启动采集,而采集昨日和今日还可以在管理员登陆后自动运行"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>检测重复项</td>"
MyIO.Echo "<td>"
MyIO.Echo " <input type=""radio"" name=""Repeat"" value=""1""" & setChecked(xdb("Repeat") = "1") & " /> 是"
MyIO.Echo " <input type=""radio"" name=""Repeat"" value=""0""" & setChecked(xdb("Repeat") = "0") & " /> 否"
MyIO.Echo "</select>"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>页面编码</td>"
MyIO.Echo "<td>"
MyIO.Echo " <input type=""radio"" name=""Charset"" value=""gb2312""" & setChecked(xdb("Charset") = "gb2312") & " /> gb2312"
MyIO.Echo " <input type=""radio"" name=""Charset"" value=""utf-8""" & setChecked(xdb("Charset") = "utf-8") & " /> utf-8"
MyIO.Echo " <input type=""radio"" name=""Charset"" value=""big5""" & setChecked(xdb("Charset") = "big5") & " /> big5"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>列表源码</td>"
MyIO.Echo "<td>"
MyIO.Echo " <div id=""_LIST_BODY"" style=""display:none;width:500px;height:200px;border:1px solid #000000;overflow-x:auto;overflow-y:auto;""></div>"
MyIO.Echo " <iframe id=""_LIST_HTML"" style=""display:none;width:500px;height:200px;border:1px solid #000000;"" src=""about:blank""></iframe>"
MyIO.Echo " <br/><input type=""button"" name=""btnList"" value=""页面预览"" class=""btn"" onclick=""jspp.Spy.showList(this)"" disabled=""true"" />"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>列表规则</td>"
MyIO.Echo "<td><textarea name=""ListRule"" class=""area"" style=""width:400px;height:80px"">" & MyIO.HTMLEncode(xdb("ListRule")) & "</textarea> <input name=""btnChkListRule"" type=""button"" value=""检测规则"" class=""btn"" onclick=""jspp.Spy.chkListRule(this.form)"" disabled=""true"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>连接列表</td>"
MyIO.Echo "<td><select name=""ListPage"" class=""slt"" onchange=""jspp.Spy.chkContent(this)""></select> 需要先检测列表规则</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>内容源码</td>"
MyIO.Echo "<td>"
MyIO.Echo " <div id=""_CONTENT_BODY"" style=""display:none;width:500px;height:200px;border:1px solid #000000;overflow-x:auto;overflow-y:auto;""></div>"
MyIO.Echo " <iframe id=""_CONTENT_HTML"" style=""display:none;width:500px;height:200px;border:1px solid #000000;"" src=""about:blank""></iframe>"
MyIO.Echo " <br/><input type=""button"" name=""btnContent"" value=""页面预览"" class=""btn"" onclick=""jspp.Spy.showContent(this)"" disabled=""true"" />"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>内容规则</td>"
MyIO.Echo "<td><textarea name=""ContentRule"" class=""area"" style=""width:400px;height:80px"">" & MyIO.HTMLEncode(xdb("ContentRule")) & "</textarea> <input name=""btnChkContentRule"" type=""button"" value=""检测规则"" class=""btn"" onclick=""jspp.Spy.chkContentRule(this.form)"" disabled=""true"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>删除标签</td>"
MyIO.Echo "<td>"
MyIO.Echo " <input type=""checkbox"" name=""Mark"" value=""div""" & setChecked(InString(xdb("Mark"), "div", False)) & " /> div"
MyIO.Echo " <input type=""checkbox"" name=""Mark"" value=""table""" & setChecked(InString(xdb("Mark"), "table", False)) & " /> table"
MyIO.Echo " <input type=""checkbox"" name=""Mark"" value=""img""" & setChecked(InString(xdb("Mark"), "img", False)) & " /> img"
MyIO.Echo " <input type=""checkbox"" name=""Mark"" value=""strong""" & setChecked(InString(xdb("Mark"), "strong", False)) & " /> strong"
MyIO.Echo " <input type=""checkbox"" name=""Mark"" value=""b""" & setChecked(InString(xdb("Mark"), "b", False)) & " /> b"
MyIO.Echo " <input type=""checkbox"" name=""Mark"" value=""u""" & setChecked(InString(xdb("Mark"), "u", False)) & " /> u"
MyIO.Echo " <input type=""checkbox"" name=""Mark"" value=""i""" & setChecked(InString(xdb("Mark"), "i", False)) & " /> i"
MyIO.Echo " 删除标签的意思即删除标签及其包含的文字"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>分页规则</td>"
MyIO.Echo "<td><textarea name=""PageRule"" class=""area"" style=""width:400px;height:80px"">" & MyIO.HTMLEncode(xdb("PageRule")) & "</textarea> <input name=""btnChkPageRule"" type=""button"" value=""检测规则"" class=""btn"" onclick=""jspp.Spy.chkPageRule(this.form)"" disabled=""true"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>目标栏目</td>"
MyIO.Echo "<td><select name=""Staple""></select></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>采集范例</td>"
MyIO.Echo "<td>"
MyIO.Echo " <div id=""_CONTENT"" style=""display:none;width:500px;height:200px;border:1px solid #000000;overflow-x:auto;overflow-y:auto;""></div>"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td colspan=""2"" align=""center"">"
MyIO.Echo " <input name=""btnPost"" type=""button"" value=""保存编辑"" class=""btn"" onclick=""Form.submit(this)"" />"
MyIO.Echo " <input type=""button"" value=""新建采集"" class=""btn"" onclick=""opt.cache[1] = null;opt.callBack[1] = newSpy;opt.lock(1);"" />"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "</table>"
MyIO.Echo "</form>"
End If
Set xdb = Nothing
End Sub
Private Sub doCheckList()
Dim strURL, strCharset
Dim strData
strURL = MyIO.QueryString("URL")
strCharset = MyIO.QueryString("Charset")
If strURL = "" Then
strError = "未指定列表地址"
ElseIf Not InString("gb2312|utf-8|big5", strCharset, False) Then
strError = "错误的页面编码"
Else
strData = GetRemoteText(strURL, strCharset)
If strData = "" Then
strError = "获取列表地址错误"
Else
strError = strData
End If
End If
MyIO.Echo strError
End Sub
Private Sub doCheckContent()
Dim strURL, strCharset
Dim strData
strURL = MyIO.QueryString("URL")
strCharset = MyIO.QueryString("Charset")
If strURL = "" Then
strError = "未指定连接地址"
ElseIf Not InString("gb2312|utf-8|big5", strCharset, False) Then
strError = "错误的页面编码"
Else
strData = GetRemoteText(strURL, strCharset)
If strData = "" Then
strError = "获取内容连接错误"
Else
blnError = False
MyIO.Echo strData
End If
End If
If blnError Then
MyIO.Echo "MessageBox.show(MSG_WARNING, """ & strError & """);"
End If
End Sub
Private Sub doPostAdd()
Dim strName, strList, strCharset
Dim strListRule, strContentRule, strPageRule
Dim intCheck, lngStapleId
Dim objCmd, xdb
strName = Trim(MyIO.Form("Name"))
strCharset = MyIO.Form("Charset")
strList = Trim(MyIO.Form("List"))
strListRule = Trim(MyIO.Form("ListRule"))
strContentRule = Trim(MyIO.Form("ContentRule"))
strPageRule = Trim(MyIO.Form("PageRule"))
intCheck = atoi(MyIO.Form("Check"))
lngStapleId = atol(MyIO.Form("Staple"))
Set objCmd = MyKernel.Command(T_STAPLE)
objCmd.CommandType = "SELECT"
objCmd.Column = "SEQID,TITLE"
objCmd.Where = "SEQID=" & lngStapleId
If strName = "" Then
strError = "请输入采集名称"
ElseIf strList = "" Then
strError = "请输入列表地址"
ElseIf Not InString("gb2312|utf-8|big5", strCharset, False) Then
strError = "错误的页面编码"
ElseIf strListRule = "" Then
strError = "请输入内容规则"
ElseIf InStr(strName, "'") > 0 Then
strError = "请勿在名称中使用特殊字符"
ElseIf InStr(strList, "'") > 0 Then
strError = "请勿在名称中使用特殊字符"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -