<%
Fonction octets2BSTR(vIn)
strRetour =
Pour i = 1 À LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
Si ThisCharCode < &H80 Alors
strReturn = strReturn & Chr(ThisCharCode)
Autre
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
je = je + 1
Fin si
Suivant
octets2BSTR = ubb(strReturn)
Fonction de fin
Fonction dq(clé)
faible XmlHttp
définir XmlHttp = CreateObject (Microsoft.XMLHTTP)
XmlHttp.Open GET,http://www.baidu.com/s?wd=&key&&pn=&request(pn), false
XmlHttp.setRequestHeader Type de contenu, texte/XML
XmlHttp.Envoyer
dq = octets2BSTR (XmlHttp.responseBody)
Fonction de fin
Fonction BR(Str)
Str = Remplacer(Str,{br},<br>)
Str = Remplacer(Str,vbcrlf,<br>)
Str = Remplacer(Str,<br> <br>,<br>)
Str = Remplacer(Str,<br><br>,<br>)
Str = Remplacer(Str,<br><br>,<br>)
BR = Str
Fonction de fin
fonction ubb(str)
si instr(str,找到相关网页) = 0 alors
ubb = 没有搜索到任何内容
fonction de sortie
finir si
str = Remplacer(str,vbcrlf,{br})
str = Remplacer(str,<br>,{br})
str = Remplacer(str,</td>,</td>&vbcrlf)
str = Remplacer(str,<td,vbcrlf&<td)
dim re,Match,Correspondances
set re = Nouvelle RegExp
re.Global = Vrai
re.IgnoreCase = Vrai
re.Pattern=.*/<td class=f>(.*)/<//td>
Définir les correspondances = re.Execute(str)
Pour chaque match dans les matchs
ubb=ubb&BR(Match.valeur)
suivant
re.Pattern=(/- /<a .[^/<]*>百度快照/<//a>)
ubb = re.replace(ubb,)
re.Pattern=(/<a class=m.[^/<]*>.[^/<]*/<//a>)
ubb = re.replace(ubb,)
re.Pattern=(/<font color=#008000>.[^/<]*/<//font>)
ubb = re.replace(ubb,<hr>) '每一条信息的间隔
ubb = Remplacer(ubb,<td class=f>,)
ubb = Remplacer(ubb,</td>,)
ubb = BR(UBB)
re.Pattern=(找到相关网页.*秒)
Définir les correspondances = re.Execute(str)
set Match = Correspondances (0)
ubb = ubb & Correspondance & <br>
str = Remplacer(str,</div>,</div>&vbcrlf)
re.Pattern=/<div class=p>(.*)/<//div>
Définir les correspondances = re.Execute(str)
set Match = Correspondances (0)
Atténuer le lien
LeLien = Correspondance
re.Pattern=href=s?(.[^>]*)
LeLien = re.replace(LeLien,href=$1)
ubb = ubb & LeLien
fonction de fin
si len(requête(wd)) > 0 alors
réponse.write dq(requête(wd))
finir si
%>
<form méthode=post action=?>
<type d'entrée=nom du texte=wd> <type d'entrée=soumettre>
</form>