Http://www.jb51.net/article/22031.htm
Personally feel not very satisfied, because vb.net in the. NET environment to perform the collection, the resulting network connection and regular matching consumption is too large, and my final application is in the video collection submission, so consider using JS ajax+ Regular expression to achieve this goal.
Have not been systematically learning JS and regular, so spend more time than expected, tossing a night, fooled the following code. =.. =
Code
Copy Code code as follows:
<!--
Night Smell Incense Original, reproduced please retain this information, thank you very much!
Blog: http://clso.cnblogs.com
Home: http://cleclso.cn
qq:315514678 e-mail:clso#qq.com
Welcome to the Technical Exchange!
-->
<title>javascipt AJAX & Regular Expression test</title>
<script type= "Text/javascript" language= "JavaScript" >
function wrt (s) {
Subret.value = s + "\ n" + subret.value;
Subret.value + = "\ n" + s;
}
var objrequest; Define an XML Request object
var previd = "", Nowid =0,listid = "", Iscancel=false; Other variables
function Getlid () {
var Listid = Weburl.value.match (/playlist_show\/.* (? =id_ (\d+)). *\.html$/i);
if (!listid) {
return null;
} else {
return listid[1];
}
}
function Retweb () {
if (objrequest.readystate = = 4 && objrequest.status = 200) {
Get callback
var webstr = Objrequest.responsetext;
vid = Webstr.match (/var\s+videoid\s*=\s* "(\d+)" \s*;/) [1];
Vtitle = Webstr.match (/<title> (. +)-(. +)-video-Youku video-watch Online (-) <\/title>/) [2];
WRT (Nowid + ":" + vtitle + "=" + vid);
if (Previd = = vid) return;
Previd = vid;
Nowid + 1;
Start a new cycle
if (iscancel) return;
Tstart ();
} else {
Alert ("Callback failed!") ");
return;//"Error:" + Objrequest.statustext;
}
}
function Getweb (u) {
objrequest = new XMLHttpRequest (); New ActiveXObject ("Msxml2.xmlhttp"); Ie5&6 Initialize XMLHTTP Object
Objrequest.onreadystatechange = Retweb; Asynchronous callback method
Objrequest.open ("Get", u,true);
Objrequest.send (NULL);
}
function Tstart () {
if (listid== "") {
Listid=getlid ();
}
url = "http://v.youku.com/v_playlist/f" + Listid + "o1p" + Nowid + ". html";
Getweb (URL);
}
</script>
<body>
<input type= "text" id= "Weburl" value= "http://www.youku.com/playlist_show/id_2350764.html" style= "width:640"/ ><br/>
<textarea id= "Subret" readonly= "readonly" style= "width:640"; height:360; " > #star </textarea>
<br/>
<input Type=button value= "start to extract the album" Onclick= "if (iscancel) Iscancel=false;tstart ();"/>
<input Type=button value= "Clear text" onclick= "subret.value="; Nowid =0;preid= '; listid= ';/>
<input Type=button value= "suspend" onclick= "Iscancel=true"/>
</body>
The idea is basically the same as last time, so I don't have to repeat it.
With vb.net a page collection time is generally about 1 seconds, and this code relies on client script, each page collection in 0.3~0.5 seconds, according to the user's computer configuration and different.
The individual uses the IE7 test to pass, but the code is more casual, so the compatibility is not very good. If you need to use, please modify the code yourself.