ASP reads XML instance Youku album acquisition program Lei Feng Edition

Source: Internet
Author: User

CopyCode The Code is as follows: <title> Lei Feng | Youku-album collection Program </Title>
<Form name = "form1" method = "Post" Action = "? Action = Add ">
<Table width = "95%" border = "0" align = "center" cellpadding = "0" cellspacing = "1" class = "tableborder">
<Tr> <TH colspan = "2" align = "center" class = "tableheadertext"> <font color = Red> Lei Feng | Youku-album collection program </ font> </TD> </tr>
<Tr> <TD align = "center"> <a href = "http://www.youku.com/playlist/" target = "_ blank"> Find Youku albums </a>
</TD>
</Tr>
<Tr> <TD bgcolor = "# ffffff" align = "center"> album address: <input name = "maxz" type = "text" value = "<% = request (" maxz ") %> "size =" 50 "> </TD> </tr>
<Tr> <TD align = "center" bgcolor = "# ffffff"> for example, album: http://www.youku.com/playlist_show/id_2344971.html </TD> </tr>
<Tr> <TD align = "center" bgcolor = "# ffffff"> <input name = "action" type = "Submit" id = "action" value = "Submit for analysis album address "> </TD> </tr>
<Tr> <TD align = "center" bgcolor = "# ffffff"> </TD> </tr>
</Table>
</Form>
<%

If request ("action") = "add" then
Maxz = request. Form ("maxz ")

V_urla = Split (maxz, "/ID _") (1)
V_urlb = Replace (v_urla, ". html ","")
V_url = "http://www.youku.com/playlist/rss/id/4014024" & v_urlb
Response. write "<Div align =" "center" "> <a href =" & v_url & "target = _ blank> XML of the current album: "& v_url &" </a> </div>"

Function getpagecontent (URL)
Dim httpobj
On Error resume next
Set httpobj = server. Createobject ("Microsoft. XMLHTTP ")
With httpobj
. Open "get", URL, false ,"",""
. Send
End
If httpobj. readystate <> 4 then
Set httpobj = nothing
Getpagecontent = false
Exit Function
End if
Getpagecontent = Replace (httpobj. responsetext, "UTF-8", "gb2312 ")
Set httpobj = nothing
End Function
Strxml = getpagecontent ("" & v_url &"")
Set objxml = server. Createobject ("Microsoft. xmldom ")
Objxml. validateonparse = true
Objxml. async = false
Objxml. loadxml (strxml)
Set objrootelement = objxml.doc umentelement
If not isobject (objrootelement) then
Response. Write ("no file loaded ")
Else
Set channellist = objxml. getelementsbytagname ("item ")
If isnull (objxml. getelementsbytagname ("item") then
Response. Write ("read failed ")
Response. End ()
Else
Set statistics = objxml. getelementsbytagname ("title ")
Set keywordlist = objxml. getelementsbytagname ("lastbuilddate ")

'Response. Write "Total:" & keywordlist. Length-1 & "channels"
'Response. Write "<Div align =" "center" "> <H4> album name:" & Statistics. Item (0). Text & "</H4>"

V_name = Replace (Statistics. Item (0). Text, "Youku-album -","")
Zt_name = Replace (v_name, "video ","")
Response. Write "<Div align =" "center" "> <H4> album name: <font color = Red>" & zt_name & "</font> </H4>"
Response. Write "<center> <form method =" "Post" "Action =" ".../admin_add.asp">"
Response. Write "<input type =" "hidden" "name =" "db_channel" "value =" & zt_name & "/> <br>"
Response. Write "<input type =" "hidden" "name =" "db_player" "value =" "Youku" "/>"
Response. Write "<textarea name =" "db_url" "rows =" "15" "Cols =" 100 "">"
For J = 0 to channellist. Length-1
Dim Ibb
Response. write "" & channellist. item (j ). childnodes (0 ). text & "$" & channellist. item (j ). childnodes (8 ). text & CHR (13 )&""
Ibb = Ibb + 1
Next
Response. write "</textarea> <br/> <input type =" "Submit" "value =" "modified and submitted" "/> </form> </center>"
Response. write "<Div align =" "center"> <H4>: <font color = Red> "& Ibb &" </font> submit programs after verification </H4> </div> <br>"
End if
End if
%>
<% End if %>

The above program uses Youku's album list as an example to create an ASP read XML instance!
Save the above Code as XML. asp and run it in the IIS environment to collect the data of Youku album!

In fact, the above is the following XML file Copy code The Code is as follows: <? XML version = "1.0" encoding = "UTF-8"?>
<! -- Generator = "novajax feed writer" -->
<RSS version = "2.0" xmlns: Media = "http://search.yahoo.com/mrss" xmlns: iTunes = "http://www.itunes.com/dtds/podcast-1.0.dtd">
<Channel>
<Title> Youku-album-Qianlong and xiangfei (27 sets) Video </title>
<Description> Youku album Qianlong and xiangfei (27 sets) Video </description>
<Link> http://www.youku.com/playlist/ </link>
<Lastbuilddate> wed, 16 dec 2009 13:34:06 + 0800 </lastbuilddate>
<Generator> novajax feed writer </generator>
<Image>
<URL> http://www.youku.com/index/img/youkulogo.gif </URL>
<Title> Youku-China's No. 1 video network, which provides video playback, video publishing, and video search </title>
<Link> http://www.youku.com </link>
<Description> the video service platform provides video playback, video publishing, video search, and video sharing. </description>
</Image>
<Item>
<Title> Qianlong and xiangfei 01 </title>
<Link> http://www.youku.com/v_show/id_XMTM4NTY5NDk2_rss.html </link>
<Description> <! [CDATA [<a href = "http://www.youku.com/v_show/id_XMTM4NTY5NDk2_rss.html"> </a> <a href = "http://www.youku.com/v_show/id_XMTM4NTY5NDk2_rss.html"> </a> <a href = "http://www.youku.com/v_show/id_XMTM4NTY5NDk2_rss.html"> </a> <p> </P>]> </description>
<ITunes: duration> 43: 42 </iTunes: duration>
<ITunes: keywords> Zun-Dragon, nu'er Bian, Tian Niu, Weng Hong, ayinur, guhaier, Tan Feiling, wallay, and zemujiang </iTunes: keywords>
<Author> for login and sinking </author>
<Comments> http://www.youku.com/v_show/id_XMTM4NTY5NDk2_rss.html#comments </comments>
<Pubdate> wed, 16 dec 2009 13:34:06 + 0800 </pubdate>
<Guid> 34642374 </GUID>
<Enclosure type = "application/X-Shockwave-flash" url = "http://player.youku.com/player.php/sid/34642374/v.swf"> </enclosure>
</Item>
<Item>
<Title> Qianlong and xiangfei 02 </title>
<Link> http://www.youku.com/v_show/id_XMTM4NTY5NTI4_rss.html </link>
<Description> <! [CDATA [<a href = "http://www.youku.com/v_show/id_XMTM4NTY5NTI4_rss.html"> </a> <a href = "http://www.youku.com/v_show/id_XMTM4NTY5NTI4_rss.html"> </a> <a href = "http://www.youku.com/v_show/id_XMTM4NTY5NTI4_rss.html"> </a> <p> </P>]> </description>
<ITunes: duration> 41: 26 </iTunes: duration>
<ITunes: keywords> Zun-Dragon, nu'er Bian, Tian Niu, Weng Hong, ayinur, guhaier, Tan Feiling, wallay, and zemujiang </iTunes: keywords>
<Author> for login and sinking </author>
<Comments> http://www.youku.com/v_show/id_XMTM4NTY5NTI4_rss.html#comments </comments>
<Pubdate> wed, 16 dec 2009 13:34:06 + 0800 </pubdate>
<Guid> 34642382 </GUID>
<Enclosure type = "application/X-Shockwave-flash" url = "http://player.youku.com/player.php/sid/34642382/v.swf"> </enclosure>
</Item>
</Channel>
</RSS>

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.