查看完整版本: 大义乌采集程序修改求助!

galenjenny 2008-3-12 13:53

大义乌采集程序修改求助!

<!--#include file="../init.asp"-->
<%
Function getHTTPPage(url)
On error resume next
Dim http
Set http=createobject("MSXML2.XMLHTTP")
Http.open "GET",url,false
Http.send()
If Http.readystate<>4 Then
  Exit Function
End If
getHTTPPage=bytes2BSTR(Http.responseBody)
Set http=Nothing
If err.number<>0 Then err.Clear
End Function
Function bytes2BSTR(vIn)
Dim strReturn
Dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
  ThisCharCode = AscB(MidB(vIn,i,1))
  If ThisCharCode < &H80 Then
   strReturn = strReturn & Chr(ThisCharCode)
  Else
   NextCharCode = AscB(MidB(vIn,i+1,1))
   strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
   i = i + 1
  End If
Next
bytes2BSTR = strReturn
End Function
Function Get_SerialNumber(dataTable,datadb,MaxSerial)
Set SN_rs=Server.CreateObject("ADODB.Recordset")
SN_Sql="Select "&MaxSerial&" From "&dataTable&" Order by "&datadb&" Desc"
SN_rs.Open SN_Sql,Cn,1,1
If SN_rs.Eof And SN_rs.Bof Then
  Get_SerialNumber = Serial_Number
Else
  Get_SerialNumber = SN_rs(0)+1
End If
SN_rs.Close
Set SN_rs = Nothing
Get_SerialNumber = Get_SerialNumber
End Function
'//改变状态
If Request("action") = "establish" Then
System_Collect = Request.Form("System_Collect")
If System_Collect = 1 Then
  System_Collect = 0
Else
  System_Collect = 1
End If  
rs.Open "Select System_Collect From G_System",Cn,1,3
If Not(rs.Eof And rs.Bof) Then
  rs("System_Collect") = System_Collect
  rs.Update
  rs.Close
  Response.Redirect("infocj.asp")
  Response.End()
End If
End If
Function post_Add(strTable,strSegment,strID)
Cn.Execute("Update "&strTable&" Set "&strSegment&"="&strSegment&"+1 Where ID="&strID)
End Function
System_Collect=cn.execute("Select System_Collect from [G_System]")(0)
If System_Collect=1 Then
SystemSql="Select * From [G_System] Where ID = 1"
Rs.Open SystemSql,Cn,1,1
OldGoods_Time=Rs("OldGoods_Time")
News_Time=Rs("News_Time")
Rs.Close

If Dateadd("n",5,OldGoods_Time)<Now() Then
  Redim Olds(10)
  Dim Old
  
  Old=getHTTPPage("[url=http://app.ntonline.cn/imarket/c_.asp?page=1]http://app.ntonline.cn/imarket/c_.asp?page=1[/url]")
  Old=mid(Old,instr(Old,"日期"))
  Old=mid(Old,1,instr(Old,"页次"))
  For i = 0 To 9
      Old=mid(Old,instr(Old,"#EEEEEE"+20))
   Olds(i)=mid(Old,instr(Old,"href=")+6,instr(Old," title")-instr(Old,"href=")-7)
  Next
  For i = 0 To 9
  If cn.execute("Select count(Info_ID) from [G_Info] where Info_CreateTime > '"&dateadd("m",-1,now())&"' and Info_UrlSource = '"&"[url=http://app.ntonline.cn/imarket/&quot;&Olds(i)&&quot;]http://app.ntonline.cn/imarket/"&Olds(i)&"'")(0[/url]) = 0 Then
   Old=getHTTPPage("[url=http://app.ntonline.cn/imarket/]http://app.ntonline.cn/imarket/"&Olds(i[/url]))
   Old=mid(Old,1,instr(Old,"发布人"))   
   
   Old=mid(Old,instr(Old,"信息分类:"))   
   Old=mid(Old,instr(Old,"fontBlue")+10)
   Sorts=trim(mid(Old,1,instr(Old,"</td>")-1))
   
   Old=mid(Old,instr(Old,"信息类型:"))
   Old=mid(Old,instr(Old,"<td>")+4)
   Types=trim(mid(Old,1,instr(Old,"</td>")-1))
   
   Old=mid(Old,instr(Old,"信息标题:"))   
   Old=mid(Old,instr(Old,"<td>")+4)
   Topic=trim(mid(Old,1,instr(Old,"</td>")-1))
   
   Old=mid(Old,instr(Old,"padding-left:20px"))   
   Old=mid(Old,instr(Old,">")+1)
   Content=trim(mid(Old,1,instr(Old,"</td>")-1))
   
   Old=mid(Old,instr(Old,"联系人:"))   
   Old=mid(Old,instr(Old,"<td>")+4)
   Lianxi=trim(mid(Old,1,instr(Old,"</td>")-1))
   
   Old=mid(Old,instr(Old,"联系电话:"))   
   Old=mid(Old,instr(Old,"<td>")+4)
   Dianhua=trim(mid(Old,1,instr(Old,"(<a")-1))
   
   Old=mid(Old,instr(Old,"联系邮箱:"))   
   Old=mid(Old,instr(Old,"<td>")+4)
   Email=trim(mid(Old,1,instr(Old,"</td>")-1))
   
   Old=mid(Old,instr(Old,"联系地址:"))   
   Old=mid(Old,instr(Old,"<td>")+4)
   Addr=trim(mid(Old,1,instr(Old,"</td>")-1))
   
   
   Max_Info_Number = Get_SerialNumber("G_Info","Info_ID","Info_Number")
   iSql = "Select * From G_Info"
   rs.Open iSql,Cn,1,3
   rs.AddNew
   rs("Info_User_ID") = 0
   rs("Info_Number") = Max_Info_Number
   rs("Class_Frist") = 2
   Get_tclass=0
   If instr(Types,"出售")>0 Then
    rs("Class_Second") = 13
    rs("Type_Number") = 1
    If instr(Sorts,"手机通信")>0 Then Get_tclass=38
    If instr(Sorts,"电脑数码")>0 Then Get_tclass=53
    If instr(Sorts,"汽车交通")>0 Then Get_tclass=36
    If instr(Sorts,"家用电器")>0 Then Get_tclass=46
    If instr(Sorts,"文化音像")>0 Then Get_tclass=39
    If instr(Sorts,"礼品收藏")>0 Then Get_tclass=47
    If instr(Sorts,"其他信息")>0 Then Get_tclass=34
    If instr(Sorts,"运动休闲")>0 Then Get_tclass=49
    If instr(Sorts,"家居服饰")>0 Then Get_tclass=45
    If Get_tclass=0 Then Get_tclass=54
   Else
    rs("Class_Second") = 14
    rs("Type_Number") = 2
    If instr(Sorts,"手机通信")>0 Then Get_tclass=59
    If instr(Sorts,"电脑数码")>0 Then Get_tclass=74
    If instr(Sorts,"汽车交通")>0 Then Get_tclass=57
    If instr(Sorts,"家用电器")>0 Then Get_tclass=67
    If instr(Sorts,"文化音像")>0 Then Get_tclass=60
    If instr(Sorts,"礼品收藏")>0 Then Get_tclass=68
    If instr(Sorts,"其他信息")>0 Then Get_tclass=55
    If instr(Sorts,"运动休闲")>0 Then Get_tclass=70
    If instr(Sorts,"家居服饰")>0 Then Get_tclass=66
    If Get_tclass=0 Then Get_tclass=76
   End If
   
   rs("Class_Three") = Get_tclass
   
   Info_ContactWay=Dianhua&"/"&Email
   rs("Info_ContactWay") = Info_ContactWay
   
   rs("Info_ContactMan") = Lianxi
   
   rs("Info_Password") = "888333"
   
   rs("Info_Topic") = Topic
   
   rs("Info_Content") = Topic&Info_ContactWay&Lianxi&Addr&Content
   
   rs("Info_PicturePath") = ""
   rs("Info_CreateTime") = dateadd("s",i,Now())
   rs("Info_Top") = 0
   rs("Info_DisplayTime") = Date()+7&" 23:59:59"
   rs("Info_VistersTime") = dateadd("s",i,Now())
   rs("Info_Displays") = 0
   rs("Info_ZhongJie") = 0
   rs("Info_Auditing") = 0
   rs("Info_UrlSource") = "[url=http://app.ntonline.cn/imarket/]http://app.ntonline.cn/imarket/"&Olds(i[/url])
   rs.Update
   '//提取最后ID
   MainInof_ID = rs("Info_ID")
   rs.Close
   
   '//写入子表[G_OldGoods]
   bSql = "Select * From G_OldGoods"
   rs.Open bSql,Cn,1,3
   rs.AddNew
   rs("MainInof_ID") = MainInof_ID
   rs("Goods_User_ID") = 0
   rs("Goods_Title") = Topic
   rs("Goods_Content") = Content
   rs("Goods_Degree") = "二手"
   rs("Goods_Rental") = 0
   rs("Goods_Deliver") = "双方联系"
   rs("Goods_Address") = Addr
   rs("Goods_Piece") = 1
   rs.Update
   rs.Close
   Call post_Add("G_Class","Class_Times",2)
   If instr(Types,"出售")>0 Then
    Call post_Add("G_Class","Class_Times",13)
   Else
    Call post_Add("G_Class","Class_Times",14)
   End If
   Call post_Add("G_Class","Class_Times",Get_tclass)
  End If
  Next
  
  SystemSql="Select * From [G_System] Where ID = 1"
  Rs.Open SystemSql,Cn,1,3
  rs("OldGoods_Time")=now()
  Rs.update
  Rs.Close
End If

End If
%>
<html xmlns="[url=http://www.w3.org/1999/xhtml]http://www.w3.org/1999/xhtml[/url]">
<head>
<meta http-equiv="Content-Type" c />
<title>无标题文档</title>
<link href="../font.css" rel="stylesheet" type="text/css">
</head>
<body >
<table width="100%" border="0" align=center cellpadding="0" cellspacing="0">
<tr>
  <td width="37%" height="25" align="left"><img src="/vip/images/ico_arrowPos.gif" width="11" height="11" /><font class="t5"> 当前位置:信息管理 → 信息采集</font></td>
     <td width="63%" align="left"> </td>
</tr>
</table>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="150"> </td>
  </tr>
  <tr>
    <td align="center" valign="middle"><fieldset style="margin:0px; margin-bottom:5px;">
      <legend>信息采集</legend>
   <table width="170" border="0" cellspacing="0" cellpadding="0">
<form action="infocj.asp?action=establish" method="post" name="myform">
<input type="hidden" name="System_Collect" id="System_Collect" value="<%=System_Collect%>">
  <tr>
    <td height="50" align="center" class="style1"><div align="center">采集状态:
      
      <input type="submit" name="Submit" value="<% If System_Collect=1 Then Response.Write("采集已开启") Else Response.Write("采集已关闭") End If%>" title="点击将改变相反状态" style="height:20px; width:80px;">
    </div></td>
  </tr>
</form>  
</table>
<%
n=cn.execute("Select count(Info_ID) from [G_Info] where Info_Auditing = 0 and Info_Displays = 0")(0)
%>
<table width="170" height="20" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><div align="center" class="style1">有 <span class="style2"><%=n%></span> 条信息未审核[<a href="Javascript:window.location.reload()" class="style1">刷新</a>]</div></td>
  </tr>
</table>
    </fieldset></td>
  </tr>
</table>
</body>
</html>


我采集的是[url=http://app.ntonline.cn/imarket/c_.asp?page=1]http://app.ntonline.cn/imarket/c_.asp?page=1[/url]上的数据,采集出错-HTTP 500 - 内部服务器错误
望高手指点一二

momo 2008-3-12 14:34

大义乌的后台采集是固定的信息采集,他把采集规则全部写入了程序,你要换成别的采集信息,要修改采集文件的目标地址和相应的采集规则!

taonywu 2008-3-21 15:44

*** 严禁恶意灌水 内容自动屏蔽 ***

dzbcorg0804 2008-5-18 02:22

上海搬家为灾区人们祈祷

*** 作者被禁止或删除 内容自动屏蔽 ***

wfnet 2008-6-23 01:14

给钱!
我给你改
QQ876536

wrjswbt 2008-6-26 11:04

顶了
网人的采集系统不错哦,可以在后台添加采集规则,不用修改程序

宏8楮 2008-8-25 23:38

代开发票:13699874751 张先生

[font=黑体]诚信公司有各种发票,据可优惠向外代开。范围有(商品销售、餐饮、建筑、广告、服务、运输、印刷,国际货运发票....财务税务票 企业经济性质: 公司所在地: 其他经济 中国广东深圳市 经营模式: 员工人数: 其他 45 - 100 人 行业:...[/font]

庆力雯 2008-12-20 05:57

好啊~!

[size=6][b]一路看过来,看帖就回~[/b][/size]
[size=6]               [color=blue][b]支持[/b][/color]~!![/size]








[img]http://baike.360.cn/img/icon_bi_1.gif[/img]---------------------
[url=http://www.shadu86.com/][size=1]金山毒霸[/size][/url][size=1] [/size][url=http://www.kabasiji.org.cn/][size=1]卡巴斯基[/size][/url][size=1] [/size][url=http://www.office2003-xiazai.cn/][size=1]office[/size][/url][url=http://blog.duba2008.org/][size=1]金山毒霸2009[/size][/url] [url=http://www.jinshanduba9.net.cn/][size=1]金山毒霸杀毒软件[/size][/url][size=1] [/size][url=http://www.jinshanduba9.com.cn/][size=1]金山毒霸通行证[/size][/url][size=1] [/size][url=http://bbs.key99.cn/][size=1]计算机论坛[/size][/url]

klmn425 2008-12-26 16:33

Audio To Articles

No article writing experience necessary. [url=http://www.vponsale.com/invitations/]wedding invitations[/url]
Writers block never happens. [url=http://www.rs2guru.com]wedding invitations[/url]
SPEED/LEVERAGE Advantage: One article may take you an hour to write; but in one hour of speaking into a mic, you can easily create 15-20+ high quality original articles. [url=http://www.vponsale.com/]wedding dresses[/url]
Uniqueness factor is huge: No one speaks like you do. The quality of content you produce when speaking is uniquely different than when you write on the same topic. [url=http://www.rpgshow.com/lace-front-wigs-c-12.html]lace front wig[/url]
Remarkable Time Savings: Besides the huge return on [url=http://www.rpgshow.com/lace-wigs-c-9.html]lace wigs[/url] time, you can outsource the monotonous job of transcribing & editing your audio into articles.
页: [1]
查看完整版本: 大义乌采集程序修改求助!