With a good example of XMLHTTP _ Thieves/Collection

Source: Internet
Author: User
Tags trim
Enter Www.ting88.com's website, the singer album page URL copied to the text box and then submit to get the song download path, such as: http://www.ting88.com/MusicList/4141.htm

The source program is as follows:

<%
On Error Resume Next
Dim id,url,getcode,m,i,j,s,d,ns,nd,num,name
Id=trim (Request.QueryString ("id"))
' 1. Get all the contents of the original page
Function gethttppage (URL)
Dim http
Set Http=server.createobject ("Microsoft.XMLHTTP")
Http.open "Get", Url,false
Http.send ()
If Http.readystate<>4 Then
Exit function
End If
Gethttppage=bytestobstr (Http.responsebody, "GB2312")
Set http=nothing
If Err.number<>0 then err. Clear
End Function

' 2. Code conversion
Function Bytestobstr (Body,cset)
Dim objstream
Set objstream = Server.CreateObject ("ADODB.stream")
Objstream. Type = 1
Objstream. Mode =3
Objstream. Open
Objstream. Write body
Objstream. Position = 0
Objstream. Type = 2
Objstream. Charset = Cset
Bytestobstr = objstream. ReadText
Objstream. Close
Set objstream = Nothing
End Function

' Get plaintext URL
function Myreplace (CONVSTR)
Convstr=replace (Convstr, "Yvi", "1")
Convstr=replace (Convstr, "ESR", "2")
Convstr=replace (Convstr, "Sxn", "3")
Convstr=replace (Convstr, "STI", "4")
Convstr=replace (Convstr, "Wfu", "5")
Convstr=replace (Convstr, "Lqu", "6")
Convstr=replace (Convstr, "Qgi", "7")
Convstr=replace (Convstr, "BLA", "8")
Convstr=replace (Convstr, "Jfu", "9")
Convstr=replace (Convstr, "LSN", "0")
Convstr=replace (Convstr, "XPG", "/")
Convstr=replace (Convstr, "Xqd", ".")
Convstr=replace (Convstr, "", "")
Convstr=replace (Convstr, "%20", "")
Convstr=replace (Convstr, "KWD", "Wma")
Myreplace=convstr
End Function

If id= "1" Then
Url=trim (Request.Form ("Txturl"))
If Url= "" Then
Response.Redirect ("getmusic.asp")
Response.End ()
End If
' Url= ' http://www.ting88.com/MusicList/1454.htm '
S=0
D=0
Ns=0
Nd=0
Getcode=gethttppage (URL)
Num=mid (Getcode,instrrev (GetCode, ". <a href") -3,2) ' Get the number of songs
Name=mid (Getcode,instr (GetCode, "singer Name:") +5,10) ' Get singer
M= "http://218.75.78.189/33445566/"
Response.Write "<center> this face page to find" & name & "<font color=red>" & num& "</font> song" ; "<br/><br/>"
Response.Write "<table width= ' 80% ' border= ' 1 ' bordercolor= ' #A4C8FF ' cellpadding= ' 0 ' cellspacing= ' 0 ' ><tr> <td> page url:<a href= ' "& URL &" ' target= ' _blank ' > ' & URL & ' </a></td></tr>& Lt;/table>Response.Write ' <table width= ' 80% ' border= ' 0 ' cellpadding= ' 0 ' cellspacing= ' 0 ' bgcolor= ' #A4C8FF ' ><tr>< Td><table border= ' 0 ' width= ' 100% ' cellpadding= ' 2 ' cellspacing= ' 1 ' ><tr><td align=center ' bgcolor= ' # FFFFFF ' > Serial number &LT;/TD&GT;&LT;TD align=center bgcolor= ' #FFFFFF ' > Song name </td><td align=center ' # FFFFFF ' > Operation </td></tr> '
For I=1 to Num
S=instr (I+s,getcode, "checked" "value=")
D=instr (I+d,getcode, "KWD ' >")
Ns=instr (I+ns,getcode, "word=")
Nd=instr (I+nd,getcode, "&inc=")
Response.Write "<tr><td align=center bgcolor= ' #FFFFFF ' >" & I & "</td><td bgcolor=" # FFFFFF ' > <a href= ' & M & Myreplace (Mid (GETCODE,S+16,D-S-13)) & "' > ' & Mid (getcode,ns+5,nd-ns-5 ) & "</a><br/></td><td align=center bgcolor= ' #FFFFFF ' ><a href= '" & M & Myreplace (Mid (GETCODE,S+16,D-S-13)) & "' > Download </a></td></tr>"
Next
Response.Write "</table></td></tr></table></center>"
End If


%>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> get the URL address of the album Song </title>
<body>
<form name= "Form1" method= "Post" action= "getmusic.asp?id=1" >
<table width= ' 80% ' border= ' 0 ' align= ' center ' cellpadding= ' 0 ' cellspacing= ' 0 ' bgcolor= ' #A4C8FF ' >
<tr><td><table width= "100%" border= "0" align= "center" cellpadding= "2" cellspacing= "1" >
<tr>
&LT;TD height= > get the URL address of the album Song </td>
</tr>
<tr>
&LT;TD height= bgcolor= "#FFFFFF" > Web address:
<input name= "Txturl" type= "text" id= "Txturl" size= "M" Maxlength= "></td>"
</tr>
<tr>
&LT;TD height= "bgcolor=" "#FFFFFF" > <input type= "Submit" name= "submit" value= "Submit" style= "width:60" >
<input name= "reset" type= "reset" id= "reset" value= "reset" style= "width:60" ></td>
</tr>
</table></td></tr></table>
</form>
</body>

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.