MP3 resources are on the Internet, and sometimes it is normal to be unable to hear it, but most of them are not easy to use, which is really useless. After carefully analyzing its source code, it turns out to be reading the 1.xml, 2. xml... 4. xml file in the directory. I often listen to songs in the tomato garden, that is, http://www.tomatolei.com, I want to be able to put the tomato MP3 resources here? Isn't that the function of MP3 thieves that everyone often talks about? Just do it!
1. analyze the source of tomato garden Song: pageurl = "http://tomatolei.com/bbs/T_playlist.asx ";
2. Target address: 1.xml
3. UseProgramConversion format:
Front-end:
<% @ Page Language = "C #" codebehind = "readandwritexml. aspx. cs" autoeventwireup = "false" inherits = "read mp3.readandwritexml" validaterequest = false %>
<! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en">
<HTML>
<Head>
<Title> Read the MP3 list in tomato garden. </title>
<Meta content = "Microsoft Visual Studio. NET 7.1" name = "generator">
<Meta content = "C #" name = "code_language">
<Meta content = "JavaScript" name = "vs_defaultclientscript">
<Meta content = "http://schemas.microsoft.com/intellisense/ie5" name = "vs_targetschema">
</Head>
<Body ms_positioning = "gridlayout">
<Form ID = "form1" method = "Post" runat = "server">
<Font face = "">
<Asp: textbox id = "textbox1" style = "Z-INDEX: 101; left: 56px; position: absolute; top: 32px" runat = "server"
Width = "312px" Height = "240px" textmode = "multiline"> </ASP: textbox>
<Asp: button id = "button1" style = "Z-INDEX: 102; left: 160px; position: absolute; top: 288px" runat = "server"
Width = "96px" text = "corrected ~ "> </ASP: button> </font> </form>
</Body>
</Html>
Background:
using system;
using system. collections;
using system. componentmodel;
using system. data;
using system. drawing;
using system. web;
using system. web. sessionstate;
using system. web. ui;
using system. web. UI. webcontrols;
using system. web. UI. htmlcontrols;
using system. io;
using system. net;
using system. text;
using system. text. regularexpressions;
namespace read Take the abstract description of MP3
{< br> ///
/// webform1 in tomato garden.
//
public class readandwritexml: system. web. UI. page
{< br> protected system. web. UI. webcontrols. textbox textbox1;
protected system. web. UI. webcontrols. button button1;
private string pageurl = "";
Private void page_load (Object sender, system. eventargs E)
{
// Place the user hereCodeTo initialize the page
If (! Ispostback)
{
/// First read the acx file (http://tomatolei.com/bbs/T_playlist.asx) of Tomato Garden)
///
Pageurl = "http://tomatolei.com/bbs/T_playlist.asx ";
WebClient WC = new WebClient ();
WC. Credentials = credentialcache. defaultcredentials;
Byte [] pagedata = WC. downloaddata (pageurl );
String result = encoding. Default. getstring (pagedata );
Textbox1.text = result;
}
}
# Code generated by region web Form Designer
Override protected void oninit (eventargs E)
{
//
// Codegen: This call is required by the ASP. NET web form designer.
//
Initializecomponent ();
Base. oninit (E );
}
/// <Summary>
/// The designer supports the required methods-do not use the code editor to modify
/// Content of this method.
/// </Summary>
Private void initializecomponent ()
{
This. button1.click + = new system. eventhandler (this. button#click );
This. Load + = new system. eventhandler (this. page_load );
}
# Endregion
Private void button#click (Object sender, system. eventargs E)
{
String temp = textbox1.text;
Textbox1.text = "<musics firstrun = \" 1 \ "> ";
Textbox1.text + = temp;
Textbox1.text = textbox1.text. Replace ("<ASX version = 3.0> ","");
Textbox1.text = textbox1.text. Replace ("<Param name = \" allowshuffle \ "value = \" Yes \ "/> ","");
Textbox1.text = textbox1.text. Replace ("</ASX> ","");
Textbox1.text = textbox1.text. Replace ("</entry> ","");
Textbox1.text = textbox1.text. Replace ("<entry> ","");
Textbox1.text = textbox1.text. Replace ("<title>", "<music name = \"");
Textbox1.text = textbox1.text. Replace ("</title> ","\"");
Textbox1.text = textbox1.text. Replace ("<ref href =", "addres = ");
Textbox1.text + = "</musics> ";
// Textbox1.text = textbox1.text. Replace ("\ r \ n ","");
/// Start generating the 1. xml file below
///
Streamwriter swfromfilestreamutf8buffer = new streamwriter (server. mappath ("./") + "1.xml", false, system. Text. encoding. utf8, 512 );
Swfromfilestreamutf8buffer. Write (textbox1.text );
Swfromfilestreamutf8buffer. Flush ();
Swfromfilestreamutf8buffer. Close ();
}
}
}