asp 抓取baidu收录网页数代码

asp 抓取baidu收录网页数代码

<%
response.expires = -1
response.addheader "cache-control","no-cache"
Response.AddHeader "Pragma","no-cache"
wd=Request("d")
If Request("s")="baidus" Then
BaiduUrl="http://www.baidu.com/s?wd=domain%3A"&wd
Else
BaiduUrl="http://www.baidu.com/s?wd=site%3A"&wd
End If
TempStr= getHTTPPage(BaiduUrl)
dim BaiduWebSite
set reg=new Regexp
reg.Multiline=True
reg.Global=Flase
reg.IgnoreCase=true
reg.Pattern="找到相关网页((.|n)*?)篇"
Set matches = reg.execute(TempStr)
For Each match1 in matches
BaiduWebSite=match1.Value
Next
Set matches = Nothing
Set reg = Nothing
BaiduWebSite=Replace(BaiduWebSite,"找到相关网页","")
BaiduWebSite=Replace(BaiduWebSite,"篇","")
BaiduWebSite=Replace(BaiduWebSite,"约","")
BaiduWebSite=Replace(BaiduWebSite,",","")
BaiduWebSite=Replace(BaiduWebSite,"","")

If BaiduWebSite="" Then
  If Request("s")="baidus" Then
    Response.Write ("document.write (""<a href='http://www.baidu.com/s?wd=domain%3A"&wd&"' target='_blank' title='数据获取出错,请稍后重新查询! 爱儿工作室 LPLY.COM'><font color=#999999><b>x</b></font></a>"");")
  Else
    Response.Write ("document.write (""<a href='http://www.baidu.com/s?wd=site%3A"&wd&"' target='_blank' title='数据获取出错,请稍后重新查询! 爱儿工作室 LPLY.COM'><font color=#999999><b>x</b></font></a>"");")
  End If
Else
  If Request("s")="baidus" Then
    Response.Write ("document.write (""<a href='http://www.baidu.com/s?wd=domain%3A"&wd&"' target='_blank' title='"&BaiduWebSite&" "&wd&"' rel=nofollow class=LN>"&BaiduWebSite&"</a>"");")
  Else
    Response.Write ("document.write (""<a href='http://www.baidu.com/s?wd=site%3A"&wd&"' target='_blank' title='"&BaiduWebSite&" "&wd&"' rel=nofollow class=LN>"&BaiduWebSite&"</a>"");")
  End If
End If

Function getHTTPPage(Path)
        t = GetBody(Path)
        getHTTPPage=BytesToBstr(t,"GB2312")
End function

Function GetBody(url)
        on error resume next
        Set Retrieval = CreateObject("Microsoft.XMLHTTP")
        With Retrieval
        .Open "Get", url, False, "", ""
        .Send
        GetBody = .ResponseBody
        End With
        Set Retrieval = Nothing
End Function

Function BytesToBstr(body,Cset)
        dim objstream
        set objstream = Server.CreateObject("ado"&"db.str"&"eam")
        objstream.Type = 1
        objstream.Mode =3
        objstream.Open
        objstream.Write body
        objstream.Position = 0
        objstream.Type = 2
        objstream.Charset = Cset
        BytesToBstr = objstream.ReadText
        objstream.Close
        set objstream = nothing
End Function
%>

时间: 2024-08-03 22:24:35

asp 抓取baidu收录网页数代码的相关文章

asp抓取bing收录与反连代码

asp抓取bing收录与反连代码 <% response.expires = -1 response.addheader "cache-control","no-cache" Response.AddHeader "Pragma","no-cache" wd=Request("d") If Request("s")="bings" Then bingUrl=&q

asp 抓取alexa 网站世界排名代码

asp 抓取alexa 网站世界排名代码 function Alexa(AlexaURL)  on error resume next  dim getsms,getstr,url  dim star,endd  url="http://data.alexa.com/data?cli=10&dat=snba&url="&AlexaURL  getsms=getHTTPPage(url)  if getsms<>"" then   

卢松松:搜索引擎如何抓取你的网页

搜索引擎优化(SEO)是搜索引擎有好的收录网页的过程,适当的SEO有利于蜘蛛爬行你的网站,使你的内容符合搜索引擎算法,以便确认它与关键词高度相关. 优化的目的就是使网页的内容便于蜘蛛理解,下面我就以百度新收录的一篇内容来进行说明,我以一个完整标题进行搜索,其目的是能反映出更多关键词在百度自然搜索的结果页面,能更好的说明搜索引擎是如何抓取你的网页的.   (图一:百度最常见的自然搜索结果列表) SEOer通常关注的是网页主体部分的自然搜索结果,百度和Google搜索结果页面大致相同,搜索结果页面通

PHP抓取及分析网页的方法详解_php技巧

本文实例讲述了PHP抓取及分析网页的方法.分享给大家供大家参考,具体如下: 抓取和分析一个文件是非常简单的事.这个教程将通过一个例子带领你一步一步地去实现它.让我们开始吧! 首先,我首必须决定我们将抓取的URL地址.可以通过在脚本中设定或通过$QUERY_STRING传递.为了简单起见,让我们将变量直接设在脚本中. <?php $url = 'http://www.php.net'; ?> 第二步,我们抓取指定文件,并且通过file()函数将它存在一个数组里. <?php $url =

PHP 使用 CURL 同步抓取多个网页

一般CURL 抓网页的方法, 是一页一页抓, 假设要抓 4页, 所费时间各别是 5,10,7,5 秒, 那全部总合所花的时间就是 5 + 10 + 7 + 5 = 27 秒.若能同时间去抓取多个网页, 所花费的时间 5,10,7,5 秒, 全部总合所花的时间是 10 秒.(花费最多时间的秒数) 于JavaScript 可使用 AJAX 的 async(YAHOO.util.Connect.asyncRequest)来达成, 于 PHP 可以用 CURL 来达成此 Multi-Threading

C#实现抓取和分析网页类实例

  本文实例讲述了C#实现抓取和分析网页类.分享给大家供大家参考.具体分析如下: 这里介绍了抓取和分析网页的类. 其主要功能有: 1.提取网页的纯文本,去所有html标签和javascript代码 2.提取网页的链接,包括href和frame及iframe 3.提取网页的title等(其它的标签可依此类推,正则是一样的) 4.可以实现简单的表单提交及cookie保存 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

c#用httpwebrequest如何模拟抓取这样的网页信息

问题描述 c#用httpwebrequest如何模拟抓取这样的网页信息 c#用httpwebrequest如何模拟抓取这样的网页信息,下面内容是用fiddler抓取的.CONNECT user.cloudcall.hk:8080 HTTP/1.0User-Agent: Mozilla/4.0 (compatible; MSIE 6.0;Windows NT 5.1) AppleWebKitHost: user.cloudcall.hk:8080Content-Length: 0Connectio

javascript实时抓取天气和汇率的代码

问题描述 javascript实时抓取天气和汇率的代码 前台直接通过接口抓取,网上的说明看不懂啊,有没有完整代码好好研究一下,谢谢了

解决方案-GET抓取安居客网页数据频繁了被屏蔽怎么绕过他的验证?

问题描述 GET抓取安居客网页数据频繁了被屏蔽怎么绕过他的验证? 用火车头采集安居客,但是一会就会全部跳转到输入验证码页面验证了才能正常访问,除了用代理还有其他的解决方案吗? 解决方案 只能换ip,既然服务器封了就没办法了.不过网上有那种代理服务器api,几块钱一天,可以获取上万的不同ip,可以说基本上也就相当于没限制. 解决方案二: 活该,谁叫你频繁地搞,搞到手的数据就存起来用啊.不如果不用等待答复的,直接构造IP包发送请求就完了. 解决方案三: 用神箭手云爬虫吧,平台自动帮你解决这种ip啊,