asp蜘蛛机器人(记录各个蜘蛛爬行)

asp蜘蛛机器人(记录各个蜘蛛爬行)

程序代码 程序代码
'# 蜘蛛机器人
Private Sub SpiderBot()
        Dim Agent : Agent = LCase(Request.ServerVariables("Http_User_Agent"))
        Dim Bot : Bot = ""
        If Instr(Agent,"googlebot") > 0 Then Bot = "Google"
        If Instr(Agent,"mediapartners-google") > 0 Then Bot = "Google Adsense"
        If Instr(Agent,"baiduspider") > 0 Then Bot = "Baidu"
        If Instr(Agent,"sogou spider") > 0 Then Bot = "Sogou"
        If Instr(Agent,"yahoo") > 0 Then Bot = "Yahoo!"
        If Instr(Agent,"msn") > 0 Then Bot = "MSN"
        If Instr(Agent,"ia_archiver") > 0 Then Bot = "Alexa"
        If Instr(Agent,"iaarchiver") > 0 Then Bot = "Alexa"
        If Instr(Agent,"sohu") > 0 Then Bot = "Sohu"
        If Instr(Agent,"sqworm") > 0 Then Bot = "AOL"
        If Instr(Agent,"yodaobot") > 0 Then Bot = "Yodao"
        If Instr(Agent,"iaskspider") > 0 Then Bot = "Iask"
        If Len(Bot) > 0 Then
        '# 记录蜘蛛爬行
                FilePath = Server.Mappath("/robots/"&Bot&"_robots.txt") '# 保存robots目录下,请手动建立
                 Set Fso = Server.CreateObject("Scripting.FileSystemObject")
                Set Fout = Fso.OpenTextFile(FilePath,8,True)
                                Fout.WriteLine "索引页面:"&request.ServerVariables("SCRIPT_NAME")&"?"&request.ServerVariables("QUERY_STRING")
                                Fout.WriteLine "蜘蛛:"&Bot&chr(32)&chr(32)&"更新时间:"&Now()
                                Fout.WriteLine "-----------------------------------------------"
                                Fout.Close
                Set Fout = Nothing : Set Fso = Nothing
        End If
End Sub

'# 写注析不是我的强项!文件顶部插入 Call SpiderBot()


评论: 0 | 引用: 0 | 查看次数: 4314
发表评论
昵 称:
密 码: 游客发言不需要密码.
验证码: 验证码
内 容:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 关闭 | [img]标签 关闭