BVB Source Codes

Jie Yang v0.6.3 article system Show Admin_ItemCollecSteady.asp Source code

Return Download Jie Yang v0.6.3 article system: download Admin_ItemCollecSteady.asp Source code - Download Jie Yang v0.6.3 article system Source code - Type:.asp
  1. <!--#include file="inc/conn.asp"-->
  2. <!--#include file="inc/function.asp"-->
  3. <!--#include file="inc/ubbcode.asp"-->
  4. <!--#include file="inc/clsCache.asp"-->
  5. <%
  6. Dim ItemNum,ListNum,ListSuccesNum,ListFalseNum,newsNumAll
  7. Dim RsItem,SqlItem,ItemEnd,ListEnd,ErrMsg
  8.  
  9. '项目变量
  10. Dim ItemID,ItemName,LoginType,LoginUrl,LoginPostUrl,LoginUser,LoginPass,LoginFalse
  11. Dim ListStr,LsString,LoString,ListPaingType,LPsString,LPoString,ListPaingStr1,ListPaingStr2,ListPaingID1,ListPaingID2,ListPaingStr3,HsString,HoString,HttpUrlType,HttpUrlStr,CollecListNum,CollecnewsNum
  12.  
  13. '采集相关的变量
  14. Dim Arr_i,newsUrl
  15.  
  16. '其它变量
  17. Dim LoginData,LoginResult
  18. Dim Arr_Item,CacheTemp,CollecOrder,OrderTemp
  19.  
  20. '执行时间变量
  21. Dim StartTime,OverTime
  22.  
  23. '列表
  24. Dim ListUrl,ListCode,newsArrayCode,newsArray,ListArray,ListPaingNext,ListPaingTemp
  25.  
  26. CacheTemp=Lcase(trim(request.ServerVariables("SCRIPT_NAME")))
  27. CacheTemp=left(CacheTemp,instrrev(CacheTemp,"/"))
  28. CacheTemp=replace(CacheTemp,"\","_")
  29. CacheTemp=replace(CacheTemp,"/","_")
  30. CacheTemp="ansir" & CacheTemp
  31.  
  32. ItemNum=Clng(Trim(Request("ItemNum")))
  33. ListNum=Clng(Trim(Request("ListNum")))
  34. ListSuccesNum=Clng(Trim(Request("ListSuccesNum")))
  35. ListFalseNum=Clng(Trim(Request("ListFalseNum")))
  36. newsNumAll=Clng(Trim(Request("newsNumAll")))
  37. ListPaingNext=Trim(Request("ListPaingNext"))
  38.  
  39. FoundErr=False
  40. ItemEnd=False
  41. ListEnd=False
  42. CollecListNum=0
  43. CollecnewsNum=0
  44.  
  45. Call SetCache()
  46.  
  47. If ItemEnd<>True Then
  48.    If (ItemNum-1)>Ubound(Arr_Item,2) then
  49.       ItemEnd=True
  50.    Else
  51.       Call SetItems()
  52.    End If
  53. End If
  54.  
  55. If ItemEnd<>True Then
  56.    If ListPaingType=0 Then
  57.       If ListNum=1 Then
  58.          ListUrl=ListStr
  59.       Else
  60.          ListEnd=True
  61.       End If
  62.    ElseIf ListPaingType=1 Then
  63.       If ListNum=1 Then
  64.          ListUrl=ListStr
  65.       Else
  66.          If ListPaingNext="" or ListPaingNext="$False$" Then
  67.             ListEnd=True
  68.          Else
  69.             ListPaingNext=Replace(ListPaingNext,"{$ID}","&")
  70.             ListUrl=ListPaingNext
  71.          End If
  72.       End If
  73.    ElseIf ListPaingType=2 Then
  74.       If ListPaingID1>ListPaingID2 then
  75.          If (ListPaingID1-ListNum+1)<ListPaingID2 or (ListPaingID1-ListNum+1)<0 Then
  76.             Listend=True
  77.          Else
  78.             ListUrl=Replace(ListPaingStr2,"{$ID}",Cstr(ListpaingID1-ListNum+1))
  79.          End if
  80.       Else
  81.          If (ListPaingID1+ListNum-1)>ListPaingID2 Then
  82.             ListEnd=True
  83.          Else
  84.             ListUrl=Replace(ListPaingStr2,"{$ID}",CStr(ListPaingID1+ListNum-1))
  85.          End If
  86.       End If      
  87.    ElseIf ListPaingType=3  Then
  88.       ListArray=Split(ListPaingStr3,"|")
  89.       If (ListNum-1)>Ubound(ListArray) Then
  90.          ListEnd=True
  91.       Else
  92.          ListUrl=ListArray(ListNum-1)
  93.       End If    
  94.    End If
  95.    If ListNum>CollecListNum And CollecListNum<>0 Then
  96.       ListEnd=True
  97.    End if
  98. End If
  99.  
  100. If ItemEnd=True Then
  101.    ErrMsg="<br>列表分析完成"
  102.    ErrMsg=ErrMsg & "<br>成功分析: "  &  ListSuccesNum  &  "  页列表,失败: "    &  ListFalseNum  &  "  页,信息:" & newsNumAll & "  条"
  103.    ErrMsg=ErrMsg& "<br>正在整理数据,稍后进行信息的采集..."
  104.    ErrMsg=ErrMsg & "<meta http-equiv=""refresh"" content=""3;url=Admin_ItemCollecnews.asp?ItemNum=1&newsNum=1&newsSuccesNum=0&newsFalseNum=0&ImagesNumAll=0&newsNumAll=" & newsNumAll & """>"
  105. Else
  106.    If ListEnd=True Then
  107.       ItemNum=ItemNum+1
  108.       ListNum=1
  109.       ErrMsg="<br>" & ItemName & "  项目所有列表分析完成,正在整理数据请稍后..."
  110.       ErrMsg=ErrMsg & "<meta http-equiv=""refresh"" content=""3;url=Admin_ItemCollecSteady.asp?ItemNum=" & ItemNum & "&ListNum=" & ListNum & "&ListSuccesNum=" & ListSuccesNum & "&ListFalseNum=" & ListFalseNum & "&newsNumAll=" & newsNumAll & """>"
  111.    End If
  112. End If
  113.  
  114. Call TopItem()
  115. If ItemEnd<>True And ListEnd<>True Then
  116.    FoundErr=False
  117.    ErrMsg=""
  118.    Call StartCollection()
  119. End  If
  120.  
  121. Call WriteSucced(ErrMsg)
  122. Response.Flush()
  123. %>
  124.  
  125. <%
  126. '==================================================
  127. '过程名:StartCollection
  128. '作  用:开始采集
  129. '参  数:无
  130. '==================================================
  131. Sub StartCollection
  132.  
  133. '第一次采集时登录
  134. If LoginType=1 And ListNum=1 then
  135.    LoginData=UrlEncoding(LoginUser & "&" & LoginPass)
  136.    LoginResult=PostHttpPage(LoginUrl,LoginPostUrl,LoginData)
  137.    If Instr(LoginResult,LoginFalse)>0 Then
  138.       FoundErr=True
  139.       ErrMsg=ErrMsg & "<br><li>在登录网站时发生错误,请确保登录信息的正确性!</li>"
  140.    End If
  141. End If
  142.  
  143.  
  144. If FoundErr<>True then
  145.    ListCode=GetHttpPage(ListUrl)
  146.    Call GetListPaing()
  147.    If ListCode="$False$" Then
  148.       FoundErr=True
  149.       ErrMsg=ErrMsg & "<br><li>在获取列表:" & ListUrl & "网页源码时发生错误!</li>"
  150.    Else
  151.       ListCode=GetBody(ListCode,LsString,LoString,False,False)
  152.       If ListCode="$False$" Or ListCode="" Then
  153.          FoundErr=True
  154.          ErrMsg=ErrMsg & "<br><li>在截取:" & ListUrl & "的信息列表时发生错误!</li>"
  155.       End If
  156.    End If
  157. End If
  158.  
  159. If FoundErr<>True Then
  160.    newsArrayCode=GetArray(ListCode,HsString,HoString,False,False)
  161.    If newsArrayCode="$False$" Then
  162.       FoundErr=True
  163.       ErrMsg=ErrMsg & "<br><li>在分析:" & ListUrl & "信息列表时发生错误!</li>"
  164.    Else
  165.       newsArray=Split(newsArrayCode,"$Array$")
  166.       For Arr_i=0 to Ubound(newsArray)
  167.          If HttpUrlType=1 Then
  168.             newsArray(Arr_i)=Trim(Replace(HttpUrlStr,"{$ID}",newsArray(Arr_i)))
  169.          Else
  170.             newsArray(Arr_i)=Trim(DefiniteUrl(newsArray(Arr_i),ListUrl))          
  171.          End If
  172.          newsArray(Arr_i)=CheckUrl(newsArray(Arr_i))
  173.       Next
  174.       If CollecOrder=True Then
  175.          For Arr_i=0 to Fix(Ubound(newsArray)/2)
  176.             OrderTemp=newsArray(Arr_i)
  177.             newsArray(Arr_i)=newsArray(Ubound(newsArray)-Arr_i)
  178.             newsArray(Ubound(newsArray)-Arr_i)=OrderTemp
  179.          Next
  180.       End If
  181.    End If
  182. End If
  183.  
  184. If FoundErr<>True Then
  185.    ErrMsg=ErrMsg & "<br>本次运行 " & Ubound(Arr_Item,2)+1 & " 个项目"
  186.    ErrMsg=ErrMsg & "<br>从第 " & ItemNum  & " 个项目 " & ItemName & " 的第 "  & ListNum & " 页列表分析出 " & Ubound(newsArray) & " 条信息"
  187.    If CollecnewsNum<>0 Then
  188.       ErrMsg=ErrMsg & ",限制 " & CollecnewsNum & " 条。"
  189.       If (CollecnewsNum-1)>Ubound(newsArray) Then
  190.          CollecnewsNum=Ubound(newsArray)+1
  191.       Else
  192.          '保持不变CollecnewsNum
  193.       End If
  194.    Else
  195.       CollecnewsNum=Ubound(newsArray)+1
  196.    End If
  197.    ListSuccesNum=ListSuccesNum+1
  198.    newsNumAll=newsNumAll+CollecnewsNum
  199.    Call SavenewsList()
  200. Else
  201.    ListFalseNum=ListFalseNum+1
  202. End If
  203. ErrMsg=ErrMsg & "<br>" & "<meta http-equiv=""refresh"" content=""3;url=Admin_ItemCollecSteady.asp?ItemNum=" & ItemNum & "&ListNum=" & ListNum+1 & "&ListSuccesNum=" & ListSuccesNum & "&ListFalseNum=" & ListFalseNum & "&newsNumAll=" & newsNumAll & "&ListPaingNext=" & ListPaingNext  & """>"
  204.  
  205. End Sub
  206.  
  207.  
  208. '==================================================
  209. '过程名:SetCache
  210. '作  用:存取缓存
  211. '参  数:无
  212. '==================================================
  213. Sub SetCache()
  214.    Dim myCache
  215.    Set myCache=new clsCache
  216.  
  217.    '项目信息
  218.    myCache.name=CacheTemp & "items"
  219.    If myCache.valid then
  220.       Arr_Item=myCache.value
  221.    Else
  222.       ItemEnd=True
  223.    End If
  224.    Set myCache=Nothing
  225. End Sub
  226.  
  227. Sub SetItems()
  228.       Dim ItemNumTemp
  229.       ItemNumTemp=ItemNum-1
  230.       ItemID=Arr_Item(0,ItemNumTemp)
  231.       ItemName=Arr_Item(1,ItemNumTemp)
  232.          
  233.           LoginType=Arr_Item(6,ItemNumTemp)
  234.       LoginUrl=Arr_Item(7,ItemNumTemp)          '登录
  235.       LoginPostUrl=Arr_Item(8,ItemNumTemp)
  236.       LoginUser=Arr_Item(9,ItemNumTemp)
  237.       LoginPass=Arr_Item(10,ItemNumTemp)
  238.       LoginFalse=Arr_Item(11,ItemNumTemp)
  239.       ListStr=Arr_Item(12,ItemNumTemp)            '列表地址
  240.       LsString=Arr_Item(13,ItemNumTemp)          '列表
  241.       LoString=Arr_Item(14,ItemNumTemp)
  242.       ListPaingType=Arr_Item(15,ItemNumTemp)
  243.       LPsString=Arr_Item(16,ItemNumTemp)          
  244.       LPoString=Arr_Item(17,ItemNumTemp)
  245.       ListPaingStr1=Arr_Item(18,ItemNumTemp)
  246.       ListPaingStr2=Arr_Item(19,ItemNumTemp)
  247.       ListPaingID1=Arr_Item(20,ItemNumTemp)
  248.       ListPaingID2=Arr_Item(21,ItemNumTemp)
  249.       ListPaingStr3=Arr_Item(22,ItemNumTemp)
  250.       HsString=Arr_Item(23,ItemNumTemp)  
  251.       HoString=Arr_Item(24,ItemNumTemp)
  252.       HttpUrlType=Arr_Item(25,ItemNumTemp)
  253.       HttpUrlStr=Arr_Item(26,ItemNumTemp)
  254.          
  255.       CollecListNum=Arr_Item(77,ItemNumTemp)
  256.       CollecnewsNum=Arr_Item(78,ItemNumTemp)
  257.       CollecOrder=Arr_Item(81,ItemNumTemp)
  258. End Sub
  259.  
  260. '==================================================
  261. '过程名:GetListPaing
  262. '作  用:获取列表下一页
  263. '参  数:无
  264. '==================================================
  265. Sub GetListPaing()
  266.    If ListPaingType=1 Then
  267.       ListPaingNext=GetPaing(ListCode,LPsString,LPoString,False,False)
  268.       ListPaingNext=FpHtmlEnCode(ListPaingNext)
  269.       If ListPaingNext<>"$False$" And ListPaingNext<>"" Then
  270.          If ListPaingStr1<>""  Then  
  271.             ListPaingNext=Replace(ListPaingStr1,"{$ID}",ListPaingNext)
  272.          Else
  273.             ListPaingNext=DefiniteUrl(ListPaingNext,ListUrl)
  274.          End If
  275.          ListPaingNext=Replace(ListPaingNext,"&","{$ID}")
  276.       End If
  277.    Else
  278.       ListPaingNext="$False$"
  279.    End If
  280. End Sub
  281.  
  282. '==================================================
  283. '过程名:SavenewsList
  284. '作  用:保存信息
  285. '参  数:无
  286. '==================================================
  287. Sub SavenewsList
  288.    set rs=server.createobject("adodb.recordset")
  289.    sql="select top 1 * from newsList"
  290.    rs.open sql,connItem,1,3
  291.    For Arr_i=1 To CollecnewsNum
  292.       rs.addnew
  293.       rs("ItemID")=ItemID
  294.       rs("newsUrl")=newsArray(Arr_i-1)
  295.       rs.update
  296.    Next
  297.    rs.close
  298.    set rs=nothing
  299. End Sub
  300.  
  301. '==================================================
  302. '过程名:TopItem
  303. '作  用:显示导航信息
  304. '参  数:无
  305. '==================================================
  306. Sub TopItem()%>
  307. <html>
  308. <head>
  309. <title>信息采集系统</title>
  310. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  311. <link rel="stylesheet" type="text/css" href="../style/Style.css">
  312. </head>
  313. <body>
  314. <table width="98%" align="center" border="0" cellpadding="0" cellspacing="1" bgcolor="#8ED1FF" class="mtab">
  315.   <tr>
  316.     <td class="td28">采集系统采集理管理</td>
  317.   </tr>
  318.   <tr class="td26" bgcolor="#FFFFFF">
  319.     <td><b>管理导航:</b><a href="Admin_ItemStart.asp">管理首页</a> >> 信息采集</td>
  320.   </tr>
  321. </table>
  322. <table width="98%" align="center" border="0" cellpadding="0" cellspacing="1" bgcolor="#8ED1FF" class="mtab">    
  323.   <tr>
  324.     <td bgcolor="#FFFFFF" aling="center" style="padding:4px; line-height:30px;">采集需要一定的时间,请耐心等待,如果网站出现暂时无法访问的情况这是正常的,采集正常结束后即可恢复。</td>
  325.   </tr>
  326. </table>
  327. <%End Sub%>
  328. </body>        
  329. </html>
  330.  
  331.  
  332.  
  333.  
downloadAdmin_ItemCollecSteady.asp Source code - Download Jie Yang v0.6.3 article system Source code
Related Source Codes/Software:
Jilin classification information release system v5.0 trial version - A ready-made classifieds site publishing system, h... 2016-09-21
Linyi CMS v6.5 market classification information - A. supply and demand information function: informa... 2016-09-21
Tesco discount net SQL version - And presentations, faster. 2016-09-21
- electronic enterprise website management system In a fully functional version - Super suitable for enterprise agents build a corpo... 2016-09-21
Rio mesh network hard disk system v3.0 - System functions: 1, increase the progress of Asp... 2016-09-21
Classified information network business in suzhou - Overall module: classification of supply and deman... 2016-09-21
NPOINT virtual host v1.7.0 formal version management system - The system main function is introduced 2016-09-21
IDC sales web site - Beautiful IDC sales web site source code 2016-09-21
Oo 126 CMS movie site system - This procedure ASP + ACC/ASP + SQL, using new kern... 2016-09-21
Pcook CMS bubble guest v3.0 SDCMS version - Developed by Asp+Access, and meet the needs of sma... 2016-09-21
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top