<!--#include file= "cls_thief.asp"-->
<%
' Baidu News Classification display News title demonstration using process
'============================================================================
Show = Request ("show")
If show = "" Then show = 0
Call Showajaxdata (show)
Sub Showajaxdata (groupnum)
Dim GG
Set GG = new Cls_thief
with GG
. Iscachename = ' WellFrog1 ' sets the cache name, cannot be empty, or it may be wrong, but can be empty when the refresh time is 0
. Isrefreshtime = 10 ' Set the minimum time to refresh the cache (in minutes), that is, after this time, if someone visits the page, then go back to the data source site grab data, 0 for the instant
. Isgroupnum = 13 ' Sets the number of groupings, that is, dividing all the data into groups.
'------------------------------------------
. Isbeta = "" To set the Ajax object version, NULL to use the default
. Ismethod = ' Get ' Sets the commit mode, NULL is the default [get]
. Isurl = "http://news.baidu.com" ' Sets the scratched Web page, cannot be empty, otherwise the consequences are conceited
. Ischar = 1 ' Set character set 0 to UTF8, 1 to gb2312. Is null is the default [gb2312]
'------------------------------------------
. Ispattern = "Class=r href=" "(. +?)" "Target=_blank> (?! 10px). +?) </A>.+?F6F "" > (?! <nobr>). +?) </font> "' Set regular expression, cannot be empty, otherwise the consequence is conceited
. isignorecase = True ' setting is case-insensitive and cannot be empty
. IsGlobal = True ' Set global availability, cannot be empty
End With
' Getsortdata the corresponding number
' 0, Focus 1, Domestic 2, International 3, Finance 4, interconnection net 5, real estate 6, automobile 7, sports 8, entertainment 9, Education 10, Health 11, Science and technology 12, social
ARR = Gg. Getgroupdata (groupnum)
Set GG = Nothing
Response.Write (Tojsstr (ARR))
End Sub
' The array to be used to convert the 2d array to JS
Function tojsstr (arr2d)
str = ""
for j = 0 to Ubound (arr2d,2)
&nb Sp For i = 0 to Ubound (arr2d,1)
if i = 0 Then str = str & "{"
str = str & "N" & I & ":" "" & Encode (arr2d (i,j)) & "" "
if I <> Ubound (arr2d,1) n
str = str & ","
else
str = str & "}"
if J <> Ubound (arr2d,2) Then str = str & ","
end If
&N Bsp; next
next
tojsstr = str
End Function
%>
<script language= " JavaScript "runat=" "Server"
function encode (str) {
return escape (str);
}
function decode (str) {
return unescape (str);
}
</script>