Baidu News Classification Display news title demo using process

Source: Internet
Author: User
Tags character set regular expression

<!--#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). +?) &LT;/A&GT;.+?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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.