ASP Read XML example Youku Album acquisition program Lei Feng Version _ Application Tips

Source: Internet
Author: User
Tags cdata comments generator xml example xmlns

Copy Code code as follows:

<title> Lei Feng | Youku-Album COLLECTION program </title><form name= "Form1" method= "Post" action= "Action=add" >
<table width= "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>
&LT;TR&GT;&LT;TD align= "center" ><a href= "http://www.youku.com/playlist/" target= "_blank" > Dot I find Youku albums </a >
</td>
</tr>
&LT;TR&GT;&LT;TD bgcolor= "#FFFFFF" align= "Center" > Album Address: <input name= "Maxz" type= "text" value= "<%=request" (" Maxz ")%>" size= "></td></tr>
&LT;TR&GT;&LT;TD align= "center" bgcolor= "#FFFFFF" > such as album:http://www.youku.com/playlist_show/id_2344971.html< /td></tr>
&LT;TR&GT;&LT;TD align= "center" bgcolor= "#FFFFFF" ><input name= "action" type= "submit" id= "Action" value= " Submit analysis of this album address "></td></tr>
&LT;TR&GT;&LT;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 > Current album xml:" &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 With
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.documentelement
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& Channel"
' Response.Write ' <div align= "center" >
V_name=replace (Statistics.item (0). Text, "Youku-albums-", "" "
Zt_name=replace (V_name, "video", "")
Response.Write "<div align=" "Center" >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=" "" "" cols= "", "" > "
For J=0 to Channellist.length-1
Dim Ibb
Response.Write "" &channellist.item (j). ChildNodes (0) .text& "$" &channellist.item (j). ChildNodes (8). Text &AMP;CHR (& "")
Ibb=ibb+1
Next
Response.Write "</textarea><br/><input type=" "Submit" "value=" "modified to submit" "/></form></ Center> "
Response.Write "<div align=" "Center" >End If
End If
%>
<%end If%>

The above program is an example of an ASP reading XML from the list of Youku albums!
Save the above code as XML. The ASP can collect the data of Youku album in the IIS Environment!

In fact, the above gets the following XML file
Copy Code code 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-albums-Qianlong and Princess (27 episodes) video </title>
<description> Cool album Qianlong and Princess (27 episodes) of video </description>
<link>http://www.youku.com/playlist/</link>
<lastbuilddate>wed, Dec 2009 13:34:06 +0800</lastbuilddate>
<generator>novajax Feed writer</generator>
<image>
<url>yun_qi_img/youkulogo.gif</url>
<title> Youku-China's first video network, providing video playback, video publishing, video Search </title>
<link>http://www.youku.com</link>
<description> Video service platform, providing video playback, video publishing, video search, video sharing </description>
</image>
<item>
<title> Qianlong and the 01</title> of the fragrant princess
<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> Dragon, Nurbia, Tian Girl, Yung Ewong, Ayinur, Haier, Tan Fei Ling, Vali, Slamdins </itunes:keywords>
<author> for Jeff Shen Boundary </author>
<comments>http://www.youku.com/v_show/id_XMTM4NTY5NDk2_rss.html#comments</comments>
<pubdate>wed, 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 the 02</title> of the fragrant princess
<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> Dragon, Nurbia, Tian Girl, Yung Ewong, Ayinur, Haier, Tan Fei Ling, Vali, Slamdins </itunes:keywords>
<author> for Jeff Shen Boundary </author>
<comments>http://www.youku.com/v_show/id_XMTM4NTY5NTI4_rss.html#comments</comments>
<pubdate>wed, 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>

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.