实例讲解实现抓取网上房产信息的ASP程序(2)


 tempLink=replace(tempLink,"../","")

 response.Write(i&":"&tempLink&"<br>")
 NewsContent=ReadXml(tempLink,"gb2312","<td valign=""bottom"" width=""400"">","<hr width=""760"" noshade size=""1"" color=""#808080""> ")
 NewsContent=RemoveHtml(NewsContent)
 NewsContent=replace(NewsContent,VbCrLf,"")
 NewsContent=replace(NewsContent,vbNewLine,"")
 NewsContent=replace(NewsContent," ","")
 NewsContent=replace(NewsContent," ","")
 NewsContent=replace(NewsContent," ","")
 NewsContent=replace(NewsContent,"\n","")
 NewsContent=replace(NewsContent,chr(10),"")
 NewsContent=replace(NewsContent,chr(13),"")
 '===============get Content=======================
 response.Write(NewsContent)
 KeyId=SubStr(NewsContent,"列号:","信息类别:")
 NewsClass=SubStr(NewsContent,"类别:","所在城市:")
 City=SubStr(NewsContent,"城市:","房屋具体位置:")
 Position=SubStr(NewsContent,"位置:","房屋类型:")
 HouseType=SubStr(NewsContent,"类型:","楼层:")
 Level=SubStr(NewsContent,"楼层:","使用面积:")
 Area=SubStr(NewsContent,"面积:","房价:")
 Price=SubStr(NewsContent,"房价:","其他说明:")
 Demostra=SubStr(NewsContent,"说明:","联系人:")
 ContactMan=SubStr(NewsContent,"联系人:","联系方式:")
 Contact=SubStr(NewsContent,"联系方式:","信息来源:")
 response.Write("总序列号:"&KeyId&"<br>")
 response.Write("信息类别:"&NewsClass&"<br>")
 response.Write("所在城市:"&City&"<br>")
 response.Write("房屋具体位置:"&Position&"<br>")
 response.Write("房屋类型:"&HouseType&"<br>")
 response.Write("楼层:"&Level&"<br>")
 response.Write("使用面积:"&Area&"<br>")
 response.Write("房价:"&Price&"<br>")
 response.Write("其他说明:"&Demostra&"<br>")
 response.Write("联系人:"&ContactMan&"<br>")
 response.Write("联系方式:"&Contact&"<br>")
 'title=RemoveHTML(aa(i))
 'response.Write("title:"&title)
 for n=0 to application.Contents.count
   if(application.Contents(n)=KeyId) then
    ifexit=true    
   end if  
 next 
 if not ifexit then
   application(time&i)=KeyId
 '添加到数据库
 '====================================================
 set rs=server.CreateObject("adodb.recordset")
 rs.open "select top 1 * from news order by id desc",conn,3,3
 rs.addnew
 rs("NewsClass")=NewsClass
 rs("City")=City
 rs("Position")=Position
 rs("HouseType")=HouseType
 rs("Level")=Level
 rs("Area")=Area
 rs("Price")=Price
 rs("Demostra")=Demostra
 rs("ContactMan")=ContactMan

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3248.html